Conectar API: sources, uploads, pipelines, runs, node rows, review; tested end to end

This commit is contained in:
Roberto Treviño
2026-11-24 21:00:52 -06:00
parent cddf91185b
commit 326250ffb3
5 changed files with 314 additions and 22 deletions
+44
View File
@@ -0,0 +1,44 @@
"""What waits for a person, and their decisions (append-only; the next run applies them)."""
from typing import Any
from fastapi import APIRouter, Depends
from pydantic import BaseModel
from core.pipeline import EntityName, Id
from persistance import nodes, review
from webapi.auth import Caller, caller
router = APIRouter(prefix="/review", tags=["review"])
Rows = list[dict[str, Any]]
@router.get("/held")
def held(entity: EntityName) -> Rows:
"""Rows a rule held, with the reasons and the values as they came."""
return review.held(entity)
@router.get("/conflicts")
def conflicts(entity: EntityName) -> Rows:
"""Rows of one person and date that disagree; reject the wrong ones."""
return review.conflicts(entity)
@router.get("/links")
def links(pipeline: Id, node: Id) -> Rows:
"""Records that may be the same person but were left apart."""
return review.links(pipeline, node)
class Rejection(BaseModel):
entity: EntityName
record: str
reason: str
@router.post("/rejections", status_code=201)
def reject(decision: Rejection, who: Caller = Depends(caller)) -> dict[str, str]:
"""This record's row must not reach silver; applied on the next run."""
nodes.reject(decision.entity, decision.record, decision.reason, who.id)
return {"record": decision.record}