Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename message parser configs #3017

Merged
merged 3 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading