-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: add some missing Encounter.class codes (#334)
These codes were not handled, but now are: - OBSENC (v3) - I (v2 -> IMP) - P (v2 -> PRENC) Additionally, we verify the code system too now.
- Loading branch information
Showing
5 changed files
with
75 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Tests for core__encounter""" | ||
|
||
import json | ||
|
||
from tests import testbed_utils | ||
|
||
|
||
def test_core_enc_class(tmp_path): | ||
"""Verify that we handle multiply rows as needed when multiple options appear""" | ||
v2_sys = "http://terminology.hl7.org/CodeSystem/v2-0004" | ||
v3_sys = "http://terminology.hl7.org/CodeSystem/v3-ActCode" | ||
|
||
testbed = testbed_utils.LocalTestbed(tmp_path) | ||
testbed.add_encounter("o", **{"class": {"code": "O", "system": v2_sys}}) | ||
testbed.add_encounter("obsenc", **{"class": {"code": "OBSENC", "system": v3_sys}}) | ||
testbed.add_encounter("unsupported", **{"class": {"code": "?", "system": v3_sys}}) | ||
|
||
con = testbed.build() | ||
df = con.sql("SELECT id, class_code, class_display FROM core__encounter ORDER BY id").df() | ||
rows = json.loads(df.to_json(orient="records")) | ||
assert rows == [ | ||
{"id": "o", "class_code": "AMB", "class_display": "ambulatory"}, | ||
{"id": "obsenc", "class_code": "OBSENC", "class_display": "observation encounter"}, | ||
{"id": "unsupported", "class_code": None, "class_display": None}, | ||
] |