# FHIR

> A checkup as a FHIR bundle and a member as a Patient: the resources, codes and values.

A checkup reaches you as a FHIR `Bundle`, and a member as a FHIR `Patient`. This page describes
those resources, which is the format YOU(th) sends today. Both are health data, shared only for
members who consented to share their data with your organization.

> **Preview:** reading them from the [read API](/docs/webhooks/catch-up#the-read-api), at
> `GET /v1/checkups/{checkup_id}/fhir` and `GET /v1/patients/{patient_id}/fhir`, is not available
> yet. The routes are proposed and may change; the resources' format is not.

Resources are FHIR R4, checked against the R4B structures. YOU(th) never sends or answers a resource
that fails that check. Passing it does not certify a resource against any profile or for clinical
use.

## A checkup: `Bundle`

A `Bundle` of type `collection`, with a `timestamp`. The bundle only packs the resources together:
its own `id` does not name the checkup.

| Resource           | One for          | Holds                                                                                                                                                                                                                                                                               |
| ------------------ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Patient`          | The member       | `id`, an `identifier`, `active`, and `birthDate` and `gender` where known                                                                                                                                                                                                           |
| `DiagnosticReport` | The checkup      | `id` and `identifier`: the checkup's id. `status` `final`. `category`: the checkup type. `code.text`: the checkup's name. `effectiveDateTime`: when the member took it. `issued`: when it was completed, the webhook's `occurred_at` or a moment before. `result`: its Observations |
| `Observation`      | Each measurement | The biomarker's code, its value, and `effectiveDateTime`: when it was measured                                                                                                                                                                                                      |

- Every entry has a `fullUrl` of the form `urn:uuid:<uuid>`, stable for that resource. References
  between resources use it, so they resolve inside the bundle. Resource `id`s are YOU(th)'s ids.
- A measurement's `code` is the biomarker's code, such as `heart_rate`, in YOU(th)'s biomarker code
  system; [Biomarkers](/docs/data/biomarkers) lists them. Codes are open: new biomarkers can appear
  at any time; keep a code you do not know.
- A number is a `valueQuantity`: the unit as text, plus `system` `http://unitsofmeasure.org` and
  the `code` in UCUM, the Unified Code for Units of Measure, where the unit has one (`bpm` is
  `/min`, `mmHg` is `mm[Hg]`).
- A category, such as a risk level `low`, is a `valueCodeableConcept`, coded in a YOU(th) code
  system. A category is a classification, never a diagnosis.
- Blood pressure is one Observation: code LOINC `85354-9` beside YOU(th)'s `blood_pressure`, with
  two components, systolic LOINC `8480-6` and diastolic LOINC `8462-4`. When only one side was
  measured, both components are still there, and the missing one has a `dataAbsentReason` of
  `unknown` (system `http://terminology.hl7.org/CodeSystem/data-absent-reason`) instead of a value.

In this example, shortened, the blood pressure was measured on one side only:

```json
{
  "resourceType": "Bundle",
  "id": "90970514-fbcb-4c07-aee3-3778f4dc594a",
  "type": "collection",
  "timestamp": "2026-10-01T09:30:00Z",
  "entry": [
    {
      "fullUrl": "urn:uuid:797790be-4a7b-4aeb-a554-e2685ee57942",
      "resource": {
        "resourceType": "Patient",
        "id": "cfefb422-ac79-4cb9-a849-e80f8a6f21cd",
        "identifier": [
          {
            "system": "https://api.youth-platform.io/fhir/identifiers/patients",
            "value": "cfefb422-ac79-4cb9-a849-e80f8a6f21cd"
          }
        ],
        "active": true,
        "birthDate": "1988-04-12",
        "gender": "female"
      }
    },
    {
      "fullUrl": "urn:uuid:3bc83773-8e40-465d-b194-5b52c797f59d",
      "resource": {
        "resourceType": "DiagnosticReport",
        "id": "64d866f3-0c88-485c-bfe6-3339df1d224a",
        "identifier": [
          {
            "system": "https://api.youth-platform.io/fhir/identifiers/checkups",
            "value": "64d866f3-0c88-485c-bfe6-3339df1d224a"
          }
        ],
        "status": "final",
        "category": [
          {
            "coding": [
              {
                "system": "https://api.youth-platform.io/fhir/codes/checkup-type",
                "code": "digital",
                "display": "Digital checkup"
              }
            ]
          }
        ],
        "code": { "text": "Digital checkup" },
        "subject": { "reference": "urn:uuid:797790be-4a7b-4aeb-a554-e2685ee57942" },
        "effectiveDateTime": "2026-10-01T09:28:00Z",
        "issued": "2026-10-01T09:30:00Z",
        "result": [
          { "reference": "urn:uuid:c47f1291-702c-42a1-a0f6-bbf4cb4eee15" },
          { "reference": "urn:uuid:d0851610-7047-40c5-a486-a80dacdbe56c" },
          { "reference": "urn:uuid:960272da-d72c-413b-92ff-83acdf46709e" }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:c47f1291-702c-42a1-a0f6-bbf4cb4eee15",
      "resource": {
        "resourceType": "Observation",
        "id": "119d03ca-128d-4a26-8924-fa76fa92fbfe",
        "status": "final",
        "code": {
          "coding": [
            {
              "system": "https://api.youth-platform.io/fhir/codes/biomarkers",
              "code": "heart_rate"
            }
          ]
        },
        "subject": { "reference": "urn:uuid:797790be-4a7b-4aeb-a554-e2685ee57942" },
        "effectiveDateTime": "2026-10-01T09:24:00Z",
        "valueQuantity": {
          "value": 64,
          "unit": "bpm",
          "system": "http://unitsofmeasure.org",
          "code": "/min"
        }
      }
    },
    {
      "fullUrl": "urn:uuid:d0851610-7047-40c5-a486-a80dacdbe56c",
      "resource": {
        "resourceType": "Observation",
        "id": "c3a1f0d2-8e4b-5b7a-9f61-2d0e7c5b4a38",
        "status": "final",
        "code": {
          "coding": [
            {
              "system": "https://api.youth-platform.io/fhir/codes/biomarkers",
              "code": "blood_pressure"
            },
            { "system": "http://loinc.org", "code": "85354-9" }
          ]
        },
        "subject": { "reference": "urn:uuid:797790be-4a7b-4aeb-a554-e2685ee57942" },
        "effectiveDateTime": "2026-10-01T09:26:00Z",
        "component": [
          {
            "code": { "coding": [{ "system": "http://loinc.org", "code": "8480-6" }] },
            "valueQuantity": {
              "value": 122,
              "unit": "mmHg",
              "system": "http://unitsofmeasure.org",
              "code": "mm[Hg]"
            }
          },
          {
            "code": { "coding": [{ "system": "http://loinc.org", "code": "8462-4" }] },
            "dataAbsentReason": {
              "coding": [
                {
                  "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
                  "code": "unknown"
                }
              ]
            }
          }
        ]
      }
    },
    {
      "fullUrl": "urn:uuid:960272da-d72c-413b-92ff-83acdf46709e",
      "resource": {
        "resourceType": "Observation",
        "id": "cd127997-4727-4795-b34c-227ac825d3e0",
        "status": "final",
        "code": {
          "coding": [
            {
              "system": "https://api.youth-platform.io/fhir/codes/biomarkers",
              "code": "high_fasting_glucose_risk"
            }
          ]
        },
        "subject": { "reference": "urn:uuid:797790be-4a7b-4aeb-a554-e2685ee57942" },
        "effectiveDateTime": "2026-10-01T09:25:00Z",
        "valueCodeableConcept": {
          "coding": [
            { "system": "https://api.youth-platform.io/fhir/codes/risk-level", "code": "low" }
          ],
          "text": "low"
        }
      }
    }
  ]
}
```

## A member: `Patient`

A member on their own is the same `Patient` as in the bundle: `id`, `identifier`, `active`, and
`birthDate` and `gender` where known. No name, and no extensions.

## Code and identifier systems

Every code and identifier YOU(th) sends names the system it belongs to. A system is a name, not an
address to call, and it never changes: store it with the code, and match on both.

| System                                                    | Holds                                                             |
| --------------------------------------------------------- | ----------------------------------------------------------------- |
| `https://api.youth-platform.io/fhir/codes/biomarkers`     | A measurement's code, such as `heart_rate`                        |
| `https://api.youth-platform.io/fhir/codes/checkup-type`   | The checkup type, in the `DiagnosticReport`'s `category`          |
| `https://api.youth-platform.io/fhir/codes/risk-level`     | A risk level, such as `low`; each scale of categories has its own |
| `https://api.youth-platform.io/fhir/identifiers/patients` | The member's id, in the `Patient`'s `identifier`                  |
| `https://api.youth-platform.io/fhir/identifiers/checkups` | The checkup's id, in the `DiagnosticReport`'s `identifier`        |

New codes join a system; a code never changes its meaning.

Blood pressure is the one measurement that carries a LOINC code beside YOU(th)'s own. A coding
added later never breaks a receiver that ignores codings it does not know.
