Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified FHIR Path Mapping enum to include HL7v2 values #1087

Merged
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
@@ -1,89 +1,107 @@
package gov.hhs.cdc.trustedintermediary.plugin.path;

/**
* Enumerates FHIR path expressions for various data elements within a FHIR message. These paths can
* 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.
* 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
extension.value = 'HD.1'
).value
"""),
SENDING_FACILITY_UNIVERSAL_ID(
"",
"""
Bundle.entry.resource.ofType(MessageHeader).sender.resolve().identifier.where(
extension.url = 'https://reportstream.cdc.gov/fhir/StructureDefinition/hl7v2Field' and
extension.value = 'HD.2,HD.3'
).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
extension.value = 'HD.2,HD.3'
).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
extension.value = 'HD.1'
).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
extension.value = 'HD.2,HD.3'
).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
extension.value = 'HD.2,HD.3'
).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;
}
}
Loading