US Core Implementation Guide
8.0.1 - STU 8 US

US Core Implementation Guide, published by HL7 International / Cross-Group Projects. This guide is not an authorized publication; it is the continuous build for version 8.0.1 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/US-Core/ and changes regularly. See the Directory of published versions

## Resource Profile: US Core DocumentReference Profile

Official URL: http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference | Version: 8.0.1
Standards status: Trial-use | Maturity Level: 3 | Computable Name: USCoreDocumentReferenceProfile
Other Identifiers: OID:2.16.840.1.113883.4.642.40.2.42.22
Copyright/Legal: Used by permission of HL7 International, all rights reserved Creative Commons License

The US Core DocumentReference Profile inherits from the FHIR DocumentReference resource; refer to it for scope and usage definitions. This profile sets minimum expectations for searching and fetching patient documents including Clinical Notes using the DocumentReference resource. It specifies which core elements, extensions, vocabularies, and value sets SHALL be present and constrains how the elements are used. Providing the floor for standards development for specific use cases promotes interoperability and adoption. Before reviewing this profile, implementers are encouraged to read the Clinical Notes Guidance to understand the overlap of the US Core DiagnosticReport Profile for Report and Note exchange and the US Core DocumentReference Profile.

Example Usage Scenarios:

The following are example usage scenarios for the US Core DocumentReference profile. See the Clinical Notes section for additional details on using this profile for Clinical Notes:

- Query for all documents belonging to a Patient
- Query for a specific Clinical Note type (e.g., Discharge Summary or Continuity of Care Document (CCD))
- Query for all Clinical Notes belonging to a Patient
- Write a new Note to a Patient's Chart

### Mandatory and Must Support Data Elements

The following data elements must always be present (Mandatory definition) or must be supported if the data is present in the sending system (Must Support definition). They are presented below in a simple human-readable explanation. Profile specific guidance and examples are provided as well. The Formal Views below provides the formal summary, definitions, and terminology requirements.

Each DocumentReference Must Have:

1. a status
2. a code describing the type of document
3. a document category
4. a patient
5. document referenced (content)
6. the MIME type (i.e., contentType) of the document

Each DocumentReference Must Support:

1. a business identifier for the DocumentReference (possibly generated by the transcription system or EHR)
2. date and time the reference was created
3. an author
4. a code identifying the specific details about the format of the document — over and above the content's MIME type
5. the patient encounter that is being referenced
6. clinically relevant date

Additional USCDI Requirements:

This Additional USCDI Requirements element is not Mandatory or Must Support but is required for ASTP Health IT certification testing and is included in the formal definition of the profile and the DocumentReference examples.

1. a document category limited to The US Core DocumentReferences Type Value Set, which currently consists of a single value, "clinical note."

Profile Specific Implementation Guidance:

- See Clinical Notes
- The `DocumentReference.type` binding Must Support, at a minimum, the 10 Common Clinical Notes and may extend to the whole US Core DocumentReference Type Value Set
- In addition to the US Core DocumentReference Category value set, other category schemes such as the LOINC-based Document Class Value Set and IHE XDSclassCode may be used to facilitate the sharing of health documents.
- For a C-CDA Clinical Summary of Care (CCD):
  - The document type code is the LOINC code 34133-9 Summary of episode note.
- For C-CDA Clinical Documents
  - The format code in `DocumentReference.content.format` is "urn:hl7-org:sdwg:ccda-structuredBody:2.1".
  - For other CDA documents, Servers SHOULD select the appropriate format code from the HL7 ValueSet of Format Codes for use with Document Sharing.
- The DocumentReference resources can represent the referenced content using either an address where the document can be retrieved using `DocumentReference.content.attachment.url` or the content as inline base64 encoded data using `DocumentReference.content.attachment.data`.
  - Although both are marked as Must Support, the Server system is not required to support an address and inline base64 encoded data, but SHALL support at least one of these elements.
  - The Client application SHALL support both elements.
  - The `DocumentReference.content.attachment.url` may refer to a FHIR Binary Resource (i.e., [base]/Binary/[id]), FHIR Document Bundle (i.e., [base]/Bundle/[id], or another endpoint).
    - If the referenced a document or file is hosted on a server outside the FHIR server, it should be securely accessible using the same authorization credentials that were used to access the FHIR server. This reduces complexity for the client and improves the user experience.
  - If there are multiple `DocumentReference.content` element repetitions, these SHALL all represent the same document in different formats or attachment metadata. The content element SHALL NOT contain different versions of the same content. For version handling, use multiple DocumentReferences with `DocumentReference.relatesTo`.
- Every DocumentReference must have a responsible Organization. The organization responsible for the DocumentReference SHALL be present either in `DocumentReference.custodian` or accessible in the Provenance resource targeting the DocumentReference using `Provenance.agent.who` or `Provenance.agent.onBehalfOf`.
  - Some systems may also expose the same organization in referenced Encounter in `Encounter.serviceProvider`.

Usages:

- Refer to this Profile: US Core Observation Screening Assessment Profile and US Core Simple Observation Profile
- Examples for this Profile: DocumentReference/discharge-summary and DocumentReference/episode-summary
- CapabilityStatements using this Profile: US Core Client CapabilityStatement and US Core Server CapabilityStatement

You can also check for usages in the FHIR IG Statistics

Changes since version 7.0.0:

- The data elements list has changed

### Formal Views of Profile Content

Description of Profiles, Differentials, Snapshots and how the different presentations work.

- Key Elements Table
- Differential Table
- Snapshot Table
- Statistics/References
- All

Name | Flags | Card. | Type | Description & Constraints Filter: Bindings Constraints Obligations
--- | --- | --- | --- | ---
DocumentReference |  | 0..* | DocumentReference | A reference to a document
implicitRules | ?!Σ | 0..1 | uri | A set of rules under which this content was created
modifierExtension | ?! | 0..* | Extension | Extensions that cannot be ignored
identifier | S Σ | 0..* | Identifier | Other identifiers for the document
status | ?!S Σ | 1..1 | code | current | superseded | entered-in-error Binding: DocumentReferenceStatus (required)
type | S Σ | 1..1 | CodeableConcept | Kind of document (LOINC if possible) Binding: US Core DocumentReference Type (required): All LOINC values whose SCALE is "Doc" in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'
Additional Bindings | Purpose
US Core Clinical Note Type | Min Binding
Slices for category | S Σ | 1..* | CodeableConcept | Categorization of document Slice: Unordered, Open by value:$this Binding: DocumentClassValueSet (example): High-level kind of a clinical document at a macro level.
category:uscore | Σ | 0..* | CodeableConcept | 𝗔𝗗𝗗𝗜𝗧𝗜𝗢𝗡𝗔𝗟 𝗨𝗦𝗖𝗗𝗜: Categorization of document Binding: US Core DocumentReference Category (required): The US Core DocumentReferences Type Value Set is a "starter set" of categories supported for fetching and storing clinical notes. Note that other codes are permitted, see Required Bindings When Slicing by Value Sets
subject | S Σ | 1..1 | Reference(US Core Patient Profile S | Practitioner | Group | Device) | Who/what is the subject of the document
date | S Σ | 0..1 | instant | When this document reference was created
author | S Σ | 0..* | Reference(US Core Practitioner Profile S | US Core Organization Profile | US Core Patient Profile | US Core PractitionerRole Profile | US Core RelatedPerson Profile | Device) | Who and/or what authored the document
content | S Σ | 1..* | BackboneElement | Document referenced
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
attachment | S Σ C | 1..1 | Attachment | Where to access the document Constraints: us-core-6
contentType | S Σ | 0..1 | code | Mime type of the content, with charset etc. Binding: Mime Types (required): The mime type of an attachment. Any valid mime type is allowed. Example General: text/plain; charset=UTF-8, image/png
data | S C | 0..1 | base64Binary | Data inline, base64ed
url | S Σ C | 0..1 | url | Uri where the data can be found Example General: http://www.acme.com/logo-small.png
format | S Σ | 0..1 | Coding | Format/content rules for the document Binding: HL7FormatCodes (2.1.0) (extensible)
context | S Σ | 0..1 | BackboneElement | Clinical context of document
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
encounter | S | 0..1 | Reference(US Core Encounter Profile) | Context of the document content
period | S Σ | 0..1 | Period | Time of service that is being documented
Documentation for this format

#### Terminology Bindings

Path | Status | Usage | ValueSet | Version | Source
DocumentReference.status | Base | required | DocumentReferenceStatus | 📦4.0.1 | FHIR Std.
DocumentReference.type | Base | required | US Core DocumentReference Type | 📦8.0.1 | This IG
DocumentReference.category | Base | example | Document Class Value Set | 📍4.0.1 | FHIR Std.
DocumentReference.category:uscore | Base | required | US Core DocumentReference Category | 📦8.0.1 | This IG
DocumentReference.content.​attachment.contentType | Base | required | MimeType | 📍4.0.1 | FHIR Std.
DocumentReference.content.​format | Base | extensible | HL7 ValueSet of Format Codes for use with Document Sharing | 📍2.1.0 | THO v7.1

#### Constraints

Id | Grade | Path(s) | Description | Expression
dom-2 | error | DocumentReference | If the resource is contained in another resource, it SHALL NOT contain nested Resources | `contained.contained.empty()`
dom-3 | error | DocumentReference | If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource | `contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()`
dom-4 | error | DocumentReference | If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated | `contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()`
dom-5 | error | DocumentReference | If a resource is contained in another resource, it SHALL NOT have a security label | `contained.meta.security.empty()`
dom-6 | best practice | DocumentReference | A resource should have narrative for robust management | `text.`div`.exists()`
ele-1 | error | **ALL** elements | All FHIR elements must have a @value or children | `hasValue() or (children().count() > id.count())`
ext-1 | error | **ALL** extensions | Must have either extensions or value[x], not both | `extension.exists() != value.exists()`
us-core-6 | error | DocumentReference.content.attachment | DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present. | `url.exists() or data.exists()`

This structure is derived from DocumentReference

Name | Flags | Card. | Type | Description & Constraints Filter: Bindings Constraints Obligations
--- | --- | --- | --- | ---
DocumentReference |  | 0..* | DocumentReference | A reference to a document
identifier | S | 0..* | Identifier | Other identifiers for the document
status | S | 1..1 | code | current | superseded | entered-in-error Binding: DocumentReferenceStatus (required)
type | S | 1..1 | CodeableConcept | Kind of document (LOINC if possible) Binding: US Core DocumentReference Type (required): All LOINC values whose SCALE is "Doc" in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'
Additional Bindings | Purpose
US Core Clinical Note Type | Min Binding
Slices for category | S | 1..* | CodeableConcept | Categorization of document Slice: Unordered, Open by value:$this
category:uscore |  | 0..* | CodeableConcept | 𝗔𝗗𝗗𝗜𝗧𝗜𝗢𝗡𝗔𝗟 𝗨𝗦𝗖𝗗𝗜: Categorization of document Binding: US Core DocumentReference Category (required): The US Core DocumentReferences Type Value Set is a "starter set" of categories supported for fetching and storing clinical notes. Note that other codes are permitted, see Required Bindings When Slicing by Value Sets
subject | S | 1..1 | Reference(US Core Patient Profile S | Practitioner | Group | Device) | Who/what is the subject of the document
date | S | 0..1 | instant | When this document reference was created
author | S | 0..* | Reference(US Core Practitioner Profile S | US Core Organization Profile | US Core Patient Profile | US Core PractitionerRole Profile | US Core RelatedPerson Profile | Device) | Who and/or what authored the document
content | S | 1..* | BackboneElement | Document referenced
attachment | S C | 1..1 | Attachment | Where to access the document Constraints: us-core-6
contentType | S | 0..1 | code | Mime type of the content, with charset etc.
data | S C | 0..1 | base64Binary | Data inline, base64ed
url | S C | 0..1 | url | Uri where the data can be found
format | S | 0..1 | Coding | Format/content rules for the document Binding: HL7FormatCodes (2.1.0) (extensible)
context | S | 0..1 | BackboneElement | Clinical context of document
encounter | S | 0..1 | Reference(US Core Encounter Profile) | Context of the document content
period | S | 0..1 | Period | Time of service that is being documented
Documentation for this format

#### Terminology Bindings (Differential)

Path | Status | Usage | ValueSet | Version | Source
DocumentReference.status | Base | required | DocumentReferenceStatus | 📦4.0.1 | FHIR Std.
DocumentReference.type | Base | required | US Core DocumentReference Type | 📦8.0.1 | This IG
DocumentReference.category:uscore | Base | required | US Core DocumentReference Category | 📦8.0.1 | This IG
DocumentReference.content.​format | Base | extensible | HL7 ValueSet of Format Codes for use with Document Sharing | 📍2.1.0 | THO v7.1

#### Constraints

Id | Grade | Path(s) | Description | Expression
us-core-6 | error | DocumentReference.content.attachment | DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present. | `url.exists() or data.exists()`

Name | Flags | Card. | Type | Description & Constraints Filter: Bindings Constraints Obligations
--- | --- | --- | --- | ---
DocumentReference |  | 0..* | DocumentReference | A reference to a document
id | Σ | 0..1 | id | Logical id of this artifact
meta | Σ | 0..1 | Meta | Metadata about the resource
implicitRules | ?!Σ | 0..1 | uri | A set of rules under which this content was created
language |  | 0..1 | code | Language of the resource content Binding: CommonLanguages (preferred): A human language.
Additional Bindings | Purpose
AllLanguages | Max Binding
text |  | 0..1 | Narrative | Text summary of the resource, for human interpretation This profile does not constrain the narrative in regard to content, language, or traceability to data elements
contained |  | 0..* | Resource | Contained, inline Resources
extension |  | 0..* | Extension | Additional content defined by implementations
modifierExtension | ?! | 0..* | Extension | Extensions that cannot be ignored
masterIdentifier | Σ | 0..1 | Identifier | Master Version Specific Identifier
identifier | S Σ | 0..* | Identifier | Other identifiers for the document
status | ?!S Σ | 1..1 | code | current | superseded | entered-in-error Binding: DocumentReferenceStatus (required)
docStatus | Σ | 0..1 | code | preliminary | final | amended | entered-in-error Binding: CompositionStatus (required): Status of the underlying document.
type | S Σ | 1..1 | CodeableConcept | Kind of document (LOINC if possible) Binding: US Core DocumentReference Type (required): All LOINC values whose SCALE is "Doc" in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'
Additional Bindings | Purpose
US Core Clinical Note Type | Min Binding
Slices for category | S Σ | 1..* | CodeableConcept | Categorization of document Slice: Unordered, Open by value:$this Binding: DocumentClassValueSet (example): High-level kind of a clinical document at a macro level.
category:uscore | Σ | 0..* | CodeableConcept | 𝗔𝗗𝗗𝗜𝗧𝗜𝗢𝗡𝗔𝗟 𝗨𝗦𝗖𝗗𝗜: Categorization of document Binding: US Core DocumentReference Category (required): The US Core DocumentReferences Type Value Set is a "starter set" of categories supported for fetching and storing clinical notes. Note that other codes are permitted, see Required Bindings When Slicing by Value Sets
subject | S Σ | 1..1 | Reference(US Core Patient Profile S | Practitioner | Group | Device) | Who/what is the subject of the document
date | S Σ | 0..1 | instant | When this document reference was created
author | S Σ | 0..* | Reference(US Core Practitioner Profile S | US Core Organization Profile | US Core Patient Profile | US Core PractitionerRole Profile | US Core RelatedPerson Profile | Device) | Who and/or what authored the document
authenticator |  | 0..1 | Reference(Practitioner | PractitionerRole | Organization) | Who/what authenticated the document
custodian |  | 0..1 | Reference(Organization) | Organization which maintains the document
relatesTo | Σ | 0..* | BackboneElement | Relationships to other documents
id |  | 0..1 | string | Unique id for inter-element referencing
extension |  | 0..* | Extension | Additional content defined by implementations
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
code | Σ | 1..1 | code | replaces | transforms | signs | appends Binding: DocumentRelationshipType (required): The type of relationship between documents.
target | Σ | 1..1 | Reference(DocumentReference) | Target of the relationship
description | Σ | 0..1 | string | Human-readable description
securityLabel | Σ | 0..* | CodeableConcept | Document security-tags Binding: All Security Labels (extensible): Security Labels from the Healthcare Privacy and Security Classification System.
content | S Σ | 1..* | BackboneElement | Document referenced
id |  | 0..1 | string | Unique id for inter-element referencing
extension |  | 0..* | Extension | Additional content defined by implementations
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
attachment | S Σ C | 1..1 | Attachment | Where to access the document Constraints: us-core-6
id |  | 0..1 | string | Unique id for inter-element referencing
extension |  | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url
contentType | S Σ | 0..1 | code | Mime type of the content, with charset etc. Binding: Mime Types (required): The mime type of an attachment. Any valid mime type is allowed. Example General: text/plain; charset=UTF-8, image/png
language | Σ | 0..1 | code | Human language of the content (BCP-47) Binding: CommonLanguages (preferred): A human language.
Additional Bindings | Purpose
AllLanguages | Max Binding
Example General: en-AU
data | S C | 0..1 | base64Binary | Data inline, base64ed
url | S Σ C | 0..1 | url | Uri where the data can be found Example General: http://www.acme.com/logo-small.png
size | Σ | 0..1 | unsignedInt | Number of bytes of content (if url provided)
hash | Σ | 0..1 | base64Binary | Hash of the data (sha-1, base64ed)
title | Σ | 0..1 | string | Label to display in place of the data Example General: Official Corporate Logo
creation | Σ | 0..1 | dateTime | Date attachment was first created
format | S Σ | 0..1 | Coding | Format/content rules for the document Binding: HL7FormatCodes (2.1.0) (extensible)
context | S Σ | 0..1 | BackboneElement | Clinical context of document
id |  | 0..1 | string | Unique id for inter-element referencing
extension |  | 0..* | Extension | Additional content defined by implementations
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
encounter | S | 0..1 | Reference(US Core Encounter Profile) | Context of the document content
event |  | 0..* | CodeableConcept | Main clinical acts documented Binding: v3 Code System ActCode (example): This list of codes represents the main clinical acts being documented.
period | S Σ | 0..1 | Period | Time of service that is being documented
facilityType |  | 0..1 | CodeableConcept | Kind of facility where patient was seen Binding: FacilityTypeCodeValueSet (example): XDS Facility Type.
practiceSetting |  | 0..1 | CodeableConcept | Additional details about where the content was created (e.g. clinical specialty) Binding: PracticeSettingCodeValueSet (example): Additional details about where the content was created (e.g. clinical specialty).
sourcePatientInfo |  | 0..1 | Reference(Patient) | Patient demographics from source
related |  | 0..* | Reference(Resource) | Related identifiers or resources
Documentation for this format

#### Terminology Bindings

Path | Status | Usage | ValueSet | Version | Source
DocumentReference.language | Base | preferred | Common Languages | 📍4.0.1 | FHIR Std.
DocumentReference.status | Base | required | DocumentReferenceStatus | 📦4.0.1 | FHIR Std.
DocumentReference.docStatus | Base | required | CompositionStatus | 📍4.0.1 | FHIR Std.
DocumentReference.type | Base | required | US Core DocumentReference Type | 📦8.0.1 | This IG
DocumentReference.category | Base | example | Document Class Value Set | 📍4.0.1 | FHIR Std.
DocumentReference.category:uscore | Base | required | US Core DocumentReference Category | 📦8.0.1 | This IG
DocumentReference.relatesTo.​code | Base | required | DocumentRelationshipType | 📍4.0.1 | FHIR Std.
DocumentReference.securityLabel | Base | extensible | SecurityLabels | 📍4.0.1 | FHIR Std.
DocumentReference.content.​attachment.contentType | Base | required | MimeType | 📍4.0.1 | FHIR Std.
DocumentReference.content.​attachment.language | Base | preferred | Common Languages | 📍4.0.1 | FHIR Std.
DocumentReference.content.​format | Base | extensible | HL7 ValueSet of Format Codes for use with Document Sharing | 📍2.1.0 | THO v7.1
DocumentReference.context.​event | Base | example | v3 Code System ActCode | 📦3.0.0 | THO v7.1
DocumentReference.context.​facilityType | Base | example | Facility Type Code Value Set | 📍4.0.1 | FHIR Std.
DocumentReference.context.​practiceSetting | Base | example | Practice Setting Code Value Set | 📍4.0.1 | FHIR Std.

#### Constraints

Id | Grade | Path(s) | Description | Expression
dom-2 | error | DocumentReference | If the resource is contained in another resource, it SHALL NOT contain nested Resources | `contained.contained.empty()`
dom-3 | error | DocumentReference | If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource | `contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()`
dom-4 | error | DocumentReference | If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated | `contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()`
dom-5 | error | DocumentReference | If a resource is contained in another resource, it SHALL NOT have a security label | `contained.meta.security.empty()`
dom-6 | best practice | DocumentReference | A resource should have narrative for robust management | `text.`div`.exists()`
ele-1 | error | **ALL** elements | All FHIR elements must have a @value or children | `hasValue() or (children().count() > id.count())`
ext-1 | error | **ALL** extensions | Must have either extensions or value[x], not both | `extension.exists() != value.exists()`
us-core-6 | error | DocumentReference.content.attachment | DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present. | `url.exists() or data.exists()`

This structure is derived from DocumentReference

Summary

Mandatory: 3 elements
Must-Support: 16 elements

Structures

This structure refers to these other structures:

- US Core Patient Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient)
- US Core Practitioner Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner)
- US Core Organization Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization)
- US Core PractitionerRole Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitionerrole)
- US Core RelatedPerson Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-relatedperson)
- US Core Encounter Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter)

Slices

This structure defines the following Slices:

- The element 1 is sliced based on the value of DocumentReference.category

Maturity: 3

Key Elements View

Name | Flags | Card. | Type | Description & Constraints Filter: Bindings Constraints Obligations
--- | --- | --- | --- | ---
DocumentReference |  | 0..* | DocumentReference | A reference to a document
implicitRules | ?!Σ | 0..1 | uri | A set of rules under which this content was created
modifierExtension | ?! | 0..* | Extension | Extensions that cannot be ignored
identifier | S Σ | 0..* | Identifier | Other identifiers for the document
status | ?!S Σ | 1..1 | code | current | superseded | entered-in-error Binding: DocumentReferenceStatus (required)
type | S Σ | 1..1 | CodeableConcept | Kind of document (LOINC if possible) Binding: US Core DocumentReference Type (required): All LOINC values whose SCALE is "Doc" in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'
Additional Bindings | Purpose
US Core Clinical Note Type | Min Binding
Slices for category | S Σ | 1..* | CodeableConcept | Categorization of document Slice: Unordered, Open by value:$this Binding: DocumentClassValueSet (example): High-level kind of a clinical document at a macro level.
category:uscore | Σ | 0..* | CodeableConcept | 𝗔𝗗𝗗𝗜𝗧𝗜𝗢𝗡𝗔𝗟 𝗨𝗦𝗖𝗗𝗜: Categorization of document Binding: US Core DocumentReference Category (required): The US Core DocumentReferences Type Value Set is a "starter set" of categories supported for fetching and storing clinical notes. Note that other codes are permitted, see Required Bindings When Slicing by Value Sets
subject | S Σ | 1..1 | Reference(US Core Patient Profile S | Practitioner | Group | Device) | Who/what is the subject of the document
date | S Σ | 0..1 | instant | When this document reference was created
author | S Σ | 0..* | Reference(US Core Practitioner Profile S | US Core Organization Profile | US Core Patient Profile | US Core PractitionerRole Profile | US Core RelatedPerson Profile | Device) | Who and/or what authored the document
content | S Σ | 1..* | BackboneElement | Document referenced
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
attachment | S Σ C | 1..1 | Attachment | Where to access the document Constraints: us-core-6
contentType | S Σ | 0..1 | code | Mime type of the content, with charset etc. Binding: Mime Types (required): The mime type of an attachment. Any valid mime type is allowed. Example General: text/plain; charset=UTF-8, image/png
data | S C | 0..1 | base64Binary | Data inline, base64ed
url | S Σ C | 0..1 | url | Uri where the data can be found Example General: http://www.acme.com/logo-small.png
format | S Σ | 0..1 | Coding | Format/content rules for the document Binding: HL7FormatCodes (2.1.0) (extensible)
context | S Σ | 0..1 | BackboneElement | Clinical context of document
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
encounter | S | 0..1 | Reference(US Core Encounter Profile) | Context of the document content
period | S Σ | 0..1 | Period | Time of service that is being documented
Documentation for this format

#### Terminology Bindings

Path | Status | Usage | ValueSet | Version | Source
DocumentReference.status | Base | required | DocumentReferenceStatus | 📦4.0.1 | FHIR Std.
DocumentReference.type | Base | required | US Core DocumentReference Type | 📦8.0.1 | This IG
DocumentReference.category | Base | example | Document Class Value Set | 📍4.0.1 | FHIR Std.
DocumentReference.category:uscore | Base | required | US Core DocumentReference Category | 📦8.0.1 | This IG
DocumentReference.content.​attachment.contentType | Base | required | MimeType | 📍4.0.1 | FHIR Std.
DocumentReference.content.​format | Base | extensible | HL7 ValueSet of Format Codes for use with Document Sharing | 📍2.1.0 | THO v7.1

#### Constraints

Id | Grade | Path(s) | Description | Expression
dom-2 | error | DocumentReference | If the resource is contained in another resource, it SHALL NOT contain nested Resources | `contained.contained.empty()`
dom-3 | error | DocumentReference | If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource | `contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()`
dom-4 | error | DocumentReference | If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated | `contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()`
dom-5 | error | DocumentReference | If a resource is contained in another resource, it SHALL NOT have a security label | `contained.meta.security.empty()`
dom-6 | best practice | DocumentReference | A resource should have narrative for robust management | `text.`div`.exists()`
ele-1 | error | **ALL** elements | All FHIR elements must have a @value or children | `hasValue() or (children().count() > id.count())`
ext-1 | error | **ALL** extensions | Must have either extensions or value[x], not both | `extension.exists() != value.exists()`
us-core-6 | error | DocumentReference.content.attachment | DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present. | `url.exists() or data.exists()`

Differential View

This structure is derived from DocumentReference

Name | Flags | Card. | Type | Description & Constraints Filter: Bindings Constraints Obligations
--- | --- | --- | --- | ---
DocumentReference |  | 0..* | DocumentReference | A reference to a document
identifier | S | 0..* | Identifier | Other identifiers for the document
status | S | 1..1 | code | current | superseded | entered-in-error Binding: DocumentReferenceStatus (required)
type | S | 1..1 | CodeableConcept | Kind of document (LOINC if possible) Binding: US Core DocumentReference Type (required): All LOINC values whose SCALE is "Doc" in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'
Additional Bindings | Purpose
US Core Clinical Note Type | Min Binding
Slices for category | S | 1..* | CodeableConcept | Categorization of document Slice: Unordered, Open by value:$this
category:uscore |  | 0..* | CodeableConcept | 𝗔𝗗𝗗𝗜𝗧𝗜𝗢𝗡𝗔𝗟 𝗨𝗦𝗖𝗗𝗜: Categorization of document Binding: US Core DocumentReference Category (required): The US Core DocumentReferences Type Value Set is a "starter set" of categories supported for fetching and storing clinical notes. Note that other codes are permitted, see Required Bindings When Slicing by Value Sets
subject | S | 1..1 | Reference(US Core Patient Profile S | Practitioner | Group | Device) | Who/what is the subject of the document
date | S | 0..1 | instant | When this document reference was created
author | S | 0..* | Reference(US Core Practitioner Profile S | US Core Organization Profile | US Core Patient Profile | US Core PractitionerRole Profile | US Core RelatedPerson Profile | Device) | Who and/or what authored the document
content | S | 1..* | BackboneElement | Document referenced
attachment | S C | 1..1 | Attachment | Where to access the document Constraints: us-core-6
contentType | S | 0..1 | code | Mime type of the content, with charset etc.
data | S C | 0..1 | base64Binary | Data inline, base64ed
url | S C | 0..1 | url | Uri where the data can be found
format | S | 0..1 | Coding | Format/content rules for the document Binding: HL7FormatCodes (2.1.0) (extensible)
context | S | 0..1 | BackboneElement | Clinical context of document
encounter | S | 0..1 | Reference(US Core Encounter Profile) | Context of the document content
period | S | 0..1 | Period | Time of service that is being documented
Documentation for this format

#### Terminology Bindings (Differential)

Path | Status | Usage | ValueSet | Version | Source
DocumentReference.status | Base | required | DocumentReferenceStatus | 📦4.0.1 | FHIR Std.
DocumentReference.type | Base | required | US Core DocumentReference Type | 📦8.0.1 | This IG
DocumentReference.category:uscore | Base | required | US Core DocumentReference Category | 📦8.0.1 | This IG
DocumentReference.content.​format | Base | extensible | HL7 ValueSet of Format Codes for use with Document Sharing | 📍2.1.0 | THO v7.1

#### Constraints

Id | Grade | Path(s) | Description | Expression
us-core-6 | error | DocumentReference.content.attachment | DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present. | `url.exists() or data.exists()`

Snapshot View

Name | Flags | Card. | Type | Description & Constraints Filter: Bindings Constraints Obligations
--- | --- | --- | --- | ---
DocumentReference |  | 0..* | DocumentReference | A reference to a document
id | Σ | 0..1 | id | Logical id of this artifact
meta | Σ | 0..1 | Meta | Metadata about the resource
implicitRules | ?!Σ | 0..1 | uri | A set of rules under which this content was created
language |  | 0..1 | code | Language of the resource content Binding: CommonLanguages (preferred): A human language.
Additional Bindings | Purpose
AllLanguages | Max Binding
text |  | 0..1 | Narrative | Text summary of the resource, for human interpretation This profile does not constrain the narrative in regard to content, language, or traceability to data elements
contained |  | 0..* | Resource | Contained, inline Resources
extension |  | 0..* | Extension | Additional content defined by implementations
modifierExtension | ?! | 0..* | Extension | Extensions that cannot be ignored
masterIdentifier | Σ | 0..1 | Identifier | Master Version Specific Identifier
identifier | S Σ | 0..* | Identifier | Other identifiers for the document
status | ?!S Σ | 1..1 | code | current | superseded | entered-in-error Binding: DocumentReferenceStatus (required)
docStatus | Σ | 0..1 | code | preliminary | final | amended | entered-in-error Binding: CompositionStatus (required): Status of the underlying document.
type | S Σ | 1..1 | CodeableConcept | Kind of document (LOINC if possible) Binding: US Core DocumentReference Type (required): All LOINC values whose SCALE is "Doc" in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'
Additional Bindings | Purpose
US Core Clinical Note Type | Min Binding
Slices for category | S Σ | 1..* | CodeableConcept | Categorization of document Slice: Unordered, Open by value:$this Binding: DocumentClassValueSet (example): High-level kind of a clinical document at a macro level.
category:uscore | Σ | 0..* | CodeableConcept | 𝗔𝗗𝗗𝗜𝗧𝗜𝗢𝗡𝗔𝗟 𝗨𝗦𝗖𝗗𝗜: Categorization of document Binding: US Core DocumentReference Category (required): The US Core DocumentReferences Type Value Set is a "starter set" of categories supported for fetching and storing clinical notes. Note that other codes are permitted, see Required Bindings When Slicing by Value Sets
subject | S Σ | 1..1 | Reference(US Core Patient Profile S | Practitioner | Group | Device) | Who/what is the subject of the document
date | S Σ | 0..1 | instant | When this document reference was created
author | S Σ | 0..* | Reference(US Core Practitioner Profile S | US Core Organization Profile | US Core Patient Profile | US Core PractitionerRole Profile | US Core RelatedPerson Profile | Device) | Who and/or what authored the document
authenticator |  | 0..1 | Reference(Practitioner | PractitionerRole | Organization) | Who/what authenticated the document
custodian |  | 0..1 | Reference(Organization) | Organization which maintains the document
relatesTo | Σ | 0..* | BackboneElement | Relationships to other documents
id |  | 0..1 | string | Unique id for inter-element referencing
extension |  | 0..* | Extension | Additional content defined by implementations
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
code | Σ | 1..1 | code | replaces | transforms | signs | appends Binding: DocumentRelationshipType (required): The type of relationship between documents.
target | Σ | 1..1 | Reference(DocumentReference) | Target of the relationship
description | Σ | 0..1 | string | Human-readable description
securityLabel | Σ | 0..* | CodeableConcept | Document security-tags Binding: All Security Labels (extensible): Security Labels from the Healthcare Privacy and Security Classification System.
content | S Σ | 1..* | BackboneElement | Document referenced
id |  | 0..1 | string | Unique id for inter-element referencing
extension |  | 0..* | Extension | Additional content defined by implementations
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
attachment | S Σ C | 1..1 | Attachment | Where to access the document Constraints: us-core-6
id |  | 0..1 | string | Unique id for inter-element referencing
extension |  | 0..* | Extension | Additional content defined by implementations Slice: Unordered, Open by value:url
contentType | S Σ | 0..1 | code | Mime type of the content, with charset etc. Binding: Mime Types (required): The mime type of an attachment. Any valid mime type is allowed. Example General: text/plain; charset=UTF-8, image/png
language | Σ | 0..1 | code | Human language of the content (BCP-47) Binding: CommonLanguages (preferred): A human language.
Additional Bindings | Purpose
AllLanguages | Max Binding
Example General: en-AU
data | S C | 0..1 | base64Binary | Data inline, base64ed
url | S Σ C | 0..1 | url | Uri where the data can be found Example General: http://www.acme.com/logo-small.png
size | Σ | 0..1 | unsignedInt | Number of bytes of content (if url provided)
hash | Σ | 0..1 | base64Binary | Hash of the data (sha-1, base64ed)
title | Σ | 0..1 | string | Label to display in place of the data Example General: Official Corporate Logo
creation | Σ | 0..1 | dateTime | Date attachment was first created
format | S Σ | 0..1 | Coding | Format/content rules for the document Binding: HL7FormatCodes (2.1.0) (extensible)
context | S Σ | 0..1 | BackboneElement | Clinical context of document
id |  | 0..1 | string | Unique id for inter-element referencing
extension |  | 0..* | Extension | Additional content defined by implementations
modifierExtension | ?!Σ | 0..* | Extension | Extensions that cannot be ignored even if unrecognized
encounter | S | 0..1 | Reference(US Core Encounter Profile) | Context of the document content
event |  | 0..* | CodeableConcept | Main clinical acts documented Binding: v3 Code System ActCode (example): This list of codes represents the main clinical acts being documented.
period | S Σ | 0..1 | Period | Time of service that is being documented
facilityType |  | 0..1 | CodeableConcept | Kind of facility where patient was seen Binding: FacilityTypeCodeValueSet (example): XDS Facility Type.
practiceSetting |  | 0..1 | CodeableConcept | Additional details about where the content was created (e.g. clinical specialty) Binding: PracticeSettingCodeValueSet (example): Additional details about where the content was created (e.g. clinical specialty).
sourcePatientInfo |  | 0..1 | Reference(Patient) | Patient demographics from source
related |  | 0..* | Reference(Resource) | Related identifiers or resources
Documentation for this format

#### Terminology Bindings

Path | Status | Usage | ValueSet | Version | Source
DocumentReference.language | Base | preferred | Common Languages | 📍4.0.1 | FHIR Std.
DocumentReference.status | Base | required | DocumentReferenceStatus | 📦4.0.1 | FHIR Std.
DocumentReference.docStatus | Base | required | CompositionStatus | 📍4.0.1 | FHIR Std.
DocumentReference.type | Base | required | US Core DocumentReference Type | 📦8.0.1 | This IG
DocumentReference.category | Base | example | Document Class Value Set | 📍4.0.1 | FHIR Std.
DocumentReference.category:uscore | Base | required | US Core DocumentReference Category | 📦8.0.1 | This IG
DocumentReference.relatesTo.​code | Base | required | DocumentRelationshipType | 📍4.0.1 | FHIR Std.
DocumentReference.securityLabel | Base | extensible | SecurityLabels | 📍4.0.1 | FHIR Std.
DocumentReference.content.​attachment.contentType | Base | required | MimeType | 📍4.0.1 | FHIR Std.
DocumentReference.content.​attachment.language | Base | preferred | Common Languages | 📍4.0.1 | FHIR Std.
DocumentReference.content.​format | Base | extensible | HL7 ValueSet of Format Codes for use with Document Sharing | 📍2.1.0 | THO v7.1
DocumentReference.context.​event | Base | example | v3 Code System ActCode | 📦3.0.0 | THO v7.1
DocumentReference.context.​facilityType | Base | example | Facility Type Code Value Set | 📍4.0.1 | FHIR Std.
DocumentReference.context.​practiceSetting | Base | example | Practice Setting Code Value Set | 📍4.0.1 | FHIR Std.

#### Constraints

Id | Grade | Path(s) | Description | Expression
dom-2 | error | DocumentReference | If the resource is contained in another resource, it SHALL NOT contain nested Resources | `contained.contained.empty()`
dom-3 | error | DocumentReference | If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource | `contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()`
dom-4 | error | DocumentReference | If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated | `contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()`
dom-5 | error | DocumentReference | If a resource is contained in another resource, it SHALL NOT have a security label | `contained.meta.security.empty()`
dom-6 | best practice | DocumentReference | A resource should have narrative for robust management | `text.`div`.exists()`
ele-1 | error | **ALL** elements | All FHIR elements must have a @value or children | `hasValue() or (children().count() > id.count())`
ext-1 | error | **ALL** extensions | Must have either extensions or value[x], not both | `extension.exists() != value.exists()`
us-core-6 | error | DocumentReference.content.attachment | DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present. | `url.exists() or data.exists()`

This structure is derived from DocumentReference

Summary

Mandatory: 3 elements
Must-Support: 16 elements

Structures

This structure refers to these other structures:

- US Core Patient Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient)
- US Core Practitioner Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner)
- US Core Organization Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization)
- US Core PractitionerRole Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitionerrole)
- US Core RelatedPerson Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-relatedperson)
- US Core Encounter Profile (http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter)

Slices

This structure defines the following Slices:

- The element 1 is sliced based on the value of DocumentReference.category

Maturity: 3

Other representations of profile: CSV, Excel, Schematron

### Notes:

Quick Start

Below is an overview of the required Server RESTful FHIR interactions for this profile - for example, search and read operations - when supporting the US Core interactions to access this profile's information (Profile Support + Interaction Support). Note that systems that support only US Core Profiles (Profile Only Support) are not required to support these interactions. See the US Core Server CapabilityStatement for a complete list of supported RESTful interactions for this IG.

- See the Scopes Format section for a description of the SMART scopes syntax.
- See the Search Syntax section for a description of the US Core search syntax.
- See the General Requirements section for additional rules and expectations when a Server requires status parameters.
- See the General Guidance section for additional guidance on searching for multiple patients.

#### US Core Scopes

Servers providing access to clniical note data SHALL support these US Core SMART Scopes:

- resource level scopes: `<patient|user|system>/DocumentReference.rs`

Servers providing access to clniical note data SHOULD support these US Core SMART Scopes:

- granular scopes: `<patient|user|system>/DocumentReference.rs?category=http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category|clinical-note`

#### Mandatory Search Parameters:

The following search parameters and search parameter combinations SHALL be supported:

1. SHALL support both read DocumentReference by `id` AND DocumentReference search using the `_id` search parameter:

   `GET [base]/DocumentReference/[id]` or `GET [base]/DocumentReference?_id=[id]`

   Example:

   1. GET [base]/DocumentReference/2169591
   2. GET [base]/DocumentReference?_id=2169591

   Implementation Notes: Fetches a single DocumentReference. The document itself is represented as a base64 encoded binary data element or retrieved using the link provided by the resource. If the document is a relative link to a Binary resource like a resource reference, it can be subsequently retrieved using: `GET [base]/Binary/[id]`. (how to search by the logical id of the resource)

2. SHALL support searching for all documentreferences for a patient using the `patient` search parameter:

   `GET [base]/DocumentReference?patient={Type/}[id]`

   Example:

   1. GET [base]/DocumentReference?patient=1137192

   Implementation Notes: Fetches a bundle of all DocumentReference resources for the specified patient. See the implementation notes above for how to access the actual document. (how to search by reference)

3. SHALL support searching using the combination of the `patient` and `category` search parameters:

   `GET [base]/DocumentReference?patient={Type/}[id]&category={system|}[code]`

   Example:

   1. GET [base]/DocumentReference?patient=1235541&category=http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category|clinical-note

   Implementation Notes: Fetches a bundle of all DocumentReference resources for the specified patient and category = "clinical-note". See the implementation notes above for how to access the actual document. (how to search by reference and how to search by token)

4. SHALL support searching using the combination of the `patient` and `category` and `date` search parameters:
   - including support for these `date` comparators: `gt,lt,ge,le`
   - including optional support for AND search on `date` (e.g.`date=[date]&date=[date]]&...`)

   `GET [base]/DocumentReference?patient={Type/}[id]&category={system|}[code]&date={gt|lt|ge|le}[date]{&date={gt|lt|ge|le}[date]&...}`

   Example:

   1. GET [base]/DocumentReference?patient=1235541&category=http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category|clinical-note&date=ge2020-01-01T00:00:00Z

   Implementation Notes: Fetches a bundle of all DocumentReference resources for the specified patient and category = "clinical-note" and date. See the implementation notes above for how to access the actual document. (how to search by reference and how to search by token and how to search by date)

5. SHALL support searching using the combination of the `patient` and `type` search parameters:

   `GET [base]/DocumentReference?patient={Type/}[id]&type={system|}[code]`

   Example:

   1. GET [base]/DocumentReference?patient=1316024&type=http://loinc.org|18842-5

   Implementation Notes: Fetches a bundle of all DocumentReference resources for the specified patient and type. See the implementation notes above for how to access the actual document. (how to search by reference and how to search by token)

#### Optional Search Parameters:

The following search parameter combinations SHOULD be supported:

1. SHOULD support searching using the combination of the `patient` and `status` search parameters:
   - including support for OR search on `status` (e.g.`status={system|}[code],{system|}[code],...`)

   `GET [base]/DocumentReference?patient={Type/}[id]&status={system|}[code]{,{system|}[code],...}`

   Example:

   1. GET [base]/DiagnosticReport?patient=1137192&status=completed

   Implementation Notes: Fetches a bundle of all DocumentReference resources for the specified patient and status. See the implementation notes above for how to access the actual document. (how to search by reference and how to search by token)

2. SHOULD support searching using the combination of the `patient` and `type` and `period` search parameters:
   - including support for these `period` comparators: `gt,lt,ge,le`
   - including optional support for AND search on `period` (e.g.`period=[date]&period=[date]]&...`)

   `GET [base]/DocumentReference?patient={Type/}[id]&type={system|}[code]&period={gt|lt|ge|le}[date]{&period={gt|lt|ge|le}[date]&...}`

   Example:

   1. GET [base]/DocumentReference?patient=2169591&type=http://loinc.org|18842-5&period=ge2020-01-01T00:00:00Z

   Implementation Notes: Fetches a bundle of all DocumentReference resources for the specified patient and type and period. See the implementation notes above for how to access the actual document. (how to search by reference and how to search by token and how to search by date)

#### Mandatory Write Capability:

1. SHALL support writing a new note to a Patient's Chart:

   `POST [base]/DocumentReference`

An example to demonstrate writing a note to the Server.

Clinical Note

    {
      "resourceType" : "DocumentReference",
      "meta" : {
        "profile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference|8.0.1"]
      },
      "status" : "current",
      "type" : {
        "coding" : [{
          "system" : "http://loinc.org",
          "code" : "18842-5",
          "display" : "Discharge Summary"
        }],
        "text" : "Discharge Summary"
      },
      "category" : [{
        "coding" : [{
          "system" : "http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category",
          "code" : "clinical-note",
          "display" : "Clinical Note"
        }],
        "text" : "Clinical No"
      }],
      "subject" : {
        "reference" : "Patient/example"
      },
      "content" : [{
        "attachment" : {
          "contentType" : "text/plain",
          "data" : "Tm8gYWN0aXZpdHkgcmVzdHJpY3Rpb24sIHJlZ3VsYXIgZGlldCwgZm9sbG93IHVwIGluIHR3byB0byB0aHJlZSB3ZWVrcyB3aXRoIHByaW1hcnkgY2FyZSBwcm92aWRlci4="
        }
      }],
      "context" : {
        "encounter" : [{
          "reference" : "Encounter/example-1"
        }]
      }
    }

Note Content

The content is Base64 encoded and states: "No activity restriction, regular diet, follow up in two to three weeks with primary care provider."

#### Mandatory Operation:

1. SHALL support fetching documents using the $docref operation.

   This $docref operation is used to request a Server generate a document based on the specified parameters. This operation is invoked on a FHIR Server's DocumentReference endpoint (e.g., `[base]/DocumentReference/$docref`) and operates across all DocumentReference instances returning a Bundle of DocumentReference resources. See the $docref operation definition for detailed documentation.

   - The operation can be invoked using the GET Syntax if the complex type parameter is omitted:

     `GET [base]/DocumentReference/$docref?{parameters}`

   - Otherwise the POST transaction with used as follows:

     `POST [base]/DocumentReference/$docref`

     The body of the POST contains the Parameters resource with the $docref operation input parameters.

Example 1: Request the latest CCD

Request the latest CCD for a patient using `GET` syntax

`GET [base]/DocumentReference/$docref?patient=123`

Request the latest CCD for a patient using `POST` syntax

`POST [base]/DocumentReference/$docref}`

POST request body:

        {
          "resourceType": "Parameters",
          "id": "get-ccd123",
          "parameter": [
            {
              "name": "patient",
              "valueId" : "123"
            }
          ]
        }

Response

    HTTP/1.1 200 OK
    [other headers]

Response body

    {
      "resourceType" : "Bundle",
      "id" : "docref-example-1",
      "type" : "searchset",
      "total" : 1,
      "link" : [{
        "relation" : "self",
        "url" : "http://example.org/fhir/DocumentReference/$docref?patient=123"
      }],
      "entry" : [{
        "fullUrl" : "http://example.org/fhir/DocumentReference/ccd123",
        "resource" : {
          "resourceType" : "DocumentReference",
          "id" : "ccd123",
          "meta" : {
            "profile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference"]
          },
          "identifier" : [{
            "system" : "urn:ietf:rfc:3986",
            "value" : "urn:oid:2.16.840.1.113883.19.5.99999.1"
          }],
          "status" : "current",
          "type" : {
            "coding" : [{
              "system" : "http://loinc.org",
              "code" : "34133-9",
              "display" : "Summary of episode note"
            }],
            "text" : "CCD Document"
          },
          "category" : [{
            "coding" : [{
              "system" : "http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category",
              "code" : "clinical-note",
              "display" : "Clinical Note"
            }],
            "text" : "Clinical Note"
          }],
          "subject" : {
            "reference" : "Patient/example",
            "display" : "Amy Shaw"
          },
          "date" : "2016-03-09T15:29:46Z",
          "author" : [{
            "reference" : "Practitioner/practitioner-1",
            "display" : "Ronald Bone, MD"
          }],
          "description" : "Pulmonology clinic acute visit",
          "content" : [{
            "attachment" : {
              "contentType" : "text/plain",
              "url" : "http://example.org/fhir/Binary/1-note",
              "title" : "URI where the data can be found: http://example.org/fhir/Binary/1-note"
            },
            "format" : {
              "system" : "http://terminology.hl7.org/CodeSystem/v3-HL7DocumentFormatCodes",
              "code" : "urn:hl7-org:sdwg:ccda-structuredBody:2.1",
              "display" : "ccda-structuredBody:2.1"
            }
          }],
          "context" : {
            "period" : {
              "start" : "2004-12-23T08:00:00+11:00",
              "end" : "2004-12-23T08:01:00+11:00"
            }
          }
        },
        "search" : {
          "mode" : "match"
        }
      }]
    }

Example 2: Request Procedure Notes and Discharge Summaries for 2019

Request Procedure Notes and Discharge Summaries for 2019 using `POST` syntax

`POST [base]/DocumentReference/$docref}`

POST request body:

    {
        "resourceType": "Parameters",
        "id": "get-docs",
        "parameter": [
            {
                "name": "patient",
                "valueId": "123"
            },
            {
                "name": "start",
                "valueDateTime": "2019-01-01"
            },
            {
                "name": "end",
                "valueDateTime": "2019-12-31"
            },
            {
                "name": "type",
                "valueCoding": {
                    "system": "http://terminology.hl7.org/CodeSystem/c80-doc-typecodes",
                    "code": "18842-5",
                    "display": "Discharge summary"
                }
            },
            {
                "name": "type",
                "valueCoding": {
                    "system": "http://terminology.hl7.org/CodeSystem/c80-doc-typecodes",
                    "code": "28570-0",
                    "display": "Procedures Note"
                }
            },
            {
                "name": "on-demand",
                "valueBoolean": true
            }
        ]
    }

Response

    HTTP/1.1 200 OK
    [other headers]

Response body

    {
      "resourceType" : "Bundle",
      "id" : "docref-example-2",
      "type" : "searchset",
      "total" : 3,
      "link" : [{
        "relation" : "self",
        "url" : "http://example.org/fhir/DocumentReference/$docref?patient=123&start=2019-01-01&end=2019-01-01&type=http://terminology.hl7.org/CodeSystem/c80-doc-typecodes|18842-5,http://terminology.hl7.org/CodeSystem/c80-doc-typecodes|28570-0&ondemand=true"
      }],
      "entry" : [{
        "fullUrl" : "http://example.org/fhir/DocumentReference/procedure-note123",
        "resource" : {
          "resourceType" : "DocumentReference",
          "id" : "procedure-note123",
          "meta" : {
            "profile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference"]
          },
          "identifier" : [{
            "system" : "urn:ietf:rfc:3986",
            "value" : "urn:oid:2.16.840.1.113883.19.5.99999.1"
          }],
          "status" : "current",
          "type" : {
            "coding" : [{
              "system" : "http://loinc.org",
              "code" : "28570-0",
              "display" : "Procedure Note"
            }],
            "text" : "Procedure Note"
          },
          "category" : [{
            "coding" : [{
              "system" : "http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category",
              "code" : "clinical-note",
              "display" : "Clinical Note"
            }],
            "text" : "Clinical Note"
          }],
          "subject" : {
            "reference" : "Patient/example",
            "display" : "Amy Shaw"
          },
          "date" : "2022-11-18T20:45:05Z",
          "author" : [{
            "reference" : "Practitioner/practitioner-1",
            "display" : "Ronald Bone, MD"
          }],
          "description" : "Ureteroscopy",
          "content" : [{
            "attachment" : {
              "contentType" : "application/pdf",
              "url" : "http://example.org/fhir/Binary/procedure-note123.pdf"
            }
          }],
          "context" : {
            "period" : {
              "start" : "2019-03-01",
              "end" : "2019-03-02"
            }
          }
        },
        "search" : {
          "mode" : "match"
        }
      },
      {
        "fullUrl" : "http://example.org/fhir/DocumentReference/procedure-note456",
        "resource" : {
          "resourceType" : "DocumentReference",
          "id" : "procedure-note456",
          "meta" : {
            "profile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference"]
          },
          "status" : "current",
          "type" : {
            "coding" : [{
              "system" : "http://loinc.org",
              "code" : "28570-0",
              "display" : "Procedure Note"
            }],
            "text" : "Procedure Note"
          },
          "category" : [{
            "coding" : [{
              "system" : "http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category",
              "code" : "clinical-note",
              "display" : "Clinical Note"
            }],
            "text" : "Clinical Note"
          }],
          "subject" : {
            "reference" : "Patient/example",
            "display" : "Amy Shaw"
          },
          "date" : "2022-11-18T20:45:05Z",
          "author" : [{
            "reference" : "Practitioner/practitioner-1",
            "display" : "Ronald Bone, MD"
          }],
          "description" : "Ureteroscopy",
          "content" : [{
            "attachment" : {
              "contentType" : "application/pdf",
              "url" : "http://example.org/fhir/Binary/procedure-note456.pdf"
            }
          }],
          "context" : {
            "period" : {
              "start" : "2019-06-01",
              "end" : "2019-06-01"
            }
          }
        },
        "search" : {
          "mode" : "match"
        }
      },
      {
        "fullUrl" : "http://example.org/fhir/DocumentReference/discharge",
        "resource" : {
          "resourceType" : "DocumentReference",
          "id" : "discharge",
          "meta" : {
            "profile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference"]
          },
          "status" : "current",
          "type" : {
            "coding" : [{
              "system" : "http://loinc.org",
              "code" : "18842-5",
              "display" : "Discharge Summary"
            }],
            "text" : "Discharge Summary"
          },
          "category" : [{
            "coding" : [{
              "system" : "http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category",
              "code" : "clinical-note",
              "display" : "Clinical Note"
            }],
            "text" : "Clinical Note"
          }],
          "subject" : {
            "reference" : "Patient/example",
            "display" : "Amy Shaw"
          },
          "date" : "2022-11-18T20:45:05Z",
          "author" : [{
            "reference" : "Practitioner/practitioner-1",
            "display" : "Ronald Bone, MD"
          }],
          "description" : "Ureteroscopy",
          "content" : [{
            "attachment" : {
              "contentType" : "application/pdf",
              "url" : "http://example.org/fhir/Binary/discharge-summary789.pdf"
            }
          }],
          "context" : {
            "period" : {
              "start" : "2019-03-01",
              "end" : "2019-03-03"
            }
          }
        },
        "search" : {
          "mode" : "match"
        }
      }]
    }