import Link from 'next/link'; import { Section } from '@/components/ui/section'; import { EmptyState } from '@/components/ui/empty-state'; import { Freshness } from '@/components/ui/freshness'; import { ClaimBadge, ConfidenceBadge } from '@/components/ui/badge'; import { gapRankings } from '@/lib/queries/rankings'; import { fmtDate, fmtInt, fmtValue, scopeLabel } from '@/lib/format'; /** * Home module "Largest trial gaps / research gaps" (§105, §328, §265-266): the gap indexes from the current * ranking snapshots for a geography. Rendered only when snapshots exist; each row exposes the two percentiles * that produced the value (lineage stored on the ranking row). */ export async function GapsModule({ geo = 'USA', limit = 8 }: { geo?: string; limit?: number }) { const gaps = await gapRankings(geo, limit); return (
All rankings → } > {gaps.length === 0 ? ( Trial and research gap indexes require a burden snapshot (deaths per top-level cancer for one geography and year) plus trial and literature counters. Nothing is shown until such a snapshot exists. ) : (
{gaps.map(({ metric, snapshot, rows }) => (

{metric.name} {scopeLabel(snapshot.scope_key)}

{rows.map((r) => ( ))}
# Cancer Gap (pct. points) Deaths {metric.slug === 'trial_gap' ? 'Active trials' : 'Publications 5y'} Confidence
{r.rank} {r.canonical_name} 0 ? 'text-danger' : ''}`}>{fmtValue(r.value, r.unit)} {fmtInt(r.inputs.deaths as number | undefined)} {fmtInt(r.inputs.activity as number | undefined)}

formula {metric.formula} · {snapshot.formula_version} sources: {snapshot.source_ids.join(', ')} {fmtInt(snapshot.eligible_entities)} eligible

{metric.slug === 'trial_gap' ? 'Caveat: trial counts aggregate a cancer and its NCIt descendants; trials registered at a broader level (e.g. "colorectal") are attributed to the broader entity and can overstate the gap of narrower sites.' : 'Caveat: literature counts are query-based per entity and not aggregated over descendants.'}{' '} Read the caveat

))}
)}
); }