Sunday, March 22, 2015

Creating an HL7 FHIR DiagnosticReport Resource

With our recent success creating and searching for Patient resources, it seems that creating a DiagnosticReport resource may be just as easy.  Lets begin by mapping the minimum number of fields we need from an HL7 ORU message:

FHIR DiagnosticReport HL7 2.x Field Note
name OBR-4 The type of procedure - need lookup table
status OBR-25 Final, prelim, etc
issued OBR-7 report date
subject Link to the patient resource we created or found
performer Lookup the organization resource
identifier OBR-3 Filler order number (accession number)
text.div OBX The actual report text

The first thing we need to do is get references to the patient and organization resources for this report.  We could use the patient we previously created, but I am not going to use it in this example because it may not be available in the future (the spark server may reset its data someday) and I can envision someone trying what I describe below and want it to work without having to create a patient resource first.  I am going to use an existing patient and organization that appears to be part of the standard dataset in the spark server:

Patient with id pat1:

http://spark.furore.com/fhir/Patient/pat1

Organization with id 1:

http://spark.furore.com/fhir/Organization/1

Here is a JSON document for the DiagnosticReport resource we will use:


  "resourceType" : "DiagnosticReport",
  "text" : { 
    "status" : "generated",
    "div" : "Report text here"
  },
  "name" : {
    "coding" : [{
      "system" : "http://loinc.org",
      "code" : "38269-7"
    }]
  },
  "status" : "final",
  "issued": "2015-03-22",
  "subject" : {
    "reference" : "Patient/pat1"
  },
  "performer" : {
    "reference" : "Organization/1",
    "display": "Acme Healthcare, Inc."
  },
  "identifier": {
    "use" : "official",
    "system" : "?",
    "value" : "1000"
  }
}

Posting this creates the new resource with id returned in the Location response header:


Success!  Two issues with the above:
1) I am not sure what LOINC codes are.  I used a code from an existing DiagnosticReport in the spark database but will probably need to do lookup the real code by mapping what I get in OBR-4 through some lookup table.
2) I don't understand how identifiers are handled yet.  It seems you can scope them somehow using the system property.  Will need to research this more later.

The next step is to try and create Patient and DiagnosticReport resources from an actual ORU message.

1 comment: