feat(api): extend /api/config/providers/{npi} with recent_claims + recent_activity

This commit is contained in:
Tyler
2026-06-21 12:46:42 -06:00
parent 50a454db59
commit e6ae364dad
3 changed files with 297 additions and 1 deletions
+52
View File
@@ -50,6 +50,58 @@ export interface Provider {
phone: string;
claimCount: number;
outstandingAr: number;
/**
* SP21 Task 1.6: populated by the extended `GET /api/config/providers/{npi}`
* endpoint. Top 10 claims for this provider by `submissionDate` desc.
* Optional so legacy callers (in-memory sample data) keep working
* without an API round-trip.
*/
recent_claims?: ClaimSummary[];
/**
* SP21 Task 1.6: populated by the extended `GET /api/config/providers/{npi}`
* endpoint. Top 10 activity events (by `ts` desc) joined to claims
* owned by this provider via `claim_id`.
*/
recent_activity?: ActivityEvent[];
}
/**
* SP21 Task 1.6: slim claim projection returned by
* `GET /api/config/providers/{npi}.recent_claims`. Mirrors the wire
* shape of `store.iter_claims(provider_npi=...)` 1:1 (camelCase,
* superset of the legacy `Claim` interface).
*/
export interface ClaimSummary {
id: string;
state: string;
billedAmount: number;
patientName: string;
providerNpi: string;
payerName: string;
cptCode: string;
submissionDate: string;
parsedAt: string;
status: string;
matchedRemittanceId?: string | null;
batchId: string;
receivedAmount?: number;
denialReason?: string | null;
}
/**
* SP21 Task 1.6: one row in `recent_activity`. Mirrors the Python
* ORM `ActivityEvent` (snake_case fields rewritten to camelCase for
* the wire). `payload` carries the same dict the recorder wrote at
* the time of the event (message, npi, amount, etc.).
*/
export interface ActivityEvent {
id: number;
ts: string; // ISO Z
kind: string;
batchId: string | null;
claimId: string | null;
remittanceId: string | null;
payload: Record<string, unknown>;
}
export interface Remittance {