From 9c64c15ffeb24165b4a25c858f0a770d410d3b1d Mon Sep 17 00:00:00 2001 From: halprin Date: Mon, 16 Dec 2024 16:36:11 -0700 Subject: [PATCH 01/36] Locust load test works in Azure --- operations/locustfile.py | 2743 +++++++++++++++++++++++++++++++++++++- 1 file changed, 2735 insertions(+), 8 deletions(-) diff --git a/operations/locustfile.py b/operations/locustfile.py index 03a87ec2a..ca9692f22 100644 --- a/operations/locustfile.py +++ b/operations/locustfile.py @@ -4,6 +4,7 @@ import urllib.parse import urllib.request import uuid +import os from locust import FastHttpUser, between, events, task from locust.runners import MasterRunner @@ -131,22 +132,2748 @@ def assert_stats(environment): def get_auth_request_body(): # set up the sample request body for the auth endpoint # using a valid test token found in the mock_credentials directory - auth_scope = "report-stream" - with open("mock_credentials/report-stream-valid-token.jwt") as f: - auth_token = f.read() + + jwt = "trusted-intermediary-valid-token.jwt" + + auth_token = os.getenv(jwt.replace('.', '-')) + + if auth_token is None: + with open(f"mock_credentials/{jwt}") as f: + auth_token = f.read() + params = urllib.parse.urlencode( - {"scope": auth_scope, "client_assertion": auth_token.strip()} + {"scope": "trusted-intermediary", "client_assertion": auth_token.strip()} ) + return params.encode("utf-8") def get_order_fhir_message(): # read the sample request body for the orders endpoint - with open("examples/Test/e2e/orders/002_ORM_O01_short.fhir", "r") as f: - return f.read() + return """{ + "resourceType": "Bundle", + "id": "1713991685806650392.f865cc8e-d438-4d5f-9147-05930f25a997", + "meta": { + "lastUpdated": "2024-04-24T20:48:05.813+00:00" + }, + "identifier": { + "system": "https://reportstream.cdc.gov/prime-router", + "value": "31808297" + }, + "type": "message", + "timestamp": "2023-05-06T10:29:16.000+00:00", + "entry": [ + { + "fullUrl": "MessageHeader/87c2d0db-6f31-3666-b9e2-7152e039c11f", + "resource": { + "resourceType": "MessageHeader", + "id": "87c2d0db-6f31-3666-b9e2-7152e039c11f", + "meta": { + "tag": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0103", + "code": "P" + } + ] + }, + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/msh-message-header", + "extension": [ + { + "url": "MSH.7", + "valueString": "20230506052916-0500" + }, + { + "url": "MSH.15", + "valueString": "AL" + }, + { + "url": "MSH.16", + "valueString": "AL" + }, + { + "url": "MSH.21", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.113883.9.82" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "value": "LAB_PRU_COMPONENT" + } + }, + { + "url": "MSH.21", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.113883.9.22" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "value": "LAB_TO_COMPONENT" + } + } + ] + } + ], + "eventCoding": { + "system": "http://terminology.hl7.org/CodeSystem/v2-0003", + "code": "O01", + "display": "ORM^O01^ORM_O01" + }, + "destination": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "natus.health.state.mn.us" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueString": "DNS" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "MSH.5" + } + ], + "name": "NATUS", + "receiver": { + "reference": "Organization/1713991685926824266.a1dc31ff-2719-470f-9a9d-2bfd3d6353e3" + } + } + ], + "sender": { + "reference": "Organization/1713991685881552998.10ccacc7-1879-4a11-b1cc-c1f87830d494" + }, + "source": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "Epic" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueString": "ISO" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "MSH.3" + } + ], + "endpoint": "urn:oid:1.2.840.114350.1.13.145.2.7.2.695071" + } + } + }, + { + "fullUrl": "Organization/1713991685881552998.10ccacc7-1879-4a11-b1cc-c1f87830d494", + "resource": { + "resourceType": "Organization", + "id": "1713991685881552998.10ccacc7-1879-4a11-b1cc-c1f87830d494", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "Centracare" + }, + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.2,HD.3" + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0301", + "code": "DNS" + } + ] + }, + "value": "centracare.com" + } + ] + } + }, + { + "fullUrl": "Organization/1713991685926824266.a1dc31ff-2719-470f-9a9d-2bfd3d6353e3", + "resource": { + "resourceType": "Organization", + "id": "1713991685926824266.a1dc31ff-2719-470f-9a9d-2bfd3d6353e3", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "MSH.6" + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "MN Public Health Lab" + }, + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.2,HD.3" + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0301", + "code": "ISO" + } + ] + }, + "system": "urn:ietf:rfc:3986", + "value": "2.16.840.1.114222.4.1.10080" + } + ] + } + }, + { + "fullUrl": "Patient/1713991686420540992.4160b099-3871-449c-9e90-dadeb21100e7", + "resource": { + "resourceType": "Patient", + "id": "1713991686420540992.4160b099-3871-449c-9e90-dadeb21100e7", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/pid-patient", + "extension": [ + { + "url": "PID.8" + }, + { + "url": "PID.24", + "valueString": "N" + }, + { + "url": "PID.30", + "valueString": "N" + } + ] + }, + { + "url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName", + "valueHumanName": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xpn-human-name", + "extension": [ + { + "url": "XPN.2", + "valueString": "SADIE" + }, + { + "url": "XPN.3", + "valueString": "S" + } + ] + } + ], + "family": "SMITH", + "given": [ + "SADIE", + "S" + ] + } + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cx-identifier", + "extension": [ + { + "url": "CX.5", + "valueString": "MR" + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "PID.3" + } + ], + "type": { + "coding": [ + { + "code": "MR" + } + ] + }, + "value": "11102779", + "assigner": { + "reference": "Organization/1713991686376793169.d63d39d1-bd81-4180-a007-1a963547ff8d" + } + } + ], + "name": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xpn-human-name", + "extension": [ + { + "url": "XPN.2", + "valueString": "BB SARAH" + }, + { + "url": "XPN.7", + "valueString": "L" + } + ] + } + ], + "use": "official", + "text": "TestValue", + "family": "SMITH", + "given": [ + "BB SARAH" + ] + } + ], + "telecom": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/contactpoint-area", + "valueString": "763" + }, + { + "url": "http://hl7.org/fhir/StructureDefinition/contactpoint-local", + "valueString": "5555555" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xtn-contact-point", + "extension": [ + { + "url": "XTN.3", + "valueString": "PH" + }, + { + "url": "XTN.7", + "valueString": "5555555" + }, + { + "url": "XTN.9", + "valueString": "(763)555-5555" + } + ] + } + ], + "system": "phone", + "use": "home" + } + ], + "gender": "male", + "birthDate": "2023-05-04", + "_birthDate": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", + "valueString": "20230504131023-0500" + }, + { + "url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime", + "valueDateTime": "2023-05-04T13:10:23-05:00" + } + ] + }, + "deceasedBoolean": false, + "address": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xad-address", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/sad-address-line", + "extension": [ + { + "url": "SAD.1", + "valueString": "555 STATE HIGHWAY 13" + } + ] + }, + { + "url": "XAD.7", + "valueCode": "H" + } + ] + } + ], + "use": "home", + "line": [ + "555 STATE HIGHWAY 13" + ], + "city": "DEER CREEK", + "district": "OTTER TAIL", + "state": "MN", + "postalCode": "56527-9657", + "country": "USA" + } + ], + "multipleBirthInteger": 1 + } + }, + { + "fullUrl": "Organization/1713991686376793169.d63d39d1-bd81-4180-a007-1a963547ff8d", + "resource": { + "resourceType": "Organization", + "id": "1713991686376793169.d63d39d1-bd81-4180-a007-1a963547ff8d", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "CRPMRN" + } + ] + } + }, + { + "fullUrl": "ServiceRequest/1713991686444544794.4cd34f9e-a7da-489c-8c3a-bd8c3edfaf67", + "resource": { + "resourceType": "ServiceRequest", + "id": "1713991686444544794.4cd34f9e-a7da-489c-8c3a-bd8c3edfaf67", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/business-event", + "valueCode": "NW" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/business-event", + "valueString": "20230506052913-0500" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/orc-common-order", + "extension": [ + { + "url": "orc-21-ordering-facility-name", + "valueReference": { + "reference": "Organization/1713991686439304395.dadd5b53-5f0e-4ca5-8e58-d6109d26f5ee" + } + }, + { + "url": "orc-21-ordering-facility-name", + "valueReference": { + "reference": "Organization/1713991686440767640.8871e10e-767a-46a3-81d3-150c106697f7" + } + }, + { + "url": "orc-12-ordering-provider", + "valueReference": { + "reference": "Practitioner/1713991686442730297.157adf6e-ef27-4065-a895-18dfd561d19e" + } + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/obr-observation-request", + "extension": [ + { + "url": "OBR.2", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "EPIC" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "value": "421832901" + } + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "ORC.2" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "EPIC" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "PLAC" + } + ] + }, + "value": "{{placer_order_id}}" + } + ], + "status": "unknown", + "subject": { + "reference": "Patient/1713991686420540992.4160b099-3871-449c-9e90-dadeb21100e7" + }, + "authoredOn": "2023-05-06T05:29:13-05:00", + "_authoredOn": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", + "valueString": "20230506052913-0500" + } + ] + }, + "requester": { + "reference": "PractitionerRole/1713991686430248172.048e0c37-4095-440f-994b-5cd80bf34c69" + } + } + }, + { + "fullUrl": "Organization/1713991686430978000.29e1ded0-6428-44af-8e58-0eeb2bea06af", + "resource": { + "resourceType": "Organization", + "id": "1713991686430978000.29e1ded0-6428-44af-8e58-0eeb2bea06af", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "NPI" + } + ] + } + }, + { + "fullUrl": "Practitioner/1713991686433173618.77eeecb0-0bad-4feb-8c05-d06d06735c90", + "resource": { + "resourceType": "Practitioner", + "id": "1713991686433173618.77eeecb0-0bad-4feb-8c05-d06d06735c90", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "NPI" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", + "extension": [ + { + "url": "XCN.3", + "valueString": "JANE" + }, + { + "url": "XCN.10", + "valueString": "L" + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "ORC.12" + } + ], + "identifier": [ + { + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", + "valueBoolean": true + } + ], + "code": "NPI" + } + ] + }, + "value": "1265136360", + "assigner": { + "reference": "Organization/1713991686430978000.29e1ded0-6428-44af-8e58-0eeb2bea06af" + } + } + ], + "name": [ + { + "use": "official", + "family": "JONES", + "given": [ + "JANE" + ] + } + ] + } + }, + { + "fullUrl": "Organization/1713991686435100196.d7b35c8a-94d2-492f-9010-728a69b55a92", + "resource": { + "resourceType": "Organization", + "id": "1713991686435100196.d7b35c8a-94d2-492f-9010-728a69b55a92", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", + "valueCoding": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueCodeableConcept": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "XON.2" + } + ] + } + } + ] + } + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", + "extension": [ + { + "url": "XON.10", + "valueString": "1043269798" + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "CMS" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + } + ], + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", + "valueString": "identifier" + } + ], + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "NPI" + } + ] + }, + "value": "1043269798" + } + ], + "name": "ST. CLOUD HOSPITAL" + } + }, + { + "fullUrl": "PractitionerRole/1713991686430248172.048e0c37-4095-440f-994b-5cd80bf34c69", + "resource": { + "resourceType": "PractitionerRole", + "id": "1713991686430248172.048e0c37-4095-440f-994b-5cd80bf34c69", + "practitioner": { + "reference": "Practitioner/1713991686433173618.77eeecb0-0bad-4feb-8c05-d06d06735c90" + }, + "organization": { + "reference": "Organization/1713991686435100196.d7b35c8a-94d2-492f-9010-728a69b55a92" + } + } + }, + { + "fullUrl": "Organization/1713991686439304395.dadd5b53-5f0e-4ca5-8e58-d6109d26f5ee", + "resource": { + "resourceType": "Organization", + "id": "1713991686439304395.dadd5b53-5f0e-4ca5-8e58-d6109d26f5ee", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", + "valueCoding": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueCodeableConcept": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "XON.2" + } + ] + } + } + ] + } + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", + "extension": [ + { + "url": "XON.10", + "valueString": "1043269798" + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "CMS" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + } + ], + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", + "valueString": "identifier" + } + ], + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "NPI" + } + ] + }, + "value": "1043269798" + } + ], + "name": "ST. CLOUD HOSPITAL" + } + }, + { + "fullUrl": "Organization/1713991686440767640.8871e10e-767a-46a3-81d3-150c106697f7", + "resource": { + "resourceType": "Organization", + "id": "1713991686440767640.8871e10e-767a-46a3-81d3-150c106697f7", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", + "valueCoding": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueCodeableConcept": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "XON.2" + } + ] + } + } + ] + } + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", + "extension": [ + { + "url": "XON.10", + "valueString": "739" + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "MN Public Health Lab" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + } + ], + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", + "valueString": "identifier" + } + ], + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "Submitter ID" + } + ] + }, + "value": "739" + } + ], + "name": "ST. CLOUD HOSPITAL" + } + }, + { + "fullUrl": "Organization/1713991686441504208.f7b9b8ec-da49-4154-9290-0a8df47fbc4d", + "resource": { + "resourceType": "Organization", + "id": "1713991686441504208.f7b9b8ec-da49-4154-9290-0a8df47fbc4d", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "NPI" + } + ] + } + }, + { + "fullUrl": "Practitioner/1713991686442730297.157adf6e-ef27-4065-a895-18dfd561d19e", + "resource": { + "resourceType": "Practitioner", + "id": "1713991686442730297.157adf6e-ef27-4065-a895-18dfd561d19e", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "NPI" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", + "extension": [ + { + "url": "XCN.3", + "valueString": "JANE" + }, + { + "url": "XCN.10", + "valueString": "L" + } + ] + } + ], + "identifier": [ + { + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", + "valueBoolean": true + } + ], + "code": "NPI" + } + ] + }, + "value": "1265136360", + "assigner": { + "reference": "Organization/1713991686441504208.f7b9b8ec-da49-4154-9290-0a8df47fbc4d" + } + } + ], + "name": [ + { + "use": "official", + "family": "JONES", + "given": [ + "JANE" + ] + } + ] + } + }, + { + "fullUrl": "Observation/1713991686770356478.1910e6f0-c091-4478-a7f6-ede1f3711b9f", + "resource": { + "resourceType": "Observation", + "id": "1713991686770356478.1910e6f0-c091-4478-a7f6-ede1f3711b9f", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/sub-id", + "valueString": "1" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/observation-sub-type", + "valueCode": "AOE" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/obx-observation", + "extension": [ + { + "url": "OBX.2", + "valueId": "NM" + }, + { + "url": "OBX.6" + }, + { + "url": "OBX.11", + "valueString": "O" + } + ] + } + ], + "status": "unknown", + "subject": { + "reference": "Patient/1713991686420540992.4160b099-3871-449c-9e90-dadeb21100e7" + }, + "effectiveDateTime": "2023-05-06T05:00:00-05:00", + "_effectiveDateTime": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", + "valueString": "20230506050000-0500" + } + ] + }, + "valueQuantity": { + "value": 1769.859285, + "unit": "gram", + "system": "UCUM", + "code": "g" + } + } + }, + { + "fullUrl": "Specimen/1713991686845404556.ccf23f10-1abe-4090-aa7c-c91dd0988c22", + "resource": { + "resourceType": "Specimen", + "id": "1713991686845404556.ccf23f10-1abe-4090-aa7c-c91dd0988c22", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Segment", + "valueString": "SPM" + } + ] + } + } + ] +} + """ def get_result_fhir_message(): # read the sample request body for the results endpoint - with open("examples/Test/e2e/results/001_ORU_R01_short.fhir", "r") as f: - return f.read() + return """{ + "resourceType": "Bundle", + "id": "1708643329059388284.3eb8aca3-48fa-48e6-8d24-249f96d190f4", + "meta": { + "lastUpdated": "2024-02-22T23:08:49.065+00:00" + }, + "identifier": { + "system": "https://reportstream.cdc.gov/prime-router", + "value": "20230607002849_0365" + }, + "type": "message", + "timestamp": "2023-06-07T00:28:49.000+00:00", + "entry": [ + { + "fullUrl": "MessageHeader/28e642fa-b0e7-3bc5-8084-293e36792f05", + "resource": { + "resourceType": "MessageHeader", + "id": "28e642fa-b0e7-3bc5-8084-293e36792f05", + "meta": { + "tag": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0103", + "code": "P" + } + ] + }, + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/msh-message-header", + "extension": [ + { + "url": "MSH.7", + "valueString": "20230606192849-0500" + }, + { + "url": "MSH.15", + "valueString": "AL" + }, + { + "url": "MSH.16", + "valueString": "AL" + }, + { + "url": "MSH.21", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.113883.9.195.3.4" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "value": "LRI_NG_FRN_PROFILE" + } + }, + { + "url": "MSH.21", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.113883.9.195.3.6" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "value": "LRI_NDBS_COMPONENT" + } + }, + { + "url": "MSH.21", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.113883.9.81" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "value": "LAB_PRN_Component" + } + }, + { + "url": "MSH.21", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.113883.9.22" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "value": "LAB_TO_COMPONENT" + } + } + ] + } + ], + "eventCoding": { + "system": "http://terminology.hl7.org/CodeSystem/v2-0003", + "code": "R01", + "display": "ORU^R01^ORU_R01" + }, + "destination": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueString": "ISO" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "MSH.5" + } + ], + "name": "Epic", + "endpoint": "urn:oid:1.2.840.114350.1.13.145.2.7.2.695071", + "receiver": { + "reference": "Organization/1708643329096405931.3df374db-c008-44a2-aa83-36e9b09a33ad" + } + } + ], + "sender": { + "reference": "Organization/1708643329084338823.57892b53-2a11-43db-8ec9-97f8db64a32f" + }, + "source": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "Natus" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "natus.health.state.mn.us" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueString": "DNS" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "MSH.3" + } + ], + "endpoint": "urn:dns:natus.health.state.mn.us" + } + } + }, + { + "fullUrl": "Organization/1708643329084338823.57892b53-2a11-43db-8ec9-97f8db64a32f", + "resource": { + "resourceType": "Organization", + "id": "1708643329084338823.57892b53-2a11-43db-8ec9-97f8db64a32f", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "MN Public Health Lab" + }, + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.2,HD.3" + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0301", + "code": "ISO" + } + ] + }, + "system": "urn:ietf:rfc:3986", + "value": "2.16.840.1.114222.4.1.10080" + } + ] + } + }, + { + "fullUrl": "Organization/1708643329096405931.3df374db-c008-44a2-aa83-36e9b09a33ad", + "resource": { + "resourceType": "Organization", + "id": "1708643329096405931.3df374db-c008-44a2-aa83-36e9b09a33ad", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "MSH.6" + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "Centracare" + }, + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.2,HD.3" + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0301", + "code": "DNS" + } + ] + }, + "value": "centracare.com" + } + ] + } + }, + { + "fullUrl": "Provenance/1708643329181039838.5d4b6ba7-fe37-4bde-9e17-5cb502c08d08", + "resource": { + "resourceType": "Provenance", + "id": "1708643329181039838.5d4b6ba7-fe37-4bde-9e17-5cb502c08d08", + "target": [ + { + "reference": "MessageHeader/28e642fa-b0e7-3bc5-8084-293e36792f05" + }, + { + "reference": "DiagnosticReport/1708643329631593922.78f28950-7a6e-4fcb-8980-e1842b578708" + } + ], + "recorded": "2023-06-06T19:28:49-05:00", + "activity": { + "coding": [ + { + "display": "ORU^R01^ORU_R01" + } + ] + }, + "agent": [ + { + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type", + "code": "author" + } + ] + }, + "who": { + "reference": "Organization/1708643329175239534.8db4b5dd-ea1c-42e7-bcd9-c61e1c4ca158" + } + } + ] + } + }, + { + "fullUrl": "Organization/1708643329175239534.8db4b5dd-ea1c-42e7-bcd9-c61e1c4ca158", + "resource": { + "resourceType": "Organization", + "id": "1708643329175239534.8db4b5dd-ea1c-42e7-bcd9-c61e1c4ca158", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "MN Public Health Lab" + }, + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.2,HD.3" + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0301", + "code": "ISO" + } + ] + }, + "system": "urn:ietf:rfc:3986", + "value": "2.16.840.1.114222.4.1.10080" + } + ] + } + }, + { + "fullUrl": "Provenance/1708643329194237432.5dc530b3-ed05-4738-91e1-188074ce4af9", + "resource": { + "resourceType": "Provenance", + "id": "1708643329194237432.5dc530b3-ed05-4738-91e1-188074ce4af9", + "recorded": "2024-02-22T23:08:49Z", + "policy": [ + "http://hl7.org/fhir/uv/v2mappings/message-oru-r01-to-bundle" + ], + "activity": { + "coding": [ + { + "code": "v2-FHIR transformation" + } + ] + }, + "agent": [ + { + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type", + "code": "assembler" + } + ] + }, + "who": { + "reference": "Organization/1708643329192128256.d81d233e-da75-4eb1-a636-e0818b307ee0" + } + } + ] + } + }, + { + "fullUrl": "Organization/1708643329192128256.d81d233e-da75-4eb1-a636-e0818b307ee0", + "resource": { + "resourceType": "Organization", + "id": "1708643329192128256.d81d233e-da75-4eb1-a636-e0818b307ee0", + "identifier": [ + { + "value": "CDC PRIME - Atlanta" + }, + { + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0301" + } + ] + }, + "system": "urn:ietf:rfc:3986", + "value": "2.16.840.1.114222.4.1.237821" + } + ] + } + }, + { + "fullUrl": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6", + "resource": { + "resourceType": "Patient", + "id": "1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/pid-patient", + "extension": [ + { + "url": "PID.30", + "valueString": "N" + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cx-identifier", + "extension": [ + { + "url": "CX.5", + "valueString": "MR" + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "PID.3" + } + ], + "type": { + "coding": [ + { + "code": "MR" + } + ] + }, + "value": "11102779", + "assigner": { + "reference": "Organization/1708643329205656925.de11953b-df2c-4b5c-a8f5-4882ae39faa5" + } + } + ], + "name": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xpn-human-name", + "extension": [ + { + "url": "XPN.2", + "valueString": "BB SARAH" + }, + { + "url": "XPN.6", + "valueString": "L" + } + ] + } + ], + "text": "TestValue", + "family": "SMITH", + "given": [ + "BB SARAH" + ], + "suffix": [ + "L" + ] + } + ], + "birthDate": "2023-05-04", + "_birthDate": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", + "valueString": "20230504131000" + }, + { + "url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime", + "valueDateTime": "2023-05-04T13:10:00Z" + } + ] + }, + "deceasedBoolean": false, + "address": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xad-address", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/sad-address-line", + "extension": [ + { + "url": "SAD.1", + "valueString": "555 STATE HIGHWAY 13" + } + ] + }, + { + "url": "XAD.7", + "valueCode": "H" + } + ] + } + ], + "use": "home", + "line": [ + "555 STATE HIGHWAY 13" + ], + "city": "DEER CREEK", + "state": "MN", + "postalCode": "565279657" + } + ] + } + }, + { + "fullUrl": "Organization/1708643329205656925.de11953b-df2c-4b5c-a8f5-4882ae39faa5", + "resource": { + "resourceType": "Organization", + "id": "1708643329205656925.de11953b-df2c-4b5c-a8f5-4882ae39faa5", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "CRPMRN" + } + ] + } + }, + { + "fullUrl": "Provenance/1708643329283292699.668bb1d4-3c6f-4a04-9085-b16177a586f0", + "resource": { + "resourceType": "Provenance", + "id": "1708643329283292699.668bb1d4-3c6f-4a04-9085-b16177a586f0", + "target": [ + { + "reference": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6" + } + ], + "recorded": "2024-02-22T23:08:49Z", + "activity": { + "coding": [ + { + "system": "https://terminology.hl7.org/CodeSystem/v3-DataOperation", + "code": "UPDATE" + } + ] + } + } + }, + { + "fullUrl": "Observation/1708643329337615661.69d9df30-4fa0-4d5d-9be3-eb3c441349d2", + "resource": { + "resourceType": "Observation", + "id": "1708643329337615661.69d9df30-4fa0-4d5d-9be3-eb3c441349d2", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/analysis-date-time", + "valueDateTime": "2023-06-06T19:16:13Z", + "_valueDateTime": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", + "valueString": "20230606191613" + } + ] + } + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/observation-sub-type", + "valueCode": "UNSP" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/obx-observation", + "extension": [ + { + "url": "OBX.2", + "valueId": "CWE" + }, + { + "url": "OBX.11", + "valueString": "F" + } + ] + } + ], + "status": "final", + "code": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueString": "coding" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", + "valueString": "LN" + } + ], + "system": "http://loinc.org", + "code": "57718-9", + "display": "Sample quality of Dried blood spot" + } + ] + }, + "subject": { + "reference": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6" + }, + "effectiveDateTime": "2023-06-03T04:50:00Z", + "_effectiveDateTime": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", + "valueString": "20230603045000" + } + ] + }, + "performer": [ + { + "reference": "PractitionerRole/1708643329346346926.5862ad7a-6aee-446b-888a-456b0b025016" + } + ], + "valueCodeableConcept": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueString": "coding" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", + "valueString": "LN" + } + ], + "system": "http://loinc.org", + "code": "LA12432-3", + "display": "Acceptable" + } + ] + } + } + }, + { + "fullUrl": "Practitioner/1708643329366242745.3a0e80f3-82fc-4d17-97e9-0b2035adce46", + "resource": { + "resourceType": "Practitioner", + "id": "1708643329366242745.3a0e80f3-82fc-4d17-97e9-0b2035adce46", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", + "extension": [ + { + "url": "XCN.3", + "valueString": "Marie" + } + ] + } + ], + "name": [ + { + "family": "Miller", + "given": [ + "Marie" + ] + } + ] + } + }, + { + "fullUrl": "Organization/1708643329385366275.d605419a-f07c-4149-8b70-32f577083612", + "resource": { + "resourceType": "Organization", + "id": "1708643329385366275.d605419a-f07c-4149-8b70-32f577083612", + "name": "MDH Newborn Screening Laboratory", + "address": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xad-address", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/sad-address-line", + "extension": [ + { + "url": "SAD.1", + "valueString": "601 Robert St N" + } + ] + } + ] + } + ], + "line": [ + "601 Robert St N" + ], + "city": "St. Paul", + "state": "MN", + "postalCode": "55155" + } + ] + } + }, + { + "fullUrl": "PractitionerRole/1708643329346346926.5862ad7a-6aee-446b-888a-456b0b025016", + "resource": { + "resourceType": "PractitionerRole", + "id": "1708643329346346926.5862ad7a-6aee-446b-888a-456b0b025016", + "practitioner": { + "reference": "Practitioner/1708643329366242745.3a0e80f3-82fc-4d17-97e9-0b2035adce46" + }, + "organization": { + "reference": "Organization/1708643329385366275.d605419a-f07c-4149-8b70-32f577083612" + }, + "code": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0912", + "code": "MDIR" + } + ] + } + ] + } + }, + { + "fullUrl": "Specimen/1708643329426115363.caf8de32-9ff6-4fcd-a4dd-6b41c7eec275", + "resource": { + "resourceType": "Specimen", + "id": "1708643329426115363.caf8de32-9ff6-4fcd-a4dd-6b41c7eec275", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Segment", + "valueString": "OBR" + } + ] + } + }, + { + "fullUrl": "ServiceRequest/1708643329612626874.6a767bc5-6fa2-488a-bf90-a3ecbc814fed", + "resource": { + "resourceType": "ServiceRequest", + "id": "1708643329612626874.6a767bc5-6fa2-488a-bf90-a3ecbc814fed", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/business-event", + "valueCode": "RE" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/orc-common-order", + "extension": [ + { + "url": "orc-21-ordering-facility-name", + "valueReference": { + "reference": "Organization/1708643329532919335.1c95b0f6-e401-4ae7-bf8c-9d698bd46a57" + } + }, + { + "url": "orc-21-ordering-facility-name", + "valueReference": { + "reference": "Organization/1708643329552456753.88e4eb0d-dece-4579-a8a1-a4014f4bcda5" + } + }, + { + "url": "ORC.31", + "valueCodeableConcept": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueString": "coding" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", + "valueString": "LN" + } + ], + "system": "http://loinc.org", + "code": "54089-8", + "display": "Newborn screening panel American Health Information Community (AHIC)" + } + ] + } + }, + { + "url": "orc-12-ordering-provider", + "valueReference": { + "reference": "Practitioner/1708643329577508774.3caa1170-d0a8-482d-9a11-ea9d568db749" + } + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/obr-observation-request", + "extension": [ + { + "url": "OBR.2", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "EPIC" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "value": "423787478" + } + }, + { + "url": "OBR.3", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "MN Public Health Lab" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.114222.4.1.10080" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "value": "20231561137" + } + }, + { + "url": "OBR.22", + "valueString": "20230606191613" + }, + { + "url": "OBR.29", + "valueIdentifier": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "EPIC" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueString": "ISO" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/filler-assigned-identifier", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/entity-identifier", + "valueString": "20231561137" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "MN Public Health Lab" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.114222.4.1.10080" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueString": "ISO" + } + ] + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "PGN" + } + ] + }, + "value": "423787478" + } + }, + { + "url": "OBR.50", + "valueCodeableConcept": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueString": "coding" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", + "valueString": "LN" + } + ], + "system": "http://loinc.org", + "code": "54089-8", + "display": "Newborn screening panel American Health Information Community (AHIC)" + } + ] + } + }, + { + "url": "OBR.11", + "valueString": "O" + }, + { + "url": "OBR.16", + "valueReference": { + "reference": "Practitioner/1708643329606988679.6374ee92-a08b-4cb6-97c6-2b09442476ff" + } + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "ORC.2" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "EPIC" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "PLAC" + } + ] + }, + "value": "{{placer_order_id}}" + }, + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "ORC.3" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "MN Public Health Lab" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.114222.4.1.10080" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "FILL" + } + ] + }, + "value": "20231561137" + } + ], + "status": "unknown", + "intent": "order", + "code": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueString": "coding" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", + "valueString": "LN" + } + ], + "system": "http://loinc.org", + "code": "57128-1", + "display": "Newborn Screening Report summary panel" + } + ] + }, + "subject": { + "reference": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6" + }, + "requester": { + "reference": "PractitionerRole/1708643329436006371.45eabfd2-cdfc-4920-b10f-b05e1a6acab7" + } + } + }, + { + "fullUrl": "Organization/1708643329440493082.2d0201f2-7497-4f14-a56a-8be814df6cce", + "resource": { + "resourceType": "Organization", + "id": "1708643329440493082.2d0201f2-7497-4f14-a56a-8be814df6cce", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "NPI" + } + ] + } + }, + { + "fullUrl": "Practitioner/1708643329457407861.c164c0c9-903e-486c-81bb-f3a697da095f", + "resource": { + "resourceType": "Practitioner", + "id": "1708643329457407861.c164c0c9-903e-486c-81bb-f3a697da095f", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "NPI" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", + "extension": [ + { + "url": "XCN.3", + "valueString": "SAMANTHA" + }, + { + "url": "XCN.10", + "valueString": "L" + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "ORC.12" + } + ], + "identifier": [ + { + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", + "valueBoolean": true + } + ], + "code": "NPI" + } + ] + }, + "value": "1174911127", + "assigner": { + "reference": "Organization/1708643329440493082.2d0201f2-7497-4f14-a56a-8be814df6cce" + } + } + ], + "name": [ + { + "use": "official", + "family": "SMITH", + "given": [ + "SAMANTHA" + ] + } + ] + } + }, + { + "fullUrl": "Organization/1708643329482488611.58a0bd6a-0d77-4d70-a95f-6028d43bb644", + "resource": { + "resourceType": "Organization", + "id": "1708643329482488611.58a0bd6a-0d77-4d70-a95f-6028d43bb644", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", + "valueCoding": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueCodeableConcept": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "XON.2" + } + ], + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueString": "coding" + } + ], + "code": "L" + } + ] + } + } + ], + "code": "L" + } + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", + "extension": [ + { + "url": "XON.10", + "valueString": "1043269798" + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "CMS" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + } + ], + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", + "valueString": "identifier" + } + ], + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "NPI" + } + ] + }, + "value": "1043269798" + } + ], + "name": "ST. CLOUD HOSPITAL", + "telecom": [ + { + "_system": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason", + "valueCode": "unknown" + } + ] + } + } + ] + } + }, + { + "fullUrl": "PractitionerRole/1708643329436006371.45eabfd2-cdfc-4920-b10f-b05e1a6acab7", + "resource": { + "resourceType": "PractitionerRole", + "id": "1708643329436006371.45eabfd2-cdfc-4920-b10f-b05e1a6acab7", + "practitioner": { + "reference": "Practitioner/1708643329457407861.c164c0c9-903e-486c-81bb-f3a697da095f" + }, + "organization": { + "reference": "Organization/1708643329482488611.58a0bd6a-0d77-4d70-a95f-6028d43bb644" + } + } + }, + { + "fullUrl": "Organization/1708643329532919335.1c95b0f6-e401-4ae7-bf8c-9d698bd46a57", + "resource": { + "resourceType": "Organization", + "id": "1708643329532919335.1c95b0f6-e401-4ae7-bf8c-9d698bd46a57", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", + "valueCoding": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueCodeableConcept": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "XON.2" + } + ], + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueString": "coding" + } + ], + "code": "L" + } + ] + } + } + ], + "code": "L" + } + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", + "extension": [ + { + "url": "XON.10", + "valueString": "1043269798" + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "CMS" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + } + ], + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", + "valueString": "identifier" + } + ], + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "NPI" + } + ] + }, + "value": "1043269798" + } + ], + "name": "ST. CLOUD HOSPITAL" + } + }, + { + "fullUrl": "Organization/1708643329552456753.88e4eb0d-dece-4579-a8a1-a4014f4bcda5", + "resource": { + "resourceType": "Organization", + "id": "1708643329552456753.88e4eb0d-dece-4579-a8a1-a4014f4bcda5", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", + "valueCoding": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueCodeableConcept": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "XON.2" + } + ], + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueString": "coding" + } + ], + "code": "L" + } + ] + } + } + ], + "code": "L" + } + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", + "extension": [ + { + "url": "XON.10", + "valueString": "739" + } + ] + } + ], + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "MN Public Health Lab" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + } + ], + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", + "valueString": "identifier" + } + ], + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "Submitter ID" + } + ] + }, + "value": "739" + } + ], + "name": "ST. CLOUD HOSPITAL" + } + }, + { + "fullUrl": "Organization/1708643329559325319.b84e8226-acee-487e-8e81-afb8bd63d91e", + "resource": { + "resourceType": "Organization", + "id": "1708643329559325319.b84e8226-acee-487e-8e81-afb8bd63d91e", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "NPI" + } + ] + } + }, + { + "fullUrl": "Practitioner/1708643329577508774.3caa1170-d0a8-482d-9a11-ea9d568db749", + "resource": { + "resourceType": "Practitioner", + "id": "1708643329577508774.3caa1170-d0a8-482d-9a11-ea9d568db749", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "NPI" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", + "extension": [ + { + "url": "XCN.3", + "valueString": "SAMANTHA" + }, + { + "url": "XCN.10", + "valueString": "L" + } + ] + } + ], + "identifier": [ + { + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", + "valueBoolean": true + } + ], + "code": "NPI" + } + ] + }, + "value": "1174911127", + "assigner": { + "reference": "Organization/1708643329559325319.b84e8226-acee-487e-8e81-afb8bd63d91e" + } + } + ], + "name": [ + { + "use": "official", + "family": "SMITH", + "given": [ + "SAMANTHA" + ] + } + ] + } + }, + { + "fullUrl": "Organization/1708643329596847368.93f52b88-0146-4868-a272-86cd247ef0b9", + "resource": { + "resourceType": "Organization", + "id": "1708643329596847368.93f52b88-0146-4868-a272-86cd247ef0b9", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "HD.1" + } + ], + "value": "NPI" + } + ] + } + }, + { + "fullUrl": "Practitioner/1708643329606988679.6374ee92-a08b-4cb6-97c6-2b09442476ff", + "resource": { + "resourceType": "Practitioner", + "id": "1708643329606988679.6374ee92-a08b-4cb6-97c6-2b09442476ff", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "NPI" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" + } + ] + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", + "extension": [ + { + "url": "XCN.3", + "valueString": "SAMANTHA" + }, + { + "url": "XCN.10", + "valueString": "L" + } + ] + } + ], + "identifier": [ + { + "type": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", + "valueBoolean": true + } + ], + "code": "NPI" + } + ] + }, + "value": "1174911127", + "assigner": { + "reference": "Organization/1708643329596847368.93f52b88-0146-4868-a272-86cd247ef0b9" + } + } + ], + "name": [ + { + "use": "official", + "family": "SMITH", + "given": [ + "SAMANTHA" + ] + } + ] + } + }, + { + "fullUrl": "DiagnosticReport/1708643329631593922.78f28950-7a6e-4fcb-8980-e1842b578708", + "resource": { + "resourceType": "DiagnosticReport", + "id": "1708643329631593922.78f28950-7a6e-4fcb-8980-e1842b578708", + "identifier": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", + "valueString": "ORC.2" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "EPIC" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "PLAC" + } + ] + }, + "value": "423787478" + }, + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", + "valueString": "MN Public Health Lab" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", + "valueString": "2.16.840.1.114222.4.1.10080" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", + "valueCode": "ISO" + } + ] + } + ], + "type": { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/v2-0203", + "code": "FILL" + } + ] + }, + "value": "20231561137" + } + ], + "basedOn": [ + { + "reference": "ServiceRequest/1708643329612626874.6a767bc5-6fa2-488a-bf90-a3ecbc814fed" + } + ], + "status": "final", + "code": { + "coding": [ + { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", + "valueString": "coding" + }, + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", + "valueString": "LN" + } + ], + "system": "http://loinc.org", + "code": "57128-1", + "display": "Newborn Screening Report summary panel" + } + ] + }, + "subject": { + "reference": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6" + }, + "effectiveDateTime": "2023-06-03T04:50:00Z", + "_effectiveDateTime": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", + "valueString": "20230603045000" + } + ] + }, + "issued": "2023-06-06T19:16:13Z", + "_issued": { + "extension": [ + { + "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", + "valueString": "20230606191613" + } + ] + }, + "specimen": [ + { + "reference": "Specimen/1708643329426115363.caf8de32-9ff6-4fcd-a4dd-6b41c7eec275" + } + ], + "result": [ + { + "reference": "Observation/1708643329337615661.69d9df30-4fa0-4d5d-9be3-eb3c441349d2" + } + ] + } + } + ] +} + """ From 6ef84a264b0047963b5faeda92cc27e5a999abc2 Mon Sep 17 00:00:00 2001 From: halprin Date: Mon, 16 Dec 2024 17:23:23 -0700 Subject: [PATCH 02/36] Use an env var to tell whether running in Azure --- operations/locustfile.py | 2751 +------------------------------------- 1 file changed, 22 insertions(+), 2729 deletions(-) diff --git a/operations/locustfile.py b/operations/locustfile.py index ca9692f22..d55a9edf8 100644 --- a/operations/locustfile.py +++ b/operations/locustfile.py @@ -20,6 +20,8 @@ result_request_body = None auth_request_body = None +in_azure = os.getenv('TEST_RUN_NAME') is not None + class SampleUser(FastHttpUser): # Each task gets called randomly, but the number next to '@task' denotes @@ -119,6 +121,10 @@ def test_start(environment): @events.quitting.add_listener def assert_stats(environment): + if in_azure: + # don't evaluate this in Azure because we want the locust process to succeed + return + if environment.stats.total.fail_ratio > 0.01: logging.error("Test failed due to failure ratio > 1%") environment.process_exit_code = 1 @@ -133,12 +139,10 @@ def get_auth_request_body(): # set up the sample request body for the auth endpoint # using a valid test token found in the mock_credentials directory - jwt = "trusted-intermediary-valid-token.jwt" - - auth_token = os.getenv(jwt.replace('.', '-')) - - if auth_token is None: - with open(f"mock_credentials/{jwt}") as f: + if in_azure: + auth_token = os.getenv("trusted-intermediary-valid-token-jwt") + else: + with open("mock_credentials/trusted-intermediary-valid-token.jwt") as f: auth_token = f.read() params = urllib.parse.urlencode( @@ -150,2730 +154,19 @@ def get_auth_request_body(): def get_order_fhir_message(): # read the sample request body for the orders endpoint - return """{ - "resourceType": "Bundle", - "id": "1713991685806650392.f865cc8e-d438-4d5f-9147-05930f25a997", - "meta": { - "lastUpdated": "2024-04-24T20:48:05.813+00:00" - }, - "identifier": { - "system": "https://reportstream.cdc.gov/prime-router", - "value": "31808297" - }, - "type": "message", - "timestamp": "2023-05-06T10:29:16.000+00:00", - "entry": [ - { - "fullUrl": "MessageHeader/87c2d0db-6f31-3666-b9e2-7152e039c11f", - "resource": { - "resourceType": "MessageHeader", - "id": "87c2d0db-6f31-3666-b9e2-7152e039c11f", - "meta": { - "tag": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0103", - "code": "P" - } - ] - }, - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/msh-message-header", - "extension": [ - { - "url": "MSH.7", - "valueString": "20230506052916-0500" - }, - { - "url": "MSH.15", - "valueString": "AL" - }, - { - "url": "MSH.16", - "valueString": "AL" - }, - { - "url": "MSH.21", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.113883.9.82" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "value": "LAB_PRU_COMPONENT" - } - }, - { - "url": "MSH.21", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.113883.9.22" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "value": "LAB_TO_COMPONENT" - } - } - ] - } - ], - "eventCoding": { - "system": "http://terminology.hl7.org/CodeSystem/v2-0003", - "code": "O01", - "display": "ORM^O01^ORM_O01" - }, - "destination": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "natus.health.state.mn.us" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueString": "DNS" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "MSH.5" - } - ], - "name": "NATUS", - "receiver": { - "reference": "Organization/1713991685926824266.a1dc31ff-2719-470f-9a9d-2bfd3d6353e3" - } - } - ], - "sender": { - "reference": "Organization/1713991685881552998.10ccacc7-1879-4a11-b1cc-c1f87830d494" - }, - "source": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "Epic" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueString": "ISO" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "MSH.3" - } - ], - "endpoint": "urn:oid:1.2.840.114350.1.13.145.2.7.2.695071" - } - } - }, - { - "fullUrl": "Organization/1713991685881552998.10ccacc7-1879-4a11-b1cc-c1f87830d494", - "resource": { - "resourceType": "Organization", - "id": "1713991685881552998.10ccacc7-1879-4a11-b1cc-c1f87830d494", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "Centracare" - }, - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.2,HD.3" - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0301", - "code": "DNS" - } - ] - }, - "value": "centracare.com" - } - ] - } - }, - { - "fullUrl": "Organization/1713991685926824266.a1dc31ff-2719-470f-9a9d-2bfd3d6353e3", - "resource": { - "resourceType": "Organization", - "id": "1713991685926824266.a1dc31ff-2719-470f-9a9d-2bfd3d6353e3", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "MSH.6" - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "MN Public Health Lab" - }, - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.2,HD.3" - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0301", - "code": "ISO" - } - ] - }, - "system": "urn:ietf:rfc:3986", - "value": "2.16.840.1.114222.4.1.10080" - } - ] - } - }, - { - "fullUrl": "Patient/1713991686420540992.4160b099-3871-449c-9e90-dadeb21100e7", - "resource": { - "resourceType": "Patient", - "id": "1713991686420540992.4160b099-3871-449c-9e90-dadeb21100e7", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/pid-patient", - "extension": [ - { - "url": "PID.8" - }, - { - "url": "PID.24", - "valueString": "N" - }, - { - "url": "PID.30", - "valueString": "N" - } - ] - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName", - "valueHumanName": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xpn-human-name", - "extension": [ - { - "url": "XPN.2", - "valueString": "SADIE" - }, - { - "url": "XPN.3", - "valueString": "S" - } - ] - } - ], - "family": "SMITH", - "given": [ - "SADIE", - "S" - ] - } - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cx-identifier", - "extension": [ - { - "url": "CX.5", - "valueString": "MR" - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "PID.3" - } - ], - "type": { - "coding": [ - { - "code": "MR" - } - ] - }, - "value": "11102779", - "assigner": { - "reference": "Organization/1713991686376793169.d63d39d1-bd81-4180-a007-1a963547ff8d" - } - } - ], - "name": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xpn-human-name", - "extension": [ - { - "url": "XPN.2", - "valueString": "BB SARAH" - }, - { - "url": "XPN.7", - "valueString": "L" - } - ] - } - ], - "use": "official", - "text": "TestValue", - "family": "SMITH", - "given": [ - "BB SARAH" - ] - } - ], - "telecom": [ - { - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/contactpoint-area", - "valueString": "763" - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/contactpoint-local", - "valueString": "5555555" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xtn-contact-point", - "extension": [ - { - "url": "XTN.3", - "valueString": "PH" - }, - { - "url": "XTN.7", - "valueString": "5555555" - }, - { - "url": "XTN.9", - "valueString": "(763)555-5555" - } - ] - } - ], - "system": "phone", - "use": "home" - } - ], - "gender": "male", - "birthDate": "2023-05-04", - "_birthDate": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", - "valueString": "20230504131023-0500" - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime", - "valueDateTime": "2023-05-04T13:10:23-05:00" - } - ] - }, - "deceasedBoolean": false, - "address": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xad-address", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/sad-address-line", - "extension": [ - { - "url": "SAD.1", - "valueString": "555 STATE HIGHWAY 13" - } - ] - }, - { - "url": "XAD.7", - "valueCode": "H" - } - ] - } - ], - "use": "home", - "line": [ - "555 STATE HIGHWAY 13" - ], - "city": "DEER CREEK", - "district": "OTTER TAIL", - "state": "MN", - "postalCode": "56527-9657", - "country": "USA" - } - ], - "multipleBirthInteger": 1 - } - }, - { - "fullUrl": "Organization/1713991686376793169.d63d39d1-bd81-4180-a007-1a963547ff8d", - "resource": { - "resourceType": "Organization", - "id": "1713991686376793169.d63d39d1-bd81-4180-a007-1a963547ff8d", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "CRPMRN" - } - ] - } - }, - { - "fullUrl": "ServiceRequest/1713991686444544794.4cd34f9e-a7da-489c-8c3a-bd8c3edfaf67", - "resource": { - "resourceType": "ServiceRequest", - "id": "1713991686444544794.4cd34f9e-a7da-489c-8c3a-bd8c3edfaf67", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/business-event", - "valueCode": "NW" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/business-event", - "valueString": "20230506052913-0500" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/orc-common-order", - "extension": [ - { - "url": "orc-21-ordering-facility-name", - "valueReference": { - "reference": "Organization/1713991686439304395.dadd5b53-5f0e-4ca5-8e58-d6109d26f5ee" - } - }, - { - "url": "orc-21-ordering-facility-name", - "valueReference": { - "reference": "Organization/1713991686440767640.8871e10e-767a-46a3-81d3-150c106697f7" - } - }, - { - "url": "orc-12-ordering-provider", - "valueReference": { - "reference": "Practitioner/1713991686442730297.157adf6e-ef27-4065-a895-18dfd561d19e" - } - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/obr-observation-request", - "extension": [ - { - "url": "OBR.2", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "EPIC" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "value": "421832901" - } - } - ] - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "ORC.2" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "EPIC" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "PLAC" - } - ] - }, - "value": "{{placer_order_id}}" - } - ], - "status": "unknown", - "subject": { - "reference": "Patient/1713991686420540992.4160b099-3871-449c-9e90-dadeb21100e7" - }, - "authoredOn": "2023-05-06T05:29:13-05:00", - "_authoredOn": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", - "valueString": "20230506052913-0500" - } - ] - }, - "requester": { - "reference": "PractitionerRole/1713991686430248172.048e0c37-4095-440f-994b-5cd80bf34c69" - } - } - }, - { - "fullUrl": "Organization/1713991686430978000.29e1ded0-6428-44af-8e58-0eeb2bea06af", - "resource": { - "resourceType": "Organization", - "id": "1713991686430978000.29e1ded0-6428-44af-8e58-0eeb2bea06af", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "NPI" - } - ] - } - }, - { - "fullUrl": "Practitioner/1713991686433173618.77eeecb0-0bad-4feb-8c05-d06d06735c90", - "resource": { - "resourceType": "Practitioner", - "id": "1713991686433173618.77eeecb0-0bad-4feb-8c05-d06d06735c90", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "NPI" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", - "extension": [ - { - "url": "XCN.3", - "valueString": "JANE" - }, - { - "url": "XCN.10", - "valueString": "L" - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "ORC.12" - } - ], - "identifier": [ - { - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", - "valueBoolean": true - } - ], - "code": "NPI" - } - ] - }, - "value": "1265136360", - "assigner": { - "reference": "Organization/1713991686430978000.29e1ded0-6428-44af-8e58-0eeb2bea06af" - } - } - ], - "name": [ - { - "use": "official", - "family": "JONES", - "given": [ - "JANE" - ] - } - ] - } - }, - { - "fullUrl": "Organization/1713991686435100196.d7b35c8a-94d2-492f-9010-728a69b55a92", - "resource": { - "resourceType": "Organization", - "id": "1713991686435100196.d7b35c8a-94d2-492f-9010-728a69b55a92", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", - "valueCoding": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueCodeableConcept": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "XON.2" - } - ] - } - } - ] - } - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", - "extension": [ - { - "url": "XON.10", - "valueString": "1043269798" - } - ] - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "CMS" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - } - ], - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", - "valueString": "identifier" - } - ], - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "NPI" - } - ] - }, - "value": "1043269798" - } - ], - "name": "ST. CLOUD HOSPITAL" - } - }, - { - "fullUrl": "PractitionerRole/1713991686430248172.048e0c37-4095-440f-994b-5cd80bf34c69", - "resource": { - "resourceType": "PractitionerRole", - "id": "1713991686430248172.048e0c37-4095-440f-994b-5cd80bf34c69", - "practitioner": { - "reference": "Practitioner/1713991686433173618.77eeecb0-0bad-4feb-8c05-d06d06735c90" - }, - "organization": { - "reference": "Organization/1713991686435100196.d7b35c8a-94d2-492f-9010-728a69b55a92" - } - } - }, - { - "fullUrl": "Organization/1713991686439304395.dadd5b53-5f0e-4ca5-8e58-d6109d26f5ee", - "resource": { - "resourceType": "Organization", - "id": "1713991686439304395.dadd5b53-5f0e-4ca5-8e58-d6109d26f5ee", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", - "valueCoding": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueCodeableConcept": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "XON.2" - } - ] - } - } - ] - } - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", - "extension": [ - { - "url": "XON.10", - "valueString": "1043269798" - } - ] - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "CMS" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - } - ], - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", - "valueString": "identifier" - } - ], - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "NPI" - } - ] - }, - "value": "1043269798" - } - ], - "name": "ST. CLOUD HOSPITAL" - } - }, - { - "fullUrl": "Organization/1713991686440767640.8871e10e-767a-46a3-81d3-150c106697f7", - "resource": { - "resourceType": "Organization", - "id": "1713991686440767640.8871e10e-767a-46a3-81d3-150c106697f7", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", - "valueCoding": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueCodeableConcept": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "XON.2" - } - ] - } - } - ] - } - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", - "extension": [ - { - "url": "XON.10", - "valueString": "739" - } - ] - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "MN Public Health Lab" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - } - ], - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", - "valueString": "identifier" - } - ], - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "Submitter ID" - } - ] - }, - "value": "739" - } - ], - "name": "ST. CLOUD HOSPITAL" - } - }, - { - "fullUrl": "Organization/1713991686441504208.f7b9b8ec-da49-4154-9290-0a8df47fbc4d", - "resource": { - "resourceType": "Organization", - "id": "1713991686441504208.f7b9b8ec-da49-4154-9290-0a8df47fbc4d", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "NPI" - } - ] - } - }, - { - "fullUrl": "Practitioner/1713991686442730297.157adf6e-ef27-4065-a895-18dfd561d19e", - "resource": { - "resourceType": "Practitioner", - "id": "1713991686442730297.157adf6e-ef27-4065-a895-18dfd561d19e", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "NPI" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", - "extension": [ - { - "url": "XCN.3", - "valueString": "JANE" - }, - { - "url": "XCN.10", - "valueString": "L" - } - ] - } - ], - "identifier": [ - { - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", - "valueBoolean": true - } - ], - "code": "NPI" - } - ] - }, - "value": "1265136360", - "assigner": { - "reference": "Organization/1713991686441504208.f7b9b8ec-da49-4154-9290-0a8df47fbc4d" - } - } - ], - "name": [ - { - "use": "official", - "family": "JONES", - "given": [ - "JANE" - ] - } - ] - } - }, - { - "fullUrl": "Observation/1713991686770356478.1910e6f0-c091-4478-a7f6-ede1f3711b9f", - "resource": { - "resourceType": "Observation", - "id": "1713991686770356478.1910e6f0-c091-4478-a7f6-ede1f3711b9f", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/sub-id", - "valueString": "1" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/observation-sub-type", - "valueCode": "AOE" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/obx-observation", - "extension": [ - { - "url": "OBX.2", - "valueId": "NM" - }, - { - "url": "OBX.6" - }, - { - "url": "OBX.11", - "valueString": "O" - } - ] - } - ], - "status": "unknown", - "subject": { - "reference": "Patient/1713991686420540992.4160b099-3871-449c-9e90-dadeb21100e7" - }, - "effectiveDateTime": "2023-05-06T05:00:00-05:00", - "_effectiveDateTime": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", - "valueString": "20230506050000-0500" - } - ] - }, - "valueQuantity": { - "value": 1769.859285, - "unit": "gram", - "system": "UCUM", - "code": "g" - } - } - }, - { - "fullUrl": "Specimen/1713991686845404556.ccf23f10-1abe-4090-aa7c-c91dd0988c22", - "resource": { - "resourceType": "Specimen", - "id": "1713991686845404556.ccf23f10-1abe-4090-aa7c-c91dd0988c22", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Segment", - "valueString": "SPM" - } - ] - } - } - ] -} - """ + file_path = "002_ORM_O01_short.fhir" + if not in_azure: + file_path = "examples/Test/e2e/orders/" + file_path + + with open(file_path, "r") as f: + return f.read() def get_result_fhir_message(): # read the sample request body for the results endpoint - return """{ - "resourceType": "Bundle", - "id": "1708643329059388284.3eb8aca3-48fa-48e6-8d24-249f96d190f4", - "meta": { - "lastUpdated": "2024-02-22T23:08:49.065+00:00" - }, - "identifier": { - "system": "https://reportstream.cdc.gov/prime-router", - "value": "20230607002849_0365" - }, - "type": "message", - "timestamp": "2023-06-07T00:28:49.000+00:00", - "entry": [ - { - "fullUrl": "MessageHeader/28e642fa-b0e7-3bc5-8084-293e36792f05", - "resource": { - "resourceType": "MessageHeader", - "id": "28e642fa-b0e7-3bc5-8084-293e36792f05", - "meta": { - "tag": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0103", - "code": "P" - } - ] - }, - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/msh-message-header", - "extension": [ - { - "url": "MSH.7", - "valueString": "20230606192849-0500" - }, - { - "url": "MSH.15", - "valueString": "AL" - }, - { - "url": "MSH.16", - "valueString": "AL" - }, - { - "url": "MSH.21", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.113883.9.195.3.4" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "value": "LRI_NG_FRN_PROFILE" - } - }, - { - "url": "MSH.21", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.113883.9.195.3.6" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "value": "LRI_NDBS_COMPONENT" - } - }, - { - "url": "MSH.21", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.113883.9.81" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "value": "LAB_PRN_Component" - } - }, - { - "url": "MSH.21", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.113883.9.22" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "value": "LAB_TO_COMPONENT" - } - } - ] - } - ], - "eventCoding": { - "system": "http://terminology.hl7.org/CodeSystem/v2-0003", - "code": "R01", - "display": "ORU^R01^ORU_R01" - }, - "destination": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueString": "ISO" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "MSH.5" - } - ], - "name": "Epic", - "endpoint": "urn:oid:1.2.840.114350.1.13.145.2.7.2.695071", - "receiver": { - "reference": "Organization/1708643329096405931.3df374db-c008-44a2-aa83-36e9b09a33ad" - } - } - ], - "sender": { - "reference": "Organization/1708643329084338823.57892b53-2a11-43db-8ec9-97f8db64a32f" - }, - "source": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "Natus" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "natus.health.state.mn.us" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueString": "DNS" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "MSH.3" - } - ], - "endpoint": "urn:dns:natus.health.state.mn.us" - } - } - }, - { - "fullUrl": "Organization/1708643329084338823.57892b53-2a11-43db-8ec9-97f8db64a32f", - "resource": { - "resourceType": "Organization", - "id": "1708643329084338823.57892b53-2a11-43db-8ec9-97f8db64a32f", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "MN Public Health Lab" - }, - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.2,HD.3" - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0301", - "code": "ISO" - } - ] - }, - "system": "urn:ietf:rfc:3986", - "value": "2.16.840.1.114222.4.1.10080" - } - ] - } - }, - { - "fullUrl": "Organization/1708643329096405931.3df374db-c008-44a2-aa83-36e9b09a33ad", - "resource": { - "resourceType": "Organization", - "id": "1708643329096405931.3df374db-c008-44a2-aa83-36e9b09a33ad", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "MSH.6" - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "Centracare" - }, - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.2,HD.3" - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0301", - "code": "DNS" - } - ] - }, - "value": "centracare.com" - } - ] - } - }, - { - "fullUrl": "Provenance/1708643329181039838.5d4b6ba7-fe37-4bde-9e17-5cb502c08d08", - "resource": { - "resourceType": "Provenance", - "id": "1708643329181039838.5d4b6ba7-fe37-4bde-9e17-5cb502c08d08", - "target": [ - { - "reference": "MessageHeader/28e642fa-b0e7-3bc5-8084-293e36792f05" - }, - { - "reference": "DiagnosticReport/1708643329631593922.78f28950-7a6e-4fcb-8980-e1842b578708" - } - ], - "recorded": "2023-06-06T19:28:49-05:00", - "activity": { - "coding": [ - { - "display": "ORU^R01^ORU_R01" - } - ] - }, - "agent": [ - { - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type", - "code": "author" - } - ] - }, - "who": { - "reference": "Organization/1708643329175239534.8db4b5dd-ea1c-42e7-bcd9-c61e1c4ca158" - } - } - ] - } - }, - { - "fullUrl": "Organization/1708643329175239534.8db4b5dd-ea1c-42e7-bcd9-c61e1c4ca158", - "resource": { - "resourceType": "Organization", - "id": "1708643329175239534.8db4b5dd-ea1c-42e7-bcd9-c61e1c4ca158", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "MN Public Health Lab" - }, - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.2,HD.3" - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0301", - "code": "ISO" - } - ] - }, - "system": "urn:ietf:rfc:3986", - "value": "2.16.840.1.114222.4.1.10080" - } - ] - } - }, - { - "fullUrl": "Provenance/1708643329194237432.5dc530b3-ed05-4738-91e1-188074ce4af9", - "resource": { - "resourceType": "Provenance", - "id": "1708643329194237432.5dc530b3-ed05-4738-91e1-188074ce4af9", - "recorded": "2024-02-22T23:08:49Z", - "policy": [ - "http://hl7.org/fhir/uv/v2mappings/message-oru-r01-to-bundle" - ], - "activity": { - "coding": [ - { - "code": "v2-FHIR transformation" - } - ] - }, - "agent": [ - { - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type", - "code": "assembler" - } - ] - }, - "who": { - "reference": "Organization/1708643329192128256.d81d233e-da75-4eb1-a636-e0818b307ee0" - } - } - ] - } - }, - { - "fullUrl": "Organization/1708643329192128256.d81d233e-da75-4eb1-a636-e0818b307ee0", - "resource": { - "resourceType": "Organization", - "id": "1708643329192128256.d81d233e-da75-4eb1-a636-e0818b307ee0", - "identifier": [ - { - "value": "CDC PRIME - Atlanta" - }, - { - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0301" - } - ] - }, - "system": "urn:ietf:rfc:3986", - "value": "2.16.840.1.114222.4.1.237821" - } - ] - } - }, - { - "fullUrl": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6", - "resource": { - "resourceType": "Patient", - "id": "1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/pid-patient", - "extension": [ - { - "url": "PID.30", - "valueString": "N" - } - ] - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cx-identifier", - "extension": [ - { - "url": "CX.5", - "valueString": "MR" - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "PID.3" - } - ], - "type": { - "coding": [ - { - "code": "MR" - } - ] - }, - "value": "11102779", - "assigner": { - "reference": "Organization/1708643329205656925.de11953b-df2c-4b5c-a8f5-4882ae39faa5" - } - } - ], - "name": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xpn-human-name", - "extension": [ - { - "url": "XPN.2", - "valueString": "BB SARAH" - }, - { - "url": "XPN.6", - "valueString": "L" - } - ] - } - ], - "text": "TestValue", - "family": "SMITH", - "given": [ - "BB SARAH" - ], - "suffix": [ - "L" - ] - } - ], - "birthDate": "2023-05-04", - "_birthDate": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", - "valueString": "20230504131000" - }, - { - "url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime", - "valueDateTime": "2023-05-04T13:10:00Z" - } - ] - }, - "deceasedBoolean": false, - "address": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xad-address", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/sad-address-line", - "extension": [ - { - "url": "SAD.1", - "valueString": "555 STATE HIGHWAY 13" - } - ] - }, - { - "url": "XAD.7", - "valueCode": "H" - } - ] - } - ], - "use": "home", - "line": [ - "555 STATE HIGHWAY 13" - ], - "city": "DEER CREEK", - "state": "MN", - "postalCode": "565279657" - } - ] - } - }, - { - "fullUrl": "Organization/1708643329205656925.de11953b-df2c-4b5c-a8f5-4882ae39faa5", - "resource": { - "resourceType": "Organization", - "id": "1708643329205656925.de11953b-df2c-4b5c-a8f5-4882ae39faa5", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "CRPMRN" - } - ] - } - }, - { - "fullUrl": "Provenance/1708643329283292699.668bb1d4-3c6f-4a04-9085-b16177a586f0", - "resource": { - "resourceType": "Provenance", - "id": "1708643329283292699.668bb1d4-3c6f-4a04-9085-b16177a586f0", - "target": [ - { - "reference": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6" - } - ], - "recorded": "2024-02-22T23:08:49Z", - "activity": { - "coding": [ - { - "system": "https://terminology.hl7.org/CodeSystem/v3-DataOperation", - "code": "UPDATE" - } - ] - } - } - }, - { - "fullUrl": "Observation/1708643329337615661.69d9df30-4fa0-4d5d-9be3-eb3c441349d2", - "resource": { - "resourceType": "Observation", - "id": "1708643329337615661.69d9df30-4fa0-4d5d-9be3-eb3c441349d2", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/analysis-date-time", - "valueDateTime": "2023-06-06T19:16:13Z", - "_valueDateTime": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", - "valueString": "20230606191613" - } - ] - } - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/observation-sub-type", - "valueCode": "UNSP" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/obx-observation", - "extension": [ - { - "url": "OBX.2", - "valueId": "CWE" - }, - { - "url": "OBX.11", - "valueString": "F" - } - ] - } - ], - "status": "final", - "code": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueString": "coding" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", - "valueString": "LN" - } - ], - "system": "http://loinc.org", - "code": "57718-9", - "display": "Sample quality of Dried blood spot" - } - ] - }, - "subject": { - "reference": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6" - }, - "effectiveDateTime": "2023-06-03T04:50:00Z", - "_effectiveDateTime": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", - "valueString": "20230603045000" - } - ] - }, - "performer": [ - { - "reference": "PractitionerRole/1708643329346346926.5862ad7a-6aee-446b-888a-456b0b025016" - } - ], - "valueCodeableConcept": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueString": "coding" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", - "valueString": "LN" - } - ], - "system": "http://loinc.org", - "code": "LA12432-3", - "display": "Acceptable" - } - ] - } - } - }, - { - "fullUrl": "Practitioner/1708643329366242745.3a0e80f3-82fc-4d17-97e9-0b2035adce46", - "resource": { - "resourceType": "Practitioner", - "id": "1708643329366242745.3a0e80f3-82fc-4d17-97e9-0b2035adce46", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", - "extension": [ - { - "url": "XCN.3", - "valueString": "Marie" - } - ] - } - ], - "name": [ - { - "family": "Miller", - "given": [ - "Marie" - ] - } - ] - } - }, - { - "fullUrl": "Organization/1708643329385366275.d605419a-f07c-4149-8b70-32f577083612", - "resource": { - "resourceType": "Organization", - "id": "1708643329385366275.d605419a-f07c-4149-8b70-32f577083612", - "name": "MDH Newborn Screening Laboratory", - "address": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xad-address", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/sad-address-line", - "extension": [ - { - "url": "SAD.1", - "valueString": "601 Robert St N" - } - ] - } - ] - } - ], - "line": [ - "601 Robert St N" - ], - "city": "St. Paul", - "state": "MN", - "postalCode": "55155" - } - ] - } - }, - { - "fullUrl": "PractitionerRole/1708643329346346926.5862ad7a-6aee-446b-888a-456b0b025016", - "resource": { - "resourceType": "PractitionerRole", - "id": "1708643329346346926.5862ad7a-6aee-446b-888a-456b0b025016", - "practitioner": { - "reference": "Practitioner/1708643329366242745.3a0e80f3-82fc-4d17-97e9-0b2035adce46" - }, - "organization": { - "reference": "Organization/1708643329385366275.d605419a-f07c-4149-8b70-32f577083612" - }, - "code": [ - { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0912", - "code": "MDIR" - } - ] - } - ] - } - }, - { - "fullUrl": "Specimen/1708643329426115363.caf8de32-9ff6-4fcd-a4dd-6b41c7eec275", - "resource": { - "resourceType": "Specimen", - "id": "1708643329426115363.caf8de32-9ff6-4fcd-a4dd-6b41c7eec275", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Segment", - "valueString": "OBR" - } - ] - } - }, - { - "fullUrl": "ServiceRequest/1708643329612626874.6a767bc5-6fa2-488a-bf90-a3ecbc814fed", - "resource": { - "resourceType": "ServiceRequest", - "id": "1708643329612626874.6a767bc5-6fa2-488a-bf90-a3ecbc814fed", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/business-event", - "valueCode": "RE" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/orc-common-order", - "extension": [ - { - "url": "orc-21-ordering-facility-name", - "valueReference": { - "reference": "Organization/1708643329532919335.1c95b0f6-e401-4ae7-bf8c-9d698bd46a57" - } - }, - { - "url": "orc-21-ordering-facility-name", - "valueReference": { - "reference": "Organization/1708643329552456753.88e4eb0d-dece-4579-a8a1-a4014f4bcda5" - } - }, - { - "url": "ORC.31", - "valueCodeableConcept": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueString": "coding" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", - "valueString": "LN" - } - ], - "system": "http://loinc.org", - "code": "54089-8", - "display": "Newborn screening panel American Health Information Community (AHIC)" - } - ] - } - }, - { - "url": "orc-12-ordering-provider", - "valueReference": { - "reference": "Practitioner/1708643329577508774.3caa1170-d0a8-482d-9a11-ea9d568db749" - } - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/obr-observation-request", - "extension": [ - { - "url": "OBR.2", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "EPIC" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "value": "423787478" - } - }, - { - "url": "OBR.3", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "MN Public Health Lab" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.114222.4.1.10080" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "value": "20231561137" - } - }, - { - "url": "OBR.22", - "valueString": "20230606191613" - }, - { - "url": "OBR.29", - "valueIdentifier": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "EPIC" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueString": "ISO" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/filler-assigned-identifier", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/entity-identifier", - "valueString": "20231561137" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "MN Public Health Lab" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.114222.4.1.10080" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueString": "ISO" - } - ] - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "PGN" - } - ] - }, - "value": "423787478" - } - }, - { - "url": "OBR.50", - "valueCodeableConcept": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueString": "coding" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", - "valueString": "LN" - } - ], - "system": "http://loinc.org", - "code": "54089-8", - "display": "Newborn screening panel American Health Information Community (AHIC)" - } - ] - } - }, - { - "url": "OBR.11", - "valueString": "O" - }, - { - "url": "OBR.16", - "valueReference": { - "reference": "Practitioner/1708643329606988679.6374ee92-a08b-4cb6-97c6-2b09442476ff" - } - } - ] - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "ORC.2" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "EPIC" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "PLAC" - } - ] - }, - "value": "{{placer_order_id}}" - }, - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "ORC.3" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "MN Public Health Lab" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.114222.4.1.10080" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "FILL" - } - ] - }, - "value": "20231561137" - } - ], - "status": "unknown", - "intent": "order", - "code": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueString": "coding" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", - "valueString": "LN" - } - ], - "system": "http://loinc.org", - "code": "57128-1", - "display": "Newborn Screening Report summary panel" - } - ] - }, - "subject": { - "reference": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6" - }, - "requester": { - "reference": "PractitionerRole/1708643329436006371.45eabfd2-cdfc-4920-b10f-b05e1a6acab7" - } - } - }, - { - "fullUrl": "Organization/1708643329440493082.2d0201f2-7497-4f14-a56a-8be814df6cce", - "resource": { - "resourceType": "Organization", - "id": "1708643329440493082.2d0201f2-7497-4f14-a56a-8be814df6cce", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "NPI" - } - ] - } - }, - { - "fullUrl": "Practitioner/1708643329457407861.c164c0c9-903e-486c-81bb-f3a697da095f", - "resource": { - "resourceType": "Practitioner", - "id": "1708643329457407861.c164c0c9-903e-486c-81bb-f3a697da095f", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "NPI" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", - "extension": [ - { - "url": "XCN.3", - "valueString": "SAMANTHA" - }, - { - "url": "XCN.10", - "valueString": "L" - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "ORC.12" - } - ], - "identifier": [ - { - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", - "valueBoolean": true - } - ], - "code": "NPI" - } - ] - }, - "value": "1174911127", - "assigner": { - "reference": "Organization/1708643329440493082.2d0201f2-7497-4f14-a56a-8be814df6cce" - } - } - ], - "name": [ - { - "use": "official", - "family": "SMITH", - "given": [ - "SAMANTHA" - ] - } - ] - } - }, - { - "fullUrl": "Organization/1708643329482488611.58a0bd6a-0d77-4d70-a95f-6028d43bb644", - "resource": { - "resourceType": "Organization", - "id": "1708643329482488611.58a0bd6a-0d77-4d70-a95f-6028d43bb644", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", - "valueCoding": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueCodeableConcept": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "XON.2" - } - ], - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueString": "coding" - } - ], - "code": "L" - } - ] - } - } - ], - "code": "L" - } - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", - "extension": [ - { - "url": "XON.10", - "valueString": "1043269798" - } - ] - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "CMS" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - } - ], - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", - "valueString": "identifier" - } - ], - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "NPI" - } - ] - }, - "value": "1043269798" - } - ], - "name": "ST. CLOUD HOSPITAL", - "telecom": [ - { - "_system": { - "extension": [ - { - "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason", - "valueCode": "unknown" - } - ] - } - } - ] - } - }, - { - "fullUrl": "PractitionerRole/1708643329436006371.45eabfd2-cdfc-4920-b10f-b05e1a6acab7", - "resource": { - "resourceType": "PractitionerRole", - "id": "1708643329436006371.45eabfd2-cdfc-4920-b10f-b05e1a6acab7", - "practitioner": { - "reference": "Practitioner/1708643329457407861.c164c0c9-903e-486c-81bb-f3a697da095f" - }, - "organization": { - "reference": "Organization/1708643329482488611.58a0bd6a-0d77-4d70-a95f-6028d43bb644" - } - } - }, - { - "fullUrl": "Organization/1708643329532919335.1c95b0f6-e401-4ae7-bf8c-9d698bd46a57", - "resource": { - "resourceType": "Organization", - "id": "1708643329532919335.1c95b0f6-e401-4ae7-bf8c-9d698bd46a57", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", - "valueCoding": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueCodeableConcept": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "XON.2" - } - ], - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueString": "coding" - } - ], - "code": "L" - } - ] - } - } - ], - "code": "L" - } - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", - "extension": [ - { - "url": "XON.10", - "valueString": "1043269798" - } - ] - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "CMS" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - } - ], - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", - "valueString": "identifier" - } - ], - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "NPI" - } - ] - }, - "value": "1043269798" - } - ], - "name": "ST. CLOUD HOSPITAL" - } - }, - { - "fullUrl": "Organization/1708643329552456753.88e4eb0d-dece-4579-a8a1-a4014f4bcda5", - "resource": { - "resourceType": "Organization", - "id": "1708643329552456753.88e4eb0d-dece-4579-a8a1-a4014f4bcda5", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/organization-name-type", - "valueCoding": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueCodeableConcept": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "XON.2" - } - ], - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueString": "coding" - } - ], - "code": "L" - } - ] - } - } - ], - "code": "L" - } - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xon-organization", - "extension": [ - { - "url": "XON.10", - "valueString": "739" - } - ] - } - ], - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "MN Public Health Lab" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - } - ], - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/code-index-name", - "valueString": "identifier" - } - ], - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "Submitter ID" - } - ] - }, - "value": "739" - } - ], - "name": "ST. CLOUD HOSPITAL" - } - }, - { - "fullUrl": "Organization/1708643329559325319.b84e8226-acee-487e-8e81-afb8bd63d91e", - "resource": { - "resourceType": "Organization", - "id": "1708643329559325319.b84e8226-acee-487e-8e81-afb8bd63d91e", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "NPI" - } - ] - } - }, - { - "fullUrl": "Practitioner/1708643329577508774.3caa1170-d0a8-482d-9a11-ea9d568db749", - "resource": { - "resourceType": "Practitioner", - "id": "1708643329577508774.3caa1170-d0a8-482d-9a11-ea9d568db749", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "NPI" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", - "extension": [ - { - "url": "XCN.3", - "valueString": "SAMANTHA" - }, - { - "url": "XCN.10", - "valueString": "L" - } - ] - } - ], - "identifier": [ - { - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", - "valueBoolean": true - } - ], - "code": "NPI" - } - ] - }, - "value": "1174911127", - "assigner": { - "reference": "Organization/1708643329559325319.b84e8226-acee-487e-8e81-afb8bd63d91e" - } - } - ], - "name": [ - { - "use": "official", - "family": "SMITH", - "given": [ - "SAMANTHA" - ] - } - ] - } - }, - { - "fullUrl": "Organization/1708643329596847368.93f52b88-0146-4868-a272-86cd247ef0b9", - "resource": { - "resourceType": "Organization", - "id": "1708643329596847368.93f52b88-0146-4868-a272-86cd247ef0b9", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "HD.1" - } - ], - "value": "NPI" - } - ] - } - }, - { - "fullUrl": "Practitioner/1708643329606988679.6374ee92-a08b-4cb6-97c6-2b09442476ff", - "resource": { - "resourceType": "Practitioner", - "id": "1708643329606988679.6374ee92-a08b-4cb6-97c6-2b09442476ff", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "NPI" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-unknown-type" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type" - } - ] - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/xcn-practitioner", - "extension": [ - { - "url": "XCN.3", - "valueString": "SAMANTHA" - }, - { - "url": "XCN.10", - "valueString": "L" - } - ] - } - ], - "identifier": [ - { - "type": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/codeable-concept-id", - "valueBoolean": true - } - ], - "code": "NPI" - } - ] - }, - "value": "1174911127", - "assigner": { - "reference": "Organization/1708643329596847368.93f52b88-0146-4868-a272-86cd247ef0b9" - } - } - ], - "name": [ - { - "use": "official", - "family": "SMITH", - "given": [ - "SAMANTHA" - ] - } - ] - } - }, - { - "fullUrl": "DiagnosticReport/1708643329631593922.78f28950-7a6e-4fcb-8980-e1842b578708", - "resource": { - "resourceType": "DiagnosticReport", - "id": "1708643329631593922.78f28950-7a6e-4fcb-8980-e1842b578708", - "identifier": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field", - "valueString": "ORC.2" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "EPIC" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "1.2.840.114350.1.13.145.2.7.2.695071" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "PLAC" - } - ] - }, - "value": "423787478" - }, - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/assigning-authority", - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id", - "valueString": "MN Public Health Lab" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id", - "valueString": "2.16.840.1.114222.4.1.10080" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type", - "valueCode": "ISO" - } - ] - } - ], - "type": { - "coding": [ - { - "system": "http://terminology.hl7.org/CodeSystem/v2-0203", - "code": "FILL" - } - ] - }, - "value": "20231561137" - } - ], - "basedOn": [ - { - "reference": "ServiceRequest/1708643329612626874.6a767bc5-6fa2-488a-bf90-a3ecbc814fed" - } - ], - "status": "final", - "code": { - "coding": [ - { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding", - "valueString": "coding" - }, - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/cwe-coding-system", - "valueString": "LN" - } - ], - "system": "http://loinc.org", - "code": "57128-1", - "display": "Newborn Screening Report summary panel" - } - ] - }, - "subject": { - "reference": "Patient/1708643329268871344.12d74d82-41ed-4380-a4e0-d276570f04e6" - }, - "effectiveDateTime": "2023-06-03T04:50:00Z", - "_effectiveDateTime": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", - "valueString": "20230603045000" - } - ] - }, - "issued": "2023-06-06T19:16:13Z", - "_issued": { - "extension": [ - { - "url": "https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2-date-time", - "valueString": "20230606191613" - } - ] - }, - "specimen": [ - { - "reference": "Specimen/1708643329426115363.caf8de32-9ff6-4fcd-a4dd-6b41c7eec275" - } - ], - "result": [ - { - "reference": "Observation/1708643329337615661.69d9df30-4fa0-4d5d-9be3-eb3c441349d2" - } - ] - } - } - ] -} - """ + file_path = "001_ORU_R01_short.fhir" + if not in_azure: + file_path = "examples/Test/e2e/results/" + file_path + + with open(file_path, "r") as f: + return f.read() From e90565c56e9f7a1651721c310f55b979d3102805 Mon Sep 17 00:00:00 2001 From: halprin Date: Tue, 17 Dec 2024 11:41:59 -0700 Subject: [PATCH 03/36] Add some TODOs and update comment on why we avoid failing locust when running in Azure Co-authored-by: somesylvie --- operations/locustfile.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/operations/locustfile.py b/operations/locustfile.py index d55a9edf8..8fc5e1584 100644 --- a/operations/locustfile.py +++ b/operations/locustfile.py @@ -122,7 +122,7 @@ def test_start(environment): @events.quitting.add_listener def assert_stats(environment): if in_azure: - # don't evaluate this in Azure because we want the locust process to succeed + # don't evaluate this in Azure because we want the locust process to succeed and Azure does its own test criteria checking return if environment.stats.total.fail_ratio > 0.01: @@ -139,6 +139,9 @@ def get_auth_request_body(): # set up the sample request body for the auth endpoint # using a valid test token found in the mock_credentials directory + # TODO - notes/clarification on 2 different creds, plus expiration date of jwt + # TODO - do we want to TF the tests? If yes which envs? In CDC envs, may need to adjust IP allow list on app. Also set as private endpoints in test config? + # TODO - currently in Azure we're specifying a version for the key vault item (so if it gets updated, we'll be referencing an old version) - do we want to change this? if in_azure: auth_token = os.getenv("trusted-intermediary-valid-token-jwt") else: From 790abd7c8e2c7f2db67be8fdd5b0cc1fe87f6348 Mon Sep 17 00:00:00 2001 From: halprin Date: Tue, 17 Dec 2024 16:16:20 -0700 Subject: [PATCH 04/36] Play with doing thread local registrations in the ApplicationContext --- .../external/javalin/DomainsRegistration.java | 2 ++ .../etor/EtorDomainRegistration.java | 7 ++++++ .../partner/PartnerMetadataOrchestrator.java | 9 ++++++- .../ReportStreamEndpointClient.java | 5 ---- .../ReportStreamSenderHelper.java | 6 ++++- .../context/ApplicationContext.java | 24 +++++++++++++++++++ 6 files changed, 46 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/DomainsRegistration.java b/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/DomainsRegistration.java index cee103181..4a575cb91 100644 --- a/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/DomainsRegistration.java +++ b/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/DomainsRegistration.java @@ -122,6 +122,8 @@ static DomainConnector constructNewDomainConnector(Class handler, boolean isProtected) { return (Context ctx) -> { + ApplicationContext.clearThreadRegistrations(); + LOGGER.logInfo(ctx.method().name() + " " + ctx.url()); var request = javalinContextToDomainRequest(ctx); diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java index 0711d05b7..95c01ae04 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java @@ -134,6 +134,7 @@ public Map> domainRegistra MessageLinkStorage.class, FileMessageLinkStorage.getInstance()); } + // these are default implementations if (ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { ApplicationContext.register( RSEndpointClient.class, ReportStreamEndpointClient.getInstance()); @@ -226,6 +227,12 @@ protected DomainResponse handleMessageRequest( boolean markMetadataAsFailed = false; String errorMessage = ""; + if ("True".equals(request.getHeaders().get("Load-Test")) + && ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { + ApplicationContext.registerForThread( + RSEndpointClient.class, MockRSEndpointClient.getInstance()); + } + try { return requestHandler.handle(inboundReportId); } catch (FhirParseException e) { diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java index a70308ec7..ab1746058 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java @@ -1,5 +1,6 @@ package gov.hhs.cdc.trustedintermediary.etor.metadata.partner; +import gov.hhs.cdc.trustedintermediary.context.ApplicationContext; import gov.hhs.cdc.trustedintermediary.etor.RSEndpointClient; import gov.hhs.cdc.trustedintermediary.etor.messagelink.MessageLink; import gov.hhs.cdc.trustedintermediary.etor.messagelink.MessageLinkException; @@ -31,7 +32,7 @@ public class PartnerMetadataOrchestrator { @Inject PartnerMetadataStorage partnerMetadataStorage; @Inject MessageLinkStorage messageLinkStorage; - @Inject RSEndpointClient rsclient; + // @Inject RSEndpointClient rsclient; @Inject Formatter formatter; @Inject Logger logger; @@ -44,6 +45,8 @@ private PartnerMetadataOrchestrator() {} public void updateMetadataForInboundMessage(PartnerMetadata partnerMetadata) throws PartnerMetadataException { + RSEndpointClient rsclient = ApplicationContext.getImplementation(RSEndpointClient.class); + logger.logInfo( "Looking up sender name and timeReceived from RS delivery API for inboundReportId: {}", partnerMetadata.inboundReportId()); @@ -130,6 +133,10 @@ public Optional getMetadata(String inboundReportId) PartnerMetadata partnerMetadata = optionalPartnerMetadata.get(); var outboundReportId = partnerMetadata.outboundReportId(); if (metadataIsStale(partnerMetadata) && outboundReportId != null) { + + RSEndpointClient rsclient = + ApplicationContext.getImplementation(RSEndpointClient.class); + logger.logInfo( "Receiver name not found in metadata or delivery status still pending, looking up {} from RS history API", outboundReportId); diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java index e8fec6f52..dfc84c8ee 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java @@ -4,11 +4,9 @@ import gov.hhs.cdc.trustedintermediary.etor.RSEndpointClient; import gov.hhs.cdc.trustedintermediary.wrappers.AuthEngine; import gov.hhs.cdc.trustedintermediary.wrappers.Cache; -import gov.hhs.cdc.trustedintermediary.wrappers.HapiFhir; import gov.hhs.cdc.trustedintermediary.wrappers.HttpClient; import gov.hhs.cdc.trustedintermediary.wrappers.HttpClientException; import gov.hhs.cdc.trustedintermediary.wrappers.Logger; -import gov.hhs.cdc.trustedintermediary.wrappers.MetricMetadata; import gov.hhs.cdc.trustedintermediary.wrappers.SecretRetrievalException; import gov.hhs.cdc.trustedintermediary.wrappers.Secrets; import gov.hhs.cdc.trustedintermediary.wrappers.formatter.Formatter; @@ -45,13 +43,10 @@ public class ReportStreamEndpointClient implements RSEndpointClient { @Inject private HttpClient client; @Inject private AuthEngine jwt; @Inject private Formatter formatter; - @Inject private HapiFhir fhir; @Inject private Logger logger; @Inject private Secrets secrets; @Inject private Cache cache; - @Inject MetricMetadata metadata; - private static final ReportStreamEndpointClient INSTANCE = new ReportStreamEndpointClient(); public static ReportStreamEndpointClient getInstance() { diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java index ed63a24f4..85f0cb0c4 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java @@ -1,5 +1,6 @@ package gov.hhs.cdc.trustedintermediary.external.reportstream; +import gov.hhs.cdc.trustedintermediary.context.ApplicationContext; import gov.hhs.cdc.trustedintermediary.etor.RSEndpointClient; import gov.hhs.cdc.trustedintermediary.etor.messages.UnableToSendMessageException; import gov.hhs.cdc.trustedintermediary.etor.metadata.EtorMetadataStep; @@ -17,7 +18,7 @@ public class ReportStreamSenderHelper { private static final ReportStreamSenderHelper INSTANCE = new ReportStreamSenderHelper(); - @Inject RSEndpointClient rsclient; + // @Inject RSEndpointClient rsclient; @Inject Formatter formatter; @Inject Logger logger; @Inject MetricMetadata metadata; @@ -41,6 +42,9 @@ public Optional sendResultToReportStream(String body, String fhirResourc protected Optional sendToReportStream( String body, String fhirResourceId, PartnerMetadataMessageType messageType) throws UnableToSendMessageException { + + RSEndpointClient rsclient = ApplicationContext.getImplementation(RSEndpointClient.class); + String bearerToken; String rsResponseBody; diff --git a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java index 61b261c72..ea6d2daf4 100644 --- a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java +++ b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java @@ -13,6 +13,7 @@ import java.nio.file.attribute.PosixFilePermissions; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -28,6 +29,8 @@ public class ApplicationContext { protected static final Map, Object> OBJECT_MAP = new ConcurrentHashMap<>(); + protected static final InheritableThreadLocal, Object>> THREAD_OBJECT_MAP = + new InheritableThreadLocal<>(); protected static final Map TEST_ENV_VARS = new ConcurrentHashMap<>(); protected static final Set IMPLEMENTATIONS = new HashSet<>(); @@ -40,7 +43,28 @@ public static void register(Class clazz, Object implementation) { IMPLEMENTATIONS.add(implementation.getClass()); } + public static void registerForThread(Class clazz, Object implementation) { + Map, Object> threadObjectMap = THREAD_OBJECT_MAP.get(); + if (threadObjectMap == null) { + threadObjectMap = new HashMap<>(); + } + + threadObjectMap.put(clazz, implementation); + + THREAD_OBJECT_MAP.set(threadObjectMap); + } + + public static void clearThreadRegistrations() { + THREAD_OBJECT_MAP.remove(); + } + public static T getImplementation(Class clazz) { + // check the thread local map first + Map, Object> threadObjectMap = THREAD_OBJECT_MAP.get(); + if (threadObjectMap != null && threadObjectMap.containsKey(clazz)) { + return (T) threadObjectMap.get(clazz); + } + T object = (T) OBJECT_MAP.get(clazz); if (object == null) { From 0f55439e1e8f157a2716b2dc9a12c425c7f020ae Mon Sep 17 00:00:00 2001 From: halprin Date: Wed, 18 Dec 2024 20:58:38 -0700 Subject: [PATCH 05/36] Make Inject work on the per thread injects --- .../cdc/trustedintermediary/etor/EtorDomainRegistration.java | 2 +- .../external/localfile/MockRSEndpointClient.java | 1 + .../external/reportstream/ReportStreamEndpointClient.java | 1 + .../hhs/cdc/trustedintermediary/context/ApplicationContext.java | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java index 95c01ae04..854f984b3 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java @@ -227,7 +227,7 @@ protected DomainResponse handleMessageRequest( boolean markMetadataAsFailed = false; String errorMessage = ""; - if ("True".equals(request.getHeaders().get("Load-Test")) + if ("True".equals(request.getHeaders().get("load-test")) && ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { ApplicationContext.registerForThread( RSEndpointClient.class, MockRSEndpointClient.getInstance()); diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/MockRSEndpointClient.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/MockRSEndpointClient.java index fdbfe9d95..fe8f8167f 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/MockRSEndpointClient.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/MockRSEndpointClient.java @@ -30,6 +30,7 @@ private MockRSEndpointClient() {} @Override public String getRsToken() { + logger.logInfo("!!!!!!!!! WE ARE IN THE MOCK IMPLEMENTATION !!!!!!!!!"); return "token"; } diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java index dfc84c8ee..70b616230 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java @@ -151,6 +151,7 @@ protected String requestToken() throws ReportStreamEndpointClientException { @Override public String getRsToken() throws ReportStreamEndpointClientException { + logger.logInfo("######### {[{[{[{[{[REAL IMPLEMENTATION]}]}]}]}]} #########"); logger.logInfo("Looking up ReportStream token"); var token = cache.get(RS_TOKEN_CACHE_ID); diff --git a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java index ea6d2daf4..46b5f2599 100644 --- a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java +++ b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java @@ -52,6 +52,8 @@ public static void registerForThread(Class clazz, Object implementation) { threadObjectMap.put(clazz, implementation); THREAD_OBJECT_MAP.set(threadObjectMap); + + injectIntoNonSingleton(implementation); } public static void clearThreadRegistrations() { From 54cfc1ba37600779337b4ffebc8efb10865959fa Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 3 Jan 2025 10:49:20 -0700 Subject: [PATCH 06/36] Add some comments and delete some commented out code --- .../etor/metadata/partner/PartnerMetadataOrchestrator.java | 1 - .../external/reportstream/ReportStreamSenderHelper.java | 1 - .../cdc/trustedintermediary/context/ApplicationContext.java | 4 ++++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java index ab1746058..33a8091e0 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java @@ -32,7 +32,6 @@ public class PartnerMetadataOrchestrator { @Inject PartnerMetadataStorage partnerMetadataStorage; @Inject MessageLinkStorage messageLinkStorage; - // @Inject RSEndpointClient rsclient; @Inject Formatter formatter; @Inject Logger logger; diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java index 85f0cb0c4..86877377f 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java @@ -18,7 +18,6 @@ public class ReportStreamSenderHelper { private static final ReportStreamSenderHelper INSTANCE = new ReportStreamSenderHelper(); - // @Inject RSEndpointClient rsclient; @Inject Formatter formatter; @Inject Logger logger; @Inject MetricMetadata metadata; diff --git a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java index 46b5f2599..0c4b3afea 100644 --- a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java +++ b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java @@ -53,6 +53,10 @@ public static void registerForThread(Class clazz, Object implementation) { THREAD_OBJECT_MAP.set(threadObjectMap); + // The implementation may never have had anything injected into it + // (e.g. it wasn't part of the bootstrapping implementations registered into the + // ApplicationContext), + // so inject into the implementation now. injectIntoNonSingleton(implementation); } From 7f8b16b821f6279d69cc9dfe007a8d242e039fc2 Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 3 Jan 2025 11:01:16 -0700 Subject: [PATCH 07/36] Pass in the Load-Test header in the load tests --- operations/locustfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/operations/locustfile.py b/operations/locustfile.py index 8fc5e1584..f2ad043b7 100644 --- a/operations/locustfile.py +++ b/operations/locustfile.py @@ -72,6 +72,7 @@ def post_message_request(self, endpoint, message): headers={ "Authorization": self.access_token, "RecordId": self.submission_id, + "Load-Test": "True", }, data=message.replace("{{placer_order_id}}", poi), ) From 7896fd0ccaf78254ed70b0ced3913d165de80f1d Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 3 Jan 2025 12:01:03 -0700 Subject: [PATCH 08/36] Check for load tests on the metadata endpoint too --- .../trustedintermediary/etor/EtorDomainRegistration.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java index 854f984b3..77babeaaf 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java @@ -174,6 +174,12 @@ DomainResponse handleResults(DomainRequest request) { } DomainResponse handleMetadata(DomainRequest request) { + if (Boolean.parseBoolean(request.getHeaders().get("load-test")) + && ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { + ApplicationContext.registerForThread( + RSEndpointClient.class, MockRSEndpointClient.getInstance()); + } + try { String metadataId = request.getPathParams().get("id"); Optional metadataOptional = @@ -227,7 +233,7 @@ protected DomainResponse handleMessageRequest( boolean markMetadataAsFailed = false; String errorMessage = ""; - if ("True".equals(request.getHeaders().get("load-test")) + if (Boolean.parseBoolean(request.getHeaders().get("load-test")) && ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { ApplicationContext.registerForThread( RSEndpointClient.class, MockRSEndpointClient.getInstance()); From 022e9b5c7d1bac2463b49984e56d0ee6ad2f9b6b Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 3 Jan 2025 12:36:02 -0700 Subject: [PATCH 09/36] pass load-test header to metadata endpoint for load tests --- operations/locustfile.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/operations/locustfile.py b/operations/locustfile.py index f2ad043b7..f8423d444 100644 --- a/operations/locustfile.py +++ b/operations/locustfile.py @@ -72,7 +72,7 @@ def post_message_request(self, endpoint, message): headers={ "Authorization": self.access_token, "RecordId": self.submission_id, - "Load-Test": "True", + "Load-Test": "true", }, data=message.replace("{{placer_order_id}}", poi), ) @@ -92,7 +92,10 @@ def get_v1_etor_metadata(self): if self.message_api_called: self.client.get( f"{METADATA_ENDPOINT}/{self.submission_id}", - headers={"Authorization": self.access_token}, + headers={ + "Authorization": self.access_token, + "Load-Test": "true", + }, name=f"{METADATA_ENDPOINT}/{{id}}", ) From 8be024f91187574bbd07883dd3293bb8db8497ad Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 3 Jan 2025 15:58:43 -0700 Subject: [PATCH 10/36] Add additional code comments about the thread specific implementations --- .../external/javalin/DomainsRegistration.java | 4 +++- .../cdc/trustedintermediary/etor/EtorDomainRegistration.java | 5 ++++- .../etor/metadata/partner/PartnerMetadataOrchestrator.java | 2 ++ .../external/reportstream/ReportStreamSenderHelper.java | 1 + .../cdc/trustedintermediary/context/ApplicationContext.java | 5 +++++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/DomainsRegistration.java b/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/DomainsRegistration.java index 4a575cb91..4540455c3 100644 --- a/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/DomainsRegistration.java +++ b/app/src/main/java/gov/hhs/cdc/trustedintermediary/external/javalin/DomainsRegistration.java @@ -122,7 +122,9 @@ static DomainConnector constructNewDomainConnector(Class handler, boolean isProtected) { return (Context ctx) -> { - ApplicationContext.clearThreadRegistrations(); + ApplicationContext + .clearThreadRegistrations(); // clear this thread's specific registrations from + // its previous use LOGGER.logInfo(ctx.method().name() + " " + ctx.url()); diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java index 77babeaaf..b420131ec 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java @@ -134,7 +134,6 @@ public Map> domainRegistra MessageLinkStorage.class, FileMessageLinkStorage.getInstance()); } - // these are default implementations if (ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { ApplicationContext.register( RSEndpointClient.class, ReportStreamEndpointClient.getInstance()); @@ -176,6 +175,8 @@ DomainResponse handleResults(DomainRequest request) { DomainResponse handleMetadata(DomainRequest request) { if (Boolean.parseBoolean(request.getHeaders().get("load-test")) && ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { + // register the mock RS endpoint for this HTTP request because we don't want to call RS + // for real when doing a load test. ApplicationContext.registerForThread( RSEndpointClient.class, MockRSEndpointClient.getInstance()); } @@ -235,6 +236,8 @@ protected DomainResponse handleMessageRequest( if (Boolean.parseBoolean(request.getHeaders().get("load-test")) && ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { + // register the mock RS endpoint for this HTTP request because we don't want to call RS + // for real when doing a load test. ApplicationContext.registerForThread( RSEndpointClient.class, MockRSEndpointClient.getInstance()); } diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java index 33a8091e0..8597c75b5 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/metadata/partner/PartnerMetadataOrchestrator.java @@ -44,6 +44,7 @@ private PartnerMetadataOrchestrator() {} public void updateMetadataForInboundMessage(PartnerMetadata partnerMetadata) throws PartnerMetadataException { + // can't @Inject because the implementation can be different for this specific thread RSEndpointClient rsclient = ApplicationContext.getImplementation(RSEndpointClient.class); logger.logInfo( @@ -133,6 +134,7 @@ public Optional getMetadata(String inboundReportId) var outboundReportId = partnerMetadata.outboundReportId(); if (metadataIsStale(partnerMetadata) && outboundReportId != null) { + // can't @Inject because the implementation can be different for this specific thread RSEndpointClient rsclient = ApplicationContext.getImplementation(RSEndpointClient.class); diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java index 86877377f..c1bd14e1b 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamSenderHelper.java @@ -42,6 +42,7 @@ protected Optional sendToReportStream( String body, String fhirResourceId, PartnerMetadataMessageType messageType) throws UnableToSendMessageException { + // can't @Inject because the implementation can be different for this specific thread RSEndpointClient rsclient = ApplicationContext.getImplementation(RSEndpointClient.class); String bearerToken; diff --git a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java index 0c4b3afea..1d628bf06 100644 --- a/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java +++ b/shared/src/main/java/gov/hhs/cdc/trustedintermediary/context/ApplicationContext.java @@ -43,6 +43,10 @@ public static void register(Class clazz, Object implementation) { IMPLEMENTATIONS.add(implementation.getClass()); } + /** + * Registers an implementation for a class _only_ for the current executing thread (which + * currently is one-to-one with an HTTP request). + */ public static void registerForThread(Class clazz, Object implementation) { Map, Object> threadObjectMap = THREAD_OBJECT_MAP.get(); if (threadObjectMap == null) { @@ -60,6 +64,7 @@ public static void registerForThread(Class clazz, Object implementation) { injectIntoNonSingleton(implementation); } + /** Removes the stored implementations for the current thread that calls this method. */ public static void clearThreadRegistrations() { THREAD_OBJECT_MAP.remove(); } From fcd9c16982171b0c6c124c2853f1356e166915fd Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 3 Jan 2025 15:59:55 -0700 Subject: [PATCH 11/36] Remove old debug logging --- .../external/localfile/MockRSEndpointClient.java | 1 - .../external/reportstream/ReportStreamEndpointClient.java | 1 - 2 files changed, 2 deletions(-) diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/MockRSEndpointClient.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/MockRSEndpointClient.java index fe8f8167f..fdbfe9d95 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/MockRSEndpointClient.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/localfile/MockRSEndpointClient.java @@ -30,7 +30,6 @@ private MockRSEndpointClient() {} @Override public String getRsToken() { - logger.logInfo("!!!!!!!!! WE ARE IN THE MOCK IMPLEMENTATION !!!!!!!!!"); return "token"; } diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java index 70b616230..dfc84c8ee 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/reportstream/ReportStreamEndpointClient.java @@ -151,7 +151,6 @@ protected String requestToken() throws ReportStreamEndpointClientException { @Override public String getRsToken() throws ReportStreamEndpointClientException { - logger.logInfo("######### {[{[{[{[{[REAL IMPLEMENTATION]}]}]}]}]} #########"); logger.logInfo("Looking up ReportStream token"); var token = cache.get(RS_TOKEN_CACHE_ID); From be3a8980f014d22012bf4b2c15c8b29fdb7f8733 Mon Sep 17 00:00:00 2001 From: James Herr Date: Fri, 3 Jan 2025 17:00:22 -0600 Subject: [PATCH 12/36] Started Azure Load Test Action creation Co-Authored-By: Jeremy Rosenfeld <10262289+JeremyIR@users.noreply.github.com> Co-Authored-By: halprin --- .github/workflows/azure-load-tests.yml | 44 ++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/azure-load-tests.yml diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml new file mode 100644 index 000000000..1d3db4c06 --- /dev/null +++ b/.github/workflows/azure-load-tests.yml @@ -0,0 +1,44 @@ +name: Azure Load Tests + +on: + push: + branches: + - azure-load-tests + #schedule: + + #- cron: "0 0 * * 1" + workflow_dispatch: + inputs: + rollbackCount: + description: 'Number of migrations to rollback' + required: true + default: # of rollback you require in the file input + + +jobs: + loadtest: + name: Load Test + runs-on: ubuntu-latest + + steps: + # Checkout the repository + - name: Checkout Repository + uses: actions/checkout@v2 + + # Login to Azure using the CLI + - name: Login via Azure CLI + uses: azure/login@v2 + with: + client-id: ${{ secrets.AZURE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + # Run the Azure Load Test + - name: Run Load Test + run: | + az load test-run create \ + --resource-group "csels-rsti-internal-moderate-rg" \ + --load-test-name "jeff-load-test" \ + --test-run-name "github-action-triggered-test-run" \ + --test-id "9020b745-5fc4-4284-8803-04076ea09650" \ + --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}" From 565d2b6488a50dfd11c4d4168b625def3d17ed5a Mon Sep 17 00:00:00 2001 From: jeremyir Date: Fri, 3 Jan 2025 16:02:31 -0800 Subject: [PATCH 13/36] add permissions block to workflow --- .github/workflows/azure-load-tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 1d3db4c06..83bb583a3 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -19,6 +19,9 @@ jobs: loadtest: name: Load Test runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: # Checkout the repository @@ -33,7 +36,8 @@ jobs: tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - # Run the Azure Load Test + + # Run the Azure Load Test - name: Run Load Test run: | az load test-run create \ From b085490263413f6097d2b283bfd8ab41eb501bbc Mon Sep 17 00:00:00 2001 From: James Herr Date: Mon, 6 Jan 2025 10:25:16 -0600 Subject: [PATCH 14/36] Added secret definitions Co-Authored-By: Samuel Aquino Co-Authored-By: Sylvie <38440028+somesylvie@users.noreply.github.com> --- .github/workflows/azure-load-tests.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 83bb583a3..8a9aca551 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -7,13 +7,15 @@ on: #schedule: #- cron: "0 0 * * 1" - workflow_dispatch: - inputs: - rollbackCount: - description: 'Number of migrations to rollback' - required: true - default: # of rollback you require in the file input + workflow_call: + secrets: + AZURE_CLIENT_ID: + required: true + AZURE_TENANT_ID: + required: true + AZURE_SUBSCRIPTION_ID: + required: true jobs: loadtest: From d8ae1a4382c760de99b38479fa8574479e6f843d Mon Sep 17 00:00:00 2001 From: jeremyir Date: Mon, 6 Jan 2025 10:13:39 -0800 Subject: [PATCH 15/36] try to fix az login with set oidc to true --- .github/workflows/azure-load-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 8a9aca551..7b21e3ac9 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -24,6 +24,8 @@ jobs: permissions: id-token: write contents: read + env: + ARM_USE_OIDC: true steps: # Checkout the repository From c905fe7abee0862267b411cc6901359c0b0c7c48 Mon Sep 17 00:00:00 2001 From: jeremyir Date: Mon, 6 Jan 2025 10:40:42 -0800 Subject: [PATCH 16/36] specify environment in gh actions --- .github/workflows/azure-load-tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 7b21e3ac9..ae6d59068 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -20,12 +20,13 @@ on: jobs: loadtest: name: Load Test + environment: + name: internal + runs-on: ubuntu-latest permissions: id-token: write contents: read - env: - ARM_USE_OIDC: true steps: # Checkout the repository From 467cc3bf155579de71ec987443b551bad43a106b Mon Sep 17 00:00:00 2001 From: James Herr Date: Mon, 6 Jan 2025 14:21:15 -0600 Subject: [PATCH 17/36] Fixed parameters for az load test-run Co-Authored-By: Sylvie <38440028+somesylvie@users.noreply.github.com> Co-Authored-By: Jeremy Rosenfeld <10262289+JeremyIR@users.noreply.github.com> Co-Authored-By: Bella L. Quintero <96704946+pluckyswan@users.noreply.github.com> --- .github/workflows/azure-load-tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index ae6d59068..2ca7b45af 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -46,8 +46,6 @@ jobs: - name: Run Load Test run: | az load test-run create \ - --resource-group "csels-rsti-internal-moderate-rg" \ - --load-test-name "jeff-load-test" \ - --test-run-name "github-action-triggered-test-run" \ + --load-test-resource "jeff-load-test" \ --test-id "9020b745-5fc4-4284-8803-04076ea09650" \ - --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}" + --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` From fbdf77ef8b0ea336bf0b69151cd0a34da69832cd Mon Sep 17 00:00:00 2001 From: James Herr Date: Mon, 6 Jan 2025 14:23:31 -0600 Subject: [PATCH 18/36] Added resource group Co-Authored-By: Sylvie <38440028+somesylvie@users.noreply.github.com> Co-Authored-By: Bella L. Quintero <96704946+pluckyswan@users.noreply.github.com> --- .github/workflows/azure-load-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 2ca7b45af..a920e5dd2 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -46,6 +46,7 @@ jobs: - name: Run Load Test run: | az load test-run create \ + --resource-group "csels-rsti-internal-moderate-rg" \ --load-test-resource "jeff-load-test" \ --test-id "9020b745-5fc4-4284-8803-04076ea09650" \ --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` From d3aa1da0868bbdfa176e941796f6551c35b730b3 Mon Sep 17 00:00:00 2001 From: James Herr Date: Mon, 6 Jan 2025 16:02:17 -0600 Subject: [PATCH 19/36] Updated test name Co-Authored-By: Sylvie <38440028+somesylvie@users.noreply.github.com> Co-Authored-By: halprin --- .github/workflows/azure-load-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index a920e5dd2..1429f87c1 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -47,6 +47,6 @@ jobs: run: | az load test-run create \ --resource-group "csels-rsti-internal-moderate-rg" \ - --load-test-resource "jeff-load-test" \ + --load-test-resource "load-testing-internal" \ --test-id "9020b745-5fc4-4284-8803-04076ea09650" \ --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` From 283abd1759f60fbe2e6652108432033ea7aa18c9 Mon Sep 17 00:00:00 2001 From: jeremyir Date: Mon, 6 Jan 2025 14:29:03 -0800 Subject: [PATCH 20/36] add inputs for workflow dispatch with conditional logic --- .github/workflows/azure-load-tests.yml | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 1429f87c1..7da237b52 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -8,6 +8,17 @@ on: #- cron: "0 0 * * 1" + workflow_dispatch: + inputs: + load-test-name: + required: true + type: string + description: name of load test that is run + test-id: + required: true + type: string + description: test id for load test + workflow_call: secrets: AZURE_CLIENT_ID: @@ -43,10 +54,24 @@ jobs: # Run the Azure Load Test - - name: Run Load Test + - name: Run Load Test On Push + if: github.event_name == 'push' run: | az load test-run create \ --resource-group "csels-rsti-internal-moderate-rg" \ --load-test-resource "load-testing-internal" \ --test-id "9020b745-5fc4-4284-8803-04076ea09650" \ --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` + # Run the Azure Load Test + + - name: Trigger Load Test + if: github.event_name == 'workflow_dispatch' + run: | + az load test-run create \ + --resource-group "csels-rsti-internal-moderate-rg" \ + --load-test-resource "${{ github.event.inputs.load-test-name }}" \ + --test-id "${{ github.event.inputs.test-id }}" \ + --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` + + + From d14e96f5ae4ca28cf18d63b92d9f335850808f22 Mon Sep 17 00:00:00 2001 From: jeremyir Date: Tue, 7 Jan 2025 10:21:37 -0800 Subject: [PATCH 21/36] remove inputs and conditional workflow dispatch load test step --- .github/workflows/azure-load-tests.yml | 27 ++------------------------ 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 7da237b52..f699ef9e4 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -4,20 +4,9 @@ on: push: branches: - azure-load-tests - #schedule: - - #- cron: "0 0 * * 1" - workflow_dispatch: - inputs: - load-test-name: - required: true - type: string - description: name of load test that is run - test-id: - required: true - type: string - description: test id for load test + #schedule: + #- cron: "0 0 * * 1" workflow_call: secrets: @@ -52,26 +41,14 @@ jobs: tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - # Run the Azure Load Test - name: Run Load Test On Push - if: github.event_name == 'push' run: | az load test-run create \ --resource-group "csels-rsti-internal-moderate-rg" \ --load-test-resource "load-testing-internal" \ --test-id "9020b745-5fc4-4284-8803-04076ea09650" \ --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` - # Run the Azure Load Test - - name: Trigger Load Test - if: github.event_name == 'workflow_dispatch' - run: | - az load test-run create \ - --resource-group "csels-rsti-internal-moderate-rg" \ - --load-test-resource "${{ github.event.inputs.load-test-name }}" \ - --test-id "${{ github.event.inputs.test-id }}" \ - --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` - From fdcb850832f3d7f97f7cd824fdccc267c5c7312a Mon Sep 17 00:00:00 2001 From: jeremyir Date: Tue, 7 Jan 2025 11:35:22 -0800 Subject: [PATCH 22/36] clean up load tests files and add cron job for az loadtest Co-authored-by: pluckyswan <96704946+pluckyswan@users.noreply.github.com> Co-authored-by: saquino0827 Co-authored-by: James Herr Co-authored-by: Sylvie Co-authored-by: jcrichlake --- .github/workflows/azure-load-tests.yml | 14 ++++++-------- operations/locustfile.py | 1 - 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index f699ef9e4..1810b61d3 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -5,8 +5,8 @@ on: branches: - azure-load-tests workflow_dispatch: - #schedule: - #- cron: "0 0 * * 1" + schedule: + - cron: "0 0 * * 1" workflow_call: secrets: @@ -42,13 +42,11 @@ jobs: subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} # Run the Azure Load Test - - name: Run Load Test On Push + - name: Run Load Test run: | az load test-run create \ --resource-group "csels-rsti-internal-moderate-rg" \ - --load-test-resource "load-testing-internal" \ + --load-test-resource "jeff-load-test" \ --test-id "9020b745-5fc4-4284-8803-04076ea09650" \ - --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` - - - + --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` \ + --description "Run by Github Action" diff --git a/operations/locustfile.py b/operations/locustfile.py index f8423d444..de37491ff 100644 --- a/operations/locustfile.py +++ b/operations/locustfile.py @@ -144,7 +144,6 @@ def get_auth_request_body(): # using a valid test token found in the mock_credentials directory # TODO - notes/clarification on 2 different creds, plus expiration date of jwt - # TODO - do we want to TF the tests? If yes which envs? In CDC envs, may need to adjust IP allow list on app. Also set as private endpoints in test config? # TODO - currently in Azure we're specifying a version for the key vault item (so if it gets updated, we'll be referencing an old version) - do we want to change this? if in_azure: auth_token = os.getenv("trusted-intermediary-valid-token-jwt") From 6fcaad24d6d48ed31c5fd99dab334d09eb150034 Mon Sep 17 00:00:00 2001 From: jeremyir Date: Tue, 7 Jan 2025 11:36:15 -0800 Subject: [PATCH 23/36] clean up load testing ADR and add context Co-authored-by: pluckyswan <96704946+pluckyswan@users.noreply.github.com> Co-authored-by: saquino0827 Co-authored-by: James Herr Co-authored-by: Sylvie Co-authored-by: jcrichlake --- adr/008-load-testing.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/adr/008-load-testing.md b/adr/008-load-testing.md index 56f4885b1..13c9f44b3 100644 --- a/adr/008-load-testing.md +++ b/adr/008-load-testing.md @@ -1,6 +1,7 @@ # 8. Load Testing -Date: 2022-12-21 +Initial date: 2022-12-21 +Updated: 2025-01-07 ## Decision @@ -16,11 +17,16 @@ Accepted. Load Testing will assist in determining the performance of a system under real-life load conditions, both normal and extreme. +In January 2025, we added the capability to run load tests automatically on a schedule in Azure. +In the deployed load tests, we're hitting mock ReportStream endpoints. This allows us to 1) not +bombard ReportStream with unexpected traffic and 2) identify performance issues that are specific +to the Intermediary. + ## Impact ### Positive -- **Scalability:** Locust.io is highly scalable and can simulate millions of users, making it ideal for both small-scale and large-scale load tests. +- **Scalability:** Locust.io is highly scalable and can simulate millions of users, making it ideal for both small-scale and large-scale load tests. - **Python-Based:** Writing tests in Python allows for flexibility and ease of use, especially for teams already familiar with the language. @@ -29,6 +35,9 @@ real-life load conditions, both normal and extreme. - **Cost Efficiency:** Locust.io is open-source, and doesn’t require licensing fees, which can reduce the overall cost of performance testing. +- **Azure:** Running the load tests on a schedule in a more realistic enviornment gives us more consistent data + + ### Negative - **Limited Features:** Compared to more feature-rich tools, Locust.io might lack advanced performance monitoring or detailed reporting features. @@ -48,6 +57,12 @@ real-life load conditions, both normal and extreme. - **Resource Usage:** Running large-scale tests using Locust.io may require significant system resources, which could impact cost and infrastructure planning. +- **Locust Future in Azure is Uncertain:** We were able to create a Locust test in Azure in November 2024, but as of January 2025, were unable to create another one. We've submitted a bug report, but if we remain unable to create Locust tests in Azure, we won't be able to expand this test setup to other environments + + +- **Azure Load Testing Cannot be Terraformed:** Since Azure Load Testing resources can't be created/managed in Terraform, they must be created manually. This is more work and more error prone + + ### Related Issues -- #76 +- #76, #1122 From 30979750111b9b3ff7f75768b1402363871353d8 Mon Sep 17 00:00:00 2001 From: James Herr Date: Tue, 7 Jan 2025 13:58:07 -0600 Subject: [PATCH 24/36] Changed cron schedule Co-Authored-By: Sylvie <38440028+somesylvie@users.noreply.github.com> Co-Authored-By: halprin Co-Authored-By: jcrichlake <145698165+jcrichlake@users.noreply.github.com> Co-Authored-By: Bella L. Quintero <96704946+pluckyswan@users.noreply.github.com> --- .github/workflows/azure-load-tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 1810b61d3..3600133d7 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -1,12 +1,9 @@ name: Azure Load Tests on: - push: - branches: - - azure-load-tests workflow_dispatch: schedule: - - cron: "0 0 * * 1" + - cron: "0 0 * * 2" # Midnight UTC on Tuesdays workflow_call: secrets: From 00812a346587b0c062101167a12133d8e8d9f32d Mon Sep 17 00:00:00 2001 From: James Herr Date: Tue, 7 Jan 2025 14:02:56 -0600 Subject: [PATCH 25/36] Cleaned up TODOs Co-Authored-By: Sylvie <38440028+somesylvie@users.noreply.github.com> Co-Authored-By: halprin Co-Authored-By: jcrichlake <145698165+jcrichlake@users.noreply.github.com> Co-Authored-By: Bella L. Quintero <96704946+pluckyswan@users.noreply.github.com> --- operations/locustfile.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/operations/locustfile.py b/operations/locustfile.py index de37491ff..450c33774 100644 --- a/operations/locustfile.py +++ b/operations/locustfile.py @@ -140,11 +140,9 @@ def assert_stats(environment): def get_auth_request_body(): - # set up the sample request body for the auth endpoint - # using a valid test token found in the mock_credentials directory - - # TODO - notes/clarification on 2 different creds, plus expiration date of jwt - # TODO - currently in Azure we're specifying a version for the key vault item (so if it gets updated, we'll be referencing an old version) - do we want to change this? + # Set up the sample request body for the auth endpoint + # using a valid test token. For local testing, the jwt is found in the mock_credentials directory. + # For deployed load tests, the jwt is stored in Azure Key Vault. This jwt expires in December 2029 if in_azure: auth_token = os.getenv("trusted-intermediary-valid-token-jwt") else: From cadf54a28241f48ef351edd06973499e6f28fea2 Mon Sep 17 00:00:00 2001 From: James Herr Date: Tue, 7 Jan 2025 14:03:10 -0600 Subject: [PATCH 26/36] Added comment for future RS endpoints Co-Authored-By: Sylvie <38440028+somesylvie@users.noreply.github.com> Co-Authored-By: halprin Co-Authored-By: jcrichlake <145698165+jcrichlake@users.noreply.github.com> Co-Authored-By: Bella L. Quintero <96704946+pluckyswan@users.noreply.github.com> --- .../cdc/trustedintermediary/etor/EtorDomainRegistration.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java index b420131ec..1a6068b1c 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/etor/EtorDomainRegistration.java @@ -173,6 +173,7 @@ DomainResponse handleResults(DomainRequest request) { } DomainResponse handleMetadata(DomainRequest request) { + // Any new endpoint that will call RS **must** include this check. if (Boolean.parseBoolean(request.getHeaders().get("load-test")) && ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { // register the mock RS endpoint for this HTTP request because we don't want to call RS @@ -234,6 +235,7 @@ protected DomainResponse handleMessageRequest( boolean markMetadataAsFailed = false; String errorMessage = ""; + // Any new endpoint that will call RS **must** include this check. if (Boolean.parseBoolean(request.getHeaders().get("load-test")) && ApplicationContext.isPropertyPresent("REPORT_STREAM_URL_PREFIX")) { // register the mock RS endpoint for this HTTP request because we don't want to call RS From 39e3d1816e64d87615ef3931be73b4bac30a53e0 Mon Sep 17 00:00:00 2001 From: halprin Date: Wed, 8 Jan 2025 10:47:01 -0700 Subject: [PATCH 27/36] Use latest version of actions/checkout GitHub action --- .github/workflows/azure-load-tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 3600133d7..881646b48 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -26,11 +26,9 @@ jobs: contents: read steps: - # Checkout the repository - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - # Login to Azure using the CLI - name: Login via Azure CLI uses: azure/login@v2 with: @@ -38,7 +36,6 @@ jobs: tenant-id: ${{ secrets.AZURE_TENANT_ID }} subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - # Run the Azure Load Test - name: Run Load Test run: | az load test-run create \ From 0e3ebd599da14559dfbce338a7448f37ee301006 Mon Sep 17 00:00:00 2001 From: halprin Date: Wed, 8 Jan 2025 10:50:06 -0700 Subject: [PATCH 28/36] Update load test resource and test ID to no longer be jeff-load-test --- .github/workflows/azure-load-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 881646b48..66b14bd21 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -40,7 +40,7 @@ jobs: run: | az load test-run create \ --resource-group "csels-rsti-internal-moderate-rg" \ - --load-test-resource "jeff-load-test" \ - --test-id "9020b745-5fc4-4284-8803-04076ea09650" \ + --load-test-resource "load-testing-internal" \ + --test-id "47a5e722-d63b-4ec9-8b05-17372866f00a" \ --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` \ --description "Run by Github Action" From 28a9557e011a61aaaab5fcaca114a78c03617fb0 Mon Sep 17 00:00:00 2001 From: halprin Date: Wed, 8 Jan 2025 10:51:02 -0700 Subject: [PATCH 29/36] make the test run ID with timestamp be more ISO8601 --- .github/workflows/azure-load-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 66b14bd21..d39ba3bb8 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -42,5 +42,5 @@ jobs: --resource-group "csels-rsti-internal-moderate-rg" \ --load-test-resource "load-testing-internal" \ --test-id "47a5e722-d63b-4ec9-8b05-17372866f00a" \ - --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` \ + --test-run-id "run_"`date +"%Y-%m-%dT%_H:%M:%S"` \ --description "Run by Github Action" From 3ab98e0940b17825e91e61fb62408d8b7731eb75 Mon Sep 17 00:00:00 2001 From: halprin Date: Wed, 8 Jan 2025 11:19:19 -0700 Subject: [PATCH 30/36] Test load testing --- .github/workflows/azure-load-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index d39ba3bb8..0d42f6cd6 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -1,6 +1,9 @@ name: Azure Load Tests on: + push: + branches: + - azure-load-tests workflow_dispatch: schedule: - cron: "0 0 * * 2" # Midnight UTC on Tuesdays From 903c0b69186c77d3f30fe4190175bf4351daa6a4 Mon Sep 17 00:00:00 2001 From: halprin Date: Wed, 8 Jan 2025 11:58:42 -0700 Subject: [PATCH 31/36] Fine, do not ISO8601 --- .github/workflows/azure-load-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 0d42f6cd6..0bd45785e 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -45,5 +45,5 @@ jobs: --resource-group "csels-rsti-internal-moderate-rg" \ --load-test-resource "load-testing-internal" \ --test-id "47a5e722-d63b-4ec9-8b05-17372866f00a" \ - --test-run-id "run_"`date +"%Y-%m-%dT%_H:%M:%S"` \ + --test-run-id "run_"`date +"%Y%m%d%_H%M%S"` \ --description "Run by Github Action" From ebc896b33d98baf94acc11b56861b65dc3354194 Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 10 Jan 2025 10:05:44 -0700 Subject: [PATCH 32/36] Update readme to update local and start azure load tests --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f156bfcfc..1d0da9616 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,9 @@ weekday via Github actions. See [the rs-e2e readme](rs-e2e/README.md) for more d #### Load Testing Load tests are completed with [Locust.io](https://docs.locust.io/en/stable/installation.html). + +##### Running Locally + Run the load tests by running... ```shell @@ -184,13 +187,15 @@ Run the load tests by running... ./docker-load-execute.sh ``` -Currently, we are migrating to using Azure. Local load testing is using gradle, however a docker load test is available to mimic the Azure environment settings until the azure migration is complete. +The Gradle version runs our API via Gradle. The Docker version JARs our application and runs it in Docker. This will run the API for you, so no need to run it manually. + >**Note:** > >**If you are already running the API, stop it before running the load tests or the cleanup steps won't work.** -> + + The load tests will also spin up (and clean up) a local test DB on port 5434 that should not interfere with the local dev DB. The `locustfile.py` that specifies the load test is located at @@ -206,6 +211,12 @@ The terminal will start a local web interface, and you can enter the swarm parameters for the test and the local url where the app is running (usually `http://localhost:8080`). You can also set time limits for the tests under 'Advanced Settings'. +##### Running and Configuring in Azure + +To run, navigate to the +[Azure Load Tests GitHub Action](https://github.com/CDCgov/trusted-intermediary/actions/workflows/azure-load-tests.yml) +and click on Run workflow. + ### Debugging #### Attached JVM Config for IntelliJ From 1a37cacdd5585b6fe1cb73150b6323687717e31d Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 10 Jan 2025 11:52:33 -0700 Subject: [PATCH 33/36] readme on creating load test in Azure --- README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d0da9616..ec1f62326 100644 --- a/README.md +++ b/README.md @@ -211,12 +211,39 @@ The terminal will start a local web interface, and you can enter the swarm parameters for the test and the local url where the app is running (usually `http://localhost:8080`). You can also set time limits for the tests under 'Advanced Settings'. -##### Running and Configuring in Azure +##### Running and Creating in Azure To run, navigate to the [Azure Load Tests GitHub Action](https://github.com/CDCgov/trusted-intermediary/actions/workflows/azure-load-tests.yml) and click on Run workflow. +To create a new load test in Azure, the subscription first needs to be opted into Azure's Locust preview feature. +Afterwards, you can follow these steps... + +1. Navigate to the Azure Portal with the `?Microsoft_Azure_CloudNativeTesting_locust=true` query parameter. For + example, this [link](https://portal.azure.com/?Microsoft_Azure_CloudNativeTesting_locust=true) will work. +2. Navigate or search for the Azure Load Testing service and click Create. + 1. Walk through the wizard, but make sure to pick the same resource group as the environment you plan to test. +3. After creation, navigate to the Identity slice, which is under the Settings group, of your new load test. + 1. Turn the Status to On under the System assigned tab and click Save. +4. +5. Navigate to the Tests slice, which is under the Tests group, of the previously created load test and click Create and then Upload a script to start + walking through the wizard. + 1. Under the Test plan tab... + 1. Select the Locust radio button. + 2. Upload the [`./operations/locustfile.py`](./operations/locustfile.py) file. + 3. Additional data files from our repository used by the load test need to be uploaded. E.g. order and result + FHIR files. You can inspect the `locustfile.py` file to find out which data files are used. As of this + writing, that is `002_ORM_O01_short.fhir` and `001_ORU_R01_short.fhir`. + 2. Under the Parameters tab, add a secret with `trusted-intermediary-valid-token-jwt` as the name. The Value is the + secret URL referenced previously when you added the JWT to the key vault. + 3. Under the Load tab, configure how much load you want. You also need to provide the URL of the application you + want to load test. + 4. Under the Test criteria tab, fill in any client-side metrics that you want to evaluate at the end of the load + test. This makes it easy to tell whether the application has the performance we want. Consider whether you want + the test to automatically stop if there are too many errors. + 5. Create the test. All the other options not covered here should be looked at and considered. + ### Debugging #### Attached JVM Config for IntelliJ From 99d07f9ada8cd79972f40e168917593ce1bca60e Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 10 Jan 2025 14:47:34 -0700 Subject: [PATCH 34/36] Add key vault to readme for load test set-up --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ec1f62326..b3f933eab 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,16 @@ Afterwards, you can follow these steps... 1. Walk through the wizard, but make sure to pick the same resource group as the environment you plan to test. 3. After creation, navigate to the Identity slice, which is under the Settings group, of your new load test. 1. Turn the Status to On under the System assigned tab and click Save. -4. +4. Navigate to the TI key vault in the same resource group as the load test. + 1. Navigate to the Secrets slice, under the Objects group, and click Generate/Import. + 2. Provide the name `trusted-intermediary-valid-token-jwt`. + 3. The secret value should be a newly created JWT that won't expire in a long time using the + `organization-trusted-intermediary-private-key-.pem` private key in Keybase as the signing key. + 4. Click Create. + 5. Drill into the latest version of this secret, and click the copy to clipboard button in the Secret Identifier + textbox. We will be using this later during the creation of the actual load test. + 6. Navigate to the Access policies slice, and click Create. Select Get and List for Secrets for the permissions and + the name of the previously created load test as the principal. 5. Navigate to the Tests slice, which is under the Tests group, of the previously created load test and click Create and then Upload a script to start walking through the wizard. 1. Under the Test plan tab... @@ -236,7 +245,11 @@ Afterwards, you can follow these steps... FHIR files. You can inspect the `locustfile.py` file to find out which data files are used. As of this writing, that is `002_ORM_O01_short.fhir` and `001_ORU_R01_short.fhir`. 2. Under the Parameters tab, add a secret with `trusted-intermediary-valid-token-jwt` as the name. The Value is the - secret URL referenced previously when you added the JWT to the key vault. + secret URL referenced previously when you added the secret JWT to the key vault. Before pasting the secret, + remove the hexadecimal version from the end of the URL. E.g. + `https://.vault.azure.net/secrets/trusted-intermediary-valid-token-jwt/cf7eb05481c449878f2afe6b51464fd5` + becomes `https://.vault.azure.net/secrets/trusted-intermediary-valid-token-jwt/`. We always want to + reference the last version, and we can do so by omitting the specific version. 3. Under the Load tab, configure how much load you want. You also need to provide the URL of the application you want to load test. 4. Under the Test criteria tab, fill in any client-side metrics that you want to evaluate at the end of the load From ad1de773633d7012a82aa9a1b6be33ea192d82c6 Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 10 Jan 2025 14:53:35 -0700 Subject: [PATCH 35/36] Mention we cannot use Terraform --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3f933eab..f0e439e89 100644 --- a/README.md +++ b/README.md @@ -218,7 +218,7 @@ To run, navigate to the and click on Run workflow. To create a new load test in Azure, the subscription first needs to be opted into Azure's Locust preview feature. -Afterwards, you can follow these steps... +Sadly, the Azure Terraform provider doesn't support load tests so we need to create this via ClickOps. Therefore, you can follow these steps... 1. Navigate to the Azure Portal with the `?Microsoft_Azure_CloudNativeTesting_locust=true` query parameter. For example, this [link](https://portal.azure.com/?Microsoft_Azure_CloudNativeTesting_locust=true) will work. From 8e8eda0cd794e4edcc290c2cf614029877d4223b Mon Sep 17 00:00:00 2001 From: halprin Date: Fri, 10 Jan 2025 14:55:31 -0700 Subject: [PATCH 36/36] Remove azure load test on push to azure-load-test branch --- .github/workflows/azure-load-tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/azure-load-tests.yml b/.github/workflows/azure-load-tests.yml index 0bd45785e..66b14bd21 100644 --- a/.github/workflows/azure-load-tests.yml +++ b/.github/workflows/azure-load-tests.yml @@ -1,9 +1,6 @@ name: Azure Load Tests on: - push: - branches: - - azure-load-tests workflow_dispatch: schedule: - cron: "0 0 * * 2" # Midnight UTC on Tuesdays