# Health Network

Everything you keep in OnEarly — a blood pressure reading, a meeting note, a file, a form, a task — is a piece of **content**. Each piece of content has a **content type** that says what it is and what shape it takes. Pieces of content link to each other, so related information stays together.

## Types and instances

There are two kinds of content:

| Kind | What it is | Example |
|---|---|---|
| **Content type** | A schema: the name, value type, settings and named fields that instances must follow. A content type is itself stored as content, so it has an owner, can be shared and keeps a version history. | *Blood Pressure* |
| **Instance** | One record of a content type. | *120/80*, measured this morning |

Each instance records the exact version of the content type it was created against. Changing a type later does not rewrite instances that already exist.

In the [API](/api/) these are called **types** and **instances**.

## What an instance holds

| Field | Meaning |
|---|---|
| Value | The instance's value, held in the field that matches its value type (see below). |
| Content type | The type, at the exact version used. |
| Subject | Who the content is about. This can differ from who created it — for example, a clinic records a result about a patient. |
| Occurred at | When the thing it describes happened, as opposed to when it was recorded. |
| Unit | The unit of a numeric value, from the units the type allows. |
| Created at / Updated at | When the content was first recorded and last changed. |

## Value types

Every content type declares one value type.

| Value type | Holds | Example |
|---|---|---|
| `STRING` | Text | `"120/80"` |
| `NUMERIC` | A number | `72` |
| `BOOLEAN` | True or false | `true` |
| `DATE` | A calendar date, `YYYY-MM-DD` | `"1984-03-12"` |
| `DATETIME` | A date and time in ISO 8601, with a time-zone offset | `"2026-11-04T09:30:00+11:00"` |
| `ENUM` | One value from the type's list of allowed values | `"MANUAL"` |
| `JSON` | A structured JSON document | a saved view's settings |

There is no range value type. A range is modelled as fields (for example, a low and a high value) or as JSON.

## What a content type can declare

| Setting | Purpose |
|---|---|
| Description | Plain-language explanation of the type. |
| Allowed values | For `ENUM` types: the list of values, each with a display label. |
| Allowed units | For numeric types: which units an instance may use. |
| Fields | Named slots that instances fill with other content, each with a minimum and maximum count. See below. |
| Reference | Turns a text field into a lookup that points at an instance of another type, such as a contact. |
| File | Marks the type as a file and lists the file formats it accepts. |
| Signature | Marks the type as holding a captured signature. |
| Conformance | How strictly instances must match the declared fields: `open`, `lax` or `strict`. |

### Fields

A content type declares its fields by linking to other content types. Each field has:

- a **key** — the field's name, unique within the type (for example `phone_number`)
- a **minimum and maximum count** — for example, a contact has 0 or more email addresses and at most one website
- a **position** — the order fields appear in
- an optional **description**

### References

A reference field points at an instance of another type instead of holding the value itself. A meeting note's *Attendee* field, for example, points at a *Contact*. A reference declares:

- the target type
- whether the target is shared with whoever can see the content that holds the reference
- whether the app should offer to create a new target on the spot (`forbidden`, `optional` or `required`)

## Links between content

Content links to other content. Each link has one of three kinds.

| Link | Behaviour | Typical use |
|---|---|---|
| `CONTAINS` | Parent and child. Each piece of content has at most one parent, so these links form a tree. Deleting a parent deletes everything under it. | A folder of results; a request and its steps |
| `INCLUDES` | Embeds another piece of content without owning it. Deleting the holder leaves the included content in place. | A field value; a reference to a contact |
| `RELATES_TO` | A peer link between two pieces of content, in any number. No ownership and no cascade. | A note that relates to a result |

Every link also records:

- **Certainty** — `ASSERTED` (stated as fact), `INFERRED` (worked out from other information) or `SUGGESTED` (proposed, not confirmed).
- **Carbon copy** — whether people who can see the parent can also see the child through this link. Turning carbon copy off keeps a child private even when its parent is shared. See [Permissions & Roles](permissions.md#what-a-share-covers).

Diagram: [Links between content](https://docs.onearly.com/diagrams/core-model-content-graph.html)

## Units

Units have a notation (for example `kg`), a display form and a description. These units are available out of the box:

| Unit | Unit | Unit |
|---|---|---|
| `kg` | `g` | `lb` |
| `oz` | `ml` | `kcal` |
| `km` | `mi` | `m` |
| `min/km` | `min/mi` | `serving` |
| `unit` | | |

## Versions and history

Content is never overwritten.

- Editing content adds a **new version** and retires the old one. All versions of one piece of content share a lineage, so you can follow its history.
- Each version records why it exists: `CREATE`, `EDIT`, `RETRACTED` or `REVERTED`.
- Every change is recorded as one operation that says **who made it, who they were acting as, and when**. Shares and link changes are recorded the same way.
- Content types follow the same rules. A new version of a type does not change instances created against an earlier version.

- A content type has no draft, published or deprecated state. Every version of a type can be used.

:::roadmap
[Content types that evolve safely](../roadmap/exploring.md#content-types-that-evolve-safely)
:::

## Built-in content types

OnEarly provides content types that everyone can use. They are readable by every person and group, which is what lets you create instances of them.

| Family | Types |
|---|---|
| Blood pressure | Blood Pressure (text such as `120/80`), with Systolic, Diastolic and Pulse (numeric) and Measured At (date and time) |
| Meetings | Meeting Note, with Location, Held At and Attendee (a reference to a Contact) |
| Appointments | Appointment, with Starts At, Ends At, Location and Source (`BOOKING`, `GOOGLE_CALENDAR`, `OUTLOOK` or `MANUAL`) |
| Conversation summaries | Chat Summary, with Text, Summarised At and Trigger (`USER_REQUEST` or `WORKFLOW`) |
| Contacts | Contact, with first and last name, email (0 or more), phone number (0 or more), date of birth, sex at birth, address lines, note and website (at most one) |
| Addresses | Address, with Address Line 1 and 2, Suburb, State, Postcode and Country |
| Email | Email Message, with Subject, From, To, Cc, Sent At and Body |
| Personal details | First Name, Last Name, Email, Phone Number, Date of Birth, Sex Assigned at Birth |
| Page building blocks | Note, Markdown, Paragraph, Table, Link, URL, Description, Container, Attachment, File, Cover Image |

## Your own content types

Any person or group can create content types. In the app, go to **Account → Content Types** for your own, or **Group settings → Content types** for a group's.

- A content type you create belongs to you (or your group) and is private until you share it.
- To create an instance of a type, you need at least view access to that type.

Source: https://docs.onearly.com/core-model/content-graph/
