import { useQuery } from '@tanstack/react-query' import { Siren, TrendingDown } from 'lucide-react' import { get } from '../../lib/api' import type { ApexDigest } from '../../lib/api' import { Card, Empty, StatusPill } from '../../components/ui/bits' import { demoDigest } from '../../lib/demo/apex' /** * Where the refinanced portfolio is deteriorating — as districts, sectors and * partner banks, never as borrowers. * *

Ranked by the count of stressed enterprises rather than by rate. A 40% * stress rate over eight borrowers is noise; a 12% rate over three hundred is a * programme. Both numbers are shown, but the ordering says which to read first. */ export function DigestPage() { const { data, isError } = useQuery({ queryKey: ['apex-digest'], queryFn: () => get('/nabard/digest') }) const d = data ?? demoDigest() return (

Early warning

As at {d.asOf} · ranked by how many enterprises are affected, not by rate

{isError && }
{d.districtsUnderStress.length === 0 ? ( ) : (
    {d.districtsUnderStress.map((c) => (
  1. {c.districtName} {' '} · {c.red} of {c.enterprises} stressed {c.stressRatePct}%
  2. ))}
)}
{d.sectorsUnderStress.length === 0 ? ( ) : (
    {d.sectorsUnderStress.map((c) => (
  1. {c.sectorName} {' '} · {c.red} of {c.enterprises} stressed {c.stressRatePct}%
  2. ))}
)}
{d.slowestResponders.length === 0 ? ( ) : ( {d.slowestResponders.map((b) => ( ))}
Institution Alerts raised Acted on Response rate
{b.shortName} {b.alertsRaised} {b.alertsActioned} {b.responseRatePct}%
)}

An alert nobody acts on is the failure this tier is uniquely placed to catch — the borrower's own bank has every reason not to report it, and the borrower cannot.

) }