Assuming I have an inbound HL7 2.x ORU message, what I need to do is create a JSON document for a DiagnosticReport and issue an HTTP post to the HL7 FHIR server to create it. Looking at the schema for the DiagnosticReport, I immediately notice that it has references to other resources that are not optional - specifically:
1. subject - refers to the Patient resource
2. performer - refers to the organization or practitioner (radiologist) that created the report
Since these are required properties (1..1) we will need to find (or create) these resources in the HL7 FHIR server before we can create the corresponding DiagnosticReport. The organization is something that we will need to manually create because it will be shared with all reports (for the spike we will simplify things to be single organization/issuer only). Since we are building this system from scratch, we can't assume that some other system has populated these resources for us so we will have to do it ourself. Lets start with the Patient resource.
Fortunately for us, every property of the patient resource is optional! Theoretically we could create an empty Patient resource for each ORU message and reference that from our DiagnosticReport so at least it follows the schema constraints. Since this is a spike, it seems reasonable that we could start with this, but I know we have many of the properties needed by the Patient resource in the ORU message so I am going to start with a simple mapping. The patient demographics are transmitted in the PID segment with HL7 V2.x so lets start there:
ORU | FHIR Patient |
PID-2 (Patient ID External ID) | identifier |
PID-3 (Patient ID Internal ID) | identifier |
PID-4 | identifier |
PID-5 (Patient Name) | name |
PID-7 (Date/Time of birth) | birthDate |
PID-8 (Sex) | gender |
PID-16 (Marital Status) | maritalStatus |
A few notes:
1) There is often multiple identifiers for a given patient and the Patient resource supports this by having the identifier property 0..* (0 to many). HL7 PID has several fields which can contain a patient identifier so I am going to map all of them into the identifier property
2) HL7 FHIR uses the HumanName schema for names which is different than how HL7 V2.x encodes names. We will need to extract out each component of the name (family, given, etc) and create a JSON object for it
3) HL7 FHIR uses the dateTime type that differs from how HL7 V2.x encodes date times. We will need to extract the date/time components and create a JSON object for it for the birthDate property
4) HL7 FHIR uses the administrative-gender code for the gender - we will need to map from HL7 v2.x codes to HL7 FHIR codes via lookup table
5) HL7 FHIR uses the marital-status code and we will need to map from the corresponding HL7 V2.x codes
The Patient resource also has references to others resources (managingOrganization, careProvider, etc) that I can probably populate from the ORU but I can see that will create a lot of extra work that isn't needed for this spike and am going to ignore it for now.
So now that we know how to create a Patient resource JSON document from an HL7 ORU message, lets see how we would go about creating a new one and searching for an existing one.
No comments:
Post a Comment