Skip to content

Commit

Permalink
Merge pull request #45 from smart-on-fhir/mikix/system-tweaks
Browse files Browse the repository at this point in the history
q_system_use: update to match new qualifier guidance
  • Loading branch information
mikix authored Jun 7, 2024
2 parents 9b1bd1e + 5deae24 commit 4202f80
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ A Cumulus-based implementation of the [qualifier metrics](https://github.com/syn

## Implemented Metrics

The following qualifier metrics are implemented (per May 2024 qualifer definitions).
The following qualifier metrics are implemented (per June 2024 qualifer definitions).

- [c_pt_count](https://github.com/sync-for-science/qualifier/blob/master/metrics.md#c_pt_count)
- [c_pt_deceased_count](https://github.com/sync-for-science/qualifier/blob/master/metrics.md#c_pt_deceased_count)
Expand Down
7 changes: 5 additions & 2 deletions cumulus_library_data_metrics/q_system_use/q_system_use.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ SELECT
{{ field }}
FROM rejoined_src
WHERE
has_target_system IS NULL
OR NOT has_target_system
{{ field }} IS NOT NULL
AND (
has_target_system IS NULL
OR NOT has_target_system
)
);
8 changes: 5 additions & 3 deletions cumulus_library_data_metrics/q_system_use/q_system_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def add_metric_queries(self) -> None:
)
self.make_table(src="Device", field="type", systems=[systems.SNOMED])
self.make_table(src="DiagnosticReport", field="code", systems=[systems.LOINC])
self.make_table(src="DocumentReference", field="type", systems=[systems.LOINC])
self.make_table(
src="DocumentReference", field="type", systems=[systems.LOINC, systems.NULL_FLAVOR]
)
self.make_table(
src="Immunization",
field="vaccineCode",
Expand Down Expand Up @@ -68,8 +70,8 @@ def add_metric_queries(self) -> None:
systems.CPT,
systems.LOINC,
systems.SNOMED,
"http://ada.org/cdt",
"http://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets",
"http://www.ada.org/cdt",
"https://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets",
"http://www.cms.gov/Medicare/Coding/ICD10",
],
)
Expand Down
1 change: 1 addition & 0 deletions cumulus_library_data_metrics/systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
ICD10CM = "http://hl7.org/fhir/sid/icd-10-cm"
LOINC = "http://loinc.org"
NDC = "http://hl7.org/fhir/sid/ndc"
NULL_FLAVOR = "http://terminology.hl7.org/CodeSystem/v3-NullFlavor"
RXNORM = "http://www.nlm.nih.gov/research/umls/rxnorm"
SNOMED = "http://snomed.info/sct"
UCUM = "http://unitsofmeasure.org"
Expand Down
4 changes: 3 additions & 1 deletion tests/data/q_system_use/general/documentreference/0.ndjson
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{"id": "valid", "type": {"coding": [{"system": "http://loinc.org"}]}}
{"id": "valid-loinc", "type": {"coding": [{"system": "http://loinc.org"}]}}
{"id": "valid-null", "type": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor"}]}}
{"id": "invalid", "type": {"coding": [{"system": "http://snomed.info/sct"}]}}
10 changes: 5 additions & 5 deletions tests/data/q_system_use/general/expected_summary.csv
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
id,numerator,denominator,percentage
# Various edge cases here in procedure
procedure_code,5,7,71.43
# Rest are just short happy-path checks to confirm that we look at the right json field
observation_valuecodeableconcept,1,2,50.00
observation_code,1,2,50.00
procedure_code,4,12,33.33
# Rest are often short happy-path checks to confirm that we look at the right json field
observation_valuecodeableconcept,0,2,0.00
observation_code,0,2,0.00
medicationrequest_medicationcodeableconcept,0,1,0.00
medication_code,0,1,0.00
immunization_vaccinecode,0,1,0.00
documentreference_type,0,1,0.00
documentreference_type,1,3,33.33
diagnosticreport_code,0,1,0.00
device_type,0,1,0.00
condition_code,0,1,0.00
Expand Down
7 changes: 6 additions & 1 deletion tests/data/q_system_use/general/procedure/0.ndjson
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{"id": "valid-simple", "code": {"coding": [{"system": "http://www.ama-assn.org/go/cpt"}]}}
{"id": "valid-cdt", "code": {"coding": [{"system": "http://www.ada.org/cdt"}]}}
{"id": "valid-cpt", "code": {"coding": [{"system": "http://www.ama-assn.org/go/cpt"}]}}
{"id": "valid-hcpcs", "code": {"coding": [{"system": "https://www.cms.gov/Medicare/Coding/HCPCSReleaseCodeSets"}]}}
{"id": "valid-icd10", "code": {"coding": [{"system": "http://www.cms.gov/Medicare/Coding/ICD10"}]}}
{"id": "valid-loinc", "code": {"coding": [{"system": "http://loinc.org"}]}}
{"id": "valid-snomed", "code": {"coding": [{"system": "http://snomed.info/sct"}]}}
{"id": "valid-multiple", "code": {"coding": [{"system": "nope"}, {"system": "http://loinc.org"}]}}
{"id": "bad-system", "code": {"coding": [{"system": "nope"}]}}
{"id": "missing-system", "code": {"coding": [{"display": "No system"}]}}
Expand Down

0 comments on commit 4202f80

Please sign in to comment.