---
title: FHIR DocumentReference to index document on Patient Portal
tags: FHIR_SkinLesionImageManagement
---
<font color="red">FHIR </font>DocumentReference to index document on Patient Portal
===
<div style="text-align:justify;">This chapter describes the scheme of how resource owners index documents on the Patient Portal through the FHIR DocumentReference.
FHIR Document Reference is used to index documents across resource servers with the aim of making it easier for documents to be accessed and granted in the health care ecosystem.
**Examples:**
Patient A has an electronic health record in a hospital, to allow the electronic health record to be accessed by many health institutions, the electronic health record needs to be indexed on a public server in the form of an FHIR DocumentReference reference to the original document url .
There are 2 scenarios in generating FHIR DocumentReference on Patient Portal:
1. The patient or physician manually performs the indexing document on the Patient Portal
2. FHIR EHR & PHR automatically generates FHIR DocumentReference to Patient Portal each time notified by client to post DocumentReference
In this article, we will discuss scenario 1.
</div>
## Table of Contents
[TOC]
## 1. Scenario
Once the owner has a document that he wants to be able to grant it to someone else. Then the resource owner needs to index the document on the Patient Portal in the form of an FHIR DocumentReference, which includes a reference to the original document.
## 2. Purpose
- Quick query access of document
- Optimizing performance of resource server by minimizing document storage memory, and minimizing memory used in the querying process
- Index documents across resource servers
- Easier for documents to be accessed and granted in heathcare ecosystem
## 3. Block management on patient portal used
The scheme of indexing document using FHIR DocumentReference will use portal resource management.

- Resource Management
Act as resource registry, which stores FHIR DocumentReference for indexing document use.
- Personnel Management (Person, Institutional & Organizational)
Provide list of personnel information including person, practitioner, institutional, and organizational, which is used in setting the detailed information of the document reference, includes subject, author, and other role elements.
## 4. FHIR Resource used
- FHIR DocumentReference= documents that contain reference to the original document
- FHIR Document= the the original document
### 4.1 Resource relation

FHIR DocumentReference is composed of various information regarding the document to be indexed, including information oh the resource owner, the author, the authenticator, custodian, and the original document url.
## 5. DocumentReference specification
| FHIR variable | R/O | Description |
| -------- | -------- | -------- |
| subject | O | The subject of the document be referenced |
| date | O | The date-time the DocumentReference created |
| author | O | The author who create the DocumentReference |
| custodian | O | The organization that manage the document be referenced |
| content | O | The actual document be referenced |
### Prerequisite
1. [Personel management establishment](/rk3qR60Zo)
2. Document url to be index, can be any file url such as skin lesion image, image exam report, etc.
#### Example
##### 1. DocumentReference input by patient
:::spoiler Patient/46179774-1a1e-4ae4-b626-9ff53fa080f4 [(example)](https://203.64.84.150:58443/portaltest1/fhir/Patient/46179774-1a1e-4ae4-b626-9ff53fa080f4)
```gherkin=
{
"resourceType": "Patient",
"id": "46179774-1a1e-4ae4-b626-9ff53fa080f4",
"meta": {
"versionId": "1",
"lastUpdated": "2022-08-30T16:45:53.199+08:00",
"source": "#2E1dW1HdBAatV1og"
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\"/><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>111316001</td></tr></tbody></table></div>"
},
"identifier": [ {
"system": "username",
"value": "111316001"
} ],
"active": true,
"name": [ {
"text": "Will Smith"
} ],
"managingOrganization": {
"reference": "Organization/MIPatientPortal",
"display": "MI Patient Portal"
}
}
```
:::
:::spoiler DocumentReference/misac.documentreference01[(example)](https://203.64.84.150:58443/portaltest1/fhir/DocumentReference/136)
```gherkin=
{
"resourceType": "DocumentReference",
"id": "136",
"meta": {
"versionId": "1",
"lastUpdated": "2022-12-28T15:28:49.556+08:00",
"source": "#Zb6J03TcNu1iSxWr"
},
"status": "current",
"subject": {
"reference": "Patient/88df8172-9f58-4a0f-bcca-bcdcd5ea6485",
"display": "Will Smith"
},
"date": "2022-10-05T12:24:39",
"author": [ {
"reference": "Patient/88df8172-9f58-4a0f-bcca-bcdcd5ea6485",
"display": "Will Smith"
} ],
"custodian": {
"reference": "Organization/98a6f5c5-af58-41b5-bd6f-d8ca996b5580",
"display": "MI Patient Portal"
},
"content": [ {
"attachment": {
"url": "https://tzfhir.ml:53443/SkinlesionManagement/Image/82/28ef0930-1d64-45d1-9e47-60083058e9b0.jpg"
}
} ]
}
```
:::
##### 2. DocumentReference input by physician
:::spoiler DocumentReference/misac.documentreference01[(example)](https://203.64.84.150:58443/r5/fhir/DocumentReference/135)
```gherkin=
{
"resourceType": "DocumentReference",
"id": "135",
"meta": {
"versionId": "1",
"lastUpdated": "2022-12-28T15:28:00.173+08:00",
"source": "#iM75I4QF9Amcwtpx"
},
"status": "current",
"subject": {
"reference": "Patient/88df8172-9f58-4a0f-bcca-bcdcd5ea6485",
"display": "Will Smith"
},
"date": "2022-10-05T12:24:39",
"author": [ {
"reference": "PractitionerRole/af055cb6-bd06-4ce4-9967-90d4e9f25044",
"display": "Will Smith"
} ],
"custodian": {
"reference": "Organization/98a6f5c5-af58-41b5-bd6f-d8ca996b5580",
"display": "MI Patient Portal"
},
"content": [ {
"attachment": {
"url": "https://tzfhir.ml:53443/SkinlesionManagement/Image/82/28ef0930-1d64-45d1-9e47-60083058e9b0.jpg"
}
} ]
}
```
:::
## 5. Reference
- [Who have access to your medical record](https://www.verywellhealth.com/who-has-access-to-your-medical-records-2615502#:~:text=Your%20healthcare%20providers%20have%20a,your%20records%20with%20that%20specialist.)
## 6. Demo
- [Demo website](https://jeshika106316155.github.io/FHIR_DocumentReference/)
- Github: https://github.com/jeshika106316155/FHIR_DocumentReference.git
## 6. Question
- Can practitioners index patient/other people's documents?