From 45428649e5ac358d552699b33354debb19252e8c Mon Sep 17 00:00:00 2001 From: Kori Kuzma Date: Tue, 23 Jun 2026 11:46:30 -0400 Subject: [PATCH 1/2] feat!: store allele origin as mapping, not extension close #232 --- civicpy/exports/civic_gks_record.py | 7 ++++++- civicpy/tests/test_exports.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/civicpy/exports/civic_gks_record.py b/civicpy/exports/civic_gks_record.py index b9d0eba..0c3546b 100644 --- a/civicpy/exports/civic_gks_record.py +++ b/civicpy/exports/civic_gks_record.py @@ -634,7 +634,12 @@ def get_allele_origin_qualifier(record: Evidence | Assertion) -> MappableConcept return MappableConcept( name=VARIANT_ORIGIN_TO_ALLELE_ORIGIN[variant_origin], - extensions=[Extension(name="civic_variant_origin", value=variant_origin)], + mappings=[ + ConceptMapping( + coding=Coding(code="SOMATIC", system="https://civicdb.org"), + relation=Relation.EXACT_MATCH, + ) + ], ) @staticmethod diff --git a/civicpy/tests/test_exports.py b/civicpy/tests/test_exports.py index 2739d52..404bbc0 100644 --- a/civicpy/tests/test_exports.py +++ b/civicpy/tests/test_exports.py @@ -368,7 +368,12 @@ def gks_therapeutic_proposition(gks_mpid33, gks_gid19, gks_tid146, gks_did8): "geneContextQualifier": gks_gid19, "alleleOriginQualifier": { "name": "somatic", - "extensions": [{"name": "civic_variant_origin", "value": "SOMATIC"}], + "mappings": [ + { + "coding": {"code": "SOMATIC", "system": "https://civicdb.org"}, + "relation": "exactMatch", + } + ], }, "predicate": "predictsSensitivityTo", "objectTherapeutic": gks_tid146, From 6b48250cbd45447b01368d36a0b177a6751ed54b Mon Sep 17 00:00:00 2001 From: Kori Kuzma Date: Thu, 25 Jun 2026 08:17:59 -0400 Subject: [PATCH 2/2] dont hardcode + apply aw suggestions --- civicpy/exports/civic_gks_record.py | 10 +++++++++- civicpy/tests/test_exports.py | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/civicpy/exports/civic_gks_record.py b/civicpy/exports/civic_gks_record.py index 0c3546b..8ab5058 100644 --- a/civicpy/exports/civic_gks_record.py +++ b/civicpy/exports/civic_gks_record.py @@ -636,7 +636,15 @@ def get_allele_origin_qualifier(record: Evidence | Assertion) -> MappableConcept name=VARIANT_ORIGIN_TO_ALLELE_ORIGIN[variant_origin], mappings=[ ConceptMapping( - coding=Coding(code="SOMATIC", system="https://civicdb.org"), + coding=Coding( + code=variant_origin, + system="CIViC Knowledgebase", + iris=[ + iriReference( + root="https://civic.readthedocs.io/en/latest/model/evidence/origin.html" + ) + ], + ), relation=Relation.EXACT_MATCH, ) ], diff --git a/civicpy/tests/test_exports.py b/civicpy/tests/test_exports.py index 404bbc0..9f0a38c 100644 --- a/civicpy/tests/test_exports.py +++ b/civicpy/tests/test_exports.py @@ -370,7 +370,13 @@ def gks_therapeutic_proposition(gks_mpid33, gks_gid19, gks_tid146, gks_did8): "name": "somatic", "mappings": [ { - "coding": {"code": "SOMATIC", "system": "https://civicdb.org"}, + "coding": { + "code": "SOMATIC", + "system": "CIViC Knowledgebase", + "iris": [ + "https://civic.readthedocs.io/en/latest/model/evidence/origin.html" + ], + }, "relation": "exactMatch", } ],