EvidenceKey.copy_consensus: expand from a boolean to copy_scope + copy_allele_origin
- Dominant language
- Python
- Stars
- 30
- Forks
- 3
- Avg merge
- 9h 28m
- Merged PRs (30d)
- 42
Description
🤖 Written by Claude
`EvidenceKey.copy_consensus` is a single boolean meaning "copy this value from a previous classification
for the same allele". Two things it cannot express, both needed for somatic reuse (#1419):
- **How far a value legitimately travels.** Gene-level content — what the gene does, its role, the
gene-level literature — is identical across every variant in a gene, and is the whole point of #1419.
A boolean keyed on the allele cannot reach it.
- **Which allele origin a key is meaningful for.** Segregation, de novo and allelic data are germline
concepts with no namespace to filter on, so nothing stops them being copied into a somatic record.
Design: [`claude/plans/somatic_curation_reuse_issue_1419_plan.md`](https://github.com/SACGF/variantgrid/blob/master/claude/plans/somatic_curation_reuse_issue_1419_plan.md), Parts A and B.
**Needs Shariant triage** — this changes a field labs configure, and adds a copy path that reaches
across alleles.
## Proposed
Replace `copy_consensus` (bool) with **`copy_scope`**: `NONE` / `ALLELE` / `GENE`, and add
**`copy_allele_origin`**: `ANY` / `GERMLINE` / `SOMATIC`.
Migration is mechanical: `True` → `ALLELE`, `False` → `NONE`, then the three data passes below. Both
fields join the admin fieldset beside `max_share_level`
(`classification/admin/classification_admin.py:640`), and `legacy_somatic.py:287` follows.
### `copy_scope = GENE`
The `H` (Gene) category less `condition`, plus `pubmed_gene_search_count`:
```
condition_incidence disease_onset essential_gene_crispr essential_gene_crispr2
essential_gene_gene_trap gene_constraint gene_damage_index_score gene_disease_validity
gene_indispensability_score gene_penetrance ghis gnomad_oe_lof gnomad_pli gnomad_pnull
gnomad_prec h_summary hipred_score mechanism_of_disease mode_of_inheritance phi prec
variant_penetrance pubmed_gene_search_count
```
`condition` stays at `ALLELE` — for somatic it is the tumour type, a per-patient fact and the axis on
which reuse is most likely to go clinically wrong, so it is an explicit human decision rather than a
silent pre-fill.
`literature` stays at `ALLELE` until it is split into gene-level and variant-level content
(SACGF/variantgrid_private#1102). `search_terms` stays at `ALLELE` because it contains variant terms.
Gene-scope copying never auto-selects a source: AMP tiering and therapy content are gene *and* tumour
type, so the candidates are shown with condition / clinical significance / lab / date and the curator
picks, defaulting to none. See the plan, Part B.
### `copy_allele_origin = GERMLINE`
Twenty keys that are germline concepts and have no namespace to filter on:
```
condition_incidence mode_of_inheritance gene_penetrance variant_penetrance proband_count
segregation segregation_meioses segregation_affectedcarriers segregation_unaffectedcarriers
segregation_affectednoncarriers segregation_bayes segregation_lod s_other s_summary
denovo_points d_other d_summary a_other a_summary match_maker_exchange
```
Several also carry `copy_scope = GENE`; both filters apply.
The namespaced keys (`acmg:` 28, `horak:` 17, `amp:` 4, `somatic:` 6) need no data entry — filtering the
patch by the target record's namespaces handles them, which is part of #1713.
### `copy_scope = NONE`
`somatic:tmb_value`, `somatic:tmb_status`, `somatic:msi_value`, `somatic:msi_status`,
`somatic:hrd_status`, `testing_context`, `somatic:summary_interpretation`, `review_comment` — all
covered by #1713 as `copy_consensus=False`, and carried across by the migration. Listed here so the two
issues do not disagree about the end state.
## Merge order once gene scope exists
Autopopulate beats allele-level, which beats gene-level. Allele over gene is the specific beating the
general; autopopulate over both is existing behaviour and stays.
## Related
- #1713 — the subset that is wrong today and needs no new vocabulary. Land that first.
- #1419 — gene / disease curation, which this unblocks.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.