Creating a FHIR document for the January Connectathon

I had intended to talk in some detail about the Composition resource next, as this is one of the key resources for a FHIR document, but because the January connectathon is getting close I’m going to do a series of posts to directly support people attending connectathon, and wanting to experiment with the document track. I’m planning 4 posts in this series:

  • How a client would create a FHIR document (incidentally for the remainder of this series, I’m going to refer to a FHIR document just as  ‘document’, so when you see this, I’m NOT talking about CDA. Later posts will talk more about the relationship between the two).
  • How a server could process a document. There are a few possibilities…
  • How to find the document on the server later, and render it to the client.
  • A wrap up on the Composition resource and anything else left over.

I do intend to spend a lot more time on FHIR & CDA, but this should at least cover the basics.

Before we get into the detail of the post, a few points:

  • A reminder that the Composition resource is like the header in a CDA document – it establishes the context for the document contents, and has the document type and date, references to the patient, author/s and other resources and – in particular for us – contains the section hierarchy which will have links to the detailed resources that make up the body of the document. We’ll see this in action in a minute.
  • We’re going to create an ‘ad hoc’ document – we’ll just add the sections we need for our scenario. In practice, it is likely that the types and contents of sections will be defined for specific document types using document profiles – analogous to the way that CDA does, for example in CCD or Consolidated CDA.
  • We’ll use LOINC codes for the sections – and we’ll make them the same as defined in CDA. Consistency is important, and there’s lots of good thinking in CDA…
  • All of the resources we add to the document should have a text section that contains the human readable narrative. We can assemble the document for display to a person by ‘walking the tree’ of the document hierarchy, rendering all the text elements in turn to generate the document. Again, very similar in concept to CDA.

We’ll use the scenario of a primary care consultation note (like a Progress Note), where the patient has come in for a Blood Pressure check and we are continuing their medications unchanged. They already have Hypertension on record as a Problem (It’s called a Condition in FHIR) and their medications are already on file as well. Our note is going to mention the medications they are taking – but it won’t be the actual order of course (Orders could be a good idea for another post…).

The document (bundle) itself will have:

  • A header (The composition resource). The composition has a number of sections that point to the
  • A section for the Presenting Complaint (or Chief Complaint), which will reference the Condition (Hypertension)
  • A section for the assessment  (i.e. the text that the doctor would normally write)
  • A section for physical examination (with the Blood Pressure in it)
  • A section for current medications

We’re going to have a combination of existing and new resources.

Existing resources include the patient and the practitioner resource – and some of the clinical resources as well – the Condition and the Medications. To keep it simple, we’ll assume that all these resources already exist on the server that is going to store the document, though it doesn’t really matter as the document will contain a copy of the resource plus the ID reference to wherever it is stored.

New resources are interesting. At the least we’re going to have new Observation resources to record our clinical observations like the Assessment and the Blood Pressure. When the server processes the document, it could do a couple of things:

  • It could either leave them inside the document and just store them with the document.
  • It could extract the new resources and save them locally – this might be appropriate with a new Condition for example. At the moment, there is no way for the client to indicate what to do – it is up to the server, so we’ll hold that discussion until we get to the server.

So here are the steps we will follow: (btw – these are similar in many ways to what we did when we submitted a CDA to the XDS registry, so it might be worth reviewing that as well).

I’m assuming that you will be performing these steps using some sort of object model that will eventually be serialized to XML or JSON and send to the server – for example using one of the open-source  clients that you can download from the spec.

  1. Create the document bundle, setting the tag that marks it as a document bundle.
  2. Create a Composition resource, to set the context for the document and add it to the bundle.
  3. Query the server for the patient, and add a copy of that resource to the bundle (the bundle entry will, of course, have the ID of the resource on the server). Add the reference to the ‘subject’ property of the Composition.
  4. Query the server for the author, and add a copy of that resource to the bundle. Add the reference to the ‘author’ property of the composition as for subject.
  5. Query the server for the Condition resource (hypertension) and add it to the bundle.
  6. Create a new section property in the Composition with a code to indicate that this section contains the chief complaint (LOINC 10154-3) for this consultation. The section will reference the Condition resource we just retrieved. (And, hopefully you can now see why physically adding the resource to the bundle is optional – though there are things to think about in terms of signing the document – we’ll talk about that in another post).
  7. Create a new Observation resource, and set the name property to indicate that it contains the Assessment (LOINC code 51847-2). Place the actual text of the findings in the text property of the Observation (It’s a subset of XHTML so we can format it however we want to). Generate a ‘cid:’ ID for it (so the server will know it’s a new resource) and save it in the bundle.
  8. Create a new section property in the Composition with the same code (LOINC code 51847-2) to indicate that this section contains the Assessment. The section will reference the Observation we just created – using the ‘cid:’ id.
  9. Create a new List resource with a code indicating that it will contain the Physical Examination (LOINC code 29545-1) and add to the bundle. Add a composition section with the same code that references it. Now, create 2 more Observations (with cid: ID’s ) for systolic and diastolic Blood Pressure results.  Each Observation has an entry in the List resource that references it. (So the ‘chain’ goes from Composition -> List -> Observations, indicating the correct hierarchy.
  10. Create a List resource for the medications (LOINC code 10160-0) and a Composition section that references it. Query the patient medications from the server and for each medication, place a copy in the bundle and an item property in the List that refers to it – just as we did with the Blood Pressure Observations before.

And finally you can serialize the document and send it to the server.

Conceptually, the document will look like this:

fhirdoc2

with the existing resources in green, and the new ones in yellow.

If serialized to XML, the document will look something like this:

<?xml version="1.0" encoding="UTF-8"?>
 <feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2005/Atom">
     <title>A sample FHIR document</title>
     <id>urn:uuid:500bee81-d973-4afe-b592-d39fe71e38</id>

     <updated>2013-05-28T22:12:21Z</updated>     <!-- Time the bundle was built -->
     <!-- Author is required by the Atom spec. FHIR doesn't use it-->
     <author>
         <name>Doctor Dave</name>
     </author>
     <!-- This tag specifies unambiguously that this is a FHIR document bundle -->
     <category term="http://hl7.org/fhir/tag/document" scheme="http://hl7.org/fhir/tag" />

     <!-- The composition -->
     <entry>
         <title>Progress note for Patsy Pregnant by Doctor Dave</title>
         <!-- the 'cid' protocol means this is a new composition -->
         <id>cid:1046bb61-c258-44e5-96a5-a5bae6b180fe@orionhealth.com</id>
         <updated>2013-05-28T22:12:21Z</updated>
         <content type="text/xml">
             <Composition xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">A Progress note...</div>
                 </text>
                 <instant value='2013-06-06T12:30:00'/>  <!-- the time this document was created -->
                 <!-- What type of document is this - eg Discharge Summary, referral, Consultation note -->
                 <type>
                     <coding>
                         <!-- Using an XDS system? hmmmm... -->
                         <system value='http://fhir.org.nz/xds#documentType'/>
                         <code value='pn'/>
                         <display value="Progress Note"/>
                     </coding>
                 </type>
                 <status value="final"/>
                 <confidentiality>
                     <system value='http://fhir.org.nz/xds#confidentiality'/>
                     <code value='n'/>
                     <display value="Normal"/>
                 </confidentiality>
                 <!-- Who the document is about. The patient with the ID of sample -->
                 <subject>
                     <reference value='http://hl7.org.nz/fhir/Patient/patsypregnant'/>
                     <display value="Patsy Pregnant"/>
                 </subject>
                 <author>
                     <reference value='http://hl7.org.nz/fhir/Practitioner/drdave'/>
                     <display value="Doctor Dave"/>
                 </author>
                 <!-- The document sections. First the Presenting (Chief) Complaint  -->
                 <section>
                     <code>
                         <coding>
                             <system value="http://loinc.org"/>
                             <code value="10154-3"/>
                             <display value="Chief Complaint"/>
                         </coding>
                     </code>
                     <content>
                         <reference value='http://hl7.org.nz/fhir/Condition/sample1'/>
                         <display value="Hypertension"/>
                     </content>
                 </section>

                 <!-- Assessment-->
                 <section>
                     <code>
                         <coding>
                             <system value="http://loinc.org"/>
                             <code value="51847-2"/>
                             <display value="Assessment"/>
                         </coding>
                     </code>
                     <content>
                         <reference value='cid:100@orionhealth.com'/>
                     </content>
                 </section>

                 <!-- Physical Exam -->
                 <section>
                     <code>
                         <coding>
                             <system value="http://loinc.org"/>
                             <code value="29545-1"/>
                             <display value="Physical Exam"/>
                         </coding>
                     </code>
                     <content>
                         <reference value='cid:pe100@orionhealth.com'/>
                     </content>
                 </section>

                 <!-- Medications -->
                 <section>
                     <code>
                         <coding>
                             <system value="http://loinc.org"/>
                             <code value="10160-0"/>
                             <display value="Medications"/>
                         </coding>
                     </code>
                     <content>
                         <reference value='cid:110@orionhealth.com'/>
                     </content>
                 </section>
             </Composition>
         </content>
     </entry>

     <!-- Chief Complaint  -->
     <entry>
         <title>Presenting complaint</title>
         <id>http://hl7.org.nz/fhir/Condition/sample1</id>
         <updated>2013-05-28T22:12:21Z</updated>
         <content type="text/xml">
             <Condition xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">Hypertension</div>
                 </text>
                 <subject>
                     <reference value='http://hl7.org.nz/fhir/Patient/patsypregnant'/>
                     <display value="Patsy Pregnant"/>
                 </subject>
                 <code>
                     <coding>
                         <system value="http://snomed.info/sct"/>
                         <code value="1201005"/>
                         <display value="Benign Essential Hypertension"/>
                     </coding>
                 </code>
                 <status value="confirmed"/>
             </Condition>
         </content>
     </entry>

     <!-- Assement (The clincial note) -->
     <entry>
         <title>Assessment</title>
         <id>cid:100@orionhealth.com</id>
         <updated>2013-05-28T22:12:21Z</updated>

         <content type="text/xml">
             <!-- Sample content only -->
             <Observation xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">This is a record of my consult...</div>
                 </text>
                 <name>
                     <coding>
                          <system value="http://loinc.org"/>
                         <code value="51847-2"/>
                         <display value="Assessment"/>
                     </coding>
                 </name>
                 <valueString value="This is a record of my consult..."/>
                 <status value="final"/>
                 <reliability value="ok"/>
                 <!-- All the other details of the Observation (ie progress note) here -->
             </Observation>
         </content>
     </entry>

     <!-- Physical exam - the blood pressure -->
     <entry>
         <title>Physical Exam</title>
         <id>cid:pe100@orionhealth.com</id>
         <updated>2013-05-28T22:12:21Z</updated>

         <content type="text/xml">
             <!-- Sample content only -->
             <List xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">BP 120/80</div>
                 </text>
                 <mode value="working"/>
                 <entry>
                     <item>
                         <reference value='cid:syst@orionhealth.com'/>
                         <display value="Systolic BP 120"/>
                     </item>
                 </entry>
                 <entry>
                     <item>
                         <reference value='cid:dias@orionhealth.com'/>
                         <display value="Diastolic BP 80"/>
                     </item>
                 </entry>
             </List>
         </content>
     </entry>

     <!-- Systolic BP -->
     <entry>
         <title>Systolic BP</title>
         <id>cid:syst@orionhealth.com</id>
         <updated>2013-05-28T22:12:21Z</updated>
         <content type="text/xml">
             <Observation xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">Systolic BP 120 mmHg</div>
                 </text>
                 <name>
                     <coding>
                         <system value="http://snomed.info/sct"/>
                         <code value="163030003"/>
                         <display value="Systolic BP"/>
                     </coding>
                 </name>
                 <valueQuantity>
                     <value value="120"/>
                     <units value="mm(Hg)"/>
                     <system value="http://unitsofmeasure.org" />
                 </valueQuantity>
                 <status value="final"/>
                 <reliability value="ok"/>

             </Observation>
         </content>
     </entry>

     <!-- Diastolic BP -->
     <entry>
         <title>diastolicBP</title>
         <id>cid:dias@orionhealth.com</id>
         <updated>2013-05-28T22:12:21Z</updated>
         <content type="text/xml">
             <Observation xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">Diastolic BP 80 mmHg</div>
                 </text>
                 <name>
                     <coding>
                         <system value="http://snomed.info/sct"/>
                         <code value="163031004"/>
                         <display value="Diastolic BP"/>
                     </coding>
                 </name>
                 <valueQuantity>
                     <value value="80"/>
                     <units value="mm(Hg)"/>
                     <system value="http://unitsofmeasure.org" />
                 </valueQuantity>
                 <status value="final"/>
                 <reliability value="ok"/>
             </Observation>
         </content>
     </entry>

     <!-- Medication List -->
     <entry>
         <title>The medication list</title>
         <id>cid:110@orionhealth.com</id>
         <updated>2013-05-28T22:12:21Z</updated>

         <content type="text/xml">
             <!-- Sample content only -->
             <List xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">Current list of medications</div>
                 </text>
                 <mode value="working"/>
                 <entry>
                     <item>
                         <reference value='http://hl7.org.nz/fhir/MedicationPrescription/medsample1'/>
                         <display value="Medication 1"/>
                     </item>
                 </entry>
                 <entry>
                     <item>
                         <reference value='http://hl7.org.nz/fhir/MedicationPrescription/medsample2'/>
                         <display value="Medication 2"/>
                     </item>
                 </entry>
             </List>
         </content>
     </entry>

     <!-- First Medication -->
     <entry>
         <title>Medication1</title>
         <id>http://hl7.org.nz/fhir/MedicationPrescription/medsample1</id>
         <updated>2013-05-28T22:12:21Z</updated>

         <content type="text/xml">
             <!-- Sample content only -->
             <MedicationPrescription xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">Medication 1</div>
                 </text>

                 <!-- All the other details of the Medication here -->
             </MedicationPrescription>
         </content>
     </entry>

     <!-- Second Medication -->
     <entry>
         <title>Medication2</title>
         <id>http://hl7.org.nz/fhir/MedicationPrescription/medsample2</id>
         <updated>2013-05-28T22:12:21Z</updated>

         <content type="text/xml">
             <!-- Sample content only -->
             <MedicationPrescription xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">Medication 2</div>
                 </text>

                 <!-- All the other details of the Medication here -->
             </MedicationPrescription>
         </content>
     </entry>

     <!-- Subject (Patient) -->
     <entry>
         <title>The subject of the document - Patsy Pregnant</title>
         <id>http://hl7.org.nz/fhir/Patient/patsypregnant</id>
         <updated>2013-05-28T22:12:21Z</updated>

         <content type="text/xml">
             <!-- Sample content only -->
             <Patient xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">Patsy Pregnant</div>
                 </text>
                 <!-- All the other details of Patient here -->
             </Patient>
         </content>
     </entry>

     <!-- Author (Practitioner) -->
     <entry>
         <title>The document author - Doctor Dave</title>
         <id>http://hl7.org.nz/fhir/Practitioner/drdave</id>
         <updated>2013-05-28T22:12:21Z</updated>

         <content type="text/xml">
             <!-- Sample content only -->
             <Practitioner xmlns="http://hl7.org/fhir">
                 <text>
                     <status value="generated"/>
                     <div xmlns="http://www.w3.org/1999/xhtml">Doctor Dave</div>
                 </text>
                 <!-- All the other details of Practitioner here -->
             </Practitioner>
         </content>
     </entry>

 </feed>


In the next post, we will start to think about how we can send it to the server, and what the server processing options are.

About David Hay
I'm a Product Strategist at Orion Health, Chair emeritus of HL7 New Zealand and co-Chair of the FHIR Management Group. I have a keen interest in health IT, especially health interoperability with HL7 and the new FHIR standard.

3 Responses to Creating a FHIR document for the January Connectathon

  1. Pingback: Retrieving and rendering a #FHIR document | Hay on FHIR

  2. Pingback: More comments on FHIR documents | Hay on FHIR

  3. Pingback: Modelling Encounters in FHIR: Part 2 | Hay on FHIR

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: