Skip to content

Commit e64fbf8

Browse files
committed
apply system + evidence line strength updates
1 parent b873ae2 commit e64fbf8

File tree

5 files changed

+42
-10
lines changed

5 files changed

+42
-10
lines changed

src/ga4gh/va_spec/aac_2017/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
from .models import (
44
AMP_ASCO_CAP_CLASSIFICATION_CODES,
55
AMP_ASCO_CAP_CLASSIFICATION_MAP,
6+
AMP_ASCO_CAP_EVIDENCE_LINE_STRENGTHS,
67
AmpAscoCapClassificationCode,
78
AmpAscoCapClassificationName,
9+
AmpAscoCapEvidenceLineStrength,
810
AsmpAscoCapStrengthCode,
911
VariantDiagnosticStatement,
1012
VariantPrognosticStatement,
@@ -14,8 +16,10 @@
1416
__all__ = [
1517
"AMP_ASCO_CAP_CLASSIFICATION_CODES",
1618
"AMP_ASCO_CAP_CLASSIFICATION_MAP",
19+
"AMP_ASCO_CAP_EVIDENCE_LINE_STRENGTHS",
1720
"AmpAscoCapClassificationCode",
1821
"AmpAscoCapClassificationName",
22+
"AmpAscoCapEvidenceLineStrength",
1923
"AsmpAscoCapStrengthCode",
2024
"VariantDiagnosticStatement",
2125
"VariantPrognosticStatement",

src/ga4gh/va_spec/aac_2017/models.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ class AmpAscoCapClassificationName(str, Enum):
5757
TIER_4 = "Tier IV"
5858

5959

60+
class AmpAscoCapEvidenceLineStrength(str, Enum):
61+
"""Define constraints for AMP/ASCO/CAP `EvidenceLine.strengthOfEvidenceProvided`"""
62+
63+
A = "A"
64+
B = "B"
65+
C = "C"
66+
D = "D"
67+
68+
69+
AMP_ASCO_CAP_EVIDENCE_LINE_STRENGTHS = [
70+
v.value for v in AmpAscoCapEvidenceLineStrength.__members__.values()
71+
]
72+
73+
6074
@dataclass
6175
class AmpAscoCapConfig:
6276
"""AMP/ASCO/CAP config for expected values"""
@@ -163,6 +177,13 @@ def _validate_classification_config(
163177
msg = "`targetProposition` must be one of: `VariantDiagnosticProposition`, `VariantPrognosticProposition`, `VariantTherapeuticResponseProposition`"
164178
raise ValueError(msg)
165179

180+
validate_mappable_concept(
181+
evidence_line.strengthOfEvidenceProvided,
182+
System.AMP_ASCO_CAP,
183+
valid_codes=AMP_ASCO_CAP_EVIDENCE_LINE_STRENGTHS,
184+
mc_is_required=False,
185+
)
186+
166187
return self
167188

168189

src/ga4gh/va_spec/base/enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ class System(str, Enum):
9595
"""Define constraints for systems"""
9696

9797
ACMG = "ACMG Guidelines, 2015"
98-
AMP_ASCO_CAP = "AMP/ASCO/CAP (AAC) Guidelines, 2017"
98+
AMP_ASCO_CAP = "AMP/ASCO/CAP Guidelines, 2017"
9999
CLIN_GEN = "ClinGen Low Penetrance and Risk Allele Recommendations, 2024"
100100
CCV = "ClinGen/CGC/VICC Guidelines for Oncogenicity, 2022"

tests/validation/test_va_spec_models.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,13 @@ def test_evidence_line(caf):
239239
},
240240
"strength": {
241241
"primaryCoding": {
242-
"system": "AMP/ASCO/CAP (AAC) Guidelines, 2017",
242+
"system": "AMP/ASCO/CAP Guidelines, 2017",
243243
"code": "strong",
244244
}
245245
},
246246
"classification": {
247247
"primaryCoding": {
248-
"system": "AMP/ASCO/CAP (AAC) Guidelines, 2017",
248+
"system": "AMP/ASCO/CAP Guidelines, 2017",
249249
"code": "tier 1",
250250
}
251251
},
@@ -352,7 +352,7 @@ def test_variant_pathogenicity_stmt():
352352

353353
invalid_params = deepcopy(params)
354354
invalid_params["classification"]["primaryCoding"]["system"] = (
355-
"AMP/ASCO/CAP (AAC) Guidelines, 2017"
355+
"AMP/ASCO/CAP Guidelines, 2017"
356356
)
357357
with pytest.raises(ValueError, match="`primaryCoding.system` must be one of"):
358358
VariantPathogenicityStatement(**invalid_params)
@@ -459,7 +459,7 @@ def test_variant_pathogenicity_el():
459459
invalid_params = deepcopy(params)
460460
invalid_params["strengthOfEvidenceProvided"] = {
461461
"primaryCoding": {
462-
"system": "AMP/ASCO/CAP (AAC) Guidelines, 2017",
462+
"system": "AMP/ASCO/CAP Guidelines, 2017",
463463
"code": "strong",
464464
}
465465
}
@@ -624,24 +624,24 @@ def test_aac_statement():
624624
"strength": {
625625
"primaryCoding": {
626626
"code": "strong",
627-
"system": "AMP/ASCO/CAP (AAC) Guidelines, 2017",
627+
"system": "AMP/ASCO/CAP Guidelines, 2017",
628628
}
629629
},
630630
"specifiedBy": "documents.json#/1",
631631
"classification": {
632632
"name": "Tier I",
633633
"primaryCoding": {
634634
"code": "tier 1",
635-
"system": "AMP/ASCO/CAP (AAC) Guidelines, 2017",
635+
"system": "AMP/ASCO/CAP Guidelines, 2017",
636636
},
637637
},
638638
"hasEvidenceLines": [
639639
{
640640
"directionOfEvidenceProvided": "supports",
641641
"strengthOfEvidenceProvided": {
642642
"primaryCoding": {
643-
"code": "Level A",
644-
"system": "AMP/ASCO/CAP (AAC) Guidelines, 2017",
643+
"code": "A",
644+
"system": "AMP/ASCO/CAP Guidelines, 2017",
645645
}
646646
},
647647
"hasEvidenceItems": [
@@ -669,6 +669,13 @@ def test_aac_statement():
669669
}
670670
assert VariantTherapeuticResponseStatement(**params)
671671

672+
# No strengthOfEvidenceProvided
673+
no_evidence_line_strength_params = deepcopy(params)
674+
no_evidence_line_strength_params["hasEvidenceLines"][0].pop(
675+
"strengthOfEvidenceProvided"
676+
)
677+
assert VariantTherapeuticResponseStatement(**no_evidence_line_strength_params)
678+
672679
# Invalid strength
673680
invalid_params = deepcopy(params)
674681
invalid_params["strength"]["primaryCoding"]["code"] = "Strong"

0 commit comments

Comments
 (0)