diff --git a/containers/ecr-viewer/seed-scripts/create-seed-data.py b/containers/ecr-viewer/seed-scripts/create-seed-data.py index b391edffdd..51047f8542 100644 --- a/containers/ecr-viewer/seed-scripts/create-seed-data.py +++ b/containers/ecr-viewer/seed-scripts/create-seed-data.py @@ -35,6 +35,11 @@ def _process_files(args): # Holds all of the rquests we are going to make requests = [] folder_paths = [] + configName = "integrated.json" + if os.getenv("METADATA_DATABASE_SCHEMA") == "extended": + configName = "non-integrated-extended.json" + elif os.getenv("METADATA_DATABASE_SCHEMA") == "core": + configName = "non-integrated-core.json" def _process_eicrs(subfolder, folder, folder_path, payload): r = grequests.post(f"{URL}/process-message", json=payload) @@ -82,7 +87,7 @@ def _process_eicrs(subfolder, folder, folder_path, payload): payload = { "message_type": "ecr", "data_type": "ecr", - "config_file_name": "save-eicr-to-ecr-viewer-config.json", + "config_file_name": configName, "message": eicr_file.read(), "rr_data": rr_file.read(), } @@ -110,17 +115,18 @@ def _process_eicrs(subfolder, folder, folder_path, payload): print(f"Failed to convert {folder_path}.\nResponse:\n{responses_json}") continue - for response in responses_json["processed_values"]["responses"]: - if "stamped_ecr" in response: - with open( - os.path.join(folder_path, "bundle.json"), - "w", - ) as fhir_file: - json.dump( - response["stamped_ecr"]["extended_bundle"], - fhir_file, - indent=4, - ) + if "responses" in responses_json.get("processed_values", {}): + for response in responses_json["processed_values"]["responses"]: + if "stamped_ecr" in response: + with open( + os.path.join(folder_path, "bundle.json"), + "w", + ) as fhir_file: + json.dump( + response["stamped_ecr"]["extended_bundle"], + fhir_file, + indent=4, + ) print(f"Converted {folder_path} successfully.") print( diff --git a/containers/ecr-viewer/seed-scripts/docker-compose-create-sql.yml b/containers/ecr-viewer/seed-scripts/docker-compose-create-sql.yml index 042fdac7e2..c394995e9f 100644 --- a/containers/ecr-viewer/seed-scripts/docker-compose-create-sql.yml +++ b/containers/ecr-viewer/seed-scripts/docker-compose-create-sql.yml @@ -63,6 +63,8 @@ services: condition: service_healthy ports: - "8081:8081" + environment: + - METADATA_DATABASE_TYPE=${METADATA_DATABASE_TYPE} env_file: - ../../ecr-viewer/.env.local volumes: diff --git a/containers/message-parser/app/default_schemas/ecr_viewer_metadata.json b/containers/message-parser/app/default_schemas/core.json similarity index 100% rename from containers/message-parser/app/default_schemas/ecr_viewer_metadata.json rename to containers/message-parser/app/default_schemas/core.json diff --git a/containers/message-parser/app/default_schemas/philly_ecr.json b/containers/message-parser/app/default_schemas/extended.json similarity index 100% rename from containers/message-parser/app/default_schemas/philly_ecr.json rename to containers/message-parser/app/default_schemas/extended.json diff --git a/containers/orchestration/app/custom_configs/create-seed-sql.json b/containers/orchestration/app/custom_configs/create-seed-sql.json index 326d75c9b6..0a1ffe903e 100644 --- a/containers/orchestration/app/custom_configs/create-seed-sql.json +++ b/containers/orchestration/app/custom_configs/create-seed-sql.json @@ -31,7 +31,7 @@ "endpoint": "/parse_message", "params": { "message_format": "fhir", - "parsing_schema_name": "ecr_viewer_metadata.json", + "parsing_schema_name": "core.json", "credential_manager": "azure" } } diff --git a/containers/orchestration/app/custom_configs/save-eicr-to-ecr-viewer-config.json b/containers/orchestration/app/custom_configs/non-integrated-core.json similarity index 95% rename from containers/orchestration/app/custom_configs/save-eicr-to-ecr-viewer-config.json rename to containers/orchestration/app/custom_configs/non-integrated-core.json index bc97b22b08..1699a11432 100644 --- a/containers/orchestration/app/custom_configs/save-eicr-to-ecr-viewer-config.json +++ b/containers/orchestration/app/custom_configs/non-integrated-core.json @@ -31,7 +31,7 @@ "endpoint": "/parse_message", "params": { "message_format": "fhir", - "parsing_schema_name": "ecr_viewer_metadata.json", + "parsing_schema_name": "core.json", "credential_manager": "azure" } }, diff --git a/containers/orchestration/app/custom_configs/philadelphia-ecr-viewer.json b/containers/orchestration/app/custom_configs/non-integrated-extended.json similarity index 96% rename from containers/orchestration/app/custom_configs/philadelphia-ecr-viewer.json rename to containers/orchestration/app/custom_configs/non-integrated-extended.json index 22a570eac9..40d94d8892 100644 --- a/containers/orchestration/app/custom_configs/philadelphia-ecr-viewer.json +++ b/containers/orchestration/app/custom_configs/non-integrated-extended.json @@ -31,7 +31,7 @@ "endpoint": "/parse_message", "params": { "message_format": "fhir", - "parsing_schema_name": "philly_ecr.json", + "parsing_schema_name": "extended.json", "credential_manager": "azure" } }, diff --git a/containers/orchestration/app/custom_configs/save-bundle-to-ecr-viewer.json b/containers/orchestration/app/custom_configs/save-bundle-to-ecr-viewer.json index 0734c3cd1e..757233dc0f 100644 --- a/containers/orchestration/app/custom_configs/save-bundle-to-ecr-viewer.json +++ b/containers/orchestration/app/custom_configs/save-bundle-to-ecr-viewer.json @@ -6,7 +6,7 @@ "endpoint": "/parse_message", "params": { "message_format": "fhir", - "parsing_schema_name": "ecr_viewer_metadata.json" + "parsing_schema_name": "core.json" } }, { diff --git a/containers/orchestration/tests/integration/test_orchestration.py b/containers/orchestration/tests/integration/test_orchestration.py index b80e991b7f..735e88565e 100644 --- a/containers/orchestration/tests/integration/test_orchestration.py +++ b/containers/orchestration/tests/integration/test_orchestration.py @@ -189,7 +189,7 @@ def test_previous_response_mapping_for_ecr_viewer(setup, clean_up_db): form_data = { "message_type": "ecr", "data_type": "zip", - "config_file_name": "save-eicr-to-ecr-viewer-config.json", + "config_file_name": "non-integrated-core.json", } files = {"upload_file": ("file.zip", file)} orchestration_response = httpx.post(