---
title: "Schema reference"
description: "PostgreSQL tables compiled from openEHR archetypes and FHIR profiles."
---

A PostgreSQL schema compiled from two source specifications: openEHR archetypes from the CKM and FHIR profiles from hl7.fhir.us.core@9.0.0. Nothing here is hand-written — every table, column and constraint is derived, and every column names the archetype path or FHIR element it came from.

| | Count |
|---|---|
| Entry archetypes | 155 |
| Cluster archetypes | 37 |
| Administrative tables | 13 |
| Tables in total | 465 |
| Columns | 7460 |

## How to read a page

Each page documents one source model and every table it produces. **Source** names the archetype or profile it came from; where a page lists more than one, the models were merged and the columns carry a **From** marker showing which contributed them.

Columns list the archetype path (`/data[at0001]/events[at0002]/…`) or FHIR element id (`Patient.birthDate`) they were lowered from, so any value can be traced back to the specification that defines it.

## Conventions

- Every table has a `uuid` primary key named `id`.
- A child table links to its parent with `<parent_table>_id` and is deleted with it.
- Coded values occupy a group: `<field>` (display text), `<field>_code`, `<field>_system`, `<field>_valueset_id`, with a foreign key into `valueset_code` that checks all four agree.
- Quantities occupy `<field>_magnitude` and `<field>_units`, with the units and range the archetype allows.
- Every foreign key is indexed except those into the terminology tables.

See [Provenance](/docs/provenance) for the full source-model to table mapping, including what was deliberately left out.
