Skip to content

Document Reference

angshuman sarkar edited this page Jul 4, 2020 · 4 revisions

So you have seen how to transfer a media resource using the PHR envelope/bundle. As explained earlier, Media is a basic resource and does not express any semantic meaning. For transferring any clinical documents, or attachments/medias etc, you should consider using the FHIR DocumentReference. A document reference is used to transfer any document with context - who is the author, what is the context (encounter) and significantly whats the type and category of document.

So lets say we want to transfer clinical notes from a doctor (maybe a OP consultation) - but this time we want to specify some contexts and meta information about the document.


{
  "resourceType": "DocumentReference",
  "id": "21012",
  "masterIdentifier": {
    "system": "urn:fr:hip",
    "value": "urn:oid:hip1001.21012"
  },
  "status": "current",
  "docStatus": "final",
  "type": {
    "text": "Clinical Note",
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "34108-1",
        "display": "Outpatient Note"
      },
      {
        "system": "http://egovstandards.gov.in/mdds/CD05.046",
        "code": "17",
        "display": "Clinical Note"
      }
    ]
  },
  "subject": {
    "display": "Hina Patel",
    "reference": "Patient/NCP10008"
  },
  "date": "2005-12-24T09:43:41+11:00",
  "author": [
    {
      "display": "Dr. Manju Sengar",
      "reference": "Practitioner/DHID1234"
    }
  ],
  "authenticator": {
    "display": "Hospital 10001",
    "reference": "Organization/HIP1001"
  },
  "description": "Human readable description - about the document",
  "securityLabel": [
    {
      "coding": [
        {
          "system": "http://terminology.hl7.org/CodeSystem/v3-Confidentiality",
          "code": "N",
          "display": "Normal"
        }
      ]
    }
  ],
  "content": [
    {
      "attachment": {
        "contentType": "application/pdf",
        "title": "Clinical Notes",
        "data": "base 64 encoded inline data"
      }
    }
  ],
  "context": {
    "encounter": [
      {
        "reference": "Encounter/E001",
        "display": "ambulatory encounter which lead to this document"
      }
    ],
    "period": {
      "start": "2004-12-23T08:00:00+11:00",
      "end": "2004-12-23T08:01:00+11:00"
    }
  }
}
  • id - must be unique within the bundle context.
  • masterIdentifier - optional. not used in reference stack. However, may be useful in other context, especially as a traceability means within the hospital.
  • status - usually "current", unless you are superseding the document
  • docStatus - preliminary | final | amended
  • type - type of the document. "Text" is mandatory, you may use coding. Please refer to country specific codes and mandates. The above example illustrates uses of multiple coding - loinc and MDDS (for India). Indian MDDS standards for code directory can be found here - check table for Clinical Document Type (CD05.046)
  • subject - reference to the patient resource in the bundle. In PHR context, the patient is already known, and reference stack do not use this - however it maybe useful for document exchanges. Please check country specific mandate.
  • date - date the document was created. mandatory.
  • author - reference to the practitioner resource. "Text" is mandatory. You may provide additional details using the practitioner resource in the same bundle.
  • authenticator - usually the organization where the document was created. Optional in PHR framework context, as HIU or patient systems know the origin of the document. Maybe mandated for other contexts.
  • description - Human readable description - about the document. Optional.
  • securityLabel - optional. Describes risk of harm if disclosed.
  • content - one or more attachments. "attachment.data" must be based64 encoded inline data. Check the media resource guide on how to encode to base64 data. Please do not send http URL as attachment. "attachment.contentType" describes the mimetype of the content. Refer here for common mimetypes - however please restrict to the following mimetypes - "application/pdf", "application/msword", "image/png", "image/jpeg", "application/msword", "application/rtf", "video/mpeg" etc. It purely depends on the Patient application or Doctor's application capability of rendering the attachment.
  • context - provides the context of the document - for example the encounter, which if provided is reference to encounter resource within the bundle. "context.period" is optional.

 

Now lets try to add some of the references described above.

{
  "resourceType": "Encounter",
  "id": "E001",
  "status": "finished",
  "class": {
    "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
    "code": "AMB",
    "display": "Outpatient visit"
  }
}
  • id - notice the id is same as specified in the context.encounter "Encounter/E001
  • class - you must provide the "display" text. It is advised that you provide the code if possible. IMB - inpatient, AMB - outpatient/ambulatory, EMER - emergency, FLD - field, VR - virtual, HH - Health at home

And lets add the practitioner resource as well


{
  "resourceType": "Practitioner",
  "id": "P007",
  "identifier": [
     {
       "system": "http://mciindia.org/",
       "value": "2318"
     }
  ],
  "name": [
    {
      "text": "Manju Sengar",
      "family": "Sengar",
      "given": [
        "Manju"
      ],
      "prefix": [
        "Dr"
      ],
      "suffix": [
        "MD"
      ]
    }
  ]
}

For explanation of the above attributes, please refer here

Lets put all these together in the PHR envelope.


{
  "resourceType": "Bundle",
  "id": "89fb2983-9cef-4f67-baa2-4304f37c8ec8",
  "type": "collection",
  "entry": [
    {
      "fullUrl": "urn:uuid:21012",
      "resource": {
        "resourceType": "DocumentReference",
        "id": "21012",
        "masterIdentifier": {
          "system": "urn:fr:hip",
          "value": "urn:oid:hip1001.21012"
        },
        "status": "current",
        "docStatus": "final",
        "type": {
          "text": "Clinical Note",
          "coding": [
            {
              "system": "http://loinc.org",
              "code": "34108-1",
              "display": "Outpatient Note"
            },
            {
              "system": "http://egovstandards.gov.in/mdds/CD05.046",
              "code": "17",
              "display": "Clinical Note"
            }
          ]
        },
        "subject": {
          "display": "Hina Patel",
          "reference": "Patient/NCP10008"
        },
        "date": "2005-12-24T09:43:41+11:00",
        "author": [
          {
            "display": "Dr. Manju Sengar",
            "reference": "Practitioner/DHID1234"
          }
        ],
        "authenticator": {
          "display": "Hospital 10001",
          "reference": "Organization/HIP1001"
        },
        "description": "Human readable description - about the document",
        "securityLabel": [
          {
            "text": "Normal",
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/v3-Confidentiality",
                "code": "N",
                "display": "Normal"
              }
            ]
          }
        ],
        "content": [
          {
            "attachment": {
              "contentType": "application/pdf",
              "title": "Clinical Notes",
              "data": "base 64 encoded inline data"
            }
          }
        ],
        "context": {
          "encounter": [
            {
              "reference": "Encounter/E001",
              "display": "ambulatory encounter which lead to this document"
            }
          ],
          "period": {
            "start": "2004-12-23T08:00:00+11:00",
            "end": "2004-12-23T08:01:00+11:00"
          }
        }
      }
    },
    {
      "fullUrl": "urn:uuid:E001",
      "resource": {
        "resourceType": "Encounter",
        "id": "E001",
        "status": "finished",
        "class": {
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "code": "AMB",
          "display": "Outpatient visit"
        }
      }
    },
    {
      "fullUrl": "urn:uuid:DHID1234",
      "resource": {
        "resourceType": "Practitioner",
        "id": "DHID1234",
        "identifier": [
          {
            "system": "http://mciindia.org/",
            "value": "2318"
          }
        ],
        "name": [
          {
            "text": "Manju Sengar",
            "family": "Sengar",
            "given": [
              "Manju"
            ],
            "prefix": [
              "Dr"
            ],
            "suffix": [
              "MD"
            ]
          }
        ]
      }
    }
  ]
}
  1. Notice how each of the individual resource is an entry in the bundle, the first resource DocumentReference establishes the references to other resources like Encounter and Practitioner, which find places in the same bundle, resolvable by the id (resouce-type/id). If you put any of the referenced resources in a different bundle, then the envelope is broken.
  2. Also notice that each entry has a "fullUrl" following the pattern "urn:uuid:". The "uuid" is same as the "id" of the resource. The same id is referenced from the parent resource, in this case the DocumentReference.
  3. You can put X number of root resources and X number of references in the same bundle. Just don't make the bundle too big!