Summary
Calibration selection logic is scattered across the codebase with subtly different strategies. The serving layer's display-default selection has now been consolidated into lib/score_calibrations.py (calibration_preference_key + classification_evidence_strength), shared by lib/variant_detail.py and lib/allele_measurements.py. The VA-Spec annotation path still selects its evidence calibration/classification independently. This issue tracks converging the two so there is a single source of truth for "how strong is a classification" and "which calibration do we pick."
Why this matters
There are two legitimately different preference policies, and that's fine:
- Display default — the UI cascade (
primary → investigator_provided → non-research_use_only), now calibration_preference_key. What a card/page shows by default.
- Strongest evidence — VA-Spec picks the calibration/classification with the strongest evidence for a statement (
lib/annotation/statement.py, lib/annotation/util.py).
The risk is not that these differ — it's that the "evidence strength" primitive is defined twice. The serving layer now computes it in classification_evidence_strength (ACMG points → |ln(oddspaths_ratio)| → functional call, with a pathogenic/benign direction). If VA-Spec computes "strongest" by a different rule, the UI and the emitted VA statements can disagree about which evidence is strongest for the same variant — a confusing, hard-to-spot inconsistency in a clinically-sensitive surface.
Scope
- Audit VA-Spec's calibration/classification selection (
lib/annotation/statement.py, lib/annotation/util.py::score_calibration_may_be_used_for_annotation and callers) against the new shared helpers.
- Have VA-Spec's "strongest evidence" selection reuse
classification_evidence_strength (or, if it must differ, document why in both places and add a test pinning the intended divergence).
- Consider promoting a shared
strongest_classification(...) selector and keeping the eligibility filter (score_calibration_may_be_used_for_annotation) as the separate, already-centralized concern.
- Confirm the display-default vs strongest-evidence split is intentional and documented (they should stay two named policies, not collapse).
Pointers
- Shared helpers:
src/mavedb/lib/score_calibrations.py — calibration_preference_key, classification_evidence_strength
- Serving-layer consumers:
src/mavedb/lib/variant_detail.py, src/mavedb/lib/allele_measurements.py
- VA-Spec selection:
src/mavedb/lib/annotation/statement.py, src/mavedb/lib/annotation/util.py
Summary
Calibration selection logic is scattered across the codebase with subtly different strategies. The serving layer's display-default selection has now been consolidated into
lib/score_calibrations.py(calibration_preference_key+classification_evidence_strength), shared bylib/variant_detail.pyandlib/allele_measurements.py. The VA-Spec annotation path still selects its evidence calibration/classification independently. This issue tracks converging the two so there is a single source of truth for "how strong is a classification" and "which calibration do we pick."Why this matters
There are two legitimately different preference policies, and that's fine:
primary→investigator_provided→ non-research_use_only), nowcalibration_preference_key. What a card/page shows by default.lib/annotation/statement.py,lib/annotation/util.py).The risk is not that these differ — it's that the "evidence strength" primitive is defined twice. The serving layer now computes it in
classification_evidence_strength(ACMG points →|ln(oddspaths_ratio)|→ functional call, with a pathogenic/benign direction). If VA-Spec computes "strongest" by a different rule, the UI and the emitted VA statements can disagree about which evidence is strongest for the same variant — a confusing, hard-to-spot inconsistency in a clinically-sensitive surface.Scope
lib/annotation/statement.py,lib/annotation/util.py::score_calibration_may_be_used_for_annotationand callers) against the new shared helpers.classification_evidence_strength(or, if it must differ, document why in both places and add a test pinning the intended divergence).strongest_classification(...)selector and keeping the eligibility filter (score_calibration_may_be_used_for_annotation) as the separate, already-centralized concern.Pointers
src/mavedb/lib/score_calibrations.py—calibration_preference_key,classification_evidence_strengthsrc/mavedb/lib/variant_detail.py,src/mavedb/lib/allele_measurements.pysrc/mavedb/lib/annotation/statement.py,src/mavedb/lib/annotation/util.py