CDCgov / phdi

https://cdcgov.github.io/dibbs-site/
Creative Commons Zero v1.0 Universal
32 stars 14 forks source link

Extract RR fields and insert into eICR records #186

Closed emmastephenson closed 1 year ago

emmastephenson commented 1 year ago

Why are we doing this?

Several fields that are required for LAC to properly process eCRs are actually kept in Reportability Response (RR) messages. These fields need to be extracted from the RR message and bundled with the rest of the eCR data.

Action Requested

  1. Extract the required fields from the RR message.
  2. Insert those fields into the eICR
  3. Incorporate that eICR into the read_source data function

Acceptance Criteria

Given both an RR message and an eCR message, required fields are extracted from the RR and added to the eICR.

Additional Context

We were given a JavaScript file that extracts some of this data out of the RR, so we initially thought a first step would be converting that function to Python. Further research revealed that we needed to pinpoint the following data from a RR to insert into an eICR:

Search by (in RR) and grab all lines within:
<entry typeCode="DRIV">
                        <organizer classCode="CLUSTER" moodCode="EVN">

You will want to include the following elements/lines from the RR at the root level:
- templateId
- id with root
- code
- title
- effectiveTime
- confidentialityCode

This data can then be inserted in a new root-level <section> in the eICR.

Also note there may be a case where in the eICR the ROOT <ClinicalDocument... doesn't contain an xmlns:xsi= definition within it. If it doesn't, then add this to the <ClinicalDocument element: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" example: <ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Before doing so, however, we should validate that adding this tag should be part of the RR -> eICR translation operation, not part of validation.

emmastephenson commented 1 year ago

@georgehager I took a stab at ticket-izing your recent work on RRs, but please feel free to edit or add additional context as needed!

georgehager commented 1 year ago

zipped anonymized RR and eICR data for testing

emmastephenson commented 1 year ago

Algorithm for this is completed; tested locally and with blobstore data. Need to deploy branch and test it in Azure, then will send the PR for review.