import { Section, Note } from '@/components/ui/section'; import { EmptyState } from '@/components/ui/empty-state'; import { Freshness } from '@/components/ui/freshness'; import { Pager } from '@/components/ui/pager'; import { EvidenceTable } from '@/components/data/evidence-table'; import { evidenceForCancer, evidenceForCancerCount, EVIDENCE_PAGE_SIZE } from '@/lib/queries/evidence'; import { loadProvenance } from '@/lib/queries/provenance'; import { fmtInt } from '@/lib/format'; import { pageInfo } from '@/lib/pagination'; import type { CancerBundle } from '../load'; export async function EvidenceTab({ b, evPage = 1 }: { b: CancerBundle; evPage?: number }) { const total = await evidenceForCancerCount(b.descendants); if (total === 0) { return (
No curated evidence item maps to this entity or its descendants. Evidence comes from CIViC and is displayed with its native level (A–E), direction (supports / does not support) and significance — never collapsed to a verdict.
); } const info = pageInfo(evPage, EVIDENCE_PAGE_SIZE, total); const items = await evidenceForCancer(b.descendants, { page: info.page, pageSize: info.pageSize }); const prov = await loadProvenance(items.map((e) => e.provenance_id)); const descendantItems = items.filter((e) => e.cancer_id !== b.cancer.id).length; const latest = items.reduce((m, e) => (m == null || String(e.updated_at) > String(m) ? e.updated_at : m), null); const hrefFor = (p: number) => `/cancer/${b.cancer.slug}/evidence${p > 1 ? `?evPage=${p}` : ''}`; return (
0} summary={ <> Showing {fmtInt(info.from)}–{fmtInt(info.to)} of {fmtInt(total)} evidence items {descendantItems ? ` (${fmtInt(descendantItems)} on this page mapped to a descendant entity)` : ''} } />
Evidence levels, directions and ratings are those assigned by CIViC curators. "Submitted" items have not completed curation review. This is not treatment guidance.
); }