In the previous FHIR-XDS post we discussed how a document source actor (ie a system that creates a document) could create a document and DocumentReference resource and send them to the Repository server. (Actually, we described a couple of ways that this could be done – and there are a few subtleties yet to discuss about server behaviour – but we’ll hold that for later).
However, we didn’t have a lot of time to talk about the DocumentReference resource itself. This resource represents the metadata about the document and allows a consumer to search the registry (or any server hosting these resources) to retrieve matching documents. From these results, a consumer can then generate a list of documents so that a consumer can select one to view.
The documents themselves can be of any allowed type (CDA, PDF, FHIR document, text etc) and can be stored on any server accessible via HTTP – and they do not need to be FHIR servers. It is quite legitimate for a DocumentReference resource to refer to a static document on any server (or, for that matter, a URL that generates a document ‘on the fly’, though you’d want some way to persist the generated document for medico-legal reasons as described in the ‘IHE on-demand document‘ profile). And, if one is being particularly pedantic, then even HTTP is not really required – you could use FTP or any other supported protocol.
It is important to note that although the DocumentReference resource was developed to support some of the requirements of an XDS infrastructure, it is not restricted to that purpose and can be used in any situation where the business requirement is to create a ‘list of available documents’, from which one or more can be chosen for viewing.
In fact, the FHIR specification defines a specific XDS profile that describes how the DocumentReference resource is to be used in the context of an XDS installation – for example some fields that are optional in the resource, are required when acting as a proxy to XDS. The link also gives guidance for mapping between XDS and FHIR elements, including fields required for XDS that are not in the DocumentReference and so represented by extensions.
The following description refers to the generic DocumentReference resource. Note that there are a number of properties whose value should come from a ValueSet defined by the governance body that oversees the overall installation (an Affinity Domain in XDS-speak – though the affinity domain covers much more than just code sets). We will talk a bit more about ValueSet’s after this list.
- The masterIdentifier is the identifier of the document as created by the source. It is version specific – i.e. a new one is required if the document is updated (We’ll talk about updating documents in a separate post).
- There can be any number of other document identifiers that make sense. For example, there might be a version independent identifier here.
- The subject is who the document is about. Generally this is a patient, but the specification also supports a Practitioner, a Group or a Device.
- The type and class indicate what kind of document this is- (eg a discharge summary). A ValueSet should be defined for each. (Note that ‘class’ has been called ‘sub-type’ in some versions of this resource)
- There is at least one author, which is a Practitioner.
- There can be an Organization which is the custodian of the document – responsible for maintaining the document
- There’s a policyManager link to a URL that describes the access policies to the document.
- The authenticator of the document can be an Organization or a Practitioner.
- The created date is when the document was created (not necessarily related to the period of the service that the document may describe – this is in the context.period element).
- The indexed date which is when the DocumentReference resource was created.
- The status allows minimal workflow of this DocumentReference resource (NOT the underlying document). Options are current, superseded or error. We’ll talk more about this status when we talk about updating a document in a later post.
- The docStatus and supercedes allow a document to be updated (superseded) or otherwise have it’s status changed. This is a CodeableConcept, and so can accommodate a specific workflow defined by the affinity domain such as preliminary, final, amended or whatever, as documented in the ValueSet.
- The description is the title of the document. If you’re displaying list of documents then this would be a good property to use.
- The Confidentiality property allows a privacy policy to control the access to a document. The policy can also use the generic tags functionality in FHIR.
- The PrimaryLanguage element indicates exactly that – no surprises here. It is a code, and is bound to the IETF Language tag.
- mimeType and format indicate how the document is represented – eg xml, pdf, msword etc.
- Size allows a client to estimate download time of the document, and the hash can ensure integrity.
- The Location is a URI that indicates from where the document can be downloaded. This does not need to be a FHIR server. The client will (generally) not know what this is when creating the resource as it will be related to the ID that the server assigns. However, either it or the service property is required, so it may be necessary to create a ‘dummy’ resource using the cid: prefix so the server knows it is not real – or define a service. You would define a local policy to describe this, which could be identified in the policyManager link above.
- The service is used if the location is not known. You would use this if you weren’t using simple FHIR REST, so for the moment we’ll ignore it.
- The context allows you to specify the clinical context of the document – at least the context that is useful in searching or displaying the document list. The period that the document refers to and the facility type are present, but you can add codes that make sense here as well.
For reference, the following fields need to have their options defined by the governing body using a ValueSet. These can either be defined directly in the ValueSet or be a sub-set of an external Terminology like LOINC or SNOMED.
- type
- subtype
- docStatus
- confidentiality
- mimeType
- format
- context.code
- context.facilityType
The recommended way to document this is to create a Profile resource that describes the implementation, and refers to the appropriate ValueSets – with the whole lot being saved in FHIR server/s so that they can be easily located. The option below shows a minimal profile that sets the ValueSet for the confidentiality property.
<Profile xmlns="http://hl7.org/fhir"> <text> <status value="additional"/> <div xmlns="http://www.w3.org/1999/xhtml">Minimal profile for confidentiality codes in DocumentReference</div> </text> <name value="Elbonian XDS Profile"/> <status value="draft"/> <structure> <type value="DocumentReference"/> <name value="XDSDocumentReference"/> <element> <path value="DocumentReference.confidentiality"/> <name value="ConfidentialityOptions"/> <definition> <short value="Confidentiality Code options"/> <formal value="Confidentiality Code options"/> <min value="1"/> <max value="1"/> <isModifier value="false"/> <binding> <name value="List of confidentiality options"/> <isExtensible value="false"/> <referenceResource value="/ValueSet/ConfidentialityOptions"/> </binding> </definition> </element> </structure> </Profile>
and the ValueSet that it references could look like:
<ValueSet xmlns="http://hl7.org/fhir"> <text> <status value="additional"/> <div xmlns="http://www.w3.org/1999/xhtml">The value set for confidentiality codes in the elbonian document sharing project. The codes are defined directly by the valueset, rather than references to an external terminology</div> </text> <name value="ConfidentialityOptions"/> <description value="ConfidentialityOptions"/> <status value="draft"/> <!-- Define the options in the resource rather than an external terminology--> <define> <system value="http://fhir.moh.elbonia.com/confidentiality"/> <concept> <code value='N'/> <display value="Normal"/> <definition value="That the document is of normal confidentiality - is able to be viewed for any authenticated user"/> </concept> <concept> <code value='H'/> <display value="High"/> <definition value="Then the document is Highly confidential - eg Mental health - and can only be viewed by people authorized to access documents at that level"/> </concept> </define> </ValueSet>
Finishing up…
In the previous post I promised that I would talk about the DocumentManifest resource. This is a new addition to the FHIR family, and has been introduced to support the ability for a document source to submit a collection of documents in a single batch as XDS does.
In truth, I’m not entirely clear how this resource should be used. It does have the recipient element, which provides the basis for a notification system, but beyond that the main value would seem to be that there can be more than a single document in a batch submission to the Repository server. I’ll update the post when I learn more.
So, we have saved a document in the repository and updated the registry. In the next post, we’ll switch our attention to the Document Consumer and discuss how to query the registry for documents, and to get the actual document itself.