Skip to content

Commit

Permalink
Merge pull request #1087 from CDCgov/story1024/task-results-transform…
Browse files Browse the repository at this point in the history
…ation-mapping-path-refactor

Modified FHIR Path Mapping enum to include HL7v2 values
  • Loading branch information
tjohnson7021 authored May 10, 2024
2 parents 24c3baf + 1d66c20 commit 9838a71
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 24 deletions.
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,108 @@
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
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;
}
}

0 comments on commit 9838a71

Please sign in to comment.