Skip to content

Commit

Permalink
Workflow to send HL7 messages to RS staging (#1274)
Browse files Browse the repository at this point in the history
* Added inital workflow to send hl7 files to staging

* Added option for manual testing

* Added trigger to test

* Fixed installation

* Fixed path

* Fixed hurl command call and added test sample files

* Testing workflow

* Testing workflow

* Added env variable

* Seems like the jwt cli has a limitation that requires the private key to be read from a file

* Added required pem extension

* Fixed path to hurl script

* Changed sender name for testing

* Testing getting token from RS

* Fixed variable name

* Added request to waters api

* Cleaned up and reverted to correct sender name

* Remved temp files and updated file path

* Clean up

* Removed pr trigger

* Changed to use Azure storage blob instead of repository to store files

* Added back pr trigger for testing purposes

* Added required permissions

* Changed source for az command and formatted

* Changed back to use repository-stored files instead of Azure container

* Renamed workflow

* Testing uploading to azure storage container

* Testing uploading to azure storage container (cont.)

* Testing uploading to azure storage container (cont.)

* Reverted steps used for testing

* Removed pull_request trigger used for testing

* Added test order based on AL sample file

* Added pull_request trigger for testing

* Small change to trigger gh action

* Changed public/private keypair for RS sender

* Removed pull_request trigger used for testing

* Changed schedule to run from Tuesday to Saturday, after changes in the repositories are expected to happen

* Added ORU sample file
  • Loading branch information
basiliskus authored Sep 6, 2024
1 parent bd014c9 commit 01e27b0
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/automated-staging-test-submit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Automated Staging Test - Submit Messages

on:
schedule:
- cron: "0 0 * * 2-6" # Tuesday to Saturday at Midnight UTC
workflow_dispatch:

jobs:
send_files:
runs-on: ubuntu-latest

steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Install jq
run: sudo apt-get install -y jq

- name: Install jwt-cli
run: |
curl --silent --location https://github.com/mike-engel/jwt-cli/releases/latest/download/jwt-linux.tar.gz | tar xvz -C /usr/local/bin/
sudo chmod +x /usr/local/bin/jwt
- name: Write private key to file
run: |
echo "${{ secrets.AUTOMATED_STAGING_RS_INTEGRATION_PRIVATE_KEY }}" > /tmp/staging_private_key.pem
chmod 600 /tmp/staging_private_key.pem
- name: Send HL7 sample messages to staging RS
run: |
host=https://staging.prime.cdc.gov:443
client_id=flexion
client_sender=automated-staging-test-sender
jwt=$(jwt encode --exp='+5min' --jti $(uuidgen) --alg RS256 \
-k $client_id.$client_sender -i $client_id.$client_sender \
-s $client_id.$client_sender -a $host --no-iat -S @/tmp/staging_private_key.pem)
token=$(curl \
--header "Content-Type: application/x-www-form-urlencoded" \
--data "scope=$client_id.*.report" \
--data "client_assertion=$jwt" \
--data "client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer" \
--data "grant_type=client_credentials" \
--silent \
"$host/api/token" | jq -r ".access_token")
for file in $(pwd)/examples/Test/Automated/*.hl7; do
echo "Sending $file"
curl \
--header "Content-Type: application/hl7-v2" \
--header "Client: $client_id.$client_sender" \
--header "Authorization: Bearer $token" \
--data-binary "@$file" \
--silent \
"$host/api/waters"
done
- name: Clean up private key
if: always()
run: |
rm -f /tmp/staging_private_key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
MSH|^~\&|Sender Application^sender.test.com^DNS|Sender Facility^0.0.0.0.0.0.0.0^ISO|Receiver Application^0.0.0.0.0.0.0.0^ISO|Receiver Facility^automated-staging-test-receiver-id^DNS|20230101010000-0000||ORM^O01^ORM_O01|111111|T|2.5.1||||||||||
PID|1||1300974^^^Baptist East^MR||ONE^TESTCASE||202402210152-0500|F^Female^HL70001||2106-3^White^HL70005|1234 GPCS WAY^^MONTGOMERY^Alabama^36117^USA^home^^Montgomery|||||||2227600015||||N^Not Hispanic or Latino^HL70189|||1|||||
NK1|1|ONE^MOMFIRST|MTH^Mother^HL70063||^^^^^804^5693861||||||||||||||||||||||||||||123456789^^^Medicaid&2.16.840.1.113883.4.446&ISO^MD||||000-00-0000^^^ssn&2.16.840.1.113883.4.1&ISO^SS
ORC|NW|4560411583^ORDERID||||||||||12345^^^^^^^^NPI&2.16.840.1.113883.4.6&ISO^L|||||||||
OBR|1|4560411583^ORDERID||54089-8^Newborn screening panel AHIC^LN|||202402221854-0500|||||||||12345^^^^^^^^NPI&2.16.840.1.113883.4.6&ISO^L||||||||
OBX|1|ST|57723-9^Unique bar code number of Current sample^LN||123456||||||F|||202402221854-0500
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MSH|^~\&|Sender Application^sender.test.com^DNS|Sender Facility^0.0.0.0.0.0.0.0^ISO|Receiver Application^0.0.0.0.0.0.0.0^ISO|Receiver Facility^automated-staging-test-receiver-id^DNS|20230101010000-0000||ORU^R01^ORU_R01|111111|T|2.5.1||||||||||
PID|1||1300974^^^Baptist East^MR||ONE^TESTCASE||20230504131000|F^Female^HL70001||2106-3^White^HL70005|1234 GPCS WAY^^MONTGOMERY^Alabama^36117^USA^home^^Montgomery|||||||2227600015||||N^Not Hispanic or Latino^HL70189|||1|||||N|
NK1|1|ONE^MOMFIRST|MTH^Mother^HL70063^^^^^^Mother||^^^^^804^5693861||||||||||||||||||||||||||||123456789^^^Medicaid&2.16.840.1.113883.4.446&ISO^MD||||000-00-0000^^^ssn&2.16.840.1.113883.4.1&ISO^SS|||||||
ORC|RE|4560411583^ORDERID|20231561137^ALPHL|||||||||1174911127^SMITH^SAMANTHA^^^^^^NPI^L^^^NPI|||||||||BAPTIST EAST^L^^^^CMS^NPI^^^1043269798~BAPTIST EAST^L^^^^AL Public Health Lab^Submitter ID^^^739||||||||||54089-8^Newborn screening panel American Health Information Community (AHIC)^LN|
OBR|1|4560411583^ORDERID|20231561137^ALPHL|57128-1^Newborn Screening Report summary panel^LN|||20230603045000||||O|||||1174911127^SMITH^SAMANTHA^^^^^^NPI^L^^^NPI||||||20230606191613|||F||||423787478&EPIC&1.2.840.114350.1.13.145.2.7.2.695071&ISO^20231561137&AL Public Health Lab&2.16.840.1.114222.4.1.10080&ISO|||||||||||||||||||||54089-8^Newborn screening panel American Health Information Community (AHIC)^LN|
OBX|1|CWE|57718-9^Sample quality of Dried blood spot^LN|^1^1|LA12432-3^Acceptable^LN||||||F|||20230603045000|||||20230606191613||||AL PHL Newborn Screening Laboratory^^^^^|204 Legends Court^^Prattville^AL^36066|^Miller^Marie^^^^^^||||RSLT|UNSP|
SPM|1|423787478&EPIC&1.2.840.114350.1.13.145.2.7.2.695071&ISO^20231561137&AL Public Health Lab&2.16.840.1.114222.4.1.10080&ISO||440500007^Blood spot specimen^SCT|||||||||||||20230603045000^20230603045000|20230605102300|

0 comments on commit 01e27b0

Please sign in to comment.