Skip to content

PHR FHIR Envelope

angshuman sarkar edited this page Sep 14, 2020 · 26 revisions

All data that you want to transfer, should be in a FHIR Bundle, forming the base PHR Envelope. A Bundle is a means of packaging multiple information of multiple types - either as disparate Collection or as Document. The entire bundle is referred as data "content".

  • You can send over multiple such contents/bundles through the data transfer api. Please see the reference API documentation for details.
  • Note the content (bundle) itself must be encrypted. Please refer to the API documentation of how data should be sent over HTTPS. For encryption of the "content" or "bundle", you should refer to the API and Diffie-Hellman key exchange documentation.
  • The relevant sections only focuses on the packaging information in FHIR resources' format.

NOTE: In India, CDAC National Resource Center for EHR Standards provides a comprehensive Implementer's Guide to assist you to create FHIR documents compliant to the FHR standards. If you are integrating with NDHM, then you must adhere to NDHM FHIR formats and standards maintained NRCeS

The basic Bundle

{
  "resourceType": "Bundle",
  "id": "bundle01",
  "meta": {
    "lastUpdated": "2020-01-01T15:32:26.605+05:30"
  },
  "timestamp": "2020-01-01T15:32:26.605+05:30",
  "identifier": {
    "system": "https://example.hospital.com/pr",
    "value": "bundle01"
  },
  "type": "document",
  "entry": [
    {
      "fullUrl": "Composition/1",
      "resource": {
        "resourceType": "Composition",
        "id": "1",
        "date": "2020-01-01T15:32:26.605+05:30",
        "meta": {
          "versionId": "1",
          "lastUpdated": "2020-01-01T15:32:26.605+05:30"
        },
        "identifier": {
          "system": "https://example.hospital.com/documents",
          "value": "645bb0c3-ff7e-4123-bef5-3852a4784813"
        },
        "status": "final",
        "type": {
          "coding": [
            {
              "system": "https://affinitydomain.in/sct",
              "code": "440545006",
              "display": "Prescription record"
            }
          ]
        },
        "subject": {
          "reference": "Patient/1",
          "display" : "Hina Patel" 
        },
        "author": [
          {
            "reference": "Practitioner/1"
            "display" : "Dr. Manju Sengar"  
          }
        ],
        "title": "Prescription record",
        "encounter" : {
           "reference": "Encounter/7fce6ec8-5013-4a27-b0a6-c43232608cda",
           "display": "OP Visit"
        },
        "section": [
          {
            "title": "Prescription record",
            "code": {
              "coding": [
                {
                  "system": "https://affinitydomain.in/sct",
                  "code": "440545006",
                  "display": "Prescription record"
                }
              ]
            },
            "entry": [
              {
                "reference": "MedicationRequest/1"
              }
            ]
          }
        ]
      }
    },
    {
        "fullUrl": "Encounter/7fce6ec8-5013-4a27-b0a6-c43232608cda",
        "resource": {
          "resourceType": "Encounter",
          "id": "7fce6ec8-5013-4a27-b0a6-c43232608cda",
          "status": "finished",
          "class": {
            "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
            "code": "AMB",
            "display": "Outpatient visit"
          }
        }
    },
    {
      "fullUrl": "MedicationRequest/1",
      "resource": {
        "id": "1",
        "resourceType": "MedicationRequest",
        ... 
        
      }
    }
  ]
}

The above is the basic structure of a PHR FHIR Bundle.

  • resourceType* - must be Bundle
  • id* - must be unique for each bundle that you want to send. For traceability purpose, its recommended that you provide id (for every resource) that you must be able to resolve within your system.
  • timestamp* - should be time of issue of the document.
  • identifier* - should be an identifier by which you can trace the document back to your system
  • type* - must be "document". The first resource must be a composition in the bundle, and is meant for contextual grouping of information.
  • entry* - is an array of FHIR resources. As of now, the reference HIU service supports top level Health Information (HI) types like - "Prescription", "Diagnostic Report", "Discharge Summary", "OP Consultation", which may contain resources like "Observation", "Condition", "MedicationRequest", "DocumentReference", "DiagnosticReport", "Procedure" - and also other reference entities like "Medication", "Practitioner", "Patient", "Organization", etc.

Composition

The composition is the first resource in the bundle and acts as a .. logical package that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. It defines the structure and content necessary for a document. Note, it alone does not mean anything, but along with its sections and entries allow grouping and packaging of all other resources, which when referenced from Composition must be included as entries in the Bundle.

  • title* - Must be provided and must broadly describe what the composition is about.
  • type* - should specify what the type of the document is. For example "440545006" is meant for "Prescription Record" is SNOMED-CT.
  • encounter* - provides the context of visit or clinical encounter.
  • subject* - the patient reference. You can provide a minimal information. You should also provide a "display" attribute (typically the name) for the subject.
  • author* - specifies the practitioner who is author of the document. In some context, this maybe an Organization resource reference as well. Again, please provide a "display" attribute as well.
  • section* - sections and their entries are used to list out the top level resources the document is composed of. For example, in the example above, it may contain list of MedicationRequest (even a DocumentReference or Binary containing an image). Note, do not include the referenced resources (e.g. Patient, Encounter, Practitioner etc) in the section.entry[] - such resources must be available in the bundle, but need not be included in the section.list[].

IMPORTANT

  • notice each bundle entry's fullUrl: there are 2 ways to specify so.
    • specified as "resource-type/id", as logical URL, and resolvable within the bundle. Each resource id must be also specified.
    • specified as urn:uuid, followed by the <uuid>. This is also the "id" of resource.
  • All entries must be resolvable in the bundle
  • Please do not provide absolute URL for any references

 

So let's say the Doctor wants to just prescribe a medication, her EMR/EHR can provide basic details in textual format, but does not means of mapping and sending standardised/encoded data - yet. Here, we can use a MedicationRequest resource to minimally describe and send over data.

MedicationRequest Resource

MedicationRequest resource, must mention what is the medication (either as simple CodeableConcept or as Reference to Medication). For complete details, please refer to FHIR MedicationRequest documentation.

Towards the above example, we would probably send over a response like

{
  "id": "1",
  "resourceType": "MedicationRequest",
  "subject": {
    "reference": "Patient/1",
    "display": "Hina Patel"
  },
  "status": "active",
  "intent": "order",
  "requester": {
    "reference": "Practitioner/1",
    "display": "Dr Manju Sengar"
  },
  "medicationCodeableConcept": {
    "coding": [
      {
        "system": "https://whocc.no/atc",
        "code": "N02BE01",
        "display": "Paracetamol 500mg"
      }
    ]
  },
  "authoredOn": "2020-01-01",
  "dosageInstruction": [
    {
      "text": "1 tablet twice a day",
      "route": {
        "text": "Oral"
      }
    }
  ],
  "dispenseRequest": {
      "quantity": {
        "value": “10”,
        "unit": "TAB",
      }
  },				
  "reasonReference": [
    {
      "reference": "Condition/1",
      "display": "Fever"
    }
  ]
}

The above is an example of a Medication Request resource with minimal information. Most of it should be self-explanatory, but it is trying to say that Paracetamol 500mg was prescribed for Fever.

  • resourceType* - must be specified - in this case MedicationRequest
  • id* - unique Id of the MedicationRequest resource within the bundle context. Please note the relevance to the entry fullUrl as explained above
  • status* - active. Usually. For other status values - check FHIR MedicationRequest documentation.
  • authoredOn* - time in UTC format. Note, if the Media resource is sent independently, then you must specify the createdDateTime.
  • intent* - order, check FHIR documentation for more options.
  • medicationCodebableConcept - or medicationReference must be specified.
  • dosageInstruction - at least the dosage.text must be specified.

Putting it altogether

Now if I were to put the "MedicationRequest" in the bundle's entry section, I would have something like below.

{
  "resourceType": "Bundle",
  "id": "bundle01",
  "meta": {
    "lastUpdated": "2020-01-01T15:32:26.605+05:30"
  },
  "timestamp": "2020-01-01T15:32:26.605+05:30",
  "identifier": {
    "system": "https://example.hospital.com/pr",
    "value": "bundle01"
  },
  "type": "document",
  "entry": [
    {
      "fullUrl": "Composition/1",
      "resource": {
        "resourceType": "Composition",
        "id": "1",
        "date": "2020-01-01T15:32:26.605+05:30",
        "meta": {
          "versionId": "1",
          "lastUpdated": "2020-01-01T15:32:26.605+05:30"
        },
        "identifier": {
          "system": "https://example.hospital.com/documents",
          "value": "645bb0c3-ff7e-4123-bef5-3852a4784813"
        },
        "status": "final",
        "type": {
          "coding": [
            {
              "system": "https://affinitydomain.in/sct",
              "code": "440545006",
              "display": "Prescription record"
            }
          ]
        },
        "subject": {
          "reference": "Patient/1",
          "display": "Hina Patel"
        },
        "author": [
          {
            "reference": "Practitioner/1",
            "display": "Dr. Manju Sengar"
          }
        ],
        "title": "Prescription record",
        "encounter" : {
           "reference": "Encounter/7fce6ec8-5013-4a27-b0a6-c43232608cda",
           "display": "OP Visit"
        },
        "section": [
          {
            "title": "Prescription record",
            "code": {
              "coding": [
                {
                  "system": "https://affinitydomain.in/sct",
                  "code": "440545006",
                  "display": "Prescription record"
                }
              ]
            },
            "entry": [
              {
                "reference": "MedicationRequest/1"
              }
            ]
          }
        ]
      }
    },
    {
        "fullUrl": "Encounter/7fce6ec8-5013-4a27-b0a6-c43232608cda",
        "resource": {
          "resourceType": "Encounter",
          "id": "7fce6ec8-5013-4a27-b0a6-c43232608cda",
          "status": "finished",
          "class": {
            "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
            "code": "AMB",
            "display": "Outpatient visit"
          }
        }
    },
    {
      "fullUrl": "MedicationRequest/1",
      "resource": {
        "id": "1",
        "resourceType": "MedicationRequest",
        "subject": {
          "reference": "Patient/1",
          "display": "Hina Patel"
        },
        "status": "active",
        "intent": "order",
        "requester": {
          "reference": "Practitioner/1",
          "display": "Dr Manju Sengar"
        },
        "medicationCodeableConcept": {
          "coding": [
            {
              "system": "https://whocc.no/atc",
              "code": "N02BE01",
              "display": "Paracetamol 500mg"
            }
          ]
        },
        "authoredOn": "2020-01-01",
        "dosageInstruction": [
          {
            "text": "1 tablet twice a day",
            "route": {
              "text": "Oral"
            }
          }
        ],
        "dispenseRequest": {
           "quantity": {
              "value": “10”,
              "unit": "TAB",
           }
        },
        "reasonReference": [
          {
            "reference": "Condition/1",
            "display": "Fever"
          }
        ]
      }
    }
  ]
}

And thats it, you have your first PHR FHIR bundle ready to be encrypted and sent!

  • Notice how each of the individual resource is an entry in the bundle. If you have referenced resource (from a top level resource like DiagnosticReport or MedicationRequest ) You must put all referencing and referenced resources together in the same bundle, such that all are resolvable from the same bundle. If you put any of the referenced resources in a different bundle, then the envelope is broken.
  • You can put X number of root resources and X number of references in the same bundle. Just don't make the single bundle too big!
  • Send only one Composition as part of the bundle.
  • Notice how the composition mentions that the document is a "Prescription" record. This way relevant and contextual information are grouped together in the same bundle. If the doctor was prescribing multiple medications during the same clinical encounter, see Prescription, all prescribed medications could be done in the same document. This way you can also reuse the references such as encounter, practitioner etc resources in the same bundle, as all the individual MedicationRequests refer to the same resources of Encounter and Practitioner.

IMPORTANT

  • Check with India or Country specific guidelines for Terminologies, Codings and Standards. The above example, mentions "440545006" as "Prescription Record" code, but it maybe very well be a LOINC document code. Same applies for any code/concept for Medication (e.g. medicationRequest.medicationCodeableConcept).
  • Composition bundle maybe subjected to specific profile or structures defined by the country. Please check with relevant authority for such conformance.

TIPS

  • You are never going to handcode the JSON above! You would use a FHIR client library. There are many in many different programming language in the FHIR references for developers/implementers.
  • During development, its usually a good idea to validate the resource. For this, you may use one of the validators listed in the reference library/resources section. For example, the following example validates the entire file content (json)

java -jar org.hl7.fhir.validator.jar AttachedMediaAsReport.json -version 4.0