Skip to content

Commit

Permalink
rename message parser configs (#3017)
Browse files Browse the repository at this point in the history
* update create-seed-data to use different configs depending on metadata

* rename schemas

* rename config to non-integrated-core
  • Loading branch information
BobanL authored Dec 10, 2024
1 parent 1fa26df commit a2ef121
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 17 deletions.
30 changes: 18 additions & 12 deletions containers/ecr-viewer/seed-scripts/create-seed-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(),
}
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"endpoint": "/parse_message",
"params": {
"message_format": "fhir",
"parsing_schema_name": "ecr_viewer_metadata.json"
"parsing_schema_name": "core.json"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit a2ef121

Please sign in to comment.