Skip to content

Commit

Permalink
Merge pull request #325 from seattleflu/seidelma/feature/surgery_enc_…
Browse files Browse the repository at this point in the history
…class

Add new encounter class mapping
  • Loading branch information
seidelma authored Jun 14, 2022
2 parents b49e966 + 102f300 commit f383d81
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,15 @@ def create_encounter_class(redcap_record: dict) -> dict:
"obv" : "IMP",
"observation" : "IMP",
"field" : "FLD",
"surgery overnight stay" : "IMP",
}

standardized_encounter_class = standardize_whitespace(encounter_class.lower())

if standardized_encounter_class and standardized_encounter_class not in mapper:
raise Exception(f"Unknown encounter class «{encounter_class}».")
raise Exception(f"Unknown encounter class «{encounter_class}» found in "
f"REDCAP_URL: {REDCAP_URL} PROJECT_ID: {PROJECT_ID} barcode: "
f"{redcap_record.get('barcode', 'UNKNOWN')}.")

# Default to 'AMB' if encounter_class not defined
return create_coding(
Expand Down Expand Up @@ -480,7 +483,9 @@ def create_encounter_status(redcap_record: dict) -> str:
if standardized_status in mapper.values():
return standardized_status
elif standardized_status not in mapper:
raise Exception(f"Unknown encounter status «{standardized_status}».")
raise Exception(f"Unknown encounter status «{standardized_status}» found in "
f"REDCAP_URL: {REDCAP_URL} PROJECT_ID: {PROJECT_ID} barcode: "
f"{redcap_record.get('barcode', 'UNKNOWN')}.")

return mapper[standardized_status]

Expand Down

0 comments on commit f383d81

Please sign in to comment.