No agent field in Provenance for ADT_A01 => R4
bitcrshr opened this issue · 1 comments
The following HL7 message (yanked from the hl7 website) produces invalid FHIR (R4) because the Provenance resource does not contain an agent field.
MSH|^~\&|ADT1|GOOD HEALTH HOSPITAL|GHH LAB, INC.|GOOD HEALTH HOSPITAL|198808181126|SECURITY|ADT^A01^ADT_A01|MSG00001|P|2.8||
EVN|A01|200708181123||
PID|1||PATID1234^5^M11^ADT1^MR^GOOD HEALTH HOSPITAL~123456789^^^USSSA^SS||EVERYMAN^ADAM^A^III||19610615|M||C|2222 HOME STREET^^GREENSBORO^NC^27401-1020|GL|(555) 555-2004|(555)555-2004||S||PATID12345001^2^M10^ADT1^AN^A|444333333|987654^NC|
NK1|1|NUCLEAR^NELDA^W|SPO^SPOUSE||||NK^NEXT OF KIN
PV1|1|I|2000^2012^01||||004777^ATTEND^AARON^A|||SUR||||ADM|A0|
I am unable to insert the generated FHIR into a store, as I get the following error:
{
"issue": [
{
"code": "structure",
"details": {
"text": "unparseable_resource"
},
"diagnostics": "missing required field \"agent\"",
"expression": [
"Bundle.entry[10].resource.provenance"
],
"severity": "error"
},
{
"code": "structure",
"details": {
"text": "unparseable_resource"
},
"diagnostics": "failed FHIRPath constraint: fhirpath-constraint-violation-Bundle.entry.resource.ofType(Patient).telecom: \"value.empty() or system.exists()\"",
"expression": [
"Bundle.entry[3].resource.ofType(Patient).telecom[0]"
],
"severity": "error"
},
{
"code": "structure",
"details": {
"text": "unparseable_resource"
},
"diagnostics": "failed FHIRPath constraint: fhirpath-constraint-violation-Bundle.entry.resource.ofType(Patient).telecom: \"value.empty() or system.exists()\"",
"expression": [
"Bundle.entry[3].resource.ofType(Patient).telecom[1]"
],
"severity": "error"
}
],
"resourceType": "OperationOutcome"
}
I believe I can fix the telecom issues fairly easily, but from what I can tell, as long as the MSH (present here) or EVN.5 (not present) is present, the agent
field should be rendered. Any guidance here would be greatly appreciated!
This is the result from the converter (though type is modified to be transaction
):
{
"resourceType": "Bundle",
"type": "transaction",
"timestamp": "2024-01-18T04:57:31Z",
"identifier": {
"value": "MSG00001"
},
"id": "513a3d06-5e87-6fbc-ad1b-170ab430499f",
"entry": [
{
"fullUrl": "urn:uuid:64c2d51b-34a4-e841-fb1c-03f1f7762d1a",
"resource": {
"resourceType": "MessageHeader",
"id": "64c2d51b-34a4-e841-fb1c-03f1f7762d1a",
"source": {
"name": "ADT1",
"_endpoint": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
"valueCode": "unknown"
}
]
}
},
"destination": [
{
"name": "GHH LAB, INC.",
"_endpoint": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason",
"valueCode": "unknown"
}
]
},
"receiver": {
"reference": "Organization/2d7d77cd-0ca7-13a5-c9ed-6e70b739adb4"
}
}
],
"meta": {
"security": [
{
"display": "SECURITY"
}
],
"tag": [
{
"code": "P",
"system": "http://terminology.hl7.org/CodeSystem/v2-0103"
}
]
},
"eventCoding": {
"code": "A01",
"system": "http://terminology.hl7.org/CodeSystem/v2-0003",
"display": "ADT^A01^ADT_A01"
},
"sender": {
"reference": "Organization/2d7d77cd-0ca7-13a5-c9ed-6e70b739adb4"
}
},
"request": {
"method": "PUT",
"url": "MessageHeader/64c2d51b-34a4-e841-fb1c-03f1f7762d1a"
}
},
{
"fullUrl": "urn:uuid:aaf37d11-5d66-af8d-c286-16b46b7f9ada",
"resource": {
"resourceType": "Provenance",
"id": "aaf37d11-5d66-af8d-c286-16b46b7f9ada",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><span>Resource bundle generated on 2024-01-18T21:57:32.672Z using Microsoft FHIR Converter.</span><span>Template Version: TEMPLATE_VERSION_PLACEHOLDER.</span><span>Template URL: https://github.com/microsoft/FHIR-Converter/releases/download/vTEMPLATE_VERSION_PLACEHOLDER/Hl7v2DefaultTemplates.tar.gz.</span><span>Root template: ADT_A01.</span></p></div>"
},
"occurredDateTime": "2024-01-18T04:57:31Z",
"recorded": "2024-01-18T04:57:31Z",
"agent": [
{
"type": {
"coding": [
{
"code": "author",
"system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type"
}
]
},
"who": {
"reference": "Organization/2d7d77cd-0ca7-13a5-c9ed-6e70b739adb4"
}
}
],
"activity": {
"coding": [
{
"display": "ADT^A01^ADT_A01"
}
]
},
"target": [
{
"reference": "Bundle/513a3d06-5e87-6fbc-ad1b-170ab430499f"
}
]
},
"request": {
"method": "PUT",
"url": "Provenance/aaf37d11-5d66-af8d-c286-16b46b7f9ada"
}
},
{
"fullUrl": "urn:uuid:2d7d77cd-0ca7-13a5-c9ed-6e70b739adb4",
"resource": {
"resourceType": "Organization",
"id": "2d7d77cd-0ca7-13a5-c9ed-6e70b739adb4",
"identifier": [
{
"value": "GOOD HEALTH HOSPITAL",
"system": "http://example.com/v2-to-fhir-converter/Identifier/GOOD-HEALTH-HOSPITAL"
}
]
},
"request": {
"method": "PUT",
"url": "Organization/2d7d77cd-0ca7-13a5-c9ed-6e70b739adb4"
}
},
{
"fullUrl": "urn:uuid:d5fe6802-a680-e762-8f43-9659340b00ac",
"resource": {
"resourceType": "Patient",
"id": "d5fe6802-a680-e762-8f43-9659340b00ac",
"identifier": [
{
"value": "PATID1234",
"type": {
"coding": [
{
"code": "MR",
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"display": "Medical record number"
}
]
},
"system": "http://example.com/v2-to-fhir-converter/Identifier/ADT1"
},
{
"value": "123456789",
"type": {
"coding": [
{
"code": "SS",
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"display": "Social Security number"
}
]
},
"system": "http://example.com/v2-to-fhir-converter/Identifier/USSSA"
},
{
"value": "444333333",
"type": {
"coding": [
{
"code": "SB",
"system": "http://terminology.hl7.org/CodeSystem/v2-0203"
}
]
},
"system": "http://hl7.org/fhir/sid/us-ssn"
},
{
"value": "987654",
"type": {
"coding": [
{
"code": "DL"
}
]
},
"system": "http://example.com/v2-to-fhir-converter/CodeSystem/NC"
}
],
"name": [
{
"family": "EVERYMAN",
"given": [
"ADAM",
"A"
],
"suffix": [
"III"
]
}
],
"birthDate": "1961-06-15",
"gender": "male",
"address": [
{
"line": [
"2222 HOME STREET"
],
"city": "GREENSBORO",
"state": "NC",
"postalCode": "27401-1020"
},
{
"district": "GL"
}
],
"telecom": [
{
"value": "(555) 555-2004",
"use": "home"
},
{
"value": "(555)555-2004",
"use": "work"
}
],
"maritalStatus": {
"coding": [
{
"code": "S",
"display": "Never Married",
"system": "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus"
}
]
},
"extension": [
{
"url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race",
"extension": [
{
"url": "ombCategory",
"valueCoding": {
"code": "C",
"display": "C"
}
},
{
"url": "text",
"valueString": "C"
}
]
}
],
"contact": [
{
"name": {
"family": "NUCLEAR",
"given": [
"NELDA",
"W"
]
},
"relationship": [
{
"coding": [
{
"code": "NK",
"display": "NEXT OF KIN"
}
]
}
]
}
]
},
"request": {
"method": "PUT",
"url": "Patient/d5fe6802-a680-e762-8f43-9659340b00ac"
}
},
{
"fullUrl": "urn:uuid:d8c83ef0-2bbc-591b-4de7-6f284ab60d0b",
"resource": {
"resourceType": "Account",
"id": "d8c83ef0-2bbc-591b-4de7-6f284ab60d0b",
"identifier": [
{
"value": "PATID12345001",
"type": {
"coding": [
{
"code": "AN",
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"display": "Account number"
}
]
},
"system": "http://example.com/v2-to-fhir-converter/Identifier/ADT1"
}
],
"status": "active",
"subject": [
{
"reference": "Patient/d5fe6802-a680-e762-8f43-9659340b00ac"
}
]
},
"request": {
"method": "PUT",
"url": "Account/d8c83ef0-2bbc-591b-4de7-6f284ab60d0b"
}
},
{
"fullUrl": "urn:uuid:15d1e2fd-66ed-373c-919f-8204c9c27ec6",
"resource": {
"resourceType": "Practitioner",
"id": "15d1e2fd-66ed-373c-919f-8204c9c27ec6",
"identifier": [
{
"value": "004777"
}
],
"name": [
{
"family": "ATTEND",
"given": [
"AARON",
"A"
]
}
]
},
"request": {
"method": "PUT",
"url": "Practitioner/15d1e2fd-66ed-373c-919f-8204c9c27ec6"
}
},
{
"fullUrl": "urn:uuid:fed49117-7114-cc6d-a564-aa500d035ec6",
"resource": {
"resourceType": "Location",
"id": "fed49117-7114-cc6d-a564-aa500d035ec6",
"name": "2000",
"mode": "instance",
"description": "2000--2012--01",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "lvl"
}
]
}
},
"request": {
"method": "PUT",
"url": "Location/fed49117-7114-cc6d-a564-aa500d035ec6"
}
},
{
"fullUrl": "urn:uuid:87cbde24-7a43-2c4d-b0fd-53f7e8617574",
"resource": {
"resourceType": "Location",
"id": "87cbde24-7a43-2c4d-b0fd-53f7e8617574",
"partOf": {
"reference": "Location/fed49117-7114-cc6d-a564-aa500d035ec6"
},
"name": "2012",
"mode": "instance",
"description": "2000--2012--01",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "ro"
}
]
}
},
"request": {
"method": "PUT",
"url": "Location/87cbde24-7a43-2c4d-b0fd-53f7e8617574"
}
},
{
"fullUrl": "urn:uuid:7eda07b5-b256-87e5-1e3d-c2f69a17ecd3",
"resource": {
"resourceType": "Location",
"id": "7eda07b5-b256-87e5-1e3d-c2f69a17ecd3",
"partOf": {
"reference": "Location/87cbde24-7a43-2c4d-b0fd-53f7e8617574"
},
"name": "01",
"mode": "instance",
"description": "2000--2012--01",
"physicalType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
"code": "bd"
}
]
}
},
"request": {
"method": "PUT",
"url": "Location/7eda07b5-b256-87e5-1e3d-c2f69a17ecd3"
}
},
{
"fullUrl": "urn:uuid:8add615d-1d8a-1bf3-bffc-9bd789bee0a3",
"resource": {
"resourceType": "Encounter",
"id": "8add615d-1d8a-1bf3-bffc-9bd789bee0a3",
"class": {
"code": "IMP",
"display": "inpatient encounter",
"system": "http://terminology.hl7.org/CodeSystem/v3-ActCode"
},
"status": "in-progress",
"location": [
{
"status": "active",
"location": {
"reference": "Location/fed49117-7114-cc6d-a564-aa500d035ec6"
}
}
],
"hospitalization": {
"admitSource": {
"coding": [
{
"code": "ADM"
}
]
}
},
"participant": [
{
"type": [
{
"coding": [
{
"code": "ATND",
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"display": "attender"
}
]
}
],
"individual": {
"reference": "Practitioner/15d1e2fd-66ed-373c-919f-8204c9c27ec6"
}
}
],
"serviceType": {
"coding": [
{
"code": "SUR"
}
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><span>Visit Description: </span></p></div>"
},
"account": [
{
"reference": "Account/d8c83ef0-2bbc-591b-4de7-6f284ab60d0b"
}
],
"subject": {
"reference": "Patient/d5fe6802-a680-e762-8f43-9659340b00ac"
}
},
"request": {
"method": "PUT",
"url": "Encounter/8add615d-1d8a-1bf3-bffc-9bd789bee0a3"
}
},
{
"fullUrl": "urn:uuid:c6a03972-34d3-7649-0b8f-004e4d442eca",
"resource": {
"resourceType": "Provenance",
"id": "c6a03972-34d3-7649-0b8f-004e4d442eca",
"recorded": "2007-08-18T11:23:00Z",
"activity": {
"text": "ADT^A01^ADT_A01"
},
"target": [
{
"reference": "Bundle/513a3d06-5e87-6fbc-ad1b-170ab430499f"
}
]
},
"request": {
"method": "PUT",
"url": "Provenance/c6a03972-34d3-7649-0b8f-004e4d442eca"
}
},
{
"fullUrl": "urn:uuid:b3a71bad-ca58-a43e-78c3-228806a2f316",
"resource": {
"resourceType": "RelatedPerson",
"id": "b3a71bad-ca58-a43e-78c3-228806a2f316",
"relationship": [
{
"coding": [
{
"code": "SPS",
"display": "spouse",
"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode"
}
]
},
{
"coding": [
{
"code": "NK",
"display": "NEXT OF KIN"
}
]
}
],
"name": [
{
"family": "NUCLEAR",
"given": [
"NELDA",
"W"
]
}
],
"patient": {
"reference": "Patient/d5fe6802-a680-e762-8f43-9659340b00ac"
}
},
"request": {
"method": "PUT",
"url": "RelatedPerson/b3a71bad-ca58-a43e-78c3-228806a2f316"
}
}
]
}
Verified our default template HL7v2 > FHIR R4 generates the result like described. The "Provenance" resource in R4 should have the "Agent" field as the cardinality is 1..*: https://fhir-ru.github.io/provenance-definitions.html#Provenance.agent
The issue needs to be fixed.