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 d117e4d33..9c9dacf68 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 @@ -1,6 +1,6 @@ package gov.hhs.cdc.trustedintermediary.external.hapi; -import gov.hhs.cdc.trustedintermediary.plugin.path.FhirPath; +import gov.hhs.cdc.trustedintermediary.plugin.path.Hl7FhirMappingPath; import gov.hhs.cdc.trustedintermediary.wrappers.HapiFhir; import javax.inject.Inject; import org.hl7.fhir.r4.model.Bundle; @@ -24,66 +24,69 @@ private HapiMessageHelper() {} public String extractPlacerOrderNumber(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.PLACER_ORDER_NUMBER.getPath()); + messageBundle, Hl7FhirMappingPath.PLACER_ORDER_NUMBER.getFhirPath()); } public String extractSendingApplicationNamespace(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.SENDING_APPLICATION_NAMESPACE.getPath()); + messageBundle, Hl7FhirMappingPath.SENDING_APPLICATION_NAMESPACE.getFhirPath()); } public String extractSendingApplicationUniversalId(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.SENDING_APPLICATION_UNIVERSAL_ID.getPath()); + messageBundle, Hl7FhirMappingPath.SENDING_APPLICATION_UNIVERSAL_ID.getFhirPath()); } public String extractSendingApplicationUniversalIdType(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.SENDING_APPLICATION_UNIVERSAL_ID_TYPE.getPath()); + messageBundle, + Hl7FhirMappingPath.SENDING_APPLICATION_UNIVERSAL_ID_TYPE.getFhirPath()); } public String extractSendingFacilityNamespace(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.SENDING_FACILITY_NAMESPACE.getPath()); + messageBundle, Hl7FhirMappingPath.SENDING_FACILITY_NAMESPACE.getFhirPath()); } public String extractSendingFacilityUniversalId(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.SENDING_FACILITY_UNIVERSAL_ID.getPath()); + messageBundle, Hl7FhirMappingPath.SENDING_FACILITY_UNIVERSAL_ID.getFhirPath()); } public String extractSendingFacilityUniversalIdType(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.SENDING_FACILITY_UNIVERSAL_ID_TYPE.getPath()); + messageBundle, Hl7FhirMappingPath.SENDING_FACILITY_UNIVERSAL_ID_TYPE.getFhirPath()); } public String extractReceivingApplicationNamespace(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.RECEIVING_APPLICATION_NAMESPACE.getPath()); + messageBundle, Hl7FhirMappingPath.RECEIVING_APPLICATION_NAMESPACE.getFhirPath()); } public String extractReceivingApplicationUniversalId(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.RECEIVING_APPLICATION_UNIVERSAL_ID.getPath()); + messageBundle, Hl7FhirMappingPath.RECEIVING_APPLICATION_UNIVERSAL_ID.getFhirPath()); } public String extractReceivingApplicationUniversalIdType(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.RECEIVING_APPLICATION_UNIVERSAL_ID_TYPE.getPath()); + messageBundle, + Hl7FhirMappingPath.RECEIVING_APPLICATION_UNIVERSAL_ID_TYPE.getFhirPath()); } public String extractReceivingFacilityNamespace(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.RECEIVING_FACILITY_NAMESPACE.getPath()); + messageBundle, Hl7FhirMappingPath.RECEIVING_FACILITY_NAMESPACE.getFhirPath()); } public String extractReceivingFacilityUniversalId(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.RECEIVING_FACILITY_UNIVERSAL_ID.getPath()); + messageBundle, Hl7FhirMappingPath.RECEIVING_FACILITY_UNIVERSAL_ID.getFhirPath()); } public String extractReceivingFacilityUniversalIdType(Bundle messageBundle) { return fhirEngine.getStringFromFhirPath( - messageBundle, FhirPath.RECEIVING_FACILITY_UNIVERSAL_ID_TYPE.getPath()); + messageBundle, + Hl7FhirMappingPath.RECEIVING_FACILITY_UNIVERSAL_ID_TYPE.getFhirPath()); } } diff --git a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/plugin/path/FhirPath.java b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/plugin/path/Hl7FhirMappingPath.java similarity index 77% rename from etor/src/main/java/gov/hhs/cdc/trustedintermediary/plugin/path/FhirPath.java rename to etor/src/main/java/gov/hhs/cdc/trustedintermediary/plugin/path/Hl7FhirMappingPath.java index c28bbf6e8..5d0336e30 100644 --- a/etor/src/main/java/gov/hhs/cdc/trustedintermediary/plugin/path/FhirPath.java +++ b/etor/src/main/java/gov/hhs/cdc/trustedintermediary/plugin/path/Hl7FhirMappingPath.java @@ -1,16 +1,19 @@ package gov.hhs.cdc.trustedintermediary.plugin.path; /** - * Enumerates FHIR path expressions for various data elements within a FHIR message. These paths can - * be used to extract specific pieces of data from a FHIR message, such as identifiers, namespaces, - * and codes related to sending and receiving facilities and applications. + * Enumerates FHIR and HL7 path expressions for various data elements within a FHIR message. These + * paths can be used to extract specific pieces of data from a FHIR message, such as identifiers, + * namespaces, and codes related to sending and receiving facilities and applications. It also + * defines the HL7 field names. */ -public enum FhirPath { +public enum Hl7FhirMappingPath { PLACER_ORDER_NUMBER( + "ORC.2", """ Bundle.entry.resource.ofType(ServiceRequest).identifier.where(type.coding.code = 'PLAC').value """), SENDING_FACILITY_NAMESPACE( + "", """ Bundle.entry.resource.ofType(MessageHeader).sender.resolve().identifier.where( extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and @@ -18,6 +21,7 @@ public enum FhirPath { ).value """), SENDING_FACILITY_UNIVERSAL_ID( + "", """ Bundle.entry.resource.ofType(MessageHeader).sender.resolve().identifier.where( extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and @@ -25,6 +29,7 @@ public enum FhirPath { ).value """), SENDING_FACILITY_UNIVERSAL_ID_TYPE( + "", """ Bundle.entry.resource.ofType(MessageHeader).sender.resolve().identifier.where( extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and @@ -32,18 +37,22 @@ public enum FhirPath { ).type.coding.code """), SENDING_APPLICATION_NAMESPACE( + "", """ Bundle.entry.resource.ofType(MessageHeader).source.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/namespace-id').value """), SENDING_APPLICATION_UNIVERSAL_ID( + "", """ Bundle.entry.resource.ofType(MessageHeader).source.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id').value """), SENDING_APPLICATION_UNIVERSAL_ID_TYPE( + "", """ Bundle.entry.resource.ofType(MessageHeader).source.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type').value """), RECEIVING_FACILITY_NAMESPACE( + "", """ Bundle.entry.resource.ofType(MessageHeader).destination.receiver.resolve().identifier.where( extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and @@ -51,6 +60,7 @@ public enum FhirPath { ).value """), RECEIVING_FACILITY_UNIVERSAL_ID( + "", """ Bundle.entry.resource.ofType(MessageHeader).destination.receiver.resolve().identifier.where( extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and @@ -58,6 +68,7 @@ public enum FhirPath { ).value """), RECEIVING_FACILITY_UNIVERSAL_ID_TYPE( + "", """ Bundle.entry.resource.ofType(MessageHeader).destination.receiver.resolve().identifier.where( extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and @@ -65,25 +76,33 @@ public enum FhirPath { ).type.coding.code """), RECEIVING_APPLICATION_NAMESPACE( - """ + "", """ Bundle.entry.resource.ofType(MessageHeader).destination.name """), RECEIVING_APPLICATION_UNIVERSAL_ID( + "", """ Bundle.entry.resource.ofType(MessageHeader).destination.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id').value """), RECEIVING_APPLICATION_UNIVERSAL_ID_TYPE( + "", """ Bundle.entry.resource.ofType(MessageHeader).destination.extension.where(url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/universal-id-type').value """); - private final String path; + private final String fhirPath; + private final String hl7Path; + + Hl7FhirMappingPath(String hl7Path, String fhirPath) { + this.hl7Path = hl7Path; + this.fhirPath = fhirPath; + } - FhirPath(String path) { - this.path = path; + public String getHl7Path() { + return hl7Path; } - public String getPath() { - return path; + public String getFhirPath() { + return fhirPath; } }