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 { ratioGapRankings } from '@/lib/queries/research-gap'; import { fmtDate, fmtInt, fmtPct, fmtValue, scopeLabel } from '@/lib/format'; /** * Home module "Largest trial and research gaps" (§105, §328, §265-266): the ratio-based gap indexes * (Trial Gap Ratio, Research Gap Ratio) from the current ranking snapshots of the latest burden scope * of a geography. Each row exposes the two shares that produced the log₂ ratio (lineage stored on the * ranking row). The percentile-based indexes remain available under /rankings; the full component * table, scatter plots and CSV live at /research-gap. */ export async function GapsModule({ geo = 'USA', limit = 8 }: { geo?: string; limit?: number }) { const gaps = await ratioGapRankings(geo, limit); return (
Research Gap Index → All rankings } > {gaps.length === 0 ? ( Gap ratios require a burden scope (deaths per top-level cancer for one geography, year and source) plus trial and literature counters. Nothing is shown until such a snapshot exists. ) : (
{gaps.map(({ metric, snapshot, rows }) => { const isTrial = metric.slug === 'trial_gap_ratio'; return (

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

{rows.map((r) => ( ))}
# Cancer Ratio (log₂) Deaths Death share {isTrial ? 'Active trials' : 'Publications 5y'} {isTrial ? 'Trial share' : 'Pub. share'} Confidence
{r.rank} {r.canonical_name} = 1 ? 'text-danger' : ''}`}>{fmtValue(r.value, r.unit)} {fmtInt(r.inputs.deaths as number | undefined)} {fmtPct(r.inputs.deathShare as number | undefined, 1)} {fmtInt((isTrial ? r.inputs.activeTrials : r.inputs.publications5y) as number | undefined)} {fmtPct((isTrial ? r.inputs.trialShare : r.inputs.publicationShare) as number | undefined, 1)}

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

{isTrial ? '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; a narrow query inflates the ratio.'}{' '} Burden is US-only while global estimates are under license review.{' '} Read the caveats

); })}
)}
); }