feat(backend): add GET /api/claims with filter/sort/pagination

This commit is contained in:
Tyler
2026-06-19 19:26:17 -06:00
parent 39379d2d5e
commit cab8ff6656
2 changed files with 77 additions and 0 deletions
+33
View File
@@ -417,4 +417,37 @@ def get_batch(batch_id: str) -> Any:
return json.loads(rec.result.model_dump_json())
@app.get("/api/claims")
def list_claims(
batch_id: str | None = Query(None),
status: str | None = Query(None),
provider_npi: str | None = Query(None),
payer: str | None = Query(None),
date_from: str | None = Query(None),
date_to: str | None = Query(None),
sort: str | None = Query(None),
order: str = Query("desc"),
limit: int = Query(100, ge=1, le=1000),
offset: int = Query(0, ge=0),
) -> dict[str, Any]:
common = dict(
batch_id=batch_id,
status=status,
provider_npi=provider_npi,
payer=payer,
date_from=date_from,
date_to=date_to,
)
items = list(store.iter_claims(
sort=sort, order=order, limit=limit, offset=offset, **common,
))
total = len(list(store.iter_claims(**common)))
return {
"items": items,
"total": total,
"returned": len(items),
"has_more": total > offset + len(items),
}
__all__ = ["app"]