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

Update OML mappings #15910

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 55 additions & 13 deletions prime-router/metadata/HL7/catchall/hl7/message/OML_O21.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,48 @@ resources:
repeats: false
isReferenced: false

- resourceName: Provenance
segment: MSH
resourcePath: segments/MSH/Provenance-Source

- resourceName: Provenance
segment: MSH
resourcePath: segments/MSH/Provenance-Transformation

- resourceName: Patient
segment: .PID
group: PATIENT
resourcePath: segments/PID/Patient
isReferenced: true
repeats: false
additionalSegments:
- .PD1
- MSH
- .NTE
- .NK1

- resourceName: ServiceRequest
segment: .ORC
group: ORDER
resourcePath: segments/ORC/ServiceRequest
- resourceName: Provenance
segment: .PID
group: PATIENT
resourcePath: segments/PID/Provenance-Patient

- resourceName: RelatedPerson
segment: .NK1
group: PATIENT
resourcePath: segments/NK1/RelatedPerson
isReferenced: false
repeats: true

- resourceName: Encounter
segment: .PV1
group: PATIENT.PATIENT_VISIT
resourcePath: segments/PV1/Encounter
isReferenced: true
additionalSegments:
- .OBSERVATION_REQUEST.OBR
- .OBSERVATION_REQUEST.NTE
- PATIENT.PATIENT_VISIT.PV1
- .PV2
- MSH
- PATIENT.PID

- resourceName: Observation
- resourceName: OMLObservation
segment: .OBSERVATION_REQUEST.OBSERVATION.OBX
group: ORDER
resourcePath: segments/OBX/Observation
Expand All @@ -40,11 +61,32 @@ resources:
- .OBSERVATION_REQUEST.OBSERVATION.NTE
- MSH

- resourceName: Specimen
segment: SPECIMEN.SPM
group: ORDER.OBSERVATION_REQUEST
- resourceName: OMLSpecimenSource
segment: .OBSERVATION_REQUEST.OBR
group: ORDER
resourcePath: segments/ORC/Specimen
isReferenced: true
repeats: true

- resourceName: OMLSpecimen
segment: .OBSERVATION_REQUEST.SPECIMEN.SPM
group: ORDER
resourcePath: segments/SPM/Specimen
repeats: true
isReferenced: true
additionalSegments:
- MSH
- MSH

- resourceName: ServiceRequest
segment: .ORC
group: ORDER
resourcePath: segments/ORC/ServiceRequest
repeats: true
isReferenced: true
additionalSegments:
- .OBSERVATION_REQUEST.OBR
- .OBSERVATION_REQUEST.NTE
- PATIENT.PATIENT_VISIT.PV1
- MSH
- PATIENT.PID
- .OBSERVATION_REQUEST.OBSERVATION.OBX
4 changes: 2 additions & 2 deletions prime-router/metadata/HL7/catchall/hl7/message/ORU_R01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ resources:
- .NK1

- resourceName: Provenance
group: PATIENT_RESULT.PATIENT
segment: .PID
group: PATIENT_RESULT.PATIENT
resourcePath: segments/PID/Provenance-Patient

- resourceName: RelatedPerson
Expand All @@ -45,7 +45,7 @@ resources:
resourcePath: segments/PV1/Encounter
isReferenced: true
additionalSegments:
- .PATIENT.VISIT.PV2
- .VISIT.PV2
- MSH

- resourceName: Observation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,27 @@ subject:
expressionType: resource
specs: $Patient

specimen:
generateList: true
expressionType: nested
expressions:
- valueOf: datatype/Reference
generateList: true
expressionType: resource
specs: $OMLSpecimen
useGroup: true
- valueOf: datatype/Reference
expressionType: resource
specs: $OMLSpecimenSource
useGroup: true

supportingInfo:
generateList: true
valueOf: datatype/Reference
expressionType: resource
specs: $OMLObservation
useGroup: true

note:
valueOf: segments/NTE/Annotation
expressionType: resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ container:
expressionType: HL7Spec

collection:
condition: $spm7 NOT_NULL
expressionType: nested
generateList: true
expressionsMap:
Expand Down Expand Up @@ -62,6 +61,24 @@ collection:
type: STRING
valueOf: "GeneralUtils.dateTimeWithZoneId(dateTimeIn,ZONEID)"
expressionType: JEXL
_collectedDateTime:
condition: $dateTimeIn NOT_NULL && $end NULL
expressionType: nested
vars:
dateTimeIn: OBR.7
end: OBR.8
expressionsMap:
extension_1:
generateList: true
expressionType: nested
expressionsMap:
url:
type: SYSTEM_URL
value: hl7v2-date-time
valueString:
type: STRING
valueOf: $dateTimeIn
expressionType: HL7Spec
collector:
condition: $obr10 NOT_NULL
vars:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,15 @@ contact:
vars:
nk141: STRING, NK1.41
relationship:
valueOf: datatypes/CWE/CodeableConcept
expressionType: resource
specs: NK1.7
generateList: true
expressionType: nested
expressions:
- valueOf: datatypes/CWE/CodeableConcept
expressionType: resource
specs: NK1.3
- valueOf: datatypes/CWE/CodeableConcept
expressionType: resource
specs: NK1.7
period:
vars:
startDate: NK1.8
Expand Down
8 changes: 8 additions & 0 deletions prime-router/src/main/kotlin/fhirengine/utils/HL7Reader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import java.util.Date
import ca.uhn.hl7v2.model.v251.message.OML_O21 as v251_OML_O21
import ca.uhn.hl7v2.model.v251.message.ORU_R01 as v251_ORU_R01
import ca.uhn.hl7v2.model.v251.segment.MSH as v251_MSH
import ca.uhn.hl7v2.model.v27.message.OML_O21 as v27_OML_O21
import ca.uhn.hl7v2.model.v27.message.ORU_R01 as v27_ORU_R01
import ca.uhn.hl7v2.model.v27.segment.MSH as v27_MSH
import fhirengine.translation.hl7.structures.nistelr251.message.ORU_R01 as NIST_ELR_ORU_R01
Expand Down Expand Up @@ -141,6 +142,7 @@ class HL7Reader(private val actionLogger: ActionLogger) : Logging {
}
"OML" -> {
return listOf(
v27_OML_O21::class.java,
v251_OML_O21::class.java
)
}
Expand Down Expand Up @@ -301,6 +303,12 @@ class HL7Reader(private val actionLogger: ActionLogger) : Logging {
ValidationContextFactory.noValidation(),
ReportStreamCanonicalModelClassFactory(ORU_R01::class.java),
)
} else if (hl7MessageType?.msh93 == "OML_O21") {
DefaultHapiContext(
ParserConfiguration(),
ValidationContextFactory.noValidation(),
ReportStreamCanonicalModelClassFactory(v27_OML_O21::class.java),
)
} else {
DefaultHapiContext(ValidationContextFactory.noValidation())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# $schema: ./../../../../../../metadata/json_schema/fhir/fhir-to-hl7-mapping.json

hl7Class: ca.uhn.hl7v2.model.v251.message.OML_O21
hl7Class: ca.uhn.hl7v2.model.v27.message.OML_O21

constants:
# Prefix for RS custom extension URLs
rsext: '"https://reportstream.cdc.gov/fhir/StructureDefinition/"'

elements:
- name: message-headers
condition: >
Expand All @@ -15,63 +17,25 @@ elements:
schema: classpath:/metadata/hl7_mapping/resources/MessageHeader/MSH.yml

- name: software-segment
condition: 'Bundle.entry.resource.ofType(MessageHeader).exists()'
resource: 'Bundle.entry.resource.ofType(Provenance).where(entity.exists()).entity.what.resolve()'
schema: classpath:/metadata/hl7_mapping/resources/Device/SFT.yml

- name: software-segment-legacy
condition: >
Bundle.entry.resource.ofType(MessageHeader).exists() and
(Bundle.entry.resource.ofType(MessageHeader).source.extension(%`rsext-software-vendor-org`).exists() or
Bundle.entry.resource.ofType(Provenance).exists().not())
resource: 'Bundle.entry.resource.ofType(MessageHeader)'
schema: classpath:/metadata/hl7_mapping/resources/MessageHeader/SFT.yml

- name: patient-information
resource: 'Bundle.entry.resource.ofType(Patient)'
condition: '%resource.count() = 1'
required: true
constants:
hl7SegmentGroup: '/PATIENT'
schema: classpath:/metadata/hl7_mapping/common/patient.yml

- name: patient-contact
resource: 'Bundle.entry.resource.ofType(Patient).contact'
condition: '%resource.exists()'
constants:
hl7SegmentGroup: '/PATIENT'
schema: classpath:/metadata/hl7_mapping/common/patient-contact.yml

- name: patient-visit
resource: 'Bundle.entry.resource.ofType(Encounter)'
- name: patient-base
condition: '%resource.count() = 1'
constants:
hl7SegmentGroup: '/PATIENT/PATIENT_VISIT'
schema: classpath:/metadata/hl7_mapping/common/patient-visit.yml

- name: order
resource: Bundle.entry.resource.ofType(ServiceRequest)
condition: '%resource.count() > 0'
required: true
schema: classpath:/metadata/hl7_mapping/OML_O21/base/service-request-order.yml
constants:
hl7SegmentGroup: '/ORDER'
resource: 'Bundle.entry.resource.ofType(Patient)'
resourceIndex: patientIndex
schema: classpath:/metadata/hl7_mapping/OML_O21/base/patient/patient-base.yml

- name: order-observation-request
resource: Bundle.entry.resource.ofType(ServiceRequest)
condition: '%resource.count() > 0'
required: true
constants:
hl7SegmentGroup: '/ORDER/OBSERVATION_REQUEST'
schema: classpath:/metadata/hl7_mapping/OML_O21/base/service-request-order-observation.yml
- name: order-base
resource: 'Bundle.entry.resource.ofType(ServiceRequest).where(subject.resolve().id = %resource.entry.resource.ofType(Patient).id)'
resourceIndex: orderIndex

- name: order-observation-result
resource: Bundle.entry.resource.ofType(Observation)
condition: '%resource.count() > 0'
required: true
schema: classpath:/metadata/hl7_mapping/common/observation-result.yml
constants:
hl7SegmentGroup: '/ORDER/OBSERVATION_REQUEST/OBSERVATION(%{resultIndex})'
hl7OBXField: '%{hl7SegmentGroup}/OBX'
resourceIndex: resultIndex

- name: order-specimen
resource: Bundle.entry.resource.ofType(Specimen)
condition: '%resource.count() = 1'
required: true
schema: classpath:/metadata/hl7_mapping/common/specimen.yml
constants:
hl7SpecimenFieldPath: /ORDER/OBSERVATION_REQUEST/SPECIMEN/SPM
schema: classpath:/metadata/hl7_mapping/OML_O21/base/order/order-base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# $schema: ./../../../../../../metadata/json_schema/fhir/fhir-to-hl7-mapping.json

hl7Class: ca.uhn.hl7v2.model.v27.message.OML_O21

extends: classpath:/metadata/hl7_mapping/OML_O21/OML_O21-base.yml
elements:
- name: message-headers
condition: 'true'
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# $schema: ./../../../../../../../../../metadata/json_schema/fhir/fhir-to-hl7-mapping.json

elements:

- name: observation-request
required: true
schema: classpath:/metadata/hl7_mapping/OML_O21/base/order/observation-request/observation-request.yml

- name: observation-request-observation
schema: classpath:/metadata/hl7_mapping/OML_O21/base/order/observation-request/observation/observation.yml

- name: observation-request-specimen
resource: '%resource.specimen.resolve().where(extension(%`rsext-hl7v2Segment`).value = "SPM") | %resource.specimen.resolve().where(extension(%`rsext-hl7v2Segment`).exists().not())'
resourceIndex: specimenIndex
schema: classpath:/metadata/hl7_mapping/OML_O21/base/order/observation-request/specimen/specimen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# $schema: ./../../../../../../../../../metadata/json_schema/fhir/fhir-to-hl7-mapping.json

elements:

- name: observation-request-service-request
required: true
schema: classpath:/metadata/hl7_mapping/resources/ServiceRequest/OBR.yml
constants:
obrFieldPath: '/ORDER(%{orderIndex})/OBSERVATION_REQUEST/OBR'

# - name: observation-request-note
# todo in second pass, for ORU this is mapped through Observation.note; OML maps through ServiceRequest.note
# this is already mapped into fhir via ORC/ServiceRequest... where is fhir -> hl7?
# todo add scearnio in full oml test for an OBSERVATION_REQUEST.NTE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# $schema: ./../../../../../../../../../metadata/json_schema/fhir/fhir-to-hl7-mapping.json

constants:
observationPath: '%resource.supportingInfo.resolve().ofType(Observation).where(subject.resolve().id = %resource.subject.resolve().id)'

elements:

- name: observation-result
resource: '%observationPath'
resourceIndex: resultIndex
required: false
schema: classpath:/metadata/hl7_mapping/resources/Observation/OBX.yml
constants:
hl7OBXField: '/ORDER(%{orderIndex})/OBSERVATION_REQUEST/OBSERVATION(%{resultIndex})/OBX'
hl7ObservationPath: '/ORDER(%{orderIndex})/OBSERVATION_REQUEST/OBSERVATION(%{resultIndex})'

- name: observation-participation-information
resource: '%observationPath.device.resolve().where(udiCarrier.exists())' # correct?
schema: classpath:/metadata/hl7_mapping/resources/Device/PRT.yml
constants:
hl7SegmentGroup: '/ORDER(%{orderIndex})/OBSERVATION_REQUEST/OBSERVATION(%{resultIndex})'
Loading
Loading