spb/cancerindex
Public
TypeScript 97.2%
SQL 1.5%
CSS 0.6%
JavaScript 0.5%
1import { Section, Note } from '@/components/ui/section';2import { EmptyState } from '@/components/ui/empty-state';3import { Freshness } from '@/components/ui/freshness';4import { Pager } from '@/components/ui/pager';5import { EvidenceTable } from '@/components/data/evidence-table';6import { evidenceForCancer, evidenceForCancerCount, EVIDENCE_PAGE_SIZE } from '@/lib/queries/evidence';7import { loadProvenance } from '@/lib/queries/provenance';8import { fmtInt } from '@/lib/format';9import { pageInfo } from '@/lib/pagination';10import type { CancerBundle } from '../load';1112export async function EvidenceTab({ b, evPage = 1 }: { b: CancerBundle; evPage?: number }) {13 const total = await evidenceForCancerCount(b.descendants);14 if (total === 0) {15 return (16 <Section id="evidence" kicker="Variants & evidence" title="Curated clinical evidence by variant and therapy">17 <EmptyState knows={[{ label: 'Genomics tab', href: `/cancer/${b.cancer.slug}/genomics` }, { label: 'Drugs tab', href: `/cancer/${b.cancer.slug}/drugs` }]}>18 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.19 </EmptyState>20 </Section>21 );22 }23 const info = pageInfo(evPage, EVIDENCE_PAGE_SIZE, total);24 const items = await evidenceForCancer(b.descendants, { page: info.page, pageSize: info.pageSize });25 const prov = await loadProvenance(items.map((e) => e.provenance_id));26 const descendantItems = items.filter((e) => e.cancer_id !== b.cancer.id).length;27 const latest = items.reduce<Date | string | null>((m, e) => (m == null || String(e.updated_at) > String(m) ? e.updated_at : m), null);28 const hrefFor = (p: number) => `/cancer/${b.cancer.slug}/evidence${p > 1 ? `?evPage=${p}` : ''}`;29 return (30 <div className="space-y-6">31 <Section id="evidence" kicker="Variants & evidence" title="Curated clinical evidence by variant and therapy" description={`${fmtInt(total)} evidence items mapped to this entity or its descendants, grouped by molecular profile, then therapy. ${EVIDENCE_PAGE_SIZE} items per page.`}>32 <EvidenceTable33 items={items}34 prov={prov}35 showCancer={descendantItems > 0}36 summary={37 <>38 Showing {fmtInt(info.from)}–{fmtInt(info.to)} of {fmtInt(total)} evidence items39 {descendantItems ? ` (${fmtInt(descendantItems)} on this page mapped to a descendant entity)` : ''}40 </>41 }42 />43 <Pager total={total} pageSize={info.pageSize} page={info.page} hrefFor={hrefFor} label="Evidence pages" noun="evidence items" />44 <Freshness dataUpdatedAt={latest} extra="source: civic (CC0)" />45 </Section>46 <Note tone="warn">Evidence levels, directions and ratings are those assigned by CIViC curators. "Submitted" items have not completed curation review. This is not treatment guidance.</Note>47 </div>48 );49}50