MegaScale Document Repository Mode
When a MegaScale-enabled FHIR Storage module is configured to use one of the Patient ID Partition Selection Modes, it can additionally be configured to work as a Patient-Partitioned Document Repository by enabling the Patient-Partitioned Document Repository setting.
This setting configures the repository to be able to efficiently store and retrieve FHIR Document Bundles which are partitioned by Patient ID.
Enabling this setting does not mean that the repository can only be used to store documents. Instead, it enables several specific behaviors when a document is being stored or when a document search is being performed. In other words, reading and writing other resource types including discrete data is always supported regardless of whether this setting is enabled or not.
When configured as a document repository, all documents must be associated with a Patient (referenced by the Composition.subject
element). If a document is submitted with a Patient ID that does not exist in the repository, a placeholder Patient resource will be created in the repository automatically and the document will be associated with the placeholder Patient.
This placeholder Patient resource will be created using any attributes found in the Patient resource that is submitted with the document. It may be modified at any time but should not be deleted.
When configured as a document repository, the module will automatically register the following search parameters with the FHIR server:
Name | Path | Description |
---|---|---|
Bundle: composition.subject | Bundle.where(type = 'document') |
This parameter can be used to search for documents by Patient ID, and by chained Patient identifier (only identifiers with Identifier.system values configured for Pre-Assignment may be used). The following examples show searches which use this parameter:
|
Bundle: composition.type | Bundle.where(type = 'document') |
This parameter can be used to search for documents by document type code, meaning any codes found within Composition.type .
|
Bundle: composition.category | Bundle.where(type = 'document') |
This parameter can be used to search for documents by document category code, meaning any codes found within Composition.category .
|
Bundle: composition.date | Bundle.where(type = 'document') |
This parameter can be used to search for documents by document date, meaning any codes found within Composition.date .
|
Combo Search Param: subject and type | Bundle#composition.subject and Bundle#composition.type |
This Combo Search Index Parameter indexes the combination of searching by subject and type code, to provide efficient searching for documents using this combination of parameters. |
Combo Search Param: subject and category | Bundle#composition.subject and Bundle#composition.category |
This Combo Search Index Parameter indexes the combination of searching by subject and category code, to provide efficient searching for documents using this combination of parameters. |
In a Patient Partitioned Document Repository, all documents must be associated with a Patient (referenced by the Composition.subject
element). Patients may be identified either directly by their resource ID, or by a Patient Identifier value with a system configured for Pre-Assignment.
The examples below are not intended to be complete FHIR documents and are missing various critical elements. They contain only the elements that are required to demonstrate the behavior of the Patient Partitioned Document Repository.
Documents must be submitted using a FHIR Transaction Bundle. The following example shows a FHIR Transaction Bundle which contains a document with a Patient identified by resource ID.
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
"resource": {
"resourceType": "Bundle",
"identifier": {
"system": "http://document",
"value": "1"
},
"type": "document",
"entry": [ {
"resource": {
"resourceType": "Composition",
"subject": {
"reference": "Patient/PAT-0"
},
"section": [ {
"focus": {
"reference": "MedicationStatement/f88e6811-6f5e-4650-a4e9-29e9199a3ab7"
}
} ]
}
}, {
"fullUrl": "Patient/PAT-0",
"resource": {
"resourceType": "Patient",
"id": "PAT-0",
"identifier": [ {
"system": "http://patient",
"value": "1"
} ]
}
}, {
"fullUrl": "MedicationStatement/f88e6811-6f5e-4650-a4e9-29e9199a3ab7",
"resource": {
"resourceType": "MedicationStatement",
"id": "f88e6811-6f5e-4650-a4e9-29e9199a3ab7",
"subject": {
"reference": "Patient/PAT-0"
}
}
} ]
},
"request": {
"method": "POST",
"url": "Bundle"
}
} ]
}
Documents must be submitted using a FHIR Transaction Bundle. The following example shows a FHIR Transaction Bundle which contains a document with a Patient identified by Patient resource identifier.
For the following example to work, the identfier system http://patient
must be configured for Pre-Assignment.
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [ {
"resource": {
"resourceType": "Bundle",
"identifier": {
"system": "http://document",
"value": "1"
},
"type": "document",
"entry": [ {
"resource": {
"resourceType": "Composition",
"subject": {
"reference": "urn:uuid:1e002a2e-5817-4c10-be61-dcb121421daf"
},
"section": [ {
"focus": {
"reference": "MedicationStatement/6d3826e7-a235-46e1-860b-ad0a3ed23f68"
}
} ]
}
}, {
"fullUrl": "urn:uuid:1e002a2e-5817-4c10-be61-dcb121421daf",
"resource": {
"resourceType": "Patient",
"identifier": [ {
"system": "http://patient",
"value": "1"
} ]
}
}, {
"fullUrl": "MedicationStatement/6d3826e7-a235-46e1-860b-ad0a3ed23f68",
"resource": {
"resourceType": "MedicationStatement",
"id": "6d3826e7-a235-46e1-860b-ad0a3ed23f68",
"subject": {
"reference": "urn:uuid:1e002a2e-5817-4c10-be61-dcb121421daf"
}
}
} ]
},
"request": {
"method": "POST",
"url": "Bundle"
}
} ]
}
You are about to leave the Smile Digital Health documentation and navigate to the Open Source HAPI-FHIR Documentation.