Skip to content

Commit

Permalink
Error fix and code-system update
Browse files Browse the repository at this point in the history
Fixes inner end calculation and updates code-system to the latest LOINC codes.
  • Loading branch information
Rohan-cod committed Mar 25, 2022
1 parent e6ea006 commit 7fa091e
Show file tree
Hide file tree
Showing 9 changed files with 376 additions and 379 deletions.
19 changes: 8 additions & 11 deletions vcf2fhir/fhir_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def add_diagnostic_implication(
if annotation_record['phenotype'] is not None:
associated_phenotype_component = observation.ObservationComponent()
associated_phenotype_component.code = get_codeable_concept(
"http://loinc.org", "81259-4", "Associated phenotype"
"http://loinc.org", "81259-4", "phenotypic treatment context"
)
associated_phenotype_component\
.valueCodeableConcept = get_codeable_concept(
Expand Down Expand Up @@ -282,14 +282,13 @@ def add_variant_obv(
# only the INFO.END value.
if hasattr(record.INFO, 'CIPOS') and hasattr(record.INFO, 'CIEND'):
inner_start = record.POS + record.INFO['CIPOS'][1]
inner_end = record.INFO['END'] + abs(record.INFO['CIEND'][0])
inner_end = record.INFO['END'] - abs(record.INFO['CIEND'][0])
outer_start = record.POS - abs(record.INFO['CIPOS'][0])
outer_end = record.INFO['END'] + record.INFO['CIEND'][1]
outer_start_end_component = observation.ObservationComponent()
outer_start_end_component.code = get_codeable_concept(
("http://hl7.org/fhir/uv/genomics-reporting" +
"/CodeSystem/TbdCodes"),
"outer-start-end", "Variant outer start and end"
"http://loinc.org", "81301-4",
"Variant outer start-end"
)
outer_start_end_component\
.valueRange = valRange.Range(
Expand All @@ -308,9 +307,8 @@ def add_variant_obv(

inner_start_end_component = observation.ObservationComponent()
inner_start_end_component.code = get_codeable_concept(
("http://hl7.org/fhir/uv/ge" +
"nomics-reporting/CodeSystem/TbdCodes"), "inner-start-end",
"Variant inner start and end"
"http://loinc.org", "81302-2",
"Variant inner start-end"
)
inner_start_end_component\
.valueRange = valRange.Range(
Expand Down Expand Up @@ -341,9 +339,8 @@ def add_variant_obv(

exact_start_end_component = observation.ObservationComponent()
exact_start_end_component.code = get_codeable_concept(
("http://hl7.org/fhir/uv/genomics-reporting/Code" +
"System/TbdCodes"), "exact-start-end",
"Variant exact start and end"
"http://loinc.org", "81254-5",
"Variant exact start-end"
)
exact_start_end_component.valueRange = valRange.Range(
{"low": {"value": int(record.POS)}})
Expand Down
40 changes: 20 additions & 20 deletions vcf2fhir/test/expected_annotation.json
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -673,7 +673,7 @@
{
"system": "http://loinc.org",
"code": "81259-4",
"display": "Associated phenotype"
"display": "phenotypic treatment context"
}
]
},
Expand Down Expand Up @@ -1012,9 +1012,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -1084,7 +1084,7 @@
{
"system": "http://loinc.org",
"code": "81259-4",
"display": "Associated phenotype"
"display": "phenotypic treatment context"
}
]
},
Expand Down Expand Up @@ -1312,9 +1312,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -1384,7 +1384,7 @@
{
"system": "http://loinc.org",
"code": "81259-4",
"display": "Associated phenotype"
"display": "phenotypic treatment context"
}
]
},
Expand Down Expand Up @@ -1704,9 +1704,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -1776,7 +1776,7 @@
{
"system": "http://loinc.org",
"code": "81259-4",
"display": "Associated phenotype"
"display": "phenotypic treatment context"
}
]
},
Expand Down Expand Up @@ -2429,9 +2429,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -2501,7 +2501,7 @@
{
"system": "http://loinc.org",
"code": "81259-4",
"display": "Associated phenotype"
"display": "phenotypic treatment context"
}
]
},
Expand Down
42 changes: 21 additions & 21 deletions vcf2fhir/test/expected_example1_with_patient.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -373,9 +373,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -592,9 +592,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -811,9 +811,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -1030,9 +1030,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -1249,9 +1249,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -1468,9 +1468,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down
42 changes: 21 additions & 21 deletions vcf2fhir/test/expected_example1_wo_patient.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -373,9 +373,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -592,9 +592,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -811,9 +811,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -1030,9 +1030,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -1249,9 +1249,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down Expand Up @@ -1468,9 +1468,9 @@
"code": {
"coding": [
{
"system": "http://hl7.org/fhir/uv/genomics-reporting/CodeSystem/TbdCodes",
"code": "exact-start-end",
"display": "Variant exact start and end"
"system": "http://loinc.org",
"code": "81254-5",
"display": "Variant exact start-end"
}
]
},
Expand Down
Loading

0 comments on commit 7fa091e

Please sign in to comment.