SPB Git forge

spb/cancerindex

Public
37commits 1branches 0releases
2.9 MBsize
maindefault branch
10 days agolast push
TypeScript 97.2% SQL 1.5% CSS 0.6% JavaScript 0.5%
2.1 KB · 47 lines tsx
Raw Blame History
1import Link from 'next/link';2import { Section } from '@/components/ui/section';3import { EmptyState } from '@/components/ui/empty-state';4import { PathChainView } from '@/components/graph/path-chain';5import { defaultFocus, focusCancerIds, loadPaths, resolveFocus } from '@/lib/queries/graph';6import { fmtInt } from '@/lib/format';78/**9 * Home teaser for the knowledge graph: three strongest gene → variant → drug chains for the10 * most-connected cancer (chosen from the data at request time, never hardcoded) and a link to /graph.11 */12export async function GraphModule({ limit = 3 }: { limit?: number }) {13  const ref = await defaultFocus();14  const focus = ref ? await resolveFocus(ref) : null;15  const chains = focus ? await loadPaths(focus, await focusCancerIds(focus), limit) : [];16  return (17    <Section18      id="graph"19      kicker="Knowledge graph"20      title={focus ? `Paths through ${focus.label}` : 'Knowledge graph'}21      description="Cancer → gene → variant → drug → approval → trials, as the sources state each hop: CIViC evidence level and direction, regulatory authority and date, registry trial counts. No edge is inferred by CancerIndex."22      actions={23        <Link href={focus ? `/graph?focus=cancer:${encodeURIComponent(focus.ref)}` : '/graph'} className="ci-link">24          Explore the graph →25        </Link>26      }27    >28      {!focus || chains.length === 0 ? (29        <EmptyState compact knows={[{ label: 'Open the graph', href: '/graph' }]}>30          No knowledge edge with a sensitivity direction is loaded yet, so no chain can be shown.31        </EmptyState>32      ) : (33        <>34          <ol className="m-0 list-none p-0">35            {chains.map((c) => (36              <PathChainView key={`${c.variant.id}:${c.drug.id}`} chain={c} compact />37            ))}38          </ol>39          <p className="mt-2 text-[12px] text-ink-3">40            {fmtInt(chains.length)} of the strongest chains for the cancer with the most knowledge edges ({focus.label}); ranked by source-native evidence level, then support. Not treatment guidance.41          </p>42        </>43      )}44    </Section>45  );46}47