Skip to content

Commit

Permalink
Organized assets folder/files and modified all tests to point to prop…
Browse files Browse the repository at this point in the history
…er asset (#519)

* Organized all assets and modified all tests that use each asset to find the proper directory

* Update test_validation.py

* fixed black errors

* Update test_tables.py

* fixed some failing tests

* Update test_base_service.py
  • Loading branch information
BradySkylight authored May 8, 2023
1 parent 3bdb40f commit cb21800
Show file tree
Hide file tree
Showing 71 changed files with 795 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
Path(__file__).parent.parent.parent.parent
/ "tests"
/ "assets"
/ "general"
/ "patient_bundle.json"
)

Expand Down
1 change: 1 addition & 0 deletions containers/tabulation/tests/test_tabulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
pathlib.Path(__file__).parent.parent.parent.parent
/ "tests"
/ "assets"
/ "tabulation"
/ "valid_schema.json"
)

Expand Down
1 change: 1 addition & 0 deletions containers/tabulation/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def test_check_schema_validity_valid_schema():
pathlib.Path(__file__).parent.parent.parent.parent
/ "tests"
/ "assets"
/ "tabulation"
/ "valid_schema.json"
)
valid_schema = json.load(open(valid_schema_path))
Expand Down
2 changes: 2 additions & 0 deletions containers/validation/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def test_validate_config_bad():
pathlib.Path(__file__).parent.parent.parent.parent
/ "tests"
/ "assets"
/ "validation"
/ "sample_ecr_config_bad.yaml",
"r",
) as file:
Expand All @@ -56,6 +57,7 @@ def test_validate_config_good():
pathlib.Path(__file__).parent.parent.parent.parent
/ "tests"
/ "assets"
/ "validation"
/ "sample_ecr_config.yaml",
"r",
) as file:
Expand Down
3 changes: 3 additions & 0 deletions containers/validation/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
pathlib.Path(__file__).parent.parent.parent.parent
/ "tests"
/ "assets"
/ "validation"
/ "ecr_sample_input_good.xml"
).read()

Expand All @@ -25,6 +26,7 @@
pathlib.Path(__file__).parent.parent.parent.parent
/ "tests"
/ "assets"
/ "validation"
/ "ecr_sample_input_bad.xml"
).read()

Expand All @@ -33,6 +35,7 @@
pathlib.Path(__file__).parent.parent.parent.parent
/ "tests"
/ "assets"
/ "validation"
/ "ecr_sample_input_good_with_RR.xml"
).read()

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2650,7 +2650,7 @@
<entry>
<act classCode="ACT" moodCode="EVN">
<templateId extension="2017-04-01" root="2.16.840.1.113883.10.20.15.2.3.29"/>
<id root="39d966b9-8a3a-4024-93d8-138e97d5898a"/>
<id root="8675309a-7754-r2d2-c3p0-973d9f777777"/>
<code code="RRVS19" codeSystem="2.16.840.1.114222.4.5.274" codeSystemName="PHIN VS (CDC Local Coding System)" displayName="eICR processed"/>
</act>
</entry>
Expand Down
468 changes: 468 additions & 0 deletions tests/assets/fhir-converter/ecr/example_rr.xml

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/assets/tabulation/sample_hl7.hl7
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MSH|^~\&|GHH LAB|ELAB-3|GHH OE|BLDG4|200202150930||ORU^R01|CNTRL-3456|P|2.4
PID|||555-44-4444||EVERYWOMAN^EVE^E^^^^L|JONES|196203520|F|||153 FERNWOOD DR.^^STATESVILLE^OH^35292||(206)3345232|(206)752-121||||AC555444444||67-A4335^OH^20030520
OBR|1|845439^GHH OE|1045813^GHH LAB|1554-5^GLUCOSE|||200202150730||||||||555-55-5555^PRIMARY^PATRICIA P^^^^MD^^LEVEL SEVEN HEALTHCARE, INC.|||||||||F||||||444-44-4444^HIPPOCRATES^HOWARD H^^^^MD
OBX|1|SN|1554-5^GLUCOSE^POST 12H CFST:MCNC:PT:SER/PLAS:QN||^182|mg/dl|70_105|H|||F
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion tests/cloud/test_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ def test_azure_download_object_cp1252(mock_get_client):
object_path = "output/path/some-bundle-type/some-filename-1.fhir"

with open(
pathlib.Path(__file__).parent.parent / "assets" / "cp1252-sample.txt", "rb"
pathlib.Path(__file__).parent.parent / "assets" / "cloud" / "cp1252-sample.txt",
"rb",
) as cp1252file:
object_content = cp1252file.read()

Expand Down
7 changes: 3 additions & 4 deletions tests/containers/test_base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@

def test_base_service():
service = BaseService(
service_name="test_service",
description_path=Path(__file__).parent.parent
/ "assets"
/ "test_description.md",
"test_service",
Path(__file__).parent.parent / "assets" / "containers" / "test_description.md",
)
assert service.app.title == "test_service"
assert service.app.version == default_app_version
Expand All @@ -33,6 +31,7 @@ def test_base_service_alternate_license():
service_name="test_service",
description_path=Path(__file__).parent.parent
/ "assets"
/ "containers"
/ "test_description.md",
license_info=alternate_app_license,
)
Expand Down
3 changes: 3 additions & 0 deletions tests/fhir/geospatial/test_fhir_census_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_geocode_resource_census():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle_census.json"
)
)
Expand Down Expand Up @@ -92,6 +93,7 @@ def test_geocode_resource_census():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle_census_extension.json"
)
)
Expand Down Expand Up @@ -163,6 +165,7 @@ def test_geocode_bundle_census():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle_census.json"
)
)
Expand Down
1 change: 1 addition & 0 deletions tests/fhir/geospatial/test_fhir_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def test_store_lat_long():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand Down
2 changes: 2 additions & 0 deletions tests/fhir/geospatial/test_fhir_smarty_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_geocode_resource():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand Down Expand Up @@ -86,6 +87,7 @@ def test_geocode_bundle():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand Down
5 changes: 5 additions & 0 deletions tests/fhir/harmonization/test_fhir_harmonization.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def test_double_metaphone_bundle():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "FHIR_server_extracted_data.json"
)
)
Expand Down Expand Up @@ -56,6 +57,7 @@ def test_double_metaphone_patient():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand Down Expand Up @@ -140,6 +142,7 @@ def test_standardize_names():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand Down Expand Up @@ -178,6 +181,7 @@ def test_standardize_phones():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand Down Expand Up @@ -228,6 +232,7 @@ def test_standardize_dob():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand Down
4 changes: 4 additions & 0 deletions tests/fhir/harmonization/test_standardization_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def test_standardize_names_in_resource():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand All @@ -30,6 +31,7 @@ def test_standardize_phones_in_resource():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand All @@ -44,6 +46,7 @@ def test_extract_countries_from_resource():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand All @@ -66,6 +69,7 @@ def test_standardize_dob_in_resource():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "general"
/ "patient_bundle.json"
)
)
Expand Down
4 changes: 4 additions & 0 deletions tests/fhir/linkage/test_fhir_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_add_patient_identifier_by_bundle_overwrite():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "linkage"
/ "patient_with_linking_id_bundle.json"
)
)
Expand Down Expand Up @@ -63,6 +64,7 @@ def test_patient_identifier_overwrite():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "linkage"
/ "patient_with_linking_id_bundle.json"
)
)
Expand Down Expand Up @@ -94,6 +96,7 @@ def test_add_patient_identifier_by_bundle():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "linkage"
/ "patient_with_linking_id_bundle.json"
)
)
Expand Down Expand Up @@ -126,6 +129,7 @@ def test_add_patient_identifier():
open(
pathlib.Path(__file__).parent.parent.parent
/ "assets"
/ "linkage"
/ "patient_with_linking_id_bundle.json"
)
)
Expand Down
Loading

0 comments on commit cb21800

Please sign in to comment.