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 } from '@/components/ui/badge'; import type { MapCountryDatum } from '@/components/charts/world-map'; import { countryCounts } from '@/lib/queries/trial-sites'; import { fmtInt } from '@/lib/format'; /** * Home module: compact choropleth of RECRUITING trial sites per country, all cancers, any phase * (precomputed by `pnpm cix intel`). Links to the full map with filters and its data table. The * country list under the map keeps the module readable without colour or hover. */ export async function TrialMapModule({ topN = 8 }: { topN?: number }) { const rows = await countryCounts({ cancerId: null, phase: null, recruitingOnly: true }); const totalSites = rows.reduce((s, r) => s + r.sites, 0); const data: MapCountryDatum[] = rows.map((r) => ({ country: r.country, iso3: r.iso3, sites: r.sites, trials: r.trials, href: `/trials?country=${encodeURIComponent(r.country)}&status=RECRUITING` })); return (
Full choropleth map and filters → } > {rows.length === 0 ? ( Country aggregates appear after pnpm cix intel has run on ingested ClinicalTrials.gov locations. ) : (
{rows.slice(0, topN).map((r, i) => ( ))}
# Country Recruiting sites Trials
{i + 1} {r.country} {fmtInt(r.sites)} {fmtInt(r.trials)}

{fmtInt(totalSites)} recruiting sites · {fmtInt(rows.length)} countries · {rows[0]?.formula_version} · source: clinicaltrials

)}
); }