diff --git a/containers/message-parser/tests/test_parse_message_endpoint.py b/containers/message-parser/tests/test_parse_message_endpoint.py index 3b5c6239dc..5b6d23850c 100644 --- a/containers/message-parser/tests/test_parse_message_endpoint.py +++ b/containers/message-parser/tests/test_parse_message_endpoint.py @@ -11,6 +11,7 @@ Path(__file__).parent.parent.parent.parent / "tests" / "assets" + / "general" / "patient_bundle.json" ) diff --git a/containers/tabulation/tests/test_tabulation.py b/containers/tabulation/tests/test_tabulation.py index b2e1758d63..739b0e8114 100644 --- a/containers/tabulation/tests/test_tabulation.py +++ b/containers/tabulation/tests/test_tabulation.py @@ -13,6 +13,7 @@ pathlib.Path(__file__).parent.parent.parent.parent / "tests" / "assets" + / "tabulation" / "valid_schema.json" ) diff --git a/containers/tabulation/tests/test_utils.py b/containers/tabulation/tests/test_utils.py index 5d03bea372..191bde0c5d 100644 --- a/containers/tabulation/tests/test_utils.py +++ b/containers/tabulation/tests/test_utils.py @@ -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)) diff --git a/containers/validation/tests/test_utils.py b/containers/validation/tests/test_utils.py index cdcc0711a6..e3ce04bc37 100644 --- a/containers/validation/tests/test_utils.py +++ b/containers/validation/tests/test_utils.py @@ -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: @@ -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: diff --git a/containers/validation/tests/test_validation.py b/containers/validation/tests/test_validation.py index b23f3d3685..c13887ec46 100644 --- a/containers/validation/tests/test_validation.py +++ b/containers/validation/tests/test_validation.py @@ -17,6 +17,7 @@ pathlib.Path(__file__).parent.parent.parent.parent / "tests" / "assets" + / "validation" / "ecr_sample_input_good.xml" ).read() @@ -25,6 +26,7 @@ pathlib.Path(__file__).parent.parent.parent.parent / "tests" / "assets" + / "validation" / "ecr_sample_input_bad.xml" ).read() @@ -33,6 +35,7 @@ pathlib.Path(__file__).parent.parent.parent.parent / "tests" / "assets" + / "validation" / "ecr_sample_input_good_with_RR.xml" ).read() diff --git a/tests/assets/cp1252-sample.txt b/tests/assets/cloud/cp1252-sample.txt similarity index 100% rename from tests/assets/cp1252-sample.txt rename to tests/assets/cloud/cp1252-sample.txt diff --git a/tests/assets/test_description.md b/tests/assets/containers/test_description.md similarity index 100% rename from tests/assets/test_description.md rename to tests/assets/containers/test_description.md diff --git a/tests/assets/ccda_sample.xml b/tests/assets/fhir-converter/ccda/ccda_sample.xml similarity index 100% rename from tests/assets/ccda_sample.xml rename to tests/assets/fhir-converter/ccda/ccda_sample.xml diff --git a/tests/assets/ccda_sample_unknowntype.xml b/tests/assets/fhir-converter/ccda/ccda_sample_unknowntype.xml similarity index 100% rename from tests/assets/ccda_sample_unknowntype.xml rename to tests/assets/fhir-converter/ccda/ccda_sample_unknowntype.xml diff --git a/tests/assets/example_eicr_with_rr_data.xml b/tests/assets/fhir-converter/ecr/example_eicr_with_rr_data.xml similarity index 99% rename from tests/assets/example_eicr_with_rr_data.xml rename to tests/assets/fhir-converter/ecr/example_eicr_with_rr_data.xml index 692c2c610e..47d43128bb 100644 --- a/tests/assets/example_eicr_with_rr_data.xml +++ b/tests/assets/fhir-converter/ecr/example_eicr_with_rr_data.xml @@ -2650,7 +2650,7 @@ - + diff --git a/tests/assets/example_eicr_with_rr_data_fhir_converter.json b/tests/assets/fhir-converter/ecr/example_eicr_with_rr_data_fhir_converter.json similarity index 100% rename from tests/assets/example_eicr_with_rr_data_fhir_converter.json rename to tests/assets/fhir-converter/ecr/example_eicr_with_rr_data_fhir_converter.json diff --git a/tests/assets/example_eicr_with_rr_data_with_person.json b/tests/assets/fhir-converter/ecr/example_eicr_with_rr_data_with_person.json similarity index 100% rename from tests/assets/example_eicr_with_rr_data_with_person.json rename to tests/assets/fhir-converter/ecr/example_eicr_with_rr_data_with_person.json diff --git a/tests/assets/fhir-converter/ecr/example_rr.xml b/tests/assets/fhir-converter/ecr/example_rr.xml new file mode 100644 index 0000000000..335d03b873 --- /dev/null +++ b/tests/assets/fhir-converter/ecr/example_rr.xml @@ -0,0 +1,468 @@ + + + + + + + Reportability Response + + + + + + + + 123 FAKE ST + LOS ANGELES + CA + 90062 + USA + + + + + + + + + Jessies + Girl + + + + + + + + + + + + + + + + CA + + USA + + + + + + + + + + Providence California + + + 4733 TORRANCE BLVD #4400 + LOS ANGELES + TORRANCE + CA + 90503 + USA + + + + + + + + + + + APHL | Association of Public Health Laboratories. + + + 8515 Georgia Avenue, Suite 700 + Silver Spring + MD + 20910 + US + + + + + + + + + + + + + + + + + + + + + + + + Vanderbilt University Medical Center + + 3401 West End Ave + DAVIDSON + NASHVILLE + TN + 37203 + USA + + + + + + + + + Lab Requisition + + + + + + + + + + + + + + + + + + + Homer + Simpson + + + + Providence California + + 4733 TORRANCE BLVD #4400 + LOS ANGELES + TORRANCE + CA + 90503 + USA + + + + + + + + + + + Lab + + + PROVIDENCE SAINT JOHN'S HEALTH CTR CLINICAL LABORATORY + + 2121 Santa Monica Blvd + LOS ANGELES + Santa Monica + CA + 90404-2303 + USA + + + + + Providence Saint John's Health Center + + + 2121 Santa Monica Blvd + LOS ANGELES + Santa Monica + CA + 90404-2303 + USA + + + + Providence California + + + + + + + + + + + +
+ + + . + +
+ + Subject: + + Public Health Reporting Communication: one or more conditions are reportable, or may be reportable, to public health. + +
+ + + + + + + Public Health Reporting Communication: one or more conditions are reportable, or may be reportable, to public health. + + + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + . + + + + + + + + + Your organization electronically submitted an initial case report to determine if reporting to public health is needed for a patient. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + California Department of Public Health + + + + + + + + + + + + California Department of Public Health + + + + + + + + + + + + + + + Detection of Cyclospora cayetanensis nucleic acid in a clinical specimen, including stool, intestinal fluid, intestinal aspirate, and intestinal biopsy, by any method + + + + + + + + + + + + + + + Cyclosporiasis occurs in many countries but it is most common in tropical and subtropical regions. In the United States, foodborne outbreaks of cyclosporiasis have been linked to various types of fresh produce imported from Latin America, including raspberries, cilantro, basil, snow peas, and mixed salad. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Los Angeles County Department of Public Health + + + + + + + + + + + + Los Angeles County Department of Public Health + + + + + + + + + + + + + + + Detection of Cyclospora cayetanensis nucleic acid in a clinical specimen, including stool, intestinal fluid, intestinal aspirate, and intestinal biopsy, by any method + + + + + + + + + + +
+
+
+
+
\ No newline at end of file diff --git a/tests/assets/hl7_with_msh_3_set.hl7 b/tests/assets/fhir-converter/hl7v2/hl7_with_msh_3_set.hl7 similarity index 100% rename from tests/assets/hl7_with_msh_3_set.hl7 rename to tests/assets/fhir-converter/hl7v2/hl7_with_msh_3_set.hl7 diff --git a/tests/assets/sample_hl7.hl7 b/tests/assets/fhir-converter/hl7v2/sample_hl7.hl7 similarity index 100% rename from tests/assets/sample_hl7.hl7 rename to tests/assets/fhir-converter/hl7v2/sample_hl7.hl7 diff --git a/tests/assets/FHIR_server_extracted_data.json b/tests/assets/general/FHIR_server_extracted_data.json similarity index 100% rename from tests/assets/FHIR_server_extracted_data.json rename to tests/assets/general/FHIR_server_extracted_data.json diff --git a/tests/assets/FHIR_server_observation_data.json b/tests/assets/general/FHIR_server_observation_data.json similarity index 100% rename from tests/assets/FHIR_server_observation_data.json rename to tests/assets/general/FHIR_server_observation_data.json diff --git a/tests/assets/FHIR_server_query_response_200_example.json b/tests/assets/general/FHIR_server_query_response_200_example.json similarity index 100% rename from tests/assets/FHIR_server_query_response_200_example.json rename to tests/assets/general/FHIR_server_query_response_200_example.json diff --git a/tests/assets/patient_bundle.json b/tests/assets/general/patient_bundle.json similarity index 100% rename from tests/assets/patient_bundle.json rename to tests/assets/general/patient_bundle.json diff --git a/tests/assets/patient_bundle_census.json b/tests/assets/general/patient_bundle_census.json similarity index 100% rename from tests/assets/patient_bundle_census.json rename to tests/assets/general/patient_bundle_census.json diff --git a/tests/assets/patient_bundle_census_extension.json b/tests/assets/general/patient_bundle_census_extension.json similarity index 100% rename from tests/assets/patient_bundle_census_extension.json rename to tests/assets/general/patient_bundle_census_extension.json diff --git a/tests/assets/censusResponseFullAddress.json b/tests/assets/geospatial/censusResponseFullAddress.json similarity index 100% rename from tests/assets/censusResponseFullAddress.json rename to tests/assets/geospatial/censusResponseFullAddress.json diff --git a/tests/assets/FileSingleMessageInvalidSegments.hl7 b/tests/assets/harmonization/FileSingleMessageInvalidSegments.hl7 similarity index 100% rename from tests/assets/FileSingleMessageInvalidSegments.hl7 rename to tests/assets/harmonization/FileSingleMessageInvalidSegments.hl7 diff --git a/tests/assets/FileSingleMessageLongDate.hl7 b/tests/assets/harmonization/FileSingleMessageLongDate.hl7 similarity index 100% rename from tests/assets/FileSingleMessageLongDate.hl7 rename to tests/assets/harmonization/FileSingleMessageLongDate.hl7 diff --git a/tests/assets/FileSingleMessageLongTZ.hl7 b/tests/assets/harmonization/FileSingleMessageLongTZ.hl7 similarity index 100% rename from tests/assets/FileSingleMessageLongTZ.hl7 rename to tests/assets/harmonization/FileSingleMessageLongTZ.hl7 diff --git a/tests/assets/FileSingleMessageSimple.hl7 b/tests/assets/harmonization/FileSingleMessageSimple.hl7 similarity index 100% rename from tests/assets/FileSingleMessageSimple.hl7 rename to tests/assets/harmonization/FileSingleMessageSimple.hl7 diff --git a/tests/assets/dibbs_basic_algorithm.json b/tests/assets/linkage/dibbs_basic_algorithm.json similarity index 100% rename from tests/assets/dibbs_basic_algorithm.json rename to tests/assets/linkage/dibbs_basic_algorithm.json diff --git a/tests/assets/dibbs_enhanced_algorithm.json b/tests/assets/linkage/dibbs_enhanced_algorithm.json similarity index 100% rename from tests/assets/dibbs_enhanced_algorithm.json rename to tests/assets/linkage/dibbs_enhanced_algorithm.json diff --git a/tests/assets/patient_bundle_to_link_with_mpi.json b/tests/assets/linkage/patient_bundle_to_link_with_mpi.json similarity index 100% rename from tests/assets/patient_bundle_to_link_with_mpi.json rename to tests/assets/linkage/patient_bundle_to_link_with_mpi.json diff --git a/tests/assets/patient_lol.csv b/tests/assets/linkage/patient_lol.csv similarity index 100% rename from tests/assets/patient_lol.csv rename to tests/assets/linkage/patient_lol.csv diff --git a/tests/assets/patient_with_linking_id_bundle.json b/tests/assets/linkage/patient_with_linking_id_bundle.json similarity index 100% rename from tests/assets/patient_with_linking_id_bundle.json rename to tests/assets/linkage/patient_with_linking_id_bundle.json diff --git a/tests/assets/synthetic_patient_mpi_seed_data.parquet b/tests/assets/linkage/synthetic_patient_mpi_seed_data.parquet similarity index 100% rename from tests/assets/synthetic_patient_mpi_seed_data.parquet rename to tests/assets/linkage/synthetic_patient_mpi_seed_data.parquet diff --git a/tests/assets/invalid_json.json b/tests/assets/tabulation/invalid_json.json similarity index 100% rename from tests/assets/invalid_json.json rename to tests/assets/tabulation/invalid_json.json diff --git a/tests/assets/invalid_schema.yaml b/tests/assets/tabulation/invalid_schema.yaml similarity index 100% rename from tests/assets/invalid_schema.yaml rename to tests/assets/tabulation/invalid_schema.yaml diff --git a/tests/assets/invalid_schema_no_invalid_values.yaml b/tests/assets/tabulation/invalid_schema_no_invalid_values.yaml similarity index 100% rename from tests/assets/invalid_schema_no_invalid_values.yaml rename to tests/assets/tabulation/invalid_schema_no_invalid_values.yaml diff --git a/tests/assets/observation_reference_schema.yaml b/tests/assets/tabulation/observation_reference_schema.yaml similarity index 100% rename from tests/assets/observation_reference_schema.yaml rename to tests/assets/tabulation/observation_reference_schema.yaml diff --git a/tests/assets/tabulation/sample_hl7.hl7 b/tests/assets/tabulation/sample_hl7.hl7 new file mode 100644 index 0000000000..960a354763 --- /dev/null +++ b/tests/assets/tabulation/sample_hl7.hl7 @@ -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 \ No newline at end of file diff --git a/tests/assets/tabulated_patients.csv b/tests/assets/tabulation/tabulated_patients.csv similarity index 100% rename from tests/assets/tabulated_patients.csv rename to tests/assets/tabulation/tabulated_patients.csv diff --git a/tests/assets/tabulated_physical_exam.csv b/tests/assets/tabulation/tabulated_physical_exam.csv similarity index 100% rename from tests/assets/tabulated_physical_exam.csv rename to tests/assets/tabulation/tabulated_physical_exam.csv diff --git a/tests/assets/tabulation_schema.yaml b/tests/assets/tabulation/tabulation_schema.yaml similarity index 100% rename from tests/assets/tabulation_schema.yaml rename to tests/assets/tabulation/tabulation_schema.yaml diff --git a/tests/assets/tabulation_schema_output_data.json b/tests/assets/tabulation/tabulation_schema_output_data.json similarity index 100% rename from tests/assets/tabulation_schema_output_data.json rename to tests/assets/tabulation/tabulation_schema_output_data.json diff --git a/tests/assets/valid_schema.json b/tests/assets/tabulation/valid_schema.json similarity index 100% rename from tests/assets/valid_schema.json rename to tests/assets/tabulation/valid_schema.json diff --git a/tests/assets/valid_schema.yaml b/tests/assets/tabulation/valid_schema.yaml similarity index 100% rename from tests/assets/valid_schema.yaml rename to tests/assets/tabulation/valid_schema.yaml diff --git a/tests/assets/ecr_sample_input_bad.xml b/tests/assets/validation/ecr_sample_input_bad.xml similarity index 100% rename from tests/assets/ecr_sample_input_bad.xml rename to tests/assets/validation/ecr_sample_input_bad.xml diff --git a/tests/assets/ecr_sample_input_error.xml b/tests/assets/validation/ecr_sample_input_error.xml similarity index 100% rename from tests/assets/ecr_sample_input_error.xml rename to tests/assets/validation/ecr_sample_input_error.xml diff --git a/tests/assets/ecr_sample_input_good.xml b/tests/assets/validation/ecr_sample_input_good.xml similarity index 100% rename from tests/assets/ecr_sample_input_good.xml rename to tests/assets/validation/ecr_sample_input_good.xml diff --git a/tests/assets/ecr_sample_input_good_with_RR.xml b/tests/assets/validation/ecr_sample_input_good_with_RR.xml similarity index 100% rename from tests/assets/ecr_sample_input_good_with_RR.xml rename to tests/assets/validation/ecr_sample_input_good_with_RR.xml diff --git a/tests/assets/sample_ecr_config.yaml b/tests/assets/validation/sample_ecr_config.yaml similarity index 100% rename from tests/assets/sample_ecr_config.yaml rename to tests/assets/validation/sample_ecr_config.yaml diff --git a/tests/assets/sample_ecr_config_bad.yaml b/tests/assets/validation/sample_ecr_config_bad.yaml similarity index 100% rename from tests/assets/sample_ecr_config_bad.yaml rename to tests/assets/validation/sample_ecr_config_bad.yaml diff --git a/tests/assets/sample_ecr_config_custom_messages.yaml b/tests/assets/validation/sample_ecr_config_custom_messages.yaml similarity index 100% rename from tests/assets/sample_ecr_config_custom_messages.yaml rename to tests/assets/validation/sample_ecr_config_custom_messages.yaml diff --git a/tests/assets/sample_ecr_config_with_rr.yaml b/tests/assets/validation/sample_ecr_config_with_rr.yaml similarity index 100% rename from tests/assets/sample_ecr_config_with_rr.yaml rename to tests/assets/validation/sample_ecr_config_with_rr.yaml diff --git a/tests/cloud/test_cloud.py b/tests/cloud/test_cloud.py index 547bdcd2b0..8037d65ff1 100644 --- a/tests/cloud/test_cloud.py +++ b/tests/cloud/test_cloud.py @@ -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() diff --git a/tests/containers/test_base_service.py b/tests/containers/test_base_service.py index f8387ecb51..cb21ac1e33 100644 --- a/tests/containers/test_base_service.py +++ b/tests/containers/test_base_service.py @@ -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 @@ -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, ) diff --git a/tests/fhir/geospatial/test_fhir_census_client.py b/tests/fhir/geospatial/test_fhir_census_client.py index d41a9f457c..505b158924 100644 --- a/tests/fhir/geospatial/test_fhir_census_client.py +++ b/tests/fhir/geospatial/test_fhir_census_client.py @@ -27,6 +27,7 @@ def test_geocode_resource_census(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle_census.json" ) ) @@ -92,6 +93,7 @@ def test_geocode_resource_census(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle_census_extension.json" ) ) @@ -163,6 +165,7 @@ def test_geocode_bundle_census(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle_census.json" ) ) diff --git a/tests/fhir/geospatial/test_fhir_core.py b/tests/fhir/geospatial/test_fhir_core.py index 334398df57..83454832b2 100644 --- a/tests/fhir/geospatial/test_fhir_core.py +++ b/tests/fhir/geospatial/test_fhir_core.py @@ -9,6 +9,7 @@ def test_store_lat_long(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) diff --git a/tests/fhir/geospatial/test_fhir_smarty_client.py b/tests/fhir/geospatial/test_fhir_smarty_client.py index bc7cfe42b1..90bb9d76b6 100644 --- a/tests/fhir/geospatial/test_fhir_smarty_client.py +++ b/tests/fhir/geospatial/test_fhir_smarty_client.py @@ -29,6 +29,7 @@ def test_geocode_resource(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) @@ -86,6 +87,7 @@ def test_geocode_bundle(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) diff --git a/tests/fhir/harmonization/test_fhir_harmonization.py b/tests/fhir/harmonization/test_fhir_harmonization.py index 6ed468b517..e0b2a50b36 100644 --- a/tests/fhir/harmonization/test_fhir_harmonization.py +++ b/tests/fhir/harmonization/test_fhir_harmonization.py @@ -18,6 +18,7 @@ def test_double_metaphone_bundle(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -56,6 +57,7 @@ def test_double_metaphone_patient(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) @@ -140,6 +142,7 @@ def test_standardize_names(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) @@ -178,6 +181,7 @@ def test_standardize_phones(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) @@ -228,6 +232,7 @@ def test_standardize_dob(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) diff --git a/tests/fhir/harmonization/test_standardization_helpers.py b/tests/fhir/harmonization/test_standardization_helpers.py index ac21d33d4c..ff4aff8c6c 100644 --- a/tests/fhir/harmonization/test_standardization_helpers.py +++ b/tests/fhir/harmonization/test_standardization_helpers.py @@ -15,6 +15,7 @@ def test_standardize_names_in_resource(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) @@ -30,6 +31,7 @@ def test_standardize_phones_in_resource(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) @@ -44,6 +46,7 @@ def test_extract_countries_from_resource(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) @@ -66,6 +69,7 @@ def test_standardize_dob_in_resource(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "patient_bundle.json" ) ) diff --git a/tests/fhir/linkage/test_fhir_link.py b/tests/fhir/linkage/test_fhir_link.py index 542c61a6c5..a2c9f8a62a 100644 --- a/tests/fhir/linkage/test_fhir_link.py +++ b/tests/fhir/linkage/test_fhir_link.py @@ -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" ) ) @@ -63,6 +64,7 @@ def test_patient_identifier_overwrite(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "linkage" / "patient_with_linking_id_bundle.json" ) ) @@ -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" ) ) @@ -126,6 +129,7 @@ def test_add_patient_identifier(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "linkage" / "patient_with_linking_id_bundle.json" ) ) diff --git a/tests/fhir/tabulation/test_fhir_tabulation.py b/tests/fhir/tabulation/test_fhir_tabulation.py index 844775fd32..986cd6303e 100644 --- a/tests/fhir/tabulation/test_fhir_tabulation.py +++ b/tests/fhir/tabulation/test_fhir_tabulation.py @@ -31,6 +31,7 @@ def test_tabulate_data_invalid_table_name(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulation_schema.yaml" ) ) @@ -38,6 +39,7 @@ def test_tabulate_data_invalid_table_name(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -53,6 +55,7 @@ def test_tabulate_data(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulation_schema.yaml" ) ) @@ -60,6 +63,7 @@ def test_tabulate_data(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -141,6 +145,7 @@ def test_tabulate_data(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "observation_reference_schema.yaml" ) ) @@ -148,6 +153,7 @@ def test_tabulate_data(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "FHIR_server_observation_data.json" ) ) @@ -182,6 +188,7 @@ def test_get_reference_directions(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulation_schema.yaml" ) ) @@ -202,6 +209,7 @@ def test_build_reference_dicts(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulation_schema.yaml" ) ) @@ -211,6 +219,7 @@ def test_build_reference_dicts(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -244,6 +253,7 @@ def test_dereference_included_resource(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulation_schema.yaml" ) ) @@ -251,6 +261,7 @@ def test_dereference_included_resource(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -392,7 +403,10 @@ def test_generate_search_urls(patch_generate_search_url): schema = yaml.safe_load( open( - pathlib.Path(__file__).parent.parent.parent / "assets" / "valid_schema.yaml" + pathlib.Path(__file__).parent.parent.parent + / "assets" + / "tabulation" + / "valid_schema.yaml" ) ) @@ -409,6 +423,7 @@ def test_generate_search_urls_invalid(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "invalid_schema.yaml" ) ) @@ -422,6 +437,7 @@ def test_merge_include_query_params(): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulation_schema.yaml" ) ) @@ -450,7 +466,10 @@ def test_merge_include_query_params_invalid(): def test_drop_invalid(): schema = yaml.safe_load( open( - pathlib.Path(__file__).parent.parent.parent / "assets" / "valid_schema.yaml" + pathlib.Path(__file__).parent.parent.parent + / "assets" + / "tabulation" + / "valid_schema.yaml" ) ) @@ -536,6 +555,7 @@ def test_extract_data_from_fhir_search_incremental(patch_query): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "FHIR_server_query_response_200_example.json" ) ) @@ -647,6 +667,7 @@ def test_extract_data_from_fhir_search(patch_query): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "FHIR_server_query_response_200_example.json" ) ) @@ -698,7 +719,10 @@ def test_extract_data_from_schema(patch_search, patch_gen_urls): schema = yaml.safe_load( open( - pathlib.Path(__file__).parent.parent.parent / "assets" / "valid_schema.yaml" + pathlib.Path(__file__).parent.parent.parent + / "assets" + / "tabulation" + / "valid_schema.yaml" ) ) @@ -757,6 +781,7 @@ def test_generate_tables(patch_search_incremental): schema_path = ( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulation_schema.yaml" ) @@ -764,6 +789,7 @@ def test_generate_tables(patch_search_incremental): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulation_schema_output_data.json" ) ) @@ -774,6 +800,7 @@ def test_generate_tables(patch_search_incremental): open( pathlib.Path(__file__).parent.parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -805,6 +832,7 @@ def test_generate_tables(patch_search_incremental): ( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulated_patients.csv" ), "r", @@ -837,6 +865,7 @@ def test_generate_tables(patch_search_incremental): ( pathlib.Path(__file__).parent.parent.parent / "assets" + / "tabulation" / "tabulated_physical_exam.csv" ), "r", diff --git a/tests/fhir/test_conversion.py b/tests/fhir/test_conversion.py index aacc8c37a5..45c7a1beb9 100644 --- a/tests/fhir/test_conversion.py +++ b/tests/fhir/test_conversion.py @@ -10,7 +10,13 @@ def test_get_fhir_conversion_settings(): # HL7 case 1 (using the demo message from the HL7 API walkthrough) message = "" - with open(pathlib.Path(__file__).parent.parent / "assets" / "sample_hl7.hl7") as fp: + with open( + pathlib.Path(__file__).parent.parent + / "assets" + / "fhir-converter" + / "hl7v2" + / "sample_hl7.hl7" + ) as fp: message = fp.read() settings = _get_fhir_conversion_settings(message) assert settings == { @@ -21,7 +27,11 @@ def test_get_fhir_conversion_settings(): # HL7 case 2, when MSH[3] is set message = "" with open( - pathlib.Path(__file__).parent.parent / "assets" / "hl7_with_msh_3_set.hl7" + pathlib.Path(__file__).parent.parent + / "assets" + / "fhir-converter" + / "hl7v2" + / "hl7_with_msh_3_set.hl7" ) as fp: message = fp.read() settings = _get_fhir_conversion_settings(message) @@ -33,7 +43,11 @@ def test_get_fhir_conversion_settings(): # CCDA case (using an example found at https://github.com/HL7/C-CDA-Examples) message = "" with open( - pathlib.Path(__file__).parent.parent / "assets" / "ccda_sample.xml" + pathlib.Path(__file__).parent.parent + / "assets" + / "fhir-converter" + / "ccda" + / "ccda_sample.xml" ) as fp: message = fp.read() settings = _get_fhir_conversion_settings(message) @@ -46,7 +60,11 @@ def test_get_fhir_conversion_settings(): # https://github.com/HL7/C-CDA-Examples) message = "" with open( - pathlib.Path(__file__).parent.parent / "assets" / "ccda_sample_unknowntype.xml" + pathlib.Path(__file__).parent.parent + / "assets" + / "fhir-converter" + / "ccda" + / "ccda_sample_unknowntype.xml" ) as fp: message = fp.read() with pytest.raises(KeyError): @@ -73,7 +91,13 @@ def test_convert_to_fhir_success_cred_manager(mock_requests_session): mock_cred_manager.get_access_token.return_value = mock_access_token_value message = "" - with open(pathlib.Path(__file__).parent.parent / "assets" / "sample_hl7.hl7") as fp: + with open( + pathlib.Path(__file__).parent.parent + / "assets" + / "fhir-converter" + / "hl7v2" + / "sample_hl7.hl7" + ) as fp: message = fp.read() response = convert_to_fhir( message, @@ -110,7 +134,13 @@ def test_convert_to_fhir_success_auth_header(mock_requests_session): headers = {"Authorization": "Basic dGVzdDp0ZXN0"} message = "" - with open(pathlib.Path(__file__).parent.parent / "assets" / "sample_hl7.hl7") as fp: + with open( + pathlib.Path(__file__).parent.parent + / "assets" + / "fhir-converter" + / "hl7v2" + / "sample_hl7.hl7" + ) as fp: message = fp.read() response = convert_to_fhir( message, @@ -148,7 +178,13 @@ def test_convert_to_fhir_unrecognized_data(mock_requests_session): mock_cred_manager.get_access_token.return_value = mock_access_token message = "" - with open(pathlib.Path(__file__).parent.parent / "assets" / "sample_hl7.hl7") as fp: + with open( + pathlib.Path(__file__).parent.parent + / "assets" + / "fhir-converter" + / "hl7v2" + / "sample_hl7.hl7" + ) as fp: message = fp.read() message_without_types_parts = message.split("|") @@ -196,7 +232,13 @@ def test_convert_to_fhir_failure(mock_requests_session): ) message = "" - with open(pathlib.Path(__file__).parent.parent / "assets" / "sample_hl7.hl7") as fp: + with open( + pathlib.Path(__file__).parent.parent + / "assets" + / "fhir-converter" + / "hl7v2" + / "sample_hl7.hl7" + ) as fp: message = fp.read() # Most efficient way to verify that the function will raise an exception, diff --git a/tests/fhir/test_utils.py b/tests/fhir/test_utils.py index ae3152a909..69c604133a 100644 --- a/tests/fhir/test_utils.py +++ b/tests/fhir/test_utils.py @@ -39,7 +39,12 @@ def test_find_resource_by_type(): # Regular use case: entry exists and has resources of given type bundle = json.load( - open(pathlib.Path(__file__).parent.parent / "assets" / "patient_bundle.json") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "general" + / "patient_bundle.json" + ) ) found_patients = find_entries_by_resource_type(bundle, "Patient") assert len(found_patients) == 1 @@ -48,7 +53,12 @@ def test_find_resource_by_type(): def test_get_field_valid_inputs(): bundle = json.load( - open(pathlib.Path(__file__).parent.parent / "assets" / "patient_bundle.json") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "general" + / "patient_bundle.json" + ) ) patient = bundle["entry"][1]["resource"] @@ -70,7 +80,12 @@ def test_get_field_valid_inputs(): def test_get_field_invalid_inputs(): bundle = json.load( - open(pathlib.Path(__file__).parent.parent / "assets" / "patient_bundle.json") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "general" + / "patient_bundle.json" + ) ) patient = bundle["entry"][1]["resource"] @@ -89,7 +104,12 @@ def test_get_field_invalid_inputs(): def test_get_field_indexes(): bundle = json.load( - open(pathlib.Path(__file__).parent.parent / "assets" / "patient_bundle.json") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "general" + / "patient_bundle.json" + ) ) patient = bundle["entry"][1]["resource"] diff --git a/tests/geospatial/test_census_geocode_client.py b/tests/geospatial/test_census_geocode_client.py index 9d537876b0..4336615b45 100644 --- a/tests/geospatial/test_census_geocode_client.py +++ b/tests/geospatial/test_census_geocode_client.py @@ -33,6 +33,7 @@ def test_parse_census_result_success(): open( pathlib.Path(__file__).parent.parent / "assets" + / "geospatial" / "censusResponseFullAddress.json" ) ) @@ -54,6 +55,7 @@ def test_parse_census_result_failure(): open( pathlib.Path(__file__).parent.parent / "assets" + / "geospatial" / "censusResponseFullAddress.json" ) ) @@ -75,6 +77,7 @@ def test_geocode_from_str(): open( pathlib.Path(__file__).parent.parent / "assets" + / "geospatial" / "censusResponseFullAddress.json" ) ) @@ -122,6 +125,7 @@ def test_geocode_from_dict(): open( pathlib.Path(__file__).parent.parent / "assets" + / "geospatial" / "censusResponseFullAddress.json" ) ) diff --git a/tests/harmonization/test_harmonization.py b/tests/harmonization/test_harmonization.py index b61d7a001e..b1cc9a9398 100644 --- a/tests/harmonization/test_harmonization.py +++ b/tests/harmonization/test_harmonization.py @@ -78,14 +78,19 @@ def test_standardize_hl7_datetimes(): message_long_date = open( pathlib.Path(__file__).parent.parent / "assets" + / "harmonization" / "FileSingleMessageLongDate.hl7" ).read() massage_timezone = open( - pathlib.Path(__file__).parent.parent / "assets" / "FileSingleMessageLongTZ.hl7" + pathlib.Path(__file__).parent.parent + / "assets" + / "harmonization" + / "FileSingleMessageLongTZ.hl7" ).read() massage_invalid_segments = open( pathlib.Path(__file__).parent.parent / "assets" + / "harmonization" / "FileSingleMessageInvalidSegments.hl7" ).read() @@ -129,6 +134,7 @@ def test_normalize_hl7_datetime_segment(): open( pathlib.Path(__file__).parent.parent / "assets" + / "harmonization" / "FileSingleMessageLongDate.hl7" ) .read() @@ -171,23 +177,36 @@ def test_normalize_hl7_datetime(): def test_default_hl7_value(): message_default_empty_field = open( - pathlib.Path(__file__).parent.parent / "assets" / "FileSingleMessageSimple.hl7" + pathlib.Path(__file__).parent.parent + / "assets" + / "harmonization" + / "FileSingleMessageSimple.hl7" ).read() message_default_missing_field = open( - pathlib.Path(__file__).parent.parent / "assets" / "FileSingleMessageSimple.hl7" + pathlib.Path(__file__).parent.parent + / "assets" + / "harmonization" + / "FileSingleMessageSimple.hl7" ).read() message_default_populated_field = open( - pathlib.Path(__file__).parent.parent / "assets" / "FileSingleMessageSimple.hl7" + pathlib.Path(__file__).parent.parent + / "assets" + / "harmonization" + / "FileSingleMessageSimple.hl7" ).read() message_default_invalid_field = open( pathlib.Path(__file__).parent.parent / "assets" + / "harmonization" / "FileSingleMessageInvalidSegments.hl7" ).read() message_default_invalid_segment = open( - pathlib.Path(__file__).parent.parent / "assets" / "FileSingleMessageSimple.hl7" + pathlib.Path(__file__).parent.parent + / "assets" + / "harmonization" + / "FileSingleMessageSimple.hl7" ).read() message_default_empty_field = default_hl7_value( diff --git a/tests/linkage/test_linkage.py b/tests/linkage/test_linkage.py index a607c0718f..fab177b537 100644 --- a/tests/linkage/test_linkage.py +++ b/tests/linkage/test_linkage.py @@ -131,7 +131,12 @@ def _clean_up_postgres_client(postgres_client): def test_extract_blocking_values_from_record(): bundle = json.load( - open(pathlib.Path(__file__).parent.parent / "assets" / "patient_bundle.json") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "general" + / "patient_bundle.json" + ) ) patient = [ r.get("resource") @@ -622,7 +627,7 @@ def test_blocking_data(): def test_read_write_m_probs(): data = pd.read_csv( - pathlib.Path(__file__).parent.parent / "assets" / "patient_lol.csv", + pathlib.Path(__file__).parent.parent / "assets" / "linkage" / "patient_lol.csv", index_col=False, dtype="object", keep_default_na=False, @@ -661,7 +666,7 @@ def test_read_write_m_probs(): def test_read_write_u_probs(): seed(0) data = pd.read_csv( - pathlib.Path(__file__).parent.parent / "assets" / "patient_lol.csv", + pathlib.Path(__file__).parent.parent / "assets" / "linkage" / "patient_lol.csv", index_col=False, dtype="object", keep_default_na=False, @@ -828,7 +833,10 @@ def test_feature_match_log_odds_fuzzy(): def test_algo_read(): dibbs_basic_algo = read_linkage_config( - pathlib.Path(__file__).parent.parent / "assets" / "dibbs_basic_algorithm.json" + pathlib.Path(__file__).parent.parent + / "assets" + / "linkage" + / "dibbs_basic_algorithm.json" ) assert dibbs_basic_algo == [ { @@ -861,6 +869,7 @@ def test_algo_read(): dibbs_enhanced_algo = read_linkage_config( pathlib.Path(__file__).parent.parent / "assets" + / "linkage" / "dibbs_enhanced_algorithm.json" ) assert dibbs_enhanced_algo == [ @@ -976,6 +985,7 @@ def test_link_record_against_mpi(): open( pathlib.Path(__file__).parent.parent / "assets" + / "linkage" / "patient_bundle_to_link_with_mpi.json" ) ) @@ -1056,6 +1066,7 @@ def test_add_person_resource(): pathlib.Path(__file__).parent.parent.parent / "tests" / "assets" + / "general" / "patient_bundle.json" ) ) @@ -1197,6 +1208,7 @@ def test_condense_extracted_address(): open( pathlib.Path(__file__).parent.parent / "assets" + / "linkage" / "patient_bundle_to_link_with_mpi.json" ) ) @@ -1218,6 +1230,7 @@ def test_flatten_patient(): open( pathlib.Path(__file__).parent.parent / "assets" + / "linkage" / "patient_bundle_to_link_with_mpi.json" ) ) @@ -1250,6 +1263,7 @@ def test_multi_element_blocking(): open( pathlib.Path(__file__).parent.parent / "assets" + / "linkage" / "patient_bundle_to_link_with_mpi.json" ) ) diff --git a/tests/linkage/test_postgres_mpi_connector.py b/tests/linkage/test_postgres_mpi_connector.py index 9f73c1bc74..486ed5d4ef 100644 --- a/tests/linkage/test_postgres_mpi_connector.py +++ b/tests/linkage/test_postgres_mpi_connector.py @@ -60,6 +60,7 @@ def test_block_data(): pathlib.Path(__file__).parent.parent.parent / "tests" / "assets" + / "general" / "patient_bundle.json" ) ) @@ -136,6 +137,7 @@ def test_dibbs_blocking(): pathlib.Path(__file__).parent.parent.parent / "tests" / "assets" + / "general" / "patient_bundle.json" ) ) @@ -261,6 +263,7 @@ def test_insert_match_patient(): pathlib.Path(__file__).parent.parent.parent / "tests" / "assets" + / "general" / "patient_bundle.json" ) ) diff --git a/tests/linkage/test_seed.py b/tests/linkage/test_seed.py index 02caa57043..1fc84a27eb 100644 --- a/tests/linkage/test_seed.py +++ b/tests/linkage/test_seed.py @@ -6,6 +6,7 @@ pathlib.Path(__file__).parent.parent.parent / "tests" / "assets" + / "linkage" / "synthetic_patient_mpi_seed_data.parquet" ) diff --git a/tests/tabulation/test_tables.py b/tests/tabulation/test_tables.py index f5156bb4cc..1cd5da671f 100644 --- a/tests/tabulation/test_tables.py +++ b/tests/tabulation/test_tables.py @@ -27,15 +27,31 @@ def test_load_schema(): assert load_schema( - pathlib.Path(__file__).parent.parent / "assets" / "valid_schema.yaml" + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "valid_schema.yaml" ) == yaml.safe_load( - open(pathlib.Path(__file__).parent.parent / "assets" / "valid_schema.yaml") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "valid_schema.yaml" + ) ) assert load_schema( - pathlib.Path(__file__).parent.parent / "assets" / "valid_schema.json" + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "valid_schema.json" ) == json.load( - open(pathlib.Path(__file__).parent.parent / "assets" / "valid_schema.json") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "valid_schema.json" + ) ) # Invalid schema file path @@ -45,22 +61,36 @@ def test_load_schema(): # Invalid JSON with pytest.raises(json.decoder.JSONDecodeError): load_schema( - pathlib.Path(__file__).parent.parent / "assets" / "invalid_json.json" + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "invalid_json.json" ) # Invalid file format with pytest.raises(ValueError): - load_schema(pathlib.Path(__file__).parent.parent / "assets" / "sample_hl7.hl7") + load_schema( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "sample_hl7.hl7" + ) def test_write_data_csv(): schema = yaml.safe_load( - open(pathlib.Path(__file__).parent.parent / "assets" / "tabulation_schema.yaml") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "tabulation_schema.yaml" + ) ) extracted_data = json.load( open( pathlib.Path(__file__).parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -109,12 +139,18 @@ def test_write_data_csv(): @mock.patch("phdi.tabulation.tables.pa.Table") def test_write_data_parquet(patched_pa_table, patched_writer): schema = yaml.safe_load( - open(pathlib.Path(__file__).parent.parent / "assets" / "tabulation_schema.yaml") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "tabulation_schema.yaml" + ) ) extracted_data = json.load( open( pathlib.Path(__file__).parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -174,12 +210,18 @@ def test_write_data_parquet(patched_pa_table, patched_writer): def test_write_data_parquet_with_schema(): schema = yaml.safe_load( - open(pathlib.Path(__file__).parent.parent / "assets" / "tabulation_schema.yaml") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "tabulation_schema.yaml" + ) ) extracted_data = json.load( open( pathlib.Path(__file__).parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -297,12 +339,18 @@ def test_write_data_parquet_with_schema(): def test_write_data_parquet_with_no_schema(): schema = yaml.safe_load( - open(pathlib.Path(__file__).parent.parent / "assets" / "tabulation_schema.yaml") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "tabulation_schema.yaml" + ) ) extracted_data = json.load( open( pathlib.Path(__file__).parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -412,12 +460,18 @@ def test_write_data_parquet_with_no_schema(): def test_write_data_sql(): schema = yaml.safe_load( - open(pathlib.Path(__file__).parent.parent / "assets" / "tabulation_schema.yaml") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "tabulation_schema.yaml" + ) ) extracted_data = json.load( open( pathlib.Path(__file__).parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -480,7 +534,12 @@ def test_write_data_sql(): def test_validate_schema(): valid_schema = yaml.safe_load( - open(pathlib.Path(__file__).parent.parent / "assets" / "valid_schema.yaml") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "valid_schema.yaml" + ) ) first_name = valid_schema["tables"]["table 1A"]["columns"]["First Name"] patient_id = valid_schema["tables"]["table 1A"]["columns"]["Patient ID"] @@ -549,12 +608,18 @@ def test_convert_list_to_string(): def test_create_pa_schema_from_table_schema(): schema = yaml.safe_load( - open(pathlib.Path(__file__).parent.parent / "assets" / "tabulation_schema.yaml") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "tabulation_schema.yaml" + ) ) extracted_data = json.load( open( pathlib.Path(__file__).parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) @@ -583,12 +648,18 @@ def test_create_from_arrays_data(): def test_create_parquet_data(): schema = yaml.safe_load( - open(pathlib.Path(__file__).parent.parent / "assets" / "tabulation_schema.yaml") + open( + pathlib.Path(__file__).parent.parent + / "assets" + / "tabulation" + / "tabulation_schema.yaml" + ) ) extracted_data = json.load( open( pathlib.Path(__file__).parent.parent / "assets" + / "general" / "FHIR_server_extracted_data.json" ) ) diff --git a/tests/validation/test_validation.py b/tests/validation/test_validation.py index 4fe9cc8767..c1fc9ac9ec 100644 --- a/tests/validation/test_validation.py +++ b/tests/validation/test_validation.py @@ -8,23 +8,33 @@ # Test file with known errors sample_file_bad = open( - pathlib.Path(__file__).parent.parent / "assets" / "ecr_sample_input_bad.xml" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "ecr_sample_input_bad.xml" ).read() # Test good file sample_file_good = open( - pathlib.Path(__file__).parent.parent / "assets" / "ecr_sample_input_good.xml" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "ecr_sample_input_good.xml" ).read() # Test file with error sample_file_error = open( - pathlib.Path(__file__).parent.parent / "assets" / "ecr_sample_input_error.xml" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "ecr_sample_input_error.xml" ).read() # Test good file with RR data sample_file_good_RR = open( pathlib.Path(__file__).parent.parent / "assets" + / "validation" / "ecr_sample_input_good_with_RR.xml" ).read() @@ -32,6 +42,7 @@ with open( pathlib.Path(__file__).parent.parent / "assets" + / "validation" / "sample_ecr_config_custom_messages.yaml", "r", ) as file2: @@ -39,13 +50,20 @@ # standard config file with open( - pathlib.Path(__file__).parent.parent / "assets" / "sample_ecr_config.yaml", "r" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "sample_ecr_config.yaml", + "r", ) as file: config = yaml.safe_load(file) # standard config file with correct RR Data with open( - pathlib.Path(__file__).parent.parent / "assets" / "sample_ecr_config_with_rr.yaml", + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "sample_ecr_config_with_rr.yaml", "r", ) as file: config_rr = yaml.safe_load(file) diff --git a/tests/validation/test_validation_helpers.py b/tests/validation/test_validation_helpers.py index 3a8d5eb51b..855bc651b7 100644 --- a/tests/validation/test_validation_helpers.py +++ b/tests/validation/test_validation_helpers.py @@ -13,24 +13,34 @@ # Test file with known errors sample_file_bad = open( - pathlib.Path(__file__).parent.parent / "assets" / "ecr_sample_input_bad.xml" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "ecr_sample_input_bad.xml" ).read() # Test good file sample_file_good = open( - pathlib.Path(__file__).parent.parent / "assets" / "ecr_sample_input_good.xml" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "ecr_sample_input_good.xml" ).read() # Test good file with RR data sample_file_good_RR = open( pathlib.Path(__file__).parent.parent / "assets" + / "validation" / "ecr_sample_input_good_with_RR.xml" ).read() config = open( - pathlib.Path(__file__).parent.parent / "assets" / "sample_ecr_config.yaml" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "sample_ecr_config.yaml" ).read() diff --git a/tests/validation/test_xml_utils.py b/tests/validation/test_xml_utils.py index 2aac5851a8..ae59c3fedc 100644 --- a/tests/validation/test_xml_utils.py +++ b/tests/validation/test_xml_utils.py @@ -24,24 +24,34 @@ # Test file with known errors sample_file_bad = open( - pathlib.Path(__file__).parent.parent / "assets" / "ecr_sample_input_bad.xml" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "ecr_sample_input_bad.xml" ).read() # Test good file sample_file_good = open( - pathlib.Path(__file__).parent.parent / "assets" / "ecr_sample_input_good.xml" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "ecr_sample_input_good.xml" ).read() # Test good file with RR data sample_file_good_RR = open( pathlib.Path(__file__).parent.parent / "assets" + / "validation" / "ecr_sample_input_good_with_RR.xml" ).read() config = open( - pathlib.Path(__file__).parent.parent / "assets" / "sample_ecr_config.yaml" + pathlib.Path(__file__).parent.parent + / "assets" + / "validation" + / "sample_ecr_config.yaml" ).read()