Skip to content

Commit 6eece1f

Browse files
committed
Expanded code system preference lists
1 parent becfbad commit 6eece1f

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed

cumulus_library/studies/core/builder_condition.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def denormalize_codes(self):
5454
"http://snomed.info/sct",
5555
"http://hl7.org/fhir/sid/icd-10-cm",
5656
"http://hl7.org/fhir/sid/icd-9-cm",
57+
"urn:oid:1.2.840.114350.1.13.71.2.7.2",
58+
"urn:oid:1.2.840.114350.1.13.71.2.7.4",
59+
"http://terminology.hl7.org/CodeSystem/data-absent-reason",
5760
],
5861
)
5962
self.queries.append(

cumulus_library/studies/core/builder_encounter.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def denormalize_codes(self, schema, cursor):
4040
"http://terminology.hl7.org/CodeSystem/v2-0004",
4141
"urn:oid:2.16.840.1.113883.4.642.3.248",
4242
"http://snomed.info/sct",
43+
"https://fhir.cerner.com/96976f07-eccb-424c-9825-e0d0b887148b/codeSet/71",
44+
"urn:oid:1.2.840.114350.1.13.71.2.7.10",
45+
"urn:oid:1.2.840.114350.1.13.71.2.7.2",
4346
],
4447
"has_data": False,
4548
},
@@ -51,6 +54,8 @@ def denormalize_codes(self, schema, cursor):
5154
"http://terminology.hl7.org/CodeSystem/service-type",
5255
"urn:oid:2.16.840.1.113883.4.642.3.518",
5356
"http://snomed.info/sct",
57+
"https://fhir.cerner.com/96976f07-eccb-424c-9825-e0d0b887148b/codeSet/34",
58+
"urn:oid:1.2.840.114350.1.13.71.2.7.10",
5459
],
5560
"has_data": False,
5661
},
@@ -61,6 +66,8 @@ def denormalize_codes(self, schema, cursor):
6166
"code_systems": [
6267
"http://terminology.hl7.org/CodeSystem/v3-ActPriority",
6368
"http://snomed.info/sct",
69+
"https://fhir.cerner.com/96976f07-eccb-424c-9825-e0d0b887148b/codeSet/3",
70+
"urn:oid:1.2.840.114350.1.13.71.2.7.10",
6471
],
6572
"has_data": False,
6673
},
@@ -71,6 +78,10 @@ def denormalize_codes(self, schema, cursor):
7178
"code_systems": [
7279
"http://terminology.hl7.org/CodeSystem/v3-ActPriority",
7380
"http://snomed.info/sct",
81+
"http://hl7.org/fhir/sid/icd-10-cm",
82+
"http://hl7.org/fhir/sid/icd-9-cm",
83+
"https://fhir.cerner.com/96976f07-eccb-424c-9825-e0d0b887148b/nomenclature",
84+
"urn:oid:1.2.840.114350.1.13.71.2.7.2",
7485
],
7586
"has_data": False,
7687
},

cumulus_library/studies/discovery/code_detection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class CodeDetectionBuilder(base_table_builder.BaseTableBuilder):
99
display_text = "Selecting unique code systems..."
1010

11-
def _check_coding_against_db(code_source, schema, cursor):
11+
def _check_coding_against_db(self, code_source, schema, cursor):
1212
"""selects the appropriate DB query to run"""
1313

1414
if code_source["is_array"]:

cumulus_library/template_sql/codeable_concept_denormalize.sql.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CREATE TABLE {{ target_table }} AS (
2121
{%- endif %}
2222
{%- if filter_priority %}
2323
WHERE
24-
u.codeable_concept.system = '{{ system }}'
24+
u.codeable_concept.system LIKE '{{ system }}%'
2525
{%- endif %}
2626
), --noqa: LT07
2727
{%- endfor %}

cumulus_library/template_sql/sql_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ class CodeableConceptConfig:
2828
:param source_id: the id field to use in the new table (default: 'id')
2929
:param filter_priority: If true, will use code systems to select a single code,
3030
in preference order, for use as a display value.
31-
:param code_systems: a list of systems, in preference order, for selecting data
32-
for filtering. This should not be set if filter_priority is false.
31+
:param code_systems: a list of strings matching the start of the systems field,
32+
in preference order, for selecting data for filtering. This should not be set
33+
if filter_priority is false.
3334
"""
3435

3536
column_name: str
@@ -50,7 +51,7 @@ class ExtensionConfig:
5051
:param target_table: the name of the table to create
5152
:param target_col_prefix: the string to prepend code/display column names with
5253
:param fhir_extension: the URL of the FHIR resource to select
53-
:param code_systems: a list of codes, in preference order, to use to select data
54+
:param ext_systems: a list of codes, in preference order, to use to select data
5455
:param is_array: a boolean indicating if the targeted field is an array type
5556
"""
5657

tests/test_templates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_codeable_concept_denormalize_filter_creation():
7777
source AS s,
7878
UNNEST(s.code_col.coding) AS u (codeable_concept)
7979
WHERE
80-
u.codeable_concept.system = 'http://snomed.info/sct'
80+
u.codeable_concept.system LIKE 'http://snomed.info/sct%'
8181
), --noqa: LT07
8282
8383
system_code_col_1 AS (
@@ -91,7 +91,7 @@ def test_codeable_concept_denormalize_filter_creation():
9191
source AS s,
9292
UNNEST(s.code_col.coding) AS u (codeable_concept)
9393
WHERE
94-
u.codeable_concept.system = 'http://hl7.org/fhir/sid/icd-10-cm'
94+
u.codeable_concept.system LIKE 'http://hl7.org/fhir/sid/icd-10-cm%'
9595
), --noqa: LT07
9696
9797
union_table AS (

0 commit comments

Comments
 (0)