feat: redesign around phenotype-driven triage, not variant filtering
A table with filters made the user do the work. Rare disease triage is a different task:
which few variants could explain *this* patient's phenotype, and why. The app now answers
that, and lets a reviewer act on the answer.
Domain
- a case is a proband: a VCF plus the HPO terms observed in the patient (samples -> cases)
- HPO's gene-to-phenotype annotations are loaded as reference data (scripts/load-hpo.py)
- each candidate can be shortlisted or dismissed with a reason and a note
Ranking (app/services/triage.py, 21 tests)
- weighted sum of phenotype match, rarity, consequence severity and the model's score,
with every component shown next to the candidate
- rarity and consequence filter; phenotype only ranks, because a real diagnosis can sit in
a gene nobody has annotated yet and filtering on it would hide exactly that case
- ClinVar is deliberately not an input: it appears beside the result as independent
confirmation, so nothing ranks highly merely because ClinVar already said pathogenic
UI
- the funnel is the headline: variants called -> rare -> coding candidates -> phenotype-matched
- ranked candidates with evidence chips, not a grid of everything; filters are demoted
- a variant panel showing the score breakdown, the matched HPO terms, the raw VEP record and
links out to Ensembl/gnomAD/ClinVar, with the decision controls
- a printable case report: phenotype, funnel, shortlisted variants with reasons, provenance
API: /cases with phenotypes, /cases/{id}/candidates (funnel + ranked + weights),
/variants/{id}, /variants/{id}/decision, /cases/{id}/report, /phenotypes for the picker.
Scoring moved under the case and now answers 503 with the reason when no model registry is
reachable, instead of a 500.
Verified end to end on a simulated proband (scripts/make-demo-case.sh: real GIAB HG002
background + one real ClinVar 2-star pathogenic NF2 variant). 13 variants called -> 1 coding
candidate, and the planted variant ranks first at 0.80 on phenotype 1.00, rarity 1.00 and
consequence 1.00, with ClinVar agreeing afterwards.
Tests: api 75, ml 18, loader 16, web 27; ruff, mypy, svelte-check, terraform validate, both
kustomize overlays and the Nextflow stub run all clean.
This commit is contained in:
+87
-1
@@ -12,7 +12,7 @@
|
||||
}
|
||||
html { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 17px; }
|
||||
body { margin: 0; }
|
||||
main { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.5rem; }
|
||||
main { max-width: 1280px; margin: 0 auto; padding: 2.5rem 1.5rem; }
|
||||
h1 { font-weight: 600; font-size: 2rem; letter-spacing: -0.01em; margin: 0 0 0.5rem; }
|
||||
h2 { font-weight: 600; font-size: 1.25rem; margin: 2rem 0 0.75rem; }
|
||||
p.lede { color: var(--ink-soft); max-width: 60ch; margin: 0 0 2rem; }
|
||||
@@ -40,3 +40,89 @@ td.coord, td.hgvs { font-family: var(--mono); font-size: 0.85rem; } /* aligned
|
||||
.spinner { animation: spin 0.9s linear infinite; }
|
||||
}
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
/* --- triage ------------------------------------------------------------------------------- */
|
||||
.muted { color: var(--ink-soft); }
|
||||
.actions { display: flex; align-items: center; gap: 1rem; }
|
||||
.reportlink { font-weight: 600; }
|
||||
.provenance { font-size: 0.85rem; margin: 0.35rem 0 0; }
|
||||
.casehead { margin-bottom: 1.25rem; }
|
||||
.casehead h1 { margin-bottom: 0.4rem; }
|
||||
.log { white-space: pre-wrap; background: white; border: 1px solid var(--line); padding: 0.75rem;
|
||||
max-height: 14rem; overflow: auto; font-size: 0.8rem; }
|
||||
|
||||
.chips { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
|
||||
.chip { font-size: 0.78rem; padding: 0.12rem 0.5rem; border-radius: 999px; border: 1px solid var(--line);
|
||||
background: white; color: var(--ink-soft); white-space: nowrap; }
|
||||
.chip.match { background: var(--plum-soft); border-color: transparent; color: var(--plum); font-weight: 600; }
|
||||
.chip.rare { border-color: var(--ink-soft); color: var(--ink); }
|
||||
.chip.impact { background: var(--ink); border-color: var(--ink); color: white; }
|
||||
.chip.model { border-style: dashed; color: var(--ink); }
|
||||
.chip.clinvar { background: #fdf1df; border-color: transparent; color: var(--amber); font-weight: 600; }
|
||||
.chipx { background: none; border: none; color: inherit; padding: 0 0 0 0.3rem; cursor: pointer; font: inherit; }
|
||||
|
||||
/* The funnel is the headline: thousands of variants down to a handful. */
|
||||
.funnel { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 0.35rem; }
|
||||
.funnel li { display: grid; grid-template-columns: 5rem 16rem 1fr; align-items: center; gap: 0.75rem; }
|
||||
.funnel-value { font-family: var(--mono); font-size: 1.05rem; text-align: right; font-variant-numeric: tabular-nums; }
|
||||
.funnel-label { color: var(--ink-soft); font-size: 0.9rem; }
|
||||
.funnel-track { background: white; border: 1px solid var(--line); height: 0.75rem; border-radius: 2px; }
|
||||
.funnel-bar { display: block; height: 100%; background: var(--plum); opacity: 0.75; }
|
||||
|
||||
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
|
||||
.triage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; align-items: start; }
|
||||
@media (min-width: 62rem) { .triage { grid-template-columns: minmax(0, 1fr) 24rem; } }
|
||||
|
||||
.candidate { display: grid; grid-template-columns: 2rem minmax(10rem, 16rem) 1fr auto auto; gap: 0.75rem;
|
||||
align-items: center; width: 100%; text-align: left; background: white; color: var(--ink);
|
||||
border: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 4px;
|
||||
padding: 0.6rem 0.75rem; margin-bottom: 0.4rem; font: inherit; cursor: pointer; }
|
||||
.candidate:hover { border-left-color: var(--plum-soft); }
|
||||
.candidate.selected { border-left-color: var(--plum); background: #fbf7fa; }
|
||||
.candidate .rank { font-family: var(--mono); color: var(--ink-soft); }
|
||||
.candidate .who { display: flex; flex-direction: column; gap: 0.1rem; }
|
||||
.candidate .who .coord, .candidate .who .hgvs { font-size: 0.78rem; color: var(--ink-soft); }
|
||||
.rankscore { display: flex; align-items: center; gap: 0.5rem; }
|
||||
.scorebar { width: 4rem; height: 0.5rem; background: var(--line); border-radius: 2px; overflow: hidden; }
|
||||
.scorebar span { display: block; height: 100%; background: var(--plum); }
|
||||
.scorenum { font-family: var(--mono); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
|
||||
.decision { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
|
||||
.decision.shortlisted { color: var(--plum); }
|
||||
.decision.dismissed { color: var(--ink-soft); }
|
||||
|
||||
.panel { background: white; border: 1px solid var(--line); border-radius: 4px; padding: 1rem; position: sticky; top: 1rem; }
|
||||
.panel-head { display: flex; justify-content: space-between; align-items: start; gap: 0.5rem; }
|
||||
.panel h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
|
||||
.panel h4 { margin: 1.1rem 0 0.4rem; font-size: 0.78rem; text-transform: uppercase;
|
||||
letter-spacing: 0.05em; color: var(--ink-soft); }
|
||||
.panel input, .panel textarea { width: 100%; margin-bottom: 0.5rem; font-family: inherit; }
|
||||
.components { border: none; background: none; }
|
||||
.components th { font-weight: 400; color: var(--ink-soft); padding: 0.15rem 0.5rem 0.15rem 0; }
|
||||
.components td { padding: 0.15rem 0; font-size: 0.82rem; text-align: right; }
|
||||
.evidence { display: grid; grid-template-columns: 7rem 1fr; gap: 0.2rem 0.5rem; margin: 0; font-size: 0.88rem; }
|
||||
.evidence dt { color: var(--ink-soft); }
|
||||
.evidence dd { margin: 0; }
|
||||
.links { display: flex; gap: 0.75rem; font-size: 0.85rem; }
|
||||
.decide { display: flex; gap: 0.5rem; }
|
||||
|
||||
.newcase { display: grid; gap: 0.6rem; margin-bottom: 1.5rem; }
|
||||
.newcase .row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
|
||||
.newcase button { justify-self: start; }
|
||||
.picker { position: relative; display: grid; gap: 0.4rem; }
|
||||
.picker .results { list-style: none; margin: 0; padding: 0.25rem; background: white;
|
||||
border: 1px solid var(--line); border-radius: 4px; max-height: 12rem; overflow: auto; }
|
||||
.picker .results button { width: 100%; text-align: left; border: none; padding: 0.3rem 0.4rem; }
|
||||
.picker .results button:hover { background: var(--plum-soft); }
|
||||
|
||||
.caselist { list-style: none; padding: 0; margin: 0; }
|
||||
.caselist li { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; padding: 0.7rem 0.75rem;
|
||||
background: white; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 0.4rem; }
|
||||
.casename { font-weight: 600; min-width: 10rem; }
|
||||
|
||||
.report { background: white; border: 1px solid var(--line); padding: 2rem; }
|
||||
.reportitem { border-top: 1px solid var(--line); padding-top: 0.75rem; margin-top: 0.75rem; }
|
||||
.reportitem h3 { margin: 0 0 0.4rem; }
|
||||
.dismissed { color: var(--ink-soft); }
|
||||
.disclaimer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line);
|
||||
color: var(--ink-soft); font-size: 0.85rem; }
|
||||
@media print { .noprint, nav { display: none; } .report { border: none; padding: 0; } }
|
||||
|
||||
Reference in New Issue
Block a user