feat(api): GET /api/claims/{claim_id} returns full claim context
This commit is contained in:
@@ -712,6 +712,35 @@ def list_claims(
|
||||
}
|
||||
|
||||
|
||||
@app.get("/api/claims/{claim_id}")
|
||||
def get_claim_detail_endpoint(claim_id: str) -> dict:
|
||||
"""Return one claim with full drawer context.
|
||||
|
||||
SP4 detail-drawer endpoint. The body is the spec-shaped dict
|
||||
produced by :meth:`CycloneStore.get_claim_detail` — header, state,
|
||||
service lines, diagnoses, parties, validation, raw segments,
|
||||
``stateHistory`` (most-recent-first, capped at 50), and a
|
||||
populated ``matchedRemittance`` block if the claim is paired.
|
||||
|
||||
Path param is ``claim_id`` (not ``id``) to avoid shadowing
|
||||
FastAPI's internal ``id`` name and to keep OpenAPI docs self-
|
||||
describing (matches the ``/api/acks/{ack_id}`` convention from
|
||||
SP3). Returns 404 when the claim is missing — never 500 — so the
|
||||
UI can distinguish "claim doesn't exist" from a transient fetch
|
||||
failure.
|
||||
"""
|
||||
body = store.get_claim_detail(claim_id)
|
||||
if body is None:
|
||||
raise HTTPException(
|
||||
status_code=404,
|
||||
detail={
|
||||
"error": "Not found",
|
||||
"detail": f"Claim {claim_id} not found",
|
||||
},
|
||||
)
|
||||
return body
|
||||
|
||||
|
||||
@app.get("/api/reconciliation/unmatched")
|
||||
def get_reconciliation_unmatched() -> dict:
|
||||
"""Return unmatched Claims (left) and unmatched Remittances (right).
|
||||
|
||||
Reference in New Issue
Block a user