import type { Metadata } from 'next'; import Link from 'next/link'; import { PageHeader, Section, Note } from '@/components/ui/section'; import { Badge } from '@/components/ui/badge'; import { EmptyState } from '@/components/ui/empty-state'; import { listMetrics } from '@/lib/queries/rankings'; import { humanize, unitLabel } from '@/lib/format'; export const metadata: Metadata = { title: 'Rankings', description: 'Transparent cancer rankings: one metric, one scope, one formula version per table, with lineage for every rank.' }; export const dynamic = 'force-dynamic'; const CATEGORY_ORDER = ['burden', 'lethality', 'trials', 'research', 'trend', 'molecular', 'unmet_need', 'rarity', 'treatment', 'composite']; const CATEGORY_LABEL: Record = { burden: 'Burden', lethality: 'Lethality', trials: 'Clinical research', research: 'Research activity', trend: 'Trends', molecular: 'Molecular knowledge', unmet_need: 'Gap indexes', rarity: 'Rarity', treatment: 'Treatment', composite: 'Composite' }; export default async function RankingsIndex() { const metrics = await listMetrics(); const byCat = new Map(); for (const m of metrics) byCat.set(m.category, [...(byCat.get(m.category) ?? []), m]); const cats = [...byCat.keys()].sort((a, b) => CATEGORY_ORDER.indexOf(a) - CATEGORY_ORDER.indexOf(b)); const computed = metrics.filter((m) => m.snapshot_count > 0).length; return (

{computed} of {metrics.length} metrics currently have a computed snapshot.

"Deadliest cancer" has no single answer. Annual deaths, age-standardized mortality rate, mortality-to-incidence ratio and 5-year survival each rank cancers differently and are published as separate metrics. Pick the question before reading the table. {metrics.length === 0 ? (
The metric definitions table is empty on this environment. Run the database seed.
) : (
{cats.map((cat) => (
{(byCat.get(cat) ?? []).map((m) => ( ))}
Metric Unit Direction Scopes Snapshots Sources Formula version
{m.name} {m.experimental ? experimental : null}

{m.description}

{unitLabel(m.unit)} {m.higher_is_worse == null ? 'neutral' : m.higher_is_worse ? 'higher = worse' : 'higher = better'} {m.valid_dimensions.join(', ')} {m.snapshot_count > 0 ? m.snapshot_count : —} {m.source_slugs.map((s) => ( {s} ))} {m.formula_version}
))}
)}
); }