> ## Documentation Index
> Fetch the complete documentation index at: https://docs.connectivehealth.io/llms.txt
> Use this file to discover all available pages before exploring further.

# DocumentReference

> The FHIR DocumentReference resource as produced by Connective Health

[FHIR R4 DocumentReference](https://www.hl7.org/fhir/R4/documentreference.html) ·
[US Core DocumentReference](https://hl7.org/fhir/us/core/STU9/StructureDefinition-us-core-documentreference.html)

<Info>
  This resource carries the patient's **clinical notes** in the
  [Patient Everything](/fhir/patient-everything-bundle) and [Patient Summary](/fhir/patient-summary-bundle) bundles.
  It is not produced for [Bulk Medication History](/fhir/bulk-medication-history-bundle).
</Info>

# Stable ID

The `id` is derived from the patient, the note date, the note type code, and the note text. Because the note text is
part of the `id`, any edit to the note body produces a new `DocumentReference` rather than updating the existing one.

<Note>
  The encounter link described below is **not** part of the `id`. The same note therefore carries the same `id` in
  both bundles, even though only the Patient Summary bundle links it to an encounter.
</Note>

# Fields

| Field                            | Cardinality | Notes                                                                                                                                                                                                    |
| -------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `meta.profile`                   | 1..1        | Always set to the US Core DocumentReference profile URL.                                                                                                                                                 |
| `status`                         | 1..1        | Always `current`.                                                                                                                                                                                        |
| `subject`                        | 1..1        | Reference to the [Patient](/fhir/resources/patient).                                                                                                                                                     |
| `type`                           | 1..1        | A single coding for the kind of note, from the source note type.                                                                                                                                         |
| `category`                       | 1..1        | Always `clinical-note` from the [US Core DocumentReference Category](http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category) system.                                                  |
| `date`                           | 0..1        | The note date. The source carries a date with no time, so the value is published at midnight UTC (`T00:00:00Z`) -- treat it as a date, not a precise timestamp.                                          |
| `author`                         | 0..1        | Contained [PractitionerRole](/fhir/resources/practitioner-role) for the note's provider. Omitted when no provider is known.                                                                              |
| `content.attachment.data`        | 1..1        | The note body, base64-encoded.                                                                                                                                                                           |
| `content.attachment.contentType` | 1..1        | Always `text/plain` -- notes are published as plain text, never as HTML, RTF, or PDF.                                                                                                                    |
| `content.attachment.language`    | 1..1        | Always `en-US`.                                                                                                                                                                                          |
| `context.encounter`              | 0..1        | **Patient Summary only.** References the [Encounter](/fhir/resources/encounter) for the visit the note was written for. Never set in the Patient Everything bundle, where notes are not tied to a visit. |

<Note>
  `identifier`, `docStatus`, `authenticator`, `custodian`, `description`, and `context.period` are not populated.
</Note>

# Note sourcing

| Bundle                                                | Where notes come from                                                                                                                                         |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Patient Everything](/fhir/patient-everything-bundle) | All notes on the patient's record, independent of any visit. `context.encounter` is not set.                                                                  |
| [Patient Summary](/fhir/patient-summary-bundle)       | Only notes attached to a visit that was selected for the summary -- including notes on follow-up visits. Each is linked to its visit via `context.encounter`. |

<Warning>
  A note present in the Patient Everything bundle may be absent from the Patient Summary bundle if its visit was
  not selected for the summary.
</Warning>
