diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/hapi/HapiMessageHelper.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/hapi/HapiMessageHelper.java index 4639fea6b..080e7edf7 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/hapi/HapiMessageHelper.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/external/hapi/HapiMessageHelper.java @@ -18,6 +18,62 @@ public class HapiMessageHelper { private String PLACER_ORDER_NUMBER_FHIR_PATH = "Bundle.entry.resource.ofType(ServiceRequest).identifier.where(type.coding.code = 'PLAC').value"; + private final String RECEIVING_FACILITY_NAMESPACE = + """ + MessageHeader.destination.receiver.resolve().identifier.where( + extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and + extension.valueString = 'HD.1' + ).value"""; + private final String RECEIVING_FACILITY_UNIVERSAL_ID = + """ + MessageHeader.destination.receiver.resolve().identifier.where( + extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and + extension.valueString = 'HD.2,HD.3' + ).value"""; + private final String RECIVING_FACILITY_UNIVERSAL_ID_TYPE = + """ + MessageHeader.destination.receiver.resolve().identifier.where( + extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and + extension.valueString = 'HD.2,HD.3' + ).type.coding.code"""; + private final String SENDING_FACILITY_NAMESPACE = + """ + Bundle.entry.resource.ofType(MessageHeader).sender.resolve().identifier.where( + extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and + extension.valueString = 'HD.1' + ).value + """; + private final String SENDING_FACILITY_UNIVERSAL_ID = + """ + MessageHeader.sender.resolve().identifier.where( + extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and + extension.valueString = 'HD.2,HD.3' + ).value"""; + private final String SENDING_FACILITY_UNIVERSAL_ID_TYPE = + """ + MessageHeader.sender.resolve().identifier.where( + extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and + extension.valueString = 'HD.2,HD.3' + ).type.coding.code"""; + + private final String SENDING_APPLICATION_NAMESPACE = + """ + Bundle.entry.resource.ofType(MessageHeader).source.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id').valueString"""; + private final String SENDING_APPLICATION_UNIVERSAL_ID = + """ + Bundle.entry.resource.ofType(MessageHeader).source.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id').valueString"""; + private final String SENDING_APPLICATION_UNIVERSAL_ID_TYPE = + """ + Bundle.entry.resource.ofType(MessageHeader).source.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type').valueString"""; + private final String RECEIVING_APPLICATION_NAMESPACE = + """ + Bundle.entry.resource.ofType(MessageHeader).destination.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id').valueString"""; + private final String RECEIVING_APPLICATION_UNIVERSAL_ID = + """ + Bundle.entry.resource.ofType(MessageHeader).destination.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id').valueString"""; + private final String RECEIVING_APPLICATION_UNIVERSAL_ID_TYPE = + """ + Bundle.entry.resource.ofType(MessageHeader).destination.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type').valueString"""; private final HapiFhir fhirEngine = ApplicationContext.getImplementation(HapiFhir.class); public static HapiMessageHelper getInstance() { diff --git a/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/hapi/HapiFhirImplementationTest.groovy b/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/hapi/HapiFhirImplementationTest.groovy index 9901792e9..afa6cc165 100644 --- a/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/hapi/HapiFhirImplementationTest.groovy +++ b/shared/src/test/groovy/gov/hhs/cdc/trustedintermediary/external/hapi/HapiFhirImplementationTest.groovy @@ -1,6 +1,5 @@ package gov.hhs.cdc.trustedintermediary.external.hapi -import ca.uhn.fhir.fhirpath.FhirPathExecutionException import gov.hhs.cdc.trustedintermediary.context.TestApplicationContext import gov.hhs.cdc.trustedintermediary.wrappers.FhirParseException import org.hl7.fhir.instance.model.api.IBaseResource