feat(drill): PayerPeekContent + usePayerSummary + api.getPayerSummary
This commit is contained in:
@@ -586,6 +586,39 @@ async function listProviders<T = unknown>(
|
||||
return (await res.json()) as PaginatedResponse<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aggregate stats for one payer, used by the peek modal on Dashboard /
|
||||
* Claims tables (SP21 universal drill-down). Drives
|
||||
* `GET /api/payers/{payer_id}/summary`.
|
||||
*
|
||||
* `denial_rate` is a fraction in `[0, 1]` (the API does NOT pre-multiply).
|
||||
* `top_providers` is the top 3 (or fewer) by claim count, ordered
|
||||
* server-side.
|
||||
*/
|
||||
export interface PayerSummary {
|
||||
payer_id: string;
|
||||
name: string;
|
||||
claim_count: number;
|
||||
billed_total: number;
|
||||
received_total: number;
|
||||
denial_rate: number;
|
||||
top_providers: Array<{ npi: string; count: number }>;
|
||||
}
|
||||
|
||||
async function getPayerSummary(payerId: string): Promise<PayerSummary> {
|
||||
if (!isConfigured) throw notConfiguredError();
|
||||
const res = await fetch(
|
||||
joinUrl(`/api/payers/${encodeURIComponent(payerId)}/summary`)
|
||||
);
|
||||
if (!res.ok) {
|
||||
const detail = await readErrorBody(res);
|
||||
throw new Error(
|
||||
`${res.status} ${res.statusText}${detail ? ` — ${detail}` : ""}`
|
||||
);
|
||||
}
|
||||
return (await res.json()) as PayerSummary;
|
||||
}
|
||||
|
||||
async function listActivity<T = unknown>(
|
||||
params: ListActivityParams = {}
|
||||
): Promise<PaginatedResponse<T>> {
|
||||
@@ -740,6 +773,7 @@ export const api = {
|
||||
listRemittances,
|
||||
getRemittance,
|
||||
listProviders,
|
||||
getPayerSummary,
|
||||
listActivity,
|
||||
listUnmatched,
|
||||
matchRemit,
|
||||
|
||||
Reference in New Issue
Block a user