Skip to content

Commit

Permalink
Platform/david navapbc/15514/hl7 oml aui fhir mapping (#16619)
Browse files Browse the repository at this point in the history
* probably not quite right yet

* asdf

* mr push face

* asdfA

* asdf

* tests pass

* test still failing

* expression works but test still fails

* no it was right the first time  and it's still not working:

* mr not working face

* working

* PR Feedback

* MSH-10 is a required field

* Adding Coverage/IN1 integration test

* Build failing because of file name case sensitivity, maybe

* Reapplying after merge

* Adding IN1 Coverage to OML integration test

* PR feedback

* Few more small changes

---------

Co-authored-by: David Holiday <[email protected]>
Co-authored-by: Josh Fisk <[email protected]>
  • Loading branch information
3 people authored Dec 5, 2024
1 parent 66c3691 commit e564319
Show file tree
Hide file tree
Showing 14 changed files with 304 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# $schema: ./../../../../../json_schema/fhir/hl7-to-fhir-mapping-resource-template.json

url:
type: STRING
valueOf: IN1.14

extension:
generateList: true
expressionType: nested
expressions:
- expressionType: nested
vars:
aui1: STRING_ALL, AUI.1
condition: $aui1 NOT_NULL
expressionsMap:
url:
type: STRING
valueOf: AUI.1
valueString:
type: STRING
expressionType: HL7Spec
valueOf: AUI.1
- expressionType: nested
vars:
aui2: STRING_ALL, AUI.2
condition: $aui2 NOT_NULL
expressionsMap:
url:
type: STRING
valueOf: AUI.2
valueString:
type: STRING
expressionType: HL7Spec
valueOf: AUI.2
- expressionType: nested
vars:
aui3: STRING_ALL, AUI.3
condition: $aui3 NOT_NULL
expressionsMap:
url:
type: STRING
valueOf: AUI.3
valueString:
type: STRING
expressionType: HL7Spec
valueOf: AUI.3
7 changes: 7 additions & 0 deletions prime-router/metadata/HL7/catchall/hl7/message/OML_O21.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ resources:
additionalSegments:
- MSH

- resourceName: Coverage
segment: .IN1
group: PATIENT.INSURANCE
resourcePath: segments/IN1/Coverage
repeats: false
isReferenced: false

- resourceName: ServiceRequest
segment: .ORC
group: ORDER
Expand Down
16 changes: 16 additions & 0 deletions prime-router/metadata/HL7/catchall/hl7/segments/IN1/Coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# $schema: ./../../../../../json_schema/fhir/hl7-to-fhir-mapping-resource-template.json

resourceType: Coverage

id:
type: STRING
valueOf: "GeneralUtils.generateResourceId()"
expressionType: JEXL

extension:
expressionType: nested
generateList: true
expressions:
- expressionType: resource
valueOf: datatypes/AUI/AUIExtension
specs: IN1.14
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ elements:
resourceIndex: patientIndex
schema: classpath:/metadata/hl7_mapping/OML_O21/base/patient/patient-base.yml

- name: insurance
resource: 'Bundle.entry.resource.ofType(Coverage)'
# todo: update logic when Coverage.subscriber is mapped (IN1-16/IN1-17)
# https://github.com/CDCgov/prime-reportstream/issues/15500
# resource: 'Bundle.entry.resource.ofType(Coverage).where(subscriber.resolve().id = %resource.entry.resource.ofType(Patient).id)'
schema: classpath:/metadata/hl7_mapping/resources/Coverage/IN1.yml
constants:
hl7SegmentGroup: '/PATIENT/INSURANCE'

- name: order-base
resource: 'Bundle.entry.resource.ofType(ServiceRequest).where(subject.resolve().id = %resource.entry.resource.ofType(Patient).id)'
resourceIndex: orderIndex
Expand Down
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: aui-authorization-number
value: [ '%resource.extension.where(url = "AUI.1").value' ]
hl7Spec: [ '%{auiField}-1' ]

- name: aui-date
value: [ '%resource.extension.where(url = "AUI.2").value' ]
hl7Spec: [ '%{auiField}-2' ]

- name: aui-source
value: [ '%resource.extension.where(url = "AUI.3").value' ]
hl7Spec: [ '%{auiField}-3' ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# $schema: ./../../../../../../../metadata/json_schema/fhir/fhir-to-hl7-mapping.json

constants:
hl7IN1Field: '%{hl7SegmentGroup}/IN1'

elements:

- name: aui-extension
resource: '%resource.extension.where(url = "IN1.14")'
schema: classpath:/metadata/hl7_mapping/datatypes/extensionAUI/AUI.yml
constants:
auiField: '%{hl7IN1Field}-14'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package gov.cdc.prime.router.datatests.mappinginventory.aui

import gov.cdc.prime.router.datatests.mappinginventory.verifyHL7ToFHIRToHL7Mapping
import org.junit.jupiter.api.Test

class AUIExtensionTests {
@Test
fun `test AUI mapped to AUIExtension`() {
assert(
verifyHL7ToFHIRToHL7Mapping(
"catchall/aui/AUI-to-Extension",
outputSchema = "classpath:/metadata/hl7_mapping/OML_O21/OML_O21-test.yml"
).passed
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package gov.cdc.prime.router.datatests.mappinginventory.in1

import gov.cdc.prime.router.datatests.mappinginventory.verifyHL7ToFHIRToHL7Mapping
import org.junit.jupiter.api.Test

class IN1Tests {
@Test
fun `test IN1 mapped to Coverage`() {
assert(
verifyHL7ToFHIRToHL7Mapping(
"catchall/in1/IN1-to-Coverage",
outputSchema = "classpath:/metadata/hl7_mapping/OML_O21/OML_O21-test.yml"
).passed
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"resourceType": "Bundle",
"id": "1732324230716018000.38edba19-1d39-4040-85af-9f5f6248813c",
"meta": {
"lastUpdated": "2024-11-22T17:10:30.720-08:00"
},
"identifier": {
"system": "https://reportstream.cdc.gov/prime-router",
"value": "MSG00001"
},
"type": "message",
"entry": [
{
"fullUrl": "MessageHeader/1732324230752828000.fc7cea9d-d7ca-4378-91d4-ea97c86b4787",
"resource": {
"resourceType": "MessageHeader",
"id": "1732324230752828000.fc7cea9d-d7ca-4378-91d4-ea97c86b4787",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
},
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "O21",
"display": "OML^O21^OML_O21"
}
}
},
{
"fullUrl": "Patient/1732324231018814000.533db9a5-5375-4746-be23-f7140d4a3280",
"resource": {
"resourceType": "Patient",
"id": "1732324231018814000.533db9a5-5375-4746-be23-f7140d4a3280"
}
},
{
"fullUrl": "Coverage/1732324231019741000.a36368bf-6c63-4970-8948-034a92248964",
"resource": {
"resourceType": "Coverage",
"id": "1732324231019741000.a36368bf-6c63-4970-8948-034a92248964",
"extension": [
{
"url": "IN1.14",
"extension": [
{
"url": "AUI.1",
"valueString": "1701"
},
{
"url": "AUI.2",
"valueString": "19700101"
},
{
"url": "AUI.3",
"valueString": "DR TEETH AND THE ELECTRIC MAYHEM"
}
]
}
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MSH|^~\&|||||||OML^O21^OML_O21|MSG00001|P|2.5.1
PID|1
IN1||||||||||||||1701^19700101^DR TEETH AND THE ELECTRIC MAYHEM
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"resourceType": "Bundle",
"id": "1732324230716018000.38edba19-1d39-4040-85af-9f5f6248813c",
"meta": {
"lastUpdated": "2024-11-22T17:10:30.720-08:00"
},
"identifier": {
"system": "https://reportstream.cdc.gov/prime-router",
"value": "MSG00001"
},
"type": "message",
"entry": [
{
"fullUrl": "MessageHeader/1732324230752828000.fc7cea9d-d7ca-4378-91d4-ea97c86b4787",
"resource": {
"resourceType": "MessageHeader",
"id": "1732324230752828000.fc7cea9d-d7ca-4378-91d4-ea97c86b4787",
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0103",
"code": "P"
}
]
},
"eventCoding": {
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"code": "O21",
"display": "OML^O21^OML_O21"
}
}
},
{
"fullUrl": "Patient/1732324231018814000.533db9a5-5375-4746-be23-f7140d4a3280",
"resource": {
"resourceType": "Patient",
"id": "1732324231018814000.533db9a5-5375-4746-be23-f7140d4a3280"
}
},
{
"fullUrl": "Coverage/1732324231019741000.a36368bf-6c63-4970-8948-034a92248964",
"resource": {
"resourceType": "Coverage",
"id": "1732324231019741000.a36368bf-6c63-4970-8948-034a92248964",
"extension": [
{
"url": "IN1.14",
"extension": [
{
"url": "AUI.1",
"valueString": "1701"
},
{
"url": "AUI.2",
"valueString": "19700101"
},
{
"url": "AUI.3",
"valueString": "DR TEETH AND THE ELECTRIC MAYHEM"
}
]
}
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MSH|^~\&|||||||OML^O21^OML_O21|MSG00001|P|2.5.1
PID|1
IN1||||||||||||||1701^19700101^DR TEETH AND THE ELECTRIC MAYHEM
Original file line number Diff line number Diff line change
Expand Up @@ -13240,6 +13240,32 @@
]
}
},
{
"fullUrl": "Coverage/1732739201962559000.af1bd55f-2269-4782-a205-39c76d162b0d",
"resource": {
"resourceType": "Coverage",
"id": "1732739201962559000.af1bd55f-2269-4782-a205-39c76d162b0d",
"extension": [
{
"url": "IN1.14",
"extension": [
{
"url": "AUI.1",
"valueString": "1701"
},
{
"url": "AUI.2",
"valueString": "19700101"
},
{
"url": "AUI.3",
"valueString": "DR TEETH AND THE ELECTRIC MAYHEM"
}
]
}
]
}
},
{
"fullUrl": "ServiceRequest/1732560947529907000.d8a09a6a-8364-469a-b25b-3af90b0b03a7",
"resource": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ NK1|1|SURYAN&Prefix&Own&SpousePrefix&Spouse^GENARO^GR^JR^Sir^Md^L^I^CON&Context
NK1|2|SUPERMAN&Prefix&Own&SpousePrefix&Spouse^GENARO^GR^JR^Sir^Md^L^I^CON&Context the namee&HL70448^2000&2030^G^20000501102531^2030501102531^Dr|OTH^Other^HL70063^OT^OTHER RELATIONSHIP^L|4861 20TH AVE^^THUNDER MOUNTAIN^IG^99999^USA^H|^PRN^PH^[email protected]^1^720^5553954^2^any^^^+1 720 555 3955|^WPN^PH^^1^555^4672293^^^^^+1 555 467 2294|F^Federal Agency^HL70131|20220501102531-0400|20230501102531-0400|||052479^^^^^^20160822|HospitalsRUs^^112233^^^^^^^HRU||N^Not Applicable^HL70001|19860505||||E^English^HL70296|||||||||||^WPN^PH^^1^720^5553954^^^^^+1 720 555 3955|4861 20TH AVE^#B^AURORA^IG^99999^USA^H^World^King^12^8^2017&2025^2020^2021|052479^^^^^^^20210428|||||||^VHN^SAT^^1^314^5553131^^^^^+1 314 555 3132|^AWN^FX^^1^281^5558181^^^^^+1 281 555 8182
PV1|1|O|A&Point OF Care&C^1&Room&3^B&Bed&A^Hospital Assigned&2.4.4.4&ISO^^R^&Building^&Floor^Totally A Real Location^Comprehensive&&UID4This^AA&AssigningAUTH&ISO|R^Routine^HL70007|232323|^^^Hospital Prio&2.4.4.4&ISO^active^location type^^^Description^Entity ID&NAME&UNI&ISO^ASSIGNEE&222.1111.22222&UUID|1^BEETHOVEN^LUDWIG^B^2ND^DR^MD^^Namespace&AssigningSystem&UUID^B^^^DL^^^^^^^^MD~1^BEETHOVEN2^LUDWIG^B^2ND^DR^MD^^Namespace&AssigningSystem&UUID^B^^^DL^^^^^^^^MD|1^MOZART~1^MOZARTJR|1^CHOPIN~1^CHOPINSR|URO^Urology Service^HL70069|^^^^^^^^Its Temporary|P^Passed^HL70087|R^Re-admission^HL70092|RL^Real Life^HL70023||VIP^Very Interesting Person^HL70099|1^BACH~1^BACHtheSecond|H^Human Patient^HL70018|22|||||||||||20020101|C^Collectors^HL70021|1|0|Y^Yes^HL70111|20080101|H^Happy^HL70112|^202305061200|F^Fed^HL70114|H^A Hospital Of Course^HL70115||A^Active^HL70117|^^^^^^^^Pending Location|^^^^^^^^Prior Location|20240801102531-0400|20240801102531-0400|100|199|142|130|alternate visit|A^Account Level^HL70326||Service Description|episode identifier
PV2|^^^Hospital PriorPending&2.4.4.4&ISO^active^location type^^^Description^Entity ID&NAME&UNI&ISO^ASSIGNEE&222.1111.22222&UUID||1^AD||||413^V~423^X|20230601102531-0400|20230701102531-0400|5|12|Description|1^BEETHOVEN&VAN&Referral Source Code1&VAL&ROGER^LUDWIG^B^2ND^DR^MD^SRC^&AssigningSystem&ISO^B^A^NPI^DL^^A^NameContext^^G^20220501102531-0400^20230501102531-0400^MD^AssignJ^AssignA~1^BEETHOVEN&VAN&Referral Source Code2&VAL&ROGER^LUDWIG^B^2ND^DR^MD^SRC^&AssigningSystem&ISO^B^A^NPI^DL^^A^NameContext^^G^20220501102531-0400^20230501102531-0400^MD^AssignJ^AssignA||EMP_ILL||||||100^PublicCode|SEC|Org1^1234-5&TestText&LN&1234-5&TestAltText&LN&1&2&OriginalText^123^Check Digit^C1^Assigning Authority&2.1.4.1&ISO^MD^Hospital A&2.16.840.1.113883.9.11&ISO~Org2^1234-5&TestText&LN&1234-5&TestAltText&LN&1&2&OriginalText^123^Check Digit^C1^Assigning Authority&2.1.4.1&ISO^MD^Hospital A&2.16.840.1.113883.9.11&ISO||3^Elective^HL70217|20230501102531-0400|||20220501102531-0400|||||||||444^MODE||123^CARELEVEL1
IN1||||||||||||||1701^19700101^DR TEETH AND THE ELECTRIC MAYHEM
ORC|RE|Specimen123^SPHL-000048^2.16.840.1.114222.4.1.10765^ISO|Specimen12311^SPHL-000048^2.16.840.1.114222.4.1.10765^ISO|Specimen12322^SPHL-000048^2.16.840.1.114222.4.1.10765^ISO|CM|E||Specimen12333&SPHL-000048&2.16.840.1.114222.4.1.10765&ISO^Specimen12333454&SPHL-000048&2.16.840.1.114222.4.1.10765&ISO|20230725|71^^ORC.10Name~71^^ORC.10Name2|82^^ORC.11Name~82^^ORC.11Name2|93^^ORC.12Name~93^^ORC.12Name2|12.12.12&enter location id&L|123^^^+123~1234^^^+1234|202101021000||EO^entering org text^HL79999|ED^entering device text^HL79999|60^^ORC.19Name~60^^ORC.19Name2||CDPH, Viral and Rickettsial Disease Laboratory^^^^^STARLIMS.CDC.Stag&2.16.840.1.114222.4.3.3.2.1.2&ISO^XX^STARLINKS.CDC.Stag&2.16.840.1.114222.8.7.6.5.4.1&ISO^A^SPHL-000048~CDPH, Viral and Rickettsial Disease Laboratory part two^^^^^STARLIMS.CDC.Stag&2.16.840.1.114222.4.3.3.2.1.2&ISO|111 Street St^^Streetsville^ST~112 Street St^^Streetsville^ST|456^^^+456~4567^^^+4567|111 Road Rd^^Roadsville^RD~112 Road Rd^^Roadsville^RD|OS^order status^HL79999||20260404|EMP^Employee^HL70177|I^Inpatient Order^HL70482|EL^Electronic^HL70483|UMM^Universal Modifier^HL70000|20250403|33~332
OBR|1|Placer Identifier^Placer Identifier Namespace^Placer Universal ID^ISO|Filler Identifier^Filler Identifier Namespace^Filler Universal ID^ISO|123^Universal service identifier||202202021022||20240220|1771|1^Collector&VAN&Identifier&VAL&ROGER^LUDWIG^B^2ND^DR^MD^SRC^&AssigningSystem&ISO^B^A^NPI^DL^^A^NameContext~1^Collectorx2&VAN&Identifier&VAL&ROGER^LUDWIG^B^2ND^DR^MD^SRC^&AssigningSystem&ISO^B^A^NPI^DL^^A^NameContext|G|512^Danger code|R^relevent info^ISO|202102021000|ID^BOUIN&Bouin's solution&HL70371^Collection Method^LN&Left Naris&HL70163^^CMMC&Collection Method Modifer Code&HL7|1^Ordering&VAN&Provider&VAL&JollyROGER~2^Ordering&VAN&Provider&VAL&JollyROGER|^WPN^BP^^1^260^7595016^^^^^+1 260 759 5016~^WPN^Internet^[email protected]~^WPN^BP^^1^260^7595016^^^^^+1 260 759 5016~^WPN^Internet^[email protected]|placer1|placer2|filler1|filler2||100&$^16&code|OTH|F|444&ParentId^888^ParentOBSdescriptor||1^result&VAN&copiesto&VAL&NotSoJollyROGER~2^results&VAN&copiesto&VAL&NotSoJollyROGER|adb4a5cc-50ec-4f1e-95d7-0c1f77cacee1&CSV&11D1111111&CLIA^f34b0f57-1601-4480-ae8a-d4006e50f38d&Other CSV&22D2222222&CLIA2||3216^ReasonForStudy~3216^ReasonForStudy2||123&Assistant&Results Interpreter&S&ESQ&DR&MD&&Assigning Authority&2.1.4.1&ISO^20230401102531-0400^20230501102531-0400^Point of Care^Room 101^Bed A^Hospital A&2.16.840.1.113883.9.11&ISO^active^^Building 123^Floor A~123&Assistant&Results Interpreter&S&ESQ&DR&MD&&Assigning Authority&2.1.4.1&ISO^20230401102531-0400^20230501102531-0400^Point of Care^Room 101^Bed A^Hospital A&2.16.840.1.113883.9.11&ISO^active^^Building 123^Floor A|||20230806123359-0500|||4438^Collectors Comment~4438^Collectors Comment2|||||5019^Procedure Code|887766^Procedure Code Modifier~887766^Procedure Code Modifier2|7461^Placer Supplemental~7461^Placer Supplemental2|8811^Fillter Supplemental~8811^Fillter Supplemental2|71435^Medically Necessary Duplicate Procedure|N|443331^Parent Universal Service Identifier|||Alt^Placer Order~Alt^Placer Order2|adb4a5cc-50ec-4f1e-95d7-0c1f77cacee1&CSV&11D1111111&CLIA^f34b0f57-1601-4480-ae8a-d4006e50f38d&Other CSV&22D2222222&CLIA2
NTE|1|L|Note about the observation request~second~third~fourth|||20230207|20230208|20230209|CC^Coded Request note
Expand Down

0 comments on commit e564319

Please sign in to comment.