SHC vNext QR proof of concept

Input model

The JSON an app writes to build a cycle-log card: readable built-in keywords, uniform { date, ... }[] arrays, standard FHIR R4 CodeableConcept escapes, and FHIR dateTime, with zero FHIR Bundle boilerplate.

The TypeScript types in model.d.ts are normative; model.schema.json is derived from them. Where the two differ, the TypeScript definition and the codec's validator win.

Inventory: what a model carries

One CycleLog JSON object holds consumer cycle tracking as uniform { date, ... }[] arrays whose earliest to latest recorded date spans up to 10,000 days (~27 years), bounded naturally by QR byte capacity. Every field is optional ({} is valid)—there is no start, no days, no root labels, and no synthetic tracking-window Observation; omitted sections cost near-zero space.

CycleLog input model inventory Visual inventory of the five sections of a CycleLog JSON object: card frame and metadata, whole-record context and history, built-in daily series as uniform dated arrays with readable keywords, custom series with valueType and FHIR R4 CodeableConcept extensibility, and FHIR dateTime, repeats and absence rules. 1. CARD FRAME & METADATA (ALL OPTIONAL — {} IS VALID; NO start / days / labels / tracking-window) exportedAt & reduced exportedAt (FhirInstant → Bundle.timestamp; Z & :00 ok) reduced: true → Bundle SUBSETTED tag patient (optional) family • given (≤3) • birthDate (FhirDate) Omitted → identity-free Patient id "0" source (optional) name • version (exporting app / wearable Device) Displays & text live inline on FHIR CodeableConcept 2. WHOLE-RECORD CONTEXT & HISTORY conditions[] 15 ConditionKind + escape code: ConditionKind | CodeableConcept, opt status, onset intervals[] CalendarDate start..end kind (contraception, pregnant, breastfeeding) or {code, value} procedures[] 13 ProcedureKind + escape {date: FhirDateTime, code: ProcedureKind | CodeableConcept} answers[] 7 LOINC screening questions {date: DateTime, question, value} (menarche, cycle length, ...) 3. BUILT-IN DAILY SERIES (READABLE KEYWORDS & UNIFORM { date, ... }[] ARRAYS) Menstruation & pain bleeding: {date, value} flow (spotting / light / moderate / heavy) + explicit no-bleeding / flow-none volume: 0..500 mL • pain: 0..10 • symptoms: SymptomKind (35) | CodeableConcept Fertility & temperature (natural decimals, ≤ 2 places) bbt: {unit, entries: [{date, value, excluded?, excludeReason?}]} (distinct from LOINC 8310-5 fever) skinTemp: {kind, unit, entries: TempEntry[]} (wearable deviation or absolute) mucus • ovulationTest • progesteroneTest • pregnancyTest • sex (keywords | CodeableConcept) Wellbeing & medications mood (7-pt) • energy (4-pt) • sleep (0..1440 min) • pill (taken / missed) medications: {date, code: MedicationKind (7) | CodeableConcept, status, dose?: {value, unit}}[] 4. EXTENSIBILITY: custom[] (UP TO 32 SERIES) & CodeableConcept • valueType: "boolean", "coded", "quantity" (UCUM, ≤ 6 dp), "components" (≤16) • R4 vital signs: BP (85354-9), HR (8867-4), weight (29463-7), fever (8310-5) automatically emit FHIR vital-signs category and enforce R4 profile units • FHIR CodeableConcept: {coding: [{system, code, display?}], text?} or text-only {text} • Offline displays & text: preserved on ANY non-built-in escape (SNOMED, RxNorm, tags) 5. UNIFORM ENTRIES, FHIR dateTime & ABSENCE RULES • Two-way absence: omitted entry / [] / absent field = not recorded (never "no"); explicit negatives record "no" (no-bleeding, pain 0, pill missed, not-taken) • FHIR DateTime on every entry: "YYYY-MM-DD" or "YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM)" multiple entries on one date & disagreements are just more elements in the array • Canonical normalization: same facts in any order ⇒ identical card bytes

Scroll sideways to inspect the full diagram, or read the grouped field reference below.

To see how the input model connects to lifting, omission-only planning, the codec and the QR code, see Architecture & data flow.

Core rules

1. Uniform { date, ... }[] arrays

Every observation series is a flat array of dated objects—no date-string map keys, no polymorphic T | Entry[] unions, and no start, days, or DayIndex. Repeats and same-day disagreements are simply extra array elements, preserved verbatim.

2. Two-way absence

An omitted entry, [], or an absent / null optional field always means not recorded—never "no". Explicit negatives use their own values ("no-bleeding", pain 0, sex "none", "not-taken", false); canonical JSON omits absent and empty optional fields.

3. Readable keywords + FHIR CodeableConcept

Built-in slots use readable string keywords (SymptomKind, MedicationKind, ConditionKind, etc.) that expand to canonical SNOMED CT / LOINC / cycle-log codings. Escapes and custom[] use FHIR R4 CodeableConcept ({ coding: [{ system, code, display? }], text? } or text-only { text }), preserving display and text on any non-built-in escape concept without fake app URIs.

4. FHIR dateTime, decimals & valueType

Entries use FHIR DateTime / FhirDateTime / FhirInstant ("Z" and ":00" accepted) and natural JSON decimals (≤ 2 dp for temperatures, ≤ 6 for doses and quantities). Custom series declare FHIR Observation.value[x] via valueType: "boolean" (valueBoolean), "coded" (valueCodeableConcept), "quantity" (valueQuantity), or "components" (component[]).

In FHIR, a valid model corresponds one-to-one with the FHIR profiles: any Bundle conforming to those profiles lifts into this model with nothing lost.

Top-level fields

Every property of the root CycleLog object, grouped to match the inventory diagram above.

Card frame & metadata

Every field is optional ({} is a valid CycleLog). Export timestamp, reduction flag, patient identity and source device are all optional; display text and plain-text labels live inline on FHIR CodeableConcept / Coding (and text-only { text } tags need no synthetic URI).

exportedAt FhirInstant

When the card was exported, as a FHIR instant with UTC offset (mapped to FHIR Bundle.timestamp). Not recorded: absent.

reduced boolean

The sender deliberately left out data to fit a size: a series, time of day, or display that is absent may have been tracked; recorded values are never altered. It says nothing about what was left out. Not reduced: false or absent (omitted canonically). Written as the Bundle tag SUBSETTED.

patient PatientInfo

Who the card is about, kept deliberately small. Not recorded: absent or empty; the card then carries no identity at all.

source Source

The source app: its name and optional version. Not recorded: absent.

Whole-record context & history

Diagnoses (ConditionKind or CodeableConcept), multi-day date spans, unified procedures (ProcedureKind or CodeableConcept with full or partial FHIR dateTime) and screening questions.

conditions Array of ConditionEntry

Conditions the person reports having (background context such as PCOS or fibroids). Not recorded: [] or absent. Explicit negative: status "resolved". A condition stated more than once (even differently) is carried as stated.

intervals Array of BuiltinInterval | CodedInterval ≤ 256 items

States that last over a range of calendar dates: contraception, pregnancy, breastfeeding, or any other coded or text-only state. Not recorded: [] or absent. Explicit negative for contraception: kind "none". Intervals of one state that overlap or touch are one interval: normalize merges them.

procedures Array of Procedure ≤ 512 items

Procedures: partial date (YYYY, YYYY-MM), full date (YYYY-MM-DD), or full date with time (YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM)), year 1900-2150. Not recorded: [] or absent. A procedure listed twice is two procedures.

answers Array of Answer

Screening questions the person answered, each with the date (and optional time) they answered it. What they said, never a value computed from the log. Not recorded: [] or absent. A question answered more than once (even differently, at one time) is carried as answered.

Built-in daily series

Uniform { date, ... }[] arrays using readable built-in keywords (SymptomKind, MedicationKind, Mucus, Sex, Mood, Energy, ExcludeReason, …), FHIR CodeableConcept escapes, and FHIR DateTime. Omitted dates mean not recorded; repeats and disagreements are just additional array elements.

bleeding Array of ObservationEntry<Bleeding>

Menstrual bleeding entries. Omitted dates: not recorded. Explicit negative: "no-bleeding" (or "flow-none").

volume Array of ObservationEntry<integer> 0–500 per entry

Collected menstrual fluid entries, whole mL (a smart or graduated cup). Fluid, not blood: the blood fraction varies widely between people, so a fluid volume does not establish a blood loss. Independent of bleeding: neither implies the other. Omitted dates: not recorded. Explicit negative: 0.

pain Array of ObservationEntry<integer> 0–10 per entry

Pain entries on a 0-10 numeric rating scale (LOINC 72514-3). Omitted dates: not recorded. Explicit negative: 0 ("no pain"). Another scale goes in a custom series.

Symptoms present on each date: a built-in keyword (SymptomKind) or any FHIR CodeableConcept as an escape (presence only; for severity use a custom coded series). Omitted dates: not recorded. There is no explicit "symptom absent".

bbt Bbt

Basal body temperature (waking readings). Not recorded: absent.

skinTemp SkinTemp

Nightly skin or wrist temperature from a wearable (one device per card). Never pooled with BBT. Not recorded: absent.

Cervical mucus entries. Omitted dates: not recorded. "dry" is a value.

ovulationTest Array of ObservationEntry<OvulationTest or CodeableConcept>

LH (ovulation) test result entries. Omitted dates: not recorded. Explicit negative: "negative".

progesteroneTest Array of ObservationEntry<TestResult or CodeableConcept>

Progesterone (PdG) urine test result entries. Omitted dates: not recorded. Explicit negative: "negative".

pregnancyTest Array of ObservationEntry<TestResult or CodeableConcept>

Pregnancy test result entries. Omitted dates: not recorded. Explicit negative: "negative".

Sexual intercourse entries. Omitted dates: not recorded. Explicit negative: "none".

Mood entries on a 7-point valence scale. Omitted dates: not recorded. Other mood scales or multi-select moods go in a custom series.

Energy entries on a 4-point scale. Omitted dates: not recorded.

sleep Array of ObservationEntry<integer> 0–1440 per entry

Minutes of sleep ending on each date (attributed to the wake day). Omitted dates: not recorded. 0 is a value (no sleep).

pill Array of ObservationEntry<PillLog>

Contraceptive pill log entries. Which pill is named by the contraception interval covering the date. Omitted dates: not recorded. Explicit negative: "missed".

medications Array of MedEntry

Medication entries (a dose taken twice is two entries with their timestamps). Built-in keywords: MedicationKind; any other product (RxNorm, SNOMED CT, text-only, ...) is an escape CodeableConcept. Omitted dates: not recorded. Explicit negative: status "not-taken" (a missed dose).

Custom series

Up to 32 extra dated series with FHIR Observation valueType ("boolean" → valueBoolean, "coded" → valueCodeableConcept, "quantity" → valueQuantity in UCUM unit, or "components" → component[]), each using FHIR R4 CodeableConcept and { date, ... }[] entries.

Series without a built-in slot, each with its own Observation CodeableConcept and one of four valueType kinds ("boolean", "coded", "quantity", or "components" for multi-component readings like blood pressure). Not recorded: [] or absent. One series per distinct code.

Object shapes

The nested objects referenced by the top-level fields above. Unknown properties are rejected on every object.

Shared building blocks

CodeableConcept

2 fields

A FHIR R4 CodeableConcept: either a single Coding with optional plain-text text, or a text-only concept { text } with no coding (no synthetic URI required). For built-in concepts, coding[0].display is optional on input and stripped in canonical form, and text is not allowed. For any non-built-in escape coding, both coding[0].display and text are preserved and must agree across all occurrences of the same (system, code).

coding Array of Coding ≤ 1 items

At most one standard FHIR Coding { system, code, display? }. Required unless text is given.

text string ≤ 128 chars

Plain-text label (1-128 characters, no control characters or leading/trailing whitespace). Required when coding is absent; optional on non-built-in escape codings; not allowed on built-in concepts.

Coding

3 fields

A standard FHIR Coding from any code system. For built-in concepts, display is optional on input and stripped in canonical form. For any non-built-in escape concept (including SNOMED CT, LOINC, RxNorm, ICD-10-CM, ATC, NDC, or app URIs), display is carried and all occurrences of the same (system, code) must agree on the same display text.

systemrequired string ≤ 255 chars

Code system URI: absolute URI of printable ASCII without spaces or "|", 1-255 characters.

coderequired string ≤ 128 chars

Concept code within system: 1-128 characters, no control characters, no leading/trailing/repeated spaces. SNOMED CT codes must be valid 6-18 digit concept ids (Verhoeff check digit, partition 00 or 10).

display string ≤ 128 chars

Optional human-readable display text (1-128 characters, no control characters or leading/trailing whitespace). Carried for any non-built-in escape concept; optional on input and stripped in canonical form for built-in concepts.

ObservationEntry

2 fields

One observation entry in a flat series array: a DateTime (day or timestamp) and its value. Identical entries and entries that disagree on the same date or time are all carried, each its own fact, never merged.

daterequired DateTime

When the observation was recorded: calendar date or date with time and UTC offset.

valuerequired T

The recorded value (matching the series' value type).

Header & context objects

PatientInfo

3 fields

Optional identity: deliberately small. An empty object means no identity.

family string ≤ 64 chars

Family name. Not recorded: absent.

given Array of string ≤ 3 items

Given names, in order. Not recorded: absent or []. Each 1-64 characters.

birthDate FhirDate

Birth date, from 1900 to 2150. A year alone is enough to give age without identity. Not recorded: absent.

Source

2 fields

The exporting app, shown as the source device of every observation.

namerequired string ≤ 64 chars

The app's name as users know it, 1-64 characters.

version string ≤ 32 chars

The app's version, 1-32 characters. Not recorded: absent.

ConditionEntry

3 fields

A condition the person reports.

coderequired ConditionKind or CodeableConcept

The condition: a built-in keyword (ConditionKind) or any FHIR CodeableConcept as an escape.

What the person says about it now. Not stated: absent.

onset FhirDate

When it started, as precisely as the person says (1900-2150). Not stated: absent.

BuiltinInterval

3 fields

A built-in state over a range of calendar dates.

kindrequired IntervalKind

Which state.

startrequired CalendarDate

First calendar date.

endrequired CalendarDate

Last calendar date (inclusive), not before start.

CodedInterval

4 fields

Any other state: an observation code and a coded or text-only value, over a range of calendar dates.

What is observed (an Observation CodeableConcept), e.g. LOINC 8659-5 "Birth control method". Not a built-in per-day series code and not an R4 vital-sign code.

valuerequired CodeableConcept

The state, e.g. LOINC LA27913-5 (diaphragm or cervical cap) or a text-only concept.

startrequired CalendarDate

First calendar date.

endrequired CalendarDate

Last calendar date (inclusive), not before start.

Procedure

2 fields

A completed procedure on a date or dateTime.

daterequired FhirDateTime

When: YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM) (year 1900-2150).

coderequired ProcedureKind or CodeableConcept

Which procedure: a built-in keyword (ProcedureKind) or any FHIR CodeableConcept.

Answer

3 fields

A screening question answered on a date or timestamp.

daterequired DateTime

When the person answered: calendar date or date with time and UTC offset.

questionrequired Question

Which question.

valuerequired string or integer or CodeableConcept

The answer: for a coded question its built-in answer name or any FHIR CodeableConcept as an escape; for a numeric question an integer in the question's range. See Question.

Temperatures & medications

Bbt

2 fields

Basal body temperature readings (0.01 °C / 0.01 °F precision, distinct from LOINC 8310-5 general body temperature).

unitrequired TemperatureUnit

Unit of every reading.

entriesrequired Array of TempEntry

Readings in natural degrees of unit (at most 2 decimal places, e.g. 36.52). Cel 34-42, [degF] 93-107.6.

SkinTemp

3 fields

Wearable nightly temperature from one device.

kindrequired SkinTempKind

Whether values are deviations from the device's baseline or absolute temperatures.

unitrequired TemperatureUnit

Unit of every value. For a deviation, a temperature difference in this unit.

entriesrequired Array of TempEntry

Readings by wake date, in natural degrees of unit (at most 2 decimal places, e.g. -0.31). Deviation: Cel -5..5, [degF] -9..9. Absolute: Cel 25..40, [degF] 77..104.

TempEntry

4 fields

One temperature reading with date/time and optional disturbance/exclusion flag.

daterequired DateTime

When the reading was taken: calendar date or date with time and UTC offset.

valuerequired number

Temperature in natural degrees of the series unit, at most 2 decimal places (e.g. 36.52).

excluded boolean

True when the user or app marked this reading disturbed/excluded from thermal-shift interpretation.

excludeReason ExcludeReason or CodeableConcept

Optional coded or text-only reason for exclusion (only allowed when excluded is true).

MedEntry

4 fields

One medication entry on a date or timestamp.

daterequired DateTime

When the medication was taken (or missed): calendar date or date with time and UTC offset.

The product: a built-in keyword (MedicationKind) or any FHIR CodeableConcept as an escape.

statusrequired MedStatus

Whether it was taken.

dose MedDose

Optional exact dose taken (maps to MedicationStatement.dosage[0].doseAndRate[0].doseQuantity).

MedDose

2 fields

Exact positive decimal medication dose in a UCUM unit.

valuerequired number 0 < v < 10⁹ (≤ 6 decimals)

Strictly positive decimal dose below 1,000,000,000, with at most 6 decimal places (e.g. 400, 12.5).

unitrequired string ≤ 64 chars

UCUM unit code (printable ASCII, no spaces, e.g. "mg", "ug", "mL", "[iU]").

Custom series & components

CustomBooleanSeries

3 fields

Yes / no entries (also events: only true).

coderequired CodeableConcept (excluding ReservedSeriesCode)

The Observation CodeableConcept. Not a built-in series code. An R4 vital-sign code makes the series a vital sign (category vital-signs); a code with its own R4 profile needs that profile's valueType and unit (VITAL_SIGN_PROFILES).

valueTyperequired "boolean"

FHIR Observation value type: boolean (Observation.valueBoolean).

entriesrequired Array of ObservationEntry<boolean>

Entries with boolean values (false is an explicit negative).

CustomCodedSeries

3 fields

Coded or text-only entries: categorical, ordinal or multi-select alike (each entry is one fact).

coderequired CodeableConcept (excluding ReservedSeriesCode)

The Observation CodeableConcept. Not a built-in series code. An R4 vital-sign code makes the series a vital sign (category vital-signs); a code with its own R4 profile needs that profile's valueType and unit (VITAL_SIGN_PROFILES).

valueTyperequired "coded"

FHIR Observation value type: coded or text-only (Observation.valueCodeableConcept).

entriesrequired Array of ObservationEntry<CodeableConcept>

Entries with FHIR CodeableConcept values (each one fact). Level order is not carried, so displays or text should state the rank ("3 of 5").

CustomQuantitySeries

4 fields

Natural decimal quantity entries in a UCUM unit (at most 6 decimal places).

coderequired CodeableConcept (excluding ReservedSeriesCode)

The Observation CodeableConcept. Not a built-in series code. An R4 vital-sign code makes the series a vital sign (category vital-signs); a code with its own R4 profile needs that profile's valueType and unit (VITAL_SIGN_PROFILES).

valueTyperequired "quantity"

FHIR Observation value type: decimal quantity in UCUM unit (Observation.valueQuantity).

unitrequired string ≤ 64 chars

UCUM unit code (printable ASCII, no spaces).

entriesrequired Array of ObservationEntry<number> |v| < 10⁹ (≤ 6 decimals) per entry

Entries with natural decimal numbers below 1,000,000,000 in magnitude and at most 6 decimal places. 0 is a value.

CustomComponentsSeries

4 fields

A reading of several components, written as one Observation with a component per recorded value and no top-level value (blood pressure: LOINC 85354-9 with 8480-6 and 8462-4 in mm[Hg]). Nothing here is specific to blood pressure: any code may have components.

coderequired CodeableConcept (excluding ReservedSeriesCode)

The Observation CodeableConcept. Not a built-in series code. An R4 vital-sign code makes the series a vital sign (category vital-signs); 85354-9 must be a components series whose 8480-6 and 8462-4 components are quantities in mm[Hg].

valueTyperequired "components"

FHIR Observation value type: multi-component reading with no top-level value (Observation.component[]).

componentsrequired Array of CustomBooleanComponent | CustomCodedComponent | CustomQuantityComponent ≤ 16 items

The declared components, each with its own code and valueType. Codes differ. Canonical order is the concepts' canonical order; a component never recorded in any entry is dropped.

entriesrequired Array of CustomComponentsEntry

The readings, each carrying its date/time and at least one recorded component value.

CustomBooleanComponent

2 fields

A yes / no component (component.valueBoolean).

coderequired CodeableConcept

The component CodeableConcept.

valueTyperequired "boolean"

FHIR Observation component value type: boolean (component.valueBoolean).

CustomCodedComponent

2 fields

A coded or text-only component: one CodeableConcept per reading (component.valueCodeableConcept).

coderequired CodeableConcept

The component CodeableConcept.

valueTyperequired "coded"

FHIR Observation component value type: coded or text-only (component.valueCodeableConcept).

CustomQuantityComponent

3 fields

A decimal quantity component in a UCUM unit (component.valueQuantity, at most 6 decimal places).

coderequired CodeableConcept

The component CodeableConcept.

valueTyperequired "quantity"

FHIR Observation component value type: decimal quantity in UCUM unit (component.valueQuantity).

unitrequired string ≤ 64 chars

UCUM unit code (printable ASCII, no spaces). In a vital-sign series, one of the units the R4 vital-signs profile allows for components (UCUM_VITALS_COMMON).

CustomComponentsEntry

2 fields

One multi-component reading entry on a date or timestamp.

daterequired DateTime

When the reading was taken: calendar date or date with time and UTC offset.

componentsrequired Array of CustomComponentValue ≤ 16 items

Recorded component values (1..16). Each code must match a declared component of the series, with no duplicate component code in one entry.

CustomComponentValue

2 fields

One recorded component value inside a CustomComponentsEntry.

coderequired CodeableConcept

The component CodeableConcept (must match one of series.components).

valuerequired boolean or CodeableConcept or number

The component's value: boolean, CodeableConcept, or decimal number matching the component's valueType.

Built-in vocabularies & code lists

Expand any table below to inspect its exact model values and FHIR mappings. Built-in keywords compress to a few bits and expand on decode to canonical SNOMED CT, LOINC, or cycle-log codings; every coded slot also accepts any FHIR R4 CodeableConcept (coded with optional display/text, or text-only { text }).

Bleeding Menstrual bleeding on one day: the legal combinations of bleeding and flow 7 values

Menstrual bleeding on one day: the legal combinations of bleeding and flow.

Model valueSystemCodeDisplay
no-bleedingcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logmenstrual-bleeding = falseExplicitly no bleeding
flow-nonecycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logflow-noneExplicitly no bleeding, logged on a flow scale's "none" optionpaired with menstrual-bleeding = false
bleedingcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logmenstrual-bleeding = trueBleeding, amount not recorded
spottingcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logflow-spottingBleeding, flow category spotting (also bleeding between periods with no amount)paired with menstrual-bleeding = true
lightcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logflow-lightBleeding, flow category lightpaired with menstrual-bleeding = true
moderatecycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logflow-moderateBleeding, flow category moderate (medium)paired with menstrual-bleeding = true
heavycycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logflow-heavyBleeding, flow category heavypaired with menstrual-bleeding = true
ConditionKind Built-in condition keywords (SNOMED CT), pending clinical review: the main explanations of a bleeding pattern 15 values

Built-in condition keywords (SNOMED CT), pending clinical review: the main explanations of a bleeding pattern. Any other condition is passed as a FHIR CodeableConcept.

Model valueSystemCodeDisplay
pcosSNOMED CThttp://snomed.info/sct237055002Polycystic ovary syndrome
uterine-fibroidsSNOMED CThttp://snomed.info/sct95315005Uterine leiomyoma (fibroids)
adenomyosisSNOMED CThttp://snomed.info/sct784314006Uterine adenomyosis
endometrial-polypSNOMED CThttp://snomed.info/sct1237359009Endometrial polyp
endometriosisSNOMED CThttp://snomed.info/sct129103003Endometriosis
von-willebrand-disorderSNOMED CThttp://snomed.info/sct128105004von Willebrand disorder
coagulation-disorderSNOMED CThttp://snomed.info/sct64779008Blood coagulation disorder
iron-deficiency-anemiaSNOMED CThttp://snomed.info/sct87522002Iron deficiency anemia
hypothyroidismSNOMED CThttp://snomed.info/sct40930008Hypothyroidism
hyperthyroidismSNOMED CThttp://snomed.info/sct34486009Hyperthyroidism
hyperprolactinemiaSNOMED CThttp://snomed.info/sct237662005Hyperprolactinemia
premature-ovarian-insufficiencySNOMED CThttp://snomed.info/sct237788002Premature ovarian insufficiency
hypothalamic-amenorrheaSNOMED CThttp://snomed.info/sct237120002Hypothalamic amenorrhea
perimenopauseSNOMED CThttp://snomed.info/sct161541000119104Perimenopausal state
postmenopauseSNOMED CThttp://snomed.info/sct76498008Postmenopausal state
ConditionStatus A reported condition's status, as the person states it 2 values

A reported condition's status, as the person states it.

Model valueSystemCodeDisplay
activecondition-clinicalhttp://terminology.hl7.org/CodeSystem/condition-clinicalactiveThe person has it now
resolvedcondition-clinicalhttp://terminology.hl7.org/CodeSystem/condition-clinicalresolvedThe person had it and it is over (explicit negative for now)
Energy Energy, 4 points (Clue) 4 values

Energy, 4 points (Clue).

Model valueSystemCodeDisplay
exhaustedcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logenergy-exhausted1 of 4
lowcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logenergy-low2 of 4
highcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logenergy-high3 of 4
energizedcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logenergy-energized4 of 4
ExcludeReason Built-in disturbance/exclusion reason on a BBT or skinTemp reading 8 values

Built-in disturbance/exclusion reason on a BBT or skinTemp reading.

Model valueSystemCodeDisplay
fevercycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logexclude-feverFever or acute febrile illness
alcoholcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logexclude-alcoholAlcohol consumption the previous evening
poor-sleepcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logexclude-poor-sleepPoor, broken, or unusually short sleep
late-wakecycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logexclude-late-wakeWoke significantly later (or earlier) than usual
travelcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logexclude-travelTravel or time-zone shift
stresscycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logexclude-stressAcute stress
medicationcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logexclude-medicationMedication affecting basal temperature
othercycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logexclude-otherOther unspecified disturbance
IntervalKind Built-in states over a range of days 15 values

Built-in states over a range of days. Contraception values are LOINC answers to 8659-5.

Model valueSystemCodeDisplay
noneLOINChttp://loinc.orgLA137-2Not using contraception (explicit negative)Observation.code: LOINC 8659-5
combined-pillLOINChttp://loinc.orgLA27908-5Combined oral contraceptive pillObservation.code: LOINC 8659-5
progestin-pillLOINChttp://loinc.orgLA27909-3Progestin-only pillObservation.code: LOINC 8659-5
patchLOINChttp://loinc.orgLA16581-3Contraceptive patchObservation.code: LOINC 8659-5
ringLOINChttp://loinc.orgLA27911-9Vaginal ringObservation.code: LOINC 8659-5
injectionLOINChttp://loinc.orgLA27907-7Injectable contraceptiveObservation.code: LOINC 8659-5
implantLOINChttp://loinc.orgLA27901-0Contraceptive implantObservation.code: LOINC 8659-5
hormonal-iudLOINChttp://loinc.orgLA27902-8Hormonal (progestin) IUDObservation.code: LOINC 8659-5
copper-iudLOINChttp://loinc.orgLA27903-6Copper IUDObservation.code: LOINC 8659-5
iud-unspecifiedLOINChttp://loinc.orgLA27904-4IUD, type not recordedObservation.code: LOINC 8659-5
condomLOINChttp://loinc.orgLA27912-7Male condomObservation.code: LOINC 8659-5
fertility-awarenessLOINChttp://loinc.orgLA27918-4Fertility awareness-based methodObservation.code: LOINC 8659-5
lactational-amenorrheaLOINChttp://loinc.orgLA27919-2Lactational amenorrhea methodObservation.code: LOINC 8659-5
pregnantLOINChttp://loinc.orgLA15173-0Pregnant (LOINC 82810-3)Observation.code: LOINC 82810-3
breastfeedingLOINChttp://loinc.orgLA29252-6Breastfeeding (LOINC 63895-7)Observation.code: LOINC 63895-7
MedStatus Whether a medication was taken on a day 2 values

Whether a medication was taken on a day.

Model valueSystemCodeDisplay
takenmedication-statement-statushttp://hl7.org/fhir/CodeSystem/medication-statement-statuscompletedTaken
not-takenmedication-statement-statushttp://hl7.org/fhir/CodeSystem/medication-statement-statusnot-takenExplicitly not taken (a missed dose)
MedicationKind Built-in medication keywords (SNOMED CT medicinal products) 7 values

Built-in medication keywords (SNOMED CT medicinal products). Any other product (RxNorm, SNOMED CT, text-only, ...) is passed as a FHIR CodeableConcept.

Model valueSystemCodeDisplay
ibuprofenSNOMED CThttp://snomed.info/sct38268001Ibuprofen-containing product
naproxenSNOMED CThttp://snomed.info/sct11847009Naproxen-containing product
acetaminophenSNOMED CThttp://snomed.info/sct90332006Acetaminophen-containing product
mefenamic-acidSNOMED CThttp://snomed.info/sct34364009Mefenamic acid-containing product
tranexamic-acidSNOMED CThttp://snomed.info/sct109006003Tranexamic acid-containing product
ironSNOMED CThttp://snomed.info/sct30729008Iron-containing product
folic-acidSNOMED CThttp://snomed.info/sct6247001Folic acid-containing product
Mood Mood valence, 7 points (Apple HealthKit State of Mind) 7 values

Mood valence, 7 points (Apple HealthKit State of Mind).

Model valueSystemCodeDisplay
very-unpleasantcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logvalence-very-unpleasant1 of 7
unpleasantcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logvalence-unpleasant2 of 7
slightly-unpleasantcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logvalence-slightly-unpleasant3 of 7
neutralcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logvalence-neutral4 of 7, neither pleasant nor unpleasant
slightly-pleasantcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logvalence-slightly-pleasant5 of 7
pleasantcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logvalence-pleasant6 of 7
very-pleasantcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logvalence-very-pleasant7 of 7
Mucus Cervical mucus, as self-observed 5 values

Cervical mucus, as self-observed.

Model valueSystemCodeDisplay
drycycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logmucus-dryNo mucus; feels dry
stickycycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logmucus-stickySticky, tacky or crumbly
creamycycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logmucus-creamyCreamy, lotion-like
waterycycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logmucus-wateryWatery, wet
egg-whitecycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logmucus-egg-whiteClear and stretchy, like raw egg white
OvulationTest LH (ovulation) urine test result 4 values

LH (ovulation) urine test result.

Model valueSystemCodeDisplay
negativeSNOMED CThttp://snomed.info/sct260385009No surge detected
lh-surgeSNOMED CThttp://snomed.info/sct10828004LH surge detected (a positive test)
estrogen-surgecycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logestrogen-surgeEstrogen rise detected (high fertility on two-hormone tests)
indeterminateSNOMED CThttp://snomed.info/sct82334004The result could not be read
PeriodsStopped Answers to "periods-stopped" 4 values

Answers to "periods-stopped".

Model valueSystemCodeDisplay
yes-no-periodsLOINChttp://loinc.orgLA14656-5Yes, no menstrual periods
yes-hormonesLOINChttp://loinc.orgLA14657-3Yes, but has periods now due to female hormones
noLOINChttp://loinc.orgLA32-8No
not-sureLOINChttp://loinc.orgLA12693-0Not sure
PillLog Contraceptive pill log for one day 2 values

Contraceptive pill log for one day.

Model valueSystemCodeDisplay
takencycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logcontraceptive-pill-taken = trueThe pill was taken
missedcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logcontraceptive-pill-taken = falseThe pill was missed (explicit negative)
ProcedureKind Built-in procedures (SNOMED CT) 13 values

Built-in procedures (SNOMED CT).

Model valueSystemCodeDisplay
iud-insertionSNOMED CThttp://snomed.info/sct65200003Insertion of an intrauterine device
iud-removalSNOMED CThttp://snomed.info/sct1263416007Removal of an intrauterine device
implant-insertionSNOMED CThttp://snomed.info/sct169553002Insertion of a contraceptive implant
implant-removalSNOMED CThttp://snomed.info/sct301807007Removal of a contraceptive implant
emergency-contraceptionSNOMED CThttp://snomed.info/sct1372819003Emergency contraception taken
hysterectomySNOMED CThttp://snomed.info/sct236886002Hysterectomy: afterwards absent bleeding is not amenorrhea or menopause
endometrial-ablationSNOMED CThttp://snomed.info/sct265060005Endometrial ablation: afterwards little or no bleeding is expected
oophorectomySNOMED CThttp://snomed.info/sct83152002Oophorectomy (one ovary or unspecified)
bilateral-oophorectomySNOMED CThttp://snomed.info/sct76876009Bilateral oophorectomy: surgical menopause
myomectomySNOMED CThttp://snomed.info/sct42010004Myomectomy (fibroid removal)
d-and-cSNOMED CThttp://snomed.info/sct11401008Dilation and curettage
polypectomySNOMED CThttp://snomed.info/sct236884004Endometrial polypectomy
uterine-artery-embolizationSNOMED CThttp://snomed.info/sct312138002Uterine artery embolization
Question Screening questions (LOINC) 7 values

Screening questions (LOINC). A coded question's value is one of its answer names (or any CodeableConcept as an escape); a numeric question's value is an integer.

Model valueSystemCodeDisplay
usual-cycle-lengthLOINChttp://loinc.org64700-8Usual cycle length over the last year. Answer: UsualCycleLength
periods-per-yearLOINChttp://loinc.org92656-8Number of periods per year. Answer: integer 0-100 (unit /a)UCUM unit: /a
missed-periods-3-monthsLOINChttp://loinc.org65930-0Periods missed over the past 3 months. Answer: integer 0-3UCUM unit: {#}/(3.mo)
period-in-last-yearLOINChttp://loinc.org63889-0Had a period within the last year. Answer: YesNo
periods-stoppedLOINChttp://loinc.org64701-6Periods stopped permanently. Answer: PeriodsStopped
age-periods-stoppedLOINChttp://loinc.org64702-4Age in years when periods stopped. Answer: integer 0-100UCUM unit: a
age-at-menarcheLOINChttp://loinc.org63888-2Age in years at the first period. Answer: integer 0-100UCUM unit: a
Sex Sexual intercourse on one day 4 values

Sexual intercourse on one day.

Model valueSystemCodeDisplay
nonecycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logno-sexual-intercourseExplicitly no intercourse
protectedSNOMED CThttp://snomed.info/sct63537005Intercourse with protection (e.g. a condom)
unprotectedSNOMED CThttp://snomed.info/sct2314005Intercourse without protection
unspecifiedSNOMED CThttp://snomed.info/sct70256003Intercourse, protection not recorded
SkinTempKind What a wearable temperature value means 2 values

What a wearable temperature value means.

Model valueSystemCodeDisplay
deviationcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-logskin-temperature-deviationDifference from the device's own baseline (Oura, Fitbit, Garmin); signed
absolutecycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-lognightly-skin-temperatureAbsolute nightly skin or wrist temperature (Apple Watch, Google, Whoop)
SymptomKind Built-in symptom keywords (SNOMED CT, plus hot-flash in cycle-log) 35 values

Built-in symptom keywords (SNOMED CT, plus hot-flash in cycle-log). The first 14 are the starter set of the Period Tracking guide the design started from. Any other symptom is passed as a FHIR CodeableConcept.

Model valueSystemCodeDisplay
menstrual-crampSNOMED CThttp://snomed.info/sct431416001Menstrual cramp
backacheSNOMED CThttp://snomed.info/sct161891005Backache
headacheSNOMED CThttp://snomed.info/sct25064002Headache
migraineSNOMED CThttp://snomed.info/sct37796009Migraine
stomach-acheSNOMED CThttp://snomed.info/sct271681002Stomach ache
nauseaSNOMED CThttp://snomed.info/sct422587007Nausea
breast-tendernessSNOMED CThttp://snomed.info/sct55222007Breast tenderness
ovulation-painSNOMED CThttp://snomed.info/sct43548008Ovulation pain
fatigueSNOMED CThttp://snomed.info/sct84229001Fatigue
bloatingSNOMED CThttp://snomed.info/sct116289008Abdominal bloating
depressed-moodSNOMED CThttp://snomed.info/sct366979004Depressed mood
irritableSNOMED CThttp://snomed.info/sct55929007Feeling irritable
stressSNOMED CThttp://snomed.info/sct73595000Stress
dyspareuniaSNOMED CThttp://snomed.info/sct71315007Dyspareunia
acneSNOMED CThttp://snomed.info/sct11381005Acne
pelvic-painSNOMED CThttp://snomed.info/sct30473006Pain in pelvis
low-back-painSNOMED CThttp://snomed.info/sct279039007Low back pain
breast-painSNOMED CThttp://snomed.info/sct53430007Pain of breast
mood-swingsSNOMED CThttp://snomed.info/sct18963009Mood swings
anxietySNOMED CThttp://snomed.info/sct48694002Anxiety
diarrheaSNOMED CThttp://snomed.info/sct62315008Diarrhea
constipationSNOMED CThttp://snomed.info/sct14760008Constipation
dizzinessSNOMED CThttp://snomed.info/sct404640003Dizziness
food-cravingSNOMED CThttp://snomed.info/sct248132003Craving for food or drink
vaginal-clotsSNOMED CThttp://snomed.info/sct289532003Passing clots vaginally
hot-flashcycle-loghttps://joshuamandel.com/shc2-poc/CodeSystem/cycle-loghot-flashHot flash (cause not stated)
night-sweatsSNOMED CThttp://snomed.info/sct42984000Night sweats
insomniaSNOMED CThttp://snomed.info/sct193462001Insomnia
vaginal-drynessSNOMED CThttp://snomed.info/sct31908003Vaginal dryness
palpitationsSNOMED CThttp://snomed.info/sct80313002Palpitations
urinary-incontinenceSNOMED CThttp://snomed.info/sct165232002Urinary incontinence
memory-lapsesSNOMED CThttp://snomed.info/sct225038006Memory lapses
hair-lossSNOMED CThttp://snomed.info/sct56317004Alopecia (hair loss)
increased-libidoSNOMED CThttp://snomed.info/sct58436003Increased libido
reduced-libidoSNOMED CThttp://snomed.info/sct8357008Reduced libido
TemperatureUnit Temperature unit (UCUM) 2 values

Temperature unit (UCUM).

Model valueSystemCodeDisplay
CelUCUMhttp://unitsofmeasure.orgCelDegrees Celsius
[degF]UCUMhttp://unitsofmeasure.org[degF]Degrees Fahrenheit
TestResult A urine test result (progesterone or pregnancy) 3 values

A urine test result (progesterone or pregnancy).

Model valueSystemCodeDisplay
negativeSNOMED CThttp://snomed.info/sct260385009Negative
positiveSNOMED CThttp://snomed.info/sct10828004Positive
indeterminateSNOMED CThttp://snomed.info/sct82334004The result could not be read
UsualCycleLength Answers to "usual-cycle-length" 8 values

Answers to "usual-cycle-length".

Model valueSystemCodeDisplay
<21LOINChttp://loinc.orgLA14649-0Less than 21 days
21-25LOINChttp://loinc.orgLA14650-821-25 days
26-32LOINChttp://loinc.orgLA14651-626-32 days
33-35LOINChttp://loinc.orgLA14652-433-35 days
36-90LOINChttp://loinc.orgLA14653-236-90 days
>90LOINChttp://loinc.orgLA14654-0More than 90 days
too-variableLOINChttp://loinc.orgLA14655-7Too variable to say
dont-knowLOINChttp://loinc.orgLA12688-0Don't know
YesNo Answers to "period-in-last-year" 2 values

Answers to "period-in-last-year".

Model valueSystemCodeDisplay
yesLOINChttp://loinc.orgLA33-6Yes
noLOINChttp://loinc.orgLA32-8No (explicit negative)

Profile & reservation code lists

These code lists govern which custom series automatically receive the FHIR vital-signs category and which built-in codes must use their dedicated top-level field instead of custom[] or intervals[].

IntervalReservedCode Per-day series code 24 codes

Built-in per-day series codes, which an interval may not use (the contraception, pregnancy and breastfeeding codes are allowed).

LOINC (10) http://loinc.org
2106-3 63888-2 63889-0 64700-8 64701-6 64702-4 65930-0 72514-3 92656-8 93832-4
SNOMED CT (1) http://snomed.info/sct
364316005
cycle-log (13) https://joshuamandel.com/shc2-poc/CodeSystem/cycle-log
basal-body-temperature cervical-mucus contraceptive-pill-taken energy-level menstrual-bleeding menstrual-flow menstrual-fluid-volume mood-valence nightly-skin-temperature ovulation-test pdg-test skin-temperature-deviation symptom
R4VitalSignCode R4 vital-sign code 84 codes

LOINC codes for which the HL7 validator applies an R4 vital-signs profile (requiring category vital-signs). Custom intervals may not use them; a custom series with one is a vital sign, written with category vital-signs.

LOINC (84) http://loinc.org
11291-2 11328-2 19224-5 19840-8 20564-1 2708-6 2709-4 2710-2 2713-6 29463-7 3137-7 3138-5 3141-9 3142-7 33438-3 35094-2 39156-5 40443-4 51733-4 55284-4 55425-3 59408-5 59417-6 60834-9 60835-6 60836-4 60838-0 60955-2 60978-4 61009-7 68999-2 69000-8 73795-7 73799-9 75292-3 75539-7 75987-8 76010-8 76011-6 76170-0 76171-8 76172-6 76270-8 76278-1 76476-1 76477-9 76534-7 79348-9 8287-5 8302-2 8306-3 8308-9 8309-7 8310-5 8328-7 8329-5 8330-3 8331-1 8332-9 8333-7 8334-5 8350-1 8351-9 8459-0 8462-4 8478-0 8480-6 85353-1 85354-9 8867-4 8886-4 8889-8 8890-6 8891-4 8892-2 8893-0 89270-3 89276-0 91371-5 9279-1 97549-0 9843-4 98657-0 98663-8
ReservedSeriesCode Built-in series code 27 codes

The Observation codes of the built-in series and screening questions. A custom series may not use them: put the values in the built-in instead (its coded values accept any CodeableConcept).

LOINC (13) http://loinc.org
2106-3 63888-2 63889-0 63895-7 64700-8 64701-6 64702-4 65930-0 72514-3 82810-3 8659-5 92656-8 93832-4
SNOMED CT (1) http://snomed.info/sct
364316005
cycle-log (13) https://joshuamandel.com/shc2-poc/CodeSystem/cycle-log
basal-body-temperature cervical-mucus contraceptive-pill-taken energy-level menstrual-bleeding menstrual-flow menstrual-fluid-volume mood-valence nightly-skin-temperature ovulation-test pdg-test skin-temperature-deviation symptom

Formats & cross-field rules

CalendarDateExamples: "2026-01-05", "2028-02-29" (real Gregorian date, 2000-01-01 to 2099-12-31)

A calendar date YYYY-MM-DD from 2000-01-01 to 2099-12-31 (real Gregorian date). Used for interval start and end bounds.

DateTimeExamples: "2026-01-05", "2026-01-05T07:30-05:00", "2026-01-05T22:15:42Z" (Z & :00 accepted)

A FHIR dateTime on the daily tracking timeline (2000-01-01 to 2099-12-31): either a calendar date YYYY-MM-DD (day precision) or a date with local time and quarter-hour UTC offset YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM). "Z" is accepted and normalized to "+00:00"; ":00" seconds are accepted and omitted canonically; "-00:00" is rejected.

FhirDateExamples: "2019", "2023-05", "2021-11-30" (year, month, or day precision, 1900 to 2150)

A FHIR date of year, month or day precision: YYYY, YYYY-MM or YYYY-MM-DD, from 1900 to 2150. Used for patient birth date and condition onset.

FhirDateTimeExamples: "2021-04", "2026-01-29T10:30-05:00" (procedure date or timestamp, 1900 to 2150; Z & :00 accepted)

A FHIR dateTime for procedures (year 1900 to 2150): YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM). "Z" is accepted and normalized to "+00:00"; ":00" seconds are omitted canonically; "-00:00" is rejected.

FhirInstantExamples: "2026-12-04T14:30-06:00", "2026-12-04T14:30:15Z" (maps to FHIR Bundle.timestamp; Z & :00 accepted)

A FHIR instant with calendar date (2000-01-01 to 2099-12-31), time of day, optional seconds and quarter-hour UTC offset: YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM). "Z" is accepted and normalized to "+00:00"; ":00" seconds are omitted canonically; "-00:00" is rejected. FHIR Bundle.timestamp always emits seconds.

Rules a JSON Schema cannot express

A document that passes JSON Schema validation can still be rejected by validate() and the codec's encoder if it breaks any of these cross-field rules:

  • date-span: Across all daily series, intervals and answers, recorded dates span at most 10,000 days from earliest to latest, and every interval has start ≤ end.
  • calendar-date: Every full calendar date (DateTime, CalendarDate, FhirInstant, and full dates in FhirDate / FhirDateTime) is a real Gregorian date (no 2026-02-30; 29 February only in leap years).
  • decimal-precision: Temperature readings (bbt, skinTemp) have at most 2 decimal places; medication doses and custom quantities have at most 6 decimal places.
  • snomed-check-digit: A SNOMED CT Coding (system: "http://snomed.info/sct") has a 6-18 digit concept id passing the Verhoeff check digit with partition 00 or 10 (not a description or relationship id).
  • no-unpaired-surrogates: Codes, displays, texts and names contain no unpaired UTF-16 surrogate (possible only through a \ud800-style escape in JSON text).
  • display-consistency: For non-built-in coded concepts, every occurrence of the same (system, code) with a display must agree on the same display, and every occurrence with text must agree on the same text; text is not allowed on built-in concepts; at most 512 distinct escape labels (displays, coded texts, and text-only concepts) may appear on a card.
  • unique-custom-code: Each custom series has a different code (distinct (system, code) or distinct text-only text).
  • entries: A temperature entry's excludeReason is allowed only when excluded is true (identical entries, and entries that disagree, are all valid: each is its own fact).
  • component-reading: A components series declares 1-16 components with distinct codes; each entry records at least one component with no duplicate code, matching a declared component and carrying a value of that component's valueType. A component code has one valueType, and as a quantity one unit, on the whole card.
  • vital-sign-profile: A custom series whose code has its own R4 vital-signs profile has that profile's valueType and unit: 8310-5 in Cel or [degF], 8867-4 and 9279-1 in /min, 2708-6 in %, 8302-2 and 9843-4 in cm or [in_i], 29463-7 in kg, g or [lb_av], 39156-5 in kg/m2 (quantity series), and 85354-9 a components series whose 8480-6 and 8462-4 components are quantities in mm[Hg]; in any R4 vital-sign series a quantity component's unit is one of %, cm, [in_i], kg, g, [lb_av], Cel, [degF], mm[Hg], /min, kg/m2, m2.
  • fact-limit: The model has at most 20,000 facts in all (a bound on encoder and decoder work, far above real use).
  • number-spelling: In JSON text, integer fields (pain, volume, sleep, numeric answers) are spelled -?(0|[1-9][0-9]*); decimal fields are spelled -?(0|[1-9][0-9]*)(\.[0-9]{1,N})? (N = 2 for temperatures, N = 6 for doses and custom quantities); never -0, -0.0 or scientific notation.

Order inside arrays is free, and non-canonical spellings (a CodeableConcept equal to a built-in keyword, Z offset, ':00' seconds, display on a built-in concept) are accepted: the encoder normalizes. Patterns are ECMA-262 regular expressions with Unicode (u flag) semantics.

Normative TypeScript & examples

Browse realistic sample JSON models directly (each paired with its card and FHIR Bundle on the cycle-log codec hub):

model.d.ts Full normative TypeScript definition 1000 lines

Download model.d.ts · Open raw text

/**
 * cycle-log model: the input of the cycle-log codec.
 *
 * This file is the NORMATIVE definition of the model JSON that an app exports and
 * the codec encodes into one QR code: consumer menstrual-cycle tracking spanning
 * up to 10,000 days. It contains only types and their documentation.
 * `model.schema.json` (JSON Schema 2020-12) is derived from it; where the two
 * differ, this file and `validate()` in `model.ts` win.
 * Published at https://joshuamandel.com/shc2-poc/codecs/cycle-log/model.d.ts
 *
 * Conventions
 * - Per-day series are flat arrays of `{ date, ... }` entries, where `date` is a
 *   FHIR `DateTime` (`YYYY-MM-DD` or `YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM)` in
 *   2000-01-01..2099-12-31). Across all daily series, intervals and answers, the
 *   earliest to latest recorded date spans at most 10,000 days.
 * - NOT RECORDED is an omitted entry or an absent / empty / `null` optional field.
 *   Absence never means "no". Canonical form omits absent and empty optional fields.
 * - An EXPLICIT NEGATIVE is always its own value ("no-bleeding", pain 0,
 *   sex "none", a medication "not-taken", a boolean `false`, ...).
 * - Concepts use readable built-in keywords in built-in slots (`SymptomKind`,
 *   `MedicationKind`, `ConditionKind`, `Mucus`, `Sex`, `Mood`, `Energy`,
 *   `ProcedureKind`, `IntervalKind`, `ExcludeReason`, coded `Answer` values), and
 *   standard FHIR R4 `CodeableConcept` objects (`{ coding: [Coding]; text?: string }`
 *   or text-only `{ text: string }`) everywhere else and as escapes.
 *   For built-in concepts, `coding[0].display` is optional on input and stripped in
 *   canonical form, and `text` is not allowed. For any non-built-in escape coding
 *   (whether SNOMED CT, LOINC, RxNorm, ICD-10-CM, ATC, NDC, or an app URI), both
 *   `coding[0].display` and `text` are preserved and must agree across all
 *   occurrences of the same `(system, code)`. Text-only `{ text }` concepts carry
 *   user or app tags without requiring a synthetic code-system URI.
 * - Integer fields (`pain`, `volume`, `sleep`, numeric `answers`) are integers,
 *   written in JSON as -?(0|[1-9][0-9]*). Decimal fields (`bbt` and `skinTemp`
 *   to 2 decimal places; medication doses and custom quantities to 6 decimal
 *   places) are natural decimals -?(0|[1-9][0-9]*)(\.[0-9]+)? (no scientific
 *   notation, no "-0").
 * - Order inside arrays is free; the codec sorts canonically.
 * - Identical entries and entries that disagree on the same date or time are all
 *   carried, each its own fact, never merged (except overlapping/touching
 *   intervals of the same state).
 * - Objects carry only the fields listed here; any other field is an error.
 *
 * Tags: `@minimum` / `@maximum` bound a number; `@maxLength` bounds a string in
 * Unicode code points; `@maxItems` bounds an array; `@code` is the concept a
 * built-in keyword stands for.
 */

/* ======================================================================== */
/* The model                                                                 */
/* ======================================================================== */

/** One card: consumer cycle tracking as uniform dated arrays. An empty object `{}` is valid. */
export interface CycleLog {
  /**
   * Who the card is about, kept deliberately small. Not recorded: absent or empty;
   * the card then carries no identity at all.
   */
  patient?: PatientInfo;
  /** The source app: its name and optional version. Not recorded: absent. */
  source?: Source;
  /**
   * When the card was exported, as a FHIR instant with UTC offset (mapped to
   * FHIR `Bundle.timestamp`). Not recorded: absent.
   */
  exportedAt?: FhirInstant;
  /**
   * The sender deliberately left out data to fit a size: a series, time of day, or
   * display that is absent may have been tracked; recorded values are never altered.
   * It says nothing about what was left out. Not reduced: false or absent (omitted
   * canonically). Written as the Bundle tag SUBSETTED.
   */
  reduced?: boolean;
  /**
   * Conditions the person reports having (background context such as PCOS or
   * fibroids). Not recorded: [] or absent. Explicit negative: status "resolved".
   * A condition stated more than once (even differently) is carried as stated.
   */
  conditions?: ConditionEntry[];
  /**
   * Menstrual bleeding entries. Omitted dates: not recorded. Explicit negative:
   * "no-bleeding" (or "flow-none").
   */
  bleeding?: ObservationEntry<Bleeding>[];
  /**
   * Collected menstrual fluid entries, whole mL (a smart or graduated cup). Fluid,
   * not blood: the blood fraction varies widely between people, so a fluid volume
   * does not establish a blood loss. Independent of `bleeding`: neither implies
   * the other. Omitted dates: not recorded. Explicit negative: 0.
   * @minimum 0
   * @maximum 500
   */
  volume?: ObservationEntry<number>[];
  /**
   * Pain entries on a 0-10 numeric rating scale (LOINC 72514-3). Omitted dates:
   * not recorded. Explicit negative: 0 ("no pain"). Another scale goes in a custom
   * series.
   * @minimum 0
   * @maximum 10
   */
  pain?: ObservationEntry<number>[];
  /**
   * Symptoms present on each date: a built-in keyword (`SymptomKind`) or any FHIR
   * `CodeableConcept` as an escape (presence only; for severity use a custom coded
   * series). Omitted dates: not recorded. There is no explicit "symptom absent".
   */
  symptoms?: ObservationEntry<SymptomKind | CodeableConcept>[];
  /** Basal body temperature (waking readings). Not recorded: absent. */
  bbt?: Bbt;
  /**
   * Nightly skin or wrist temperature from a wearable (one device per card).
   * Never pooled with BBT. Not recorded: absent.
   */
  skinTemp?: SkinTemp;
  /** Cervical mucus entries. Omitted dates: not recorded. "dry" is a value. */
  mucus?: ObservationEntry<Mucus | CodeableConcept>[];
  /** LH (ovulation) test result entries. Omitted dates: not recorded. Explicit negative: "negative". */
  ovulationTest?: ObservationEntry<OvulationTest | CodeableConcept>[];
  /** Progesterone (PdG) urine test result entries. Omitted dates: not recorded. Explicit negative: "negative". */
  progesteroneTest?: ObservationEntry<TestResult | CodeableConcept>[];
  /** Pregnancy test result entries. Omitted dates: not recorded. Explicit negative: "negative". */
  pregnancyTest?: ObservationEntry<TestResult | CodeableConcept>[];
  /** Sexual intercourse entries. Omitted dates: not recorded. Explicit negative: "none". */
  sex?: ObservationEntry<Sex | CodeableConcept>[];
  /** Mood entries on a 7-point valence scale. Omitted dates: not recorded. Other mood scales or multi-select moods go in a custom series. */
  mood?: ObservationEntry<Mood | CodeableConcept>[];
  /** Energy entries on a 4-point scale. Omitted dates: not recorded. */
  energy?: ObservationEntry<Energy | CodeableConcept>[];
  /**
   * Minutes of sleep ending on each date (attributed to the wake day). Omitted
   * dates: not recorded. 0 is a value (no sleep).
   * @minimum 0
   * @maximum 1440
   */
  sleep?: ObservationEntry<number>[];
  /**
   * Contraceptive pill log entries. Which pill is named by the contraception
   * interval covering the date. Omitted dates: not recorded. Explicit negative:
   * "missed".
   */
  pill?: ObservationEntry<PillLog>[];
  /**
   * Medication entries (a dose taken twice is two entries with their timestamps).
   * Built-in keywords: `MedicationKind`; any other product (RxNorm, SNOMED CT,
   * text-only, ...) is an escape `CodeableConcept`. Omitted dates: not recorded.
   * Explicit negative: status "not-taken" (a missed dose).
   */
  medications?: MedEntry[];
  /**
   * States that last over a range of calendar dates: contraception, pregnancy,
   * breastfeeding, or any other coded or text-only state. Not recorded: [] or absent.
   * Explicit negative for contraception: kind "none". Intervals of one state that
   * overlap or touch are one interval: normalize merges them.
   * @maxItems 256
   */
  intervals?: Interval[];
  /**
   * Procedures: partial date (`YYYY`, `YYYY-MM`), full date (`YYYY-MM-DD`), or full
   * date with time (`YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM)`), year 1900-2150. Not
   * recorded: [] or absent. A procedure listed twice is two procedures.
   * @maxItems 512
   */
  procedures?: Procedure[];
  /**
   * Screening questions the person answered, each with the date (and optional time)
   * they answered it. What they said, never a value computed from the log. Not
   * recorded: [] or absent. A question answered more than once (even differently,
   * at one time) is carried as answered.
   */
  answers?: Answer[];
  /**
   * Series without a built-in slot, each with its own Observation `CodeableConcept`
   * and one of four `valueType` kinds (`"boolean"`, `"coded"`, `"quantity"`, or
   * `"components"` for multi-component readings like blood pressure). Not recorded:
   * [] or absent. One series per distinct `code`.
   * @maxItems 32
   */
  custom?: CustomSeries[];
}

/* ======================================================================== */
/* Shared shapes                                                             */
/* ======================================================================== */

/**
 * A standard FHIR Coding from any code system. For built-in concepts, `display` is
 * optional on input and stripped in canonical form. For any non-built-in escape
 * concept (including SNOMED CT, LOINC, RxNorm, ICD-10-CM, ATC, NDC, or app URIs),
 * `display` is carried and all occurrences of the same `(system, code)` must agree
 * on the same display text.
 */
export interface Coding {
  /**
   * Code system URI: absolute URI of printable ASCII without spaces or "|", 1-255 characters.
   * @maxLength 255
   * @example "http://snomed.info/sct"
   * @example "http://www.nlm.nih.gov/research/umls/rxnorm"
   */
  system: string;
  /**
   * Concept code within `system`: 1-128 characters, no control characters, no
   * leading/trailing/repeated spaces. SNOMED CT codes must be valid 6-18 digit
   * concept ids (Verhoeff check digit, partition 00 or 10).
   * @maxLength 128
   * @example "25064002"
   * @example "314076"
   */
  code: string;
  /**
   * Optional human-readable display text (1-128 characters, no control characters
   * or leading/trailing whitespace). Carried for any non-built-in escape concept;
   * optional on input and stripped in canonical form for built-in concepts.
   * @maxLength 128
   * @example "Essential hypertension"
   */
  display?: string;
}

/**
 * A FHIR R4 CodeableConcept: either a single `Coding` with optional plain-text
 * `text`, or a text-only concept `{ text }` with no `coding` (no synthetic URI
 * required). For built-in concepts, `coding[0].display` is optional on input and
 * stripped in canonical form, and `text` is not allowed. For any non-built-in
 * escape coding, both `coding[0].display` and `text` are preserved and must agree
 * across all occurrences of the same `(system, code)`.
 */
export type CodeableConcept =
  | { coding: [Coding]; text?: string }
  | { text: string };

/**
 * A calendar date YYYY-MM-DD from 2000-01-01 to 2099-12-31 (real Gregorian date).
 * Used for interval start and end bounds.
 * @example "2026-01-05"
 */
export type CalendarDate = string;

/**
 * A FHIR dateTime on the daily tracking timeline (2000-01-01 to 2099-12-31):
 * either a calendar date `YYYY-MM-DD` (day precision) or a date with local time
 * and quarter-hour UTC offset `YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM)`. `"Z"` is
 * accepted and normalized to `"+00:00"`; `":00"` seconds are accepted and omitted
 * canonically; `"-00:00"` is rejected.
 * @example "2026-01-05"
 * @example "2026-01-05T07:30-05:00"
 * @example "2026-01-05T22:15:42+01:00"
 */
export type DateTime = string;

/**
 * A FHIR date of year, month or day precision: YYYY, YYYY-MM or YYYY-MM-DD, from
 * 1900 to 2150. Used for patient birth date and condition onset.
 * @example "2019"
 * @example "2023-05"
 * @example "2021-11-30"
 */
export type FhirDate = string;

/**
 * A FHIR dateTime for procedures (year 1900 to 2150): `YYYY`, `YYYY-MM`,
 * `YYYY-MM-DD`, or `YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM)`. `"Z"` is accepted and
 * normalized to `"+00:00"`; `":00"` seconds are omitted canonically; `"-00:00"` is
 * rejected.
 * @example "2021-04"
 * @example "2026-01-29T10:30-05:00"
 */
export type FhirDateTime = string;

/**
 * A FHIR instant with calendar date (2000-01-01 to 2099-12-31), time of day,
 * optional seconds and quarter-hour UTC offset: `YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM)`.
 * `"Z"` is accepted and normalized to `"+00:00"`; `":00"` seconds are omitted
 * canonically; `"-00:00"` is rejected. FHIR `Bundle.timestamp` always emits seconds.
 * @example "2026-12-04T14:30-06:00"
 * @example "2026-12-04T14:30:15+00:00"
 */
export type FhirInstant = string;

/**
 * One observation entry in a flat series array: a `DateTime` (day or timestamp)
 * and its value. Identical entries and entries that disagree on the same date or
 * time are all carried, each its own fact, never merged.
 */
export interface ObservationEntry<T> {
  /** When the observation was recorded: calendar date or date with time and UTC offset. */
  date: DateTime;
  /** The recorded value. */
  value: T;
}

/** A built-in keyword shortcut or, as an escape, any FHIR `CodeableConcept`. */
export type Coded<T extends string> = T | CodeableConcept;

/** Optional identity: deliberately small. An empty object means no identity. */
export interface PatientInfo {
  /**
   * Family name. Not recorded: absent.
   * @maxLength 64
   */
  family?: string;
  /**
   * Given names, in order. Not recorded: absent or [].
   * Each 1-64 characters.
   * @maxItems 3
   */
  given?: string[];
  /**
   * Birth date, from 1900 to 2150. A year alone is enough to give age without
   * identity. Not recorded: absent.
   */
  birthDate?: FhirDate;
}

/** The exporting app, shown as the source device of every observation. */
export interface Source {
  /**
   * The app's name as users know it, 1-64 characters.
   * @maxLength 64
   * @example "FertilityApp"
   */
  name: string;
  /**
   * The app's version, 1-32 characters. Not recorded: absent.
   * @maxLength 32
   */
  version?: string;
}

/** A condition the person reports. */
export interface ConditionEntry {
  /** The condition: a built-in keyword (`ConditionKind`) or any FHIR `CodeableConcept` as an escape. */
  code: ConditionKind | CodeableConcept;
  /** What the person says about it now. Not stated: absent. */
  status?: ConditionStatus;
  /** When it started, as precisely as the person says (1900-2150). Not stated: absent. */
  onset?: FhirDate;
}

/** Built-in disturbance/exclusion reason on a BBT or skinTemp reading. */
export type ExcludeReason =
  /** Fever or acute febrile illness. */
  | "fever"
  /** Alcohol consumption the previous evening. */
  | "alcohol"
  /** Poor, broken, or unusually short sleep. */
  | "poor-sleep"
  /** Woke significantly later (or earlier) than usual. */
  | "late-wake"
  /** Travel or time-zone shift. */
  | "travel"
  /** Acute stress. */
  | "stress"
  /** Medication affecting basal temperature. */
  | "medication"
  /** Other unspecified disturbance. */
  | "other";

/** One temperature reading with date/time and optional disturbance/exclusion flag. */
export interface TempEntry {
  /** When the reading was taken: calendar date or date with time and UTC offset. */
  date: DateTime;
  /** Temperature in natural degrees of the series unit, at most 2 decimal places (e.g. 36.52). */
  value: number;
  /** True when the user or app marked this reading disturbed/excluded from thermal-shift interpretation. */
  excluded?: boolean;
  /** Optional coded or text-only reason for exclusion (only allowed when `excluded` is true). */
  excludeReason?: ExcludeReason | CodeableConcept;
}

/** Basal body temperature readings (0.01 °C / 0.01 °F precision, distinct from LOINC 8310-5 general body temperature). */
export interface Bbt {
  /** Unit of every reading. */
  unit: TemperatureUnit;
  /**
   * Readings in natural degrees of `unit` (at most 2 decimal places, e.g. 36.52).
   * Cel 34-42, [degF] 93-107.6.
   */
  entries: TempEntry[];
}

/** Wearable nightly temperature from one device. */
export interface SkinTemp {
  /** Whether values are deviations from the device's baseline or absolute temperatures. */
  kind: SkinTempKind;
  /** Unit of every value. For a deviation, a temperature difference in this unit. */
  unit: TemperatureUnit;
  /**
   * Readings by wake date, in natural degrees of `unit` (at most 2 decimal places,
   * e.g. -0.31). Deviation: Cel -5..5, [degF] -9..9. Absolute: Cel 25..40,
   * [degF] 77..104.
   */
  entries: TempEntry[];
}

/** Exact positive decimal medication dose in a UCUM unit. */
export interface MedDose {
  /**
   * Strictly positive decimal dose below 1,000,000,000, with at most 6 decimal
   * places (e.g. 400, 12.5).
   * @minimum 0.000001
   * @maximum 999999999.999999
   */
  value: number;
  /**
   * UCUM unit code (printable ASCII, no spaces, e.g. "mg", "ug", "mL", "[iU]").
   * @maxLength 64
   * @example "mg"
   */
  unit: string;
}

/** One medication entry on a date or timestamp. */
export interface MedEntry {
  /** When the medication was taken (or missed): calendar date or date with time and UTC offset. */
  date: DateTime;
  /** The product: a built-in keyword (`MedicationKind`) or any FHIR `CodeableConcept` as an escape. */
  code: MedicationKind | CodeableConcept;
  /** Whether it was taken. */
  status: MedStatus;
  /** Optional exact dose taken (maps to MedicationStatement.dosage[0].doseAndRate[0].doseQuantity). */
  dose?: MedDose;
}

/** A state over a range of calendar dates. */
export type Interval = BuiltinInterval | CodedInterval;

/** A built-in state over a range of calendar dates. */
export interface BuiltinInterval {
  /** Which state. */
  kind: IntervalKind;
  /** First calendar date. */
  start: CalendarDate;
  /** Last calendar date (inclusive), not before `start`. */
  end: CalendarDate;
}

/** Any other state: an observation code and a coded or text-only value, over a range of calendar dates. */
export interface CodedInterval {
  /**
   * What is observed (an Observation `CodeableConcept`), e.g. LOINC 8659-5 "Birth
   * control method". Not a built-in per-day series code and not an R4 vital-sign code.
   */
  code: CodeableConcept;
  /** The state, e.g. LOINC LA27913-5 (diaphragm or cervical cap) or a text-only concept. */
  value: CodeableConcept;
  /** First calendar date. */
  start: CalendarDate;
  /** Last calendar date (inclusive), not before `start`. */
  end: CalendarDate;
}

/** A completed procedure on a date or dateTime. */
export interface Procedure {
  /** When: YYYY, YYYY-MM, YYYY-MM-DD, or YYYY-MM-DDTHH:MM(:SS)?(Z|±HH:MM) (year 1900-2150). */
  date: FhirDateTime;
  /** Which procedure: a built-in keyword (`ProcedureKind`) or any FHIR `CodeableConcept`. */
  code: ProcedureKind | CodeableConcept;
}

/** A screening question answered on a date or timestamp. */
export interface Answer {
  /** When the person answered: calendar date or date with time and UTC offset. */
  date: DateTime;
  /** Which question. */
  question: Question;
  /**
   * The answer: for a coded question its built-in answer name or any FHIR
   * `CodeableConcept` as an escape; for a numeric question an integer in the
   * question's range. See `Question`.
   */
  value: string | number | CodeableConcept;
}

/** A series without a built-in slot. */
export type CustomSeries = CustomBooleanSeries | CustomCodedSeries | CustomQuantitySeries | CustomComponentsSeries;

/** Yes / no entries (also events: only `true`). */
export interface CustomBooleanSeries {
  /**
   * The Observation `CodeableConcept`. Not a built-in series code. An R4 vital-sign
   * code makes the series a vital sign (category vital-signs); a code with its own
   * R4 profile needs that profile's valueType and unit (`VITAL_SIGN_PROFILES`).
   */
  code: CodeableConcept;
  /** FHIR Observation value type: boolean (`Observation.valueBoolean`). */
  valueType: "boolean";
  /** Entries with boolean values (false is an explicit negative). */
  entries: ObservationEntry<boolean>[];
}

/** Coded or text-only entries: categorical, ordinal or multi-select alike (each entry is one fact). */
export interface CustomCodedSeries {
  /**
   * The Observation `CodeableConcept`. Not a built-in series code. An R4 vital-sign
   * code makes the series a vital sign (category vital-signs); a code with its own
   * R4 profile needs that profile's valueType and unit (`VITAL_SIGN_PROFILES`).
   */
  code: CodeableConcept;
  /** FHIR Observation value type: coded or text-only (`Observation.valueCodeableConcept`). */
  valueType: "coded";
  /**
   * Entries with FHIR `CodeableConcept` values (each one fact). Level order is not
   * carried, so displays or text should state the rank ("3 of 5").
   */
  entries: ObservationEntry<CodeableConcept>[];
}

/** Natural decimal quantity entries in a UCUM unit (at most 6 decimal places). */
export interface CustomQuantitySeries {
  /**
   * The Observation `CodeableConcept`. Not a built-in series code. An R4 vital-sign
   * code makes the series a vital sign (category vital-signs); a code with its own
   * R4 profile needs that profile's valueType and unit (`VITAL_SIGN_PROFILES`).
   */
  code: CodeableConcept;
  /** FHIR Observation value type: decimal quantity in UCUM `unit` (`Observation.valueQuantity`). */
  valueType: "quantity";
  /**
   * UCUM unit code (printable ASCII, no spaces).
   * @maxLength 64
   * @example "mg"
   * @example "{steps}"
   */
  unit: string;
  /**
   * Entries with natural decimal numbers below 1,000,000,000 in magnitude and at
   * most 6 decimal places. 0 is a value.
   * @minimum -999999999.999999
   * @maximum 999999999.999999
   */
  entries: ObservationEntry<number>[];
}

/**
 * A reading of several components, written as one Observation with a `component`
 * per recorded value and no top-level value (blood pressure: LOINC 85354-9 with
 * 8480-6 and 8462-4 in mm[Hg]). Nothing here is specific to blood pressure: any
 * code may have components.
 */
export interface CustomComponentsSeries {
  /**
   * The Observation `CodeableConcept`. Not a built-in series code. An R4 vital-sign
   * code makes the series a vital sign (category vital-signs); 85354-9 must be a
   * components series whose 8480-6 and 8462-4 components are quantities in mm[Hg].
   */
  code: CodeableConcept;
  /** FHIR Observation value type: multi-component reading with no top-level value (`Observation.component[]`). */
  valueType: "components";
  /**
   * The declared components, each with its own code and `valueType`. Codes differ.
   * Canonical order is the concepts' canonical order; a component never recorded
   * in any entry is dropped.
   * @maxItems 16
   */
  components: CustomComponent[];
  /** The readings, each carrying its date/time and at least one recorded component value. */
  entries: CustomComponentsEntry[];
}

/** One component of a `CustomComponentsSeries`: one value per reading (`boolean`, `coded`, or `quantity`). */
export type CustomComponent = CustomBooleanComponent | CustomCodedComponent | CustomQuantityComponent;

/** A yes / no component (`component.valueBoolean`). */
export interface CustomBooleanComponent {
  /** The component `CodeableConcept`. */
  code: CodeableConcept;
  /** FHIR Observation component value type: boolean (`component.valueBoolean`). */
  valueType: "boolean";
}

/** A coded or text-only component: one `CodeableConcept` per reading (`component.valueCodeableConcept`). */
export interface CustomCodedComponent {
  /** The component `CodeableConcept`. */
  code: CodeableConcept;
  /** FHIR Observation component value type: coded or text-only (`component.valueCodeableConcept`). */
  valueType: "coded";
}

/** A decimal quantity component in a UCUM unit (`component.valueQuantity`, at most 6 decimal places). */
export interface CustomQuantityComponent {
  /** The component `CodeableConcept`. */
  code: CodeableConcept;
  /** FHIR Observation component value type: decimal quantity in UCUM `unit` (`component.valueQuantity`). */
  valueType: "quantity";
  /**
   * UCUM unit code (printable ASCII, no spaces). In a vital-sign series, one of the
   * units the R4 vital-signs profile allows for components (`UCUM_VITALS_COMMON`).
   * @maxLength 64
   * @example "mm[Hg]"
   */
  unit: string;
}

/** One multi-component reading entry on a date or timestamp. */
export interface CustomComponentsEntry {
  /** When the reading was taken: calendar date or date with time and UTC offset. */
  date: DateTime;
  /**
   * Recorded component values (1..16). Each `code` must match a declared component
   * of the series, with no duplicate component code in one entry.
   * @maxItems 16
   */
  components: CustomComponentValue[];
}

/** One recorded component value inside a `CustomComponentsEntry`. */
export interface CustomComponentValue {
  /** The component `CodeableConcept` (must match one of `series.components`). */
  code: CodeableConcept;
  /** The component's value: boolean, `CodeableConcept`, or decimal number matching the component's `valueType`. */
  value: boolean | CodeableConcept | number;
}

/* ======================================================================== */
/* Enumerations                                                              */
/* ======================================================================== */

/** Menstrual bleeding on one day: the legal combinations of bleeding and flow. */
export type Bleeding =
  /** Explicitly no bleeding. */
  | "no-bleeding"
  /** Explicitly no bleeding, logged on a flow scale's "none" option. */
  | "flow-none"
  /** Bleeding, amount not recorded. */
  | "bleeding"
  /** Bleeding, flow category spotting (also bleeding between periods with no amount). */
  | "spotting"
  /** Bleeding, flow category light. */
  | "light"
  /** Bleeding, flow category moderate (medium). */
  | "moderate"
  /** Bleeding, flow category heavy. */
  | "heavy";

/** Cervical mucus, as self-observed. */
export type Mucus =
  /** No mucus; feels dry. */
  | "dry"
  /** Sticky, tacky or crumbly. */
  | "sticky"
  /** Creamy, lotion-like. */
  | "creamy"
  /** Watery, wet. */
  | "watery"
  /** Clear and stretchy, like raw egg white. */
  | "egg-white";

/** LH (ovulation) urine test result. */
export type OvulationTest =
  /** No surge detected. */
  | "negative"
  /** LH surge detected (a positive test). */
  | "lh-surge"
  /** Estrogen rise detected (high fertility on two-hormone tests). */
  | "estrogen-surge"
  /** The result could not be read. */
  | "indeterminate";

/** A urine test result (progesterone or pregnancy). */
export type TestResult =
  /** Negative. */
  | "negative"
  /** Positive. */
  | "positive"
  /** The result could not be read. */
  | "indeterminate";

/** Sexual intercourse on one day. */
export type Sex =
  /** Explicitly no intercourse. */
  | "none"
  /** Intercourse with protection (e.g. a condom). */
  | "protected"
  /** Intercourse without protection. */
  | "unprotected"
  /** Intercourse, protection not recorded. */
  | "unspecified";

/** Mood valence, 7 points (Apple HealthKit State of Mind). */
export type Mood =
  /** 1 of 7. */
  | "very-unpleasant"
  /** 2 of 7. */
  | "unpleasant"
  /** 3 of 7. */
  | "slightly-unpleasant"
  /** 4 of 7, neither pleasant nor unpleasant. */
  | "neutral"
  /** 5 of 7. */
  | "slightly-pleasant"
  /** 6 of 7. */
  | "pleasant"
  /** 7 of 7. */
  | "very-pleasant";

/** Energy, 4 points (Clue). */
export type Energy =
  /** 1 of 4. */
  | "exhausted"
  /** 2 of 4. */
  | "low"
  /** 3 of 4. */
  | "high"
  /** 4 of 4. */
  | "energized";

/** Contraceptive pill log for one day. */
export type PillLog =
  /** The pill was taken. */
  | "taken"
  /** The pill was missed (explicit negative). */
  | "missed";

/** Whether a medication was taken on a day. */
export type MedStatus =
  /** Taken. */
  | "taken"
  /** Explicitly not taken (a missed dose). */
  | "not-taken";

/** Temperature unit (UCUM). */
export type TemperatureUnit =
  /** Degrees Celsius. */
  | "Cel"
  /** Degrees Fahrenheit. */
  | "[degF]";

/** What a wearable temperature value means. */
export type SkinTempKind =
  /** Difference from the device's own baseline (Oura, Fitbit, Garmin); signed. */
  | "deviation"
  /** Absolute nightly skin or wrist temperature (Apple Watch, Google, Whoop). */
  | "absolute";

/** Built-in states over a range of days. Contraception values are LOINC answers to 8659-5. */
export type IntervalKind =
  /** Not using contraception (explicit negative). @code http://loinc.org|LA137-2 */
  | "none"
  /** Combined oral contraceptive pill. @code http://loinc.org|LA27908-5 */
  | "combined-pill"
  /** Progestin-only pill. @code http://loinc.org|LA27909-3 */
  | "progestin-pill"
  /** Contraceptive patch. @code http://loinc.org|LA16581-3 */
  | "patch"
  /** Vaginal ring. @code http://loinc.org|LA27911-9 */
  | "ring"
  /** Injectable contraceptive. @code http://loinc.org|LA27907-7 */
  | "injection"
  /** Contraceptive implant. @code http://loinc.org|LA27901-0 */
  | "implant"
  /** Hormonal (progestin) IUD. @code http://loinc.org|LA27902-8 */
  | "hormonal-iud"
  /** Copper IUD. @code http://loinc.org|LA27903-6 */
  | "copper-iud"
  /** IUD, type not recorded. @code http://loinc.org|LA27904-4 */
  | "iud-unspecified"
  /** Male condom. @code http://loinc.org|LA27912-7 */
  | "condom"
  /** Fertility awareness-based method. @code http://loinc.org|LA27918-4 */
  | "fertility-awareness"
  /** Lactational amenorrhea method. @code http://loinc.org|LA27919-2 */
  | "lactational-amenorrhea"
  /** Pregnant (LOINC 82810-3). @code http://loinc.org|LA15173-0 */
  | "pregnant"
  /** Breastfeeding (LOINC 63895-7). @code http://loinc.org|LA29252-6 */
  | "breastfeeding";

/** Built-in procedures (SNOMED CT). */
export type ProcedureKind =
  /** Insertion of an intrauterine device. @code 65200003 */
  | "iud-insertion"
  /** Removal of an intrauterine device. @code 1263416007 */
  | "iud-removal"
  /** Insertion of a contraceptive implant. @code 169553002 */
  | "implant-insertion"
  /** Removal of a contraceptive implant. @code 301807007 */
  | "implant-removal"
  /** Emergency contraception taken. @code 1372819003 */
  | "emergency-contraception"
  /** Hysterectomy: afterwards absent bleeding is not amenorrhea or menopause. @code 236886002 */
  | "hysterectomy"
  /** Endometrial ablation: afterwards little or no bleeding is expected. @code 265060005 */
  | "endometrial-ablation"
  /** Oophorectomy (one ovary or unspecified). @code 83152002 */
  | "oophorectomy"
  /** Bilateral oophorectomy: surgical menopause. @code 76876009 */
  | "bilateral-oophorectomy"
  /** Myomectomy (fibroid removal). @code 42010004 */
  | "myomectomy"
  /** Dilation and curettage. @code 11401008 */
  | "d-and-c"
  /** Endometrial polypectomy. @code 236884004 */
  | "polypectomy"
  /** Uterine artery embolization. @code 312138002 */
  | "uterine-artery-embolization";

/** A reported condition's status, as the person states it. */
export type ConditionStatus =
  /** The person has it now. */
  | "active"
  /** The person had it and it is over (explicit negative for now). */
  | "resolved";

/* ======================================================================== */
/* Screening questions                                                       */
/* ======================================================================== */

/**
 * Screening questions (LOINC). A coded question's `value` is one of its answer
 * names (or any `CodeableConcept` as an escape); a numeric question's `value` is an integer.
 */
export type Question =
  /** Usual cycle length over the last year. Answer: `UsualCycleLength`. @code http://loinc.org|64700-8 */
  | "usual-cycle-length"
  /** Number of periods per year. Answer: integer 0-100 (unit /a). @code http://loinc.org|92656-8 @minimum 0 @maximum 100 */
  | "periods-per-year"
  /** Periods missed over the past 3 months. Answer: integer 0-3. @code http://loinc.org|65930-0 @minimum 0 @maximum 3 */
  | "missed-periods-3-months"
  /** Had a period within the last year. Answer: `YesNo`. @code http://loinc.org|63889-0 */
  | "period-in-last-year"
  /** Periods stopped permanently. Answer: `PeriodsStopped`. @code http://loinc.org|64701-6 */
  | "periods-stopped"
  /** Age in years when periods stopped. Answer: integer 0-100. @code http://loinc.org|64702-4 @minimum 0 @maximum 100 */
  | "age-periods-stopped"
  /** Age in years at the first period. Answer: integer 0-100. @code http://loinc.org|63888-2 @minimum 0 @maximum 100 */
  | "age-at-menarche";

/** Answers to "usual-cycle-length". */
export type UsualCycleLength =
  /** Less than 21 days. @code http://loinc.org|LA14649-0 */
  | "<21"
  /** 21-25 days. @code http://loinc.org|LA14650-8 */
  | "21-25"
  /** 26-32 days. @code http://loinc.org|LA14651-6 */
  | "26-32"
  /** 33-35 days. @code http://loinc.org|LA14652-4 */
  | "33-35"
  /** 36-90 days. @code http://loinc.org|LA14653-2 */
  | "36-90"
  /** More than 90 days. @code http://loinc.org|LA14654-0 */
  | ">90"
  /** Too variable to say. @code http://loinc.org|LA14655-7 */
  | "too-variable"
  /** Don't know. @code http://loinc.org|LA12688-0 */
  | "dont-know";

/** Answers to "period-in-last-year". */
export type YesNo =
  /** Yes. @code http://loinc.org|LA33-6 */
  | "yes"
  /** No (explicit negative). @code http://loinc.org|LA32-8 */
  | "no";

/** Answers to "periods-stopped". */
export type PeriodsStopped =
  /** Yes, no menstrual periods. @code http://loinc.org|LA14656-5 */
  | "yes-no-periods"
  /** Yes, but has periods now due to female hormones. @code http://loinc.org|LA14657-3 */
  | "yes-hormones"
  /** No. @code http://loinc.org|LA32-8 */
  | "no"
  /** Not sure. @code http://loinc.org|LA12693-0 */
  | "not-sure";

/* ======================================================================== */
/* Built-in concept enums (readable keywords expanding to SNOMED / cycle-log) */
/* ======================================================================== */

/**
 * Built-in symptom keywords (SNOMED CT, plus `hot-flash` in `cycle-log`).
 * The first 14 are the starter set of the Period Tracking guide the design started from.
 * Any other symptom is passed as a FHIR `CodeableConcept`.
 */
export type SymptomKind =
  /** Menstrual cramp. @code 431416001 */
  | "menstrual-cramp"
  /** Backache. @code 161891005 */
  | "backache"
  /** Headache. @code 25064002 */
  | "headache"
  /** Migraine. @code 37796009 */
  | "migraine"
  /** Stomach ache. @code 271681002 */
  | "stomach-ache"
  /** Nausea. @code 422587007 */
  | "nausea"
  /** Breast tenderness. @code 55222007 */
  | "breast-tenderness"
  /** Ovulation pain. @code 43548008 */
  | "ovulation-pain"
  /** Fatigue. @code 84229001 */
  | "fatigue"
  /** Abdominal bloating. @code 116289008 */
  | "bloating"
  /** Depressed mood. @code 366979004 */
  | "depressed-mood"
  /** Feeling irritable. @code 55929007 */
  | "irritable"
  /** Stress. @code 73595000 */
  | "stress"
  /** Dyspareunia. @code 71315007 */
  | "dyspareunia"
  /** Acne. @code 11381005 */
  | "acne"
  /** Pain in pelvis. @code 30473006 */
  | "pelvic-pain"
  /** Low back pain. @code 279039007 */
  | "low-back-pain"
  /** Pain of breast. @code 53430007 */
  | "breast-pain"
  /** Mood swings. @code 18963009 */
  | "mood-swings"
  /** Anxiety. @code 48694002 */
  | "anxiety"
  /** Diarrhea. @code 62315008 */
  | "diarrhea"
  /** Constipation. @code 14760008 */
  | "constipation"
  /** Dizziness. @code 404640003 */
  | "dizziness"
  /** Craving for food or drink. @code 248132003 */
  | "food-craving"
  /** Passing clots vaginally. @code 289532003 */
  | "vaginal-clots"
  /** Hot flash (cause not stated); a proposed code. @code https://joshuamandel.com/shc2-poc/CodeSystem/cycle-log|hot-flash */
  | "hot-flash"
  /** Night sweats. @code 42984000 */
  | "night-sweats"
  /** Insomnia. @code 193462001 */
  | "insomnia"
  /** Vaginal dryness. @code 31908003 */
  | "vaginal-dryness"
  /** Palpitations. @code 80313002 */
  | "palpitations"
  /** Urinary incontinence. @code 165232002 */
  | "urinary-incontinence"
  /** Memory lapses. @code 225038006 */
  | "memory-lapses"
  /** Alopecia (hair loss). @code 56317004 */
  | "hair-loss"
  /** Increased libido. @code 58436003 */
  | "increased-libido"
  /** Reduced libido. @code 8357008 */
  | "reduced-libido";

/**
 * Built-in medication keywords (SNOMED CT medicinal products). Any other product
 * (RxNorm, SNOMED CT, text-only, ...) is passed as a FHIR `CodeableConcept`.
 */
export type MedicationKind =
  /** Ibuprofen-containing product. @code 38268001 */
  | "ibuprofen"
  /** Naproxen-containing product. @code 11847009 */
  | "naproxen"
  /** Acetaminophen-containing product. @code 90332006 */
  | "acetaminophen"
  /** Mefenamic acid-containing product. @code 34364009 */
  | "mefenamic-acid"
  /** Tranexamic acid-containing product. @code 109006003 */
  | "tranexamic-acid"
  /** Iron-containing product. @code 30729008 */
  | "iron"
  /** Folic acid-containing product. @code 6247001 */
  | "folic-acid";

/**
 * Built-in condition keywords (SNOMED CT), pending clinical review: the main
 * explanations of a bleeding pattern. Any other condition is passed as a FHIR
 * `CodeableConcept`.
 */
export type ConditionKind =
  /** Polycystic ovary syndrome. @code 237055002 */
  | "pcos"
  /** Uterine leiomyoma (fibroids). @code 95315005 */
  | "uterine-fibroids"
  /** Uterine adenomyosis. @code 784314006 */
  | "adenomyosis"
  /** Endometrial polyp. @code 1237359009 */
  | "endometrial-polyp"
  /** Endometriosis. @code 129103003 */
  | "endometriosis"
  /** von Willebrand disorder. @code 128105004 */
  | "von-willebrand-disorder"
  /** Blood coagulation disorder. @code 64779008 */
  | "coagulation-disorder"
  /** Iron deficiency anemia. @code 87522002 */
  | "iron-deficiency-anemia"
  /** Hypothyroidism. @code 40930008 */
  | "hypothyroidism"
  /** Hyperthyroidism. @code 34486009 */
  | "hyperthyroidism"
  /** Hyperprolactinemia. @code 237662005 */
  | "hyperprolactinemia"
  /** Premature ovarian insufficiency. @code 237788002 */
  | "premature-ovarian-insufficiency"
  /** Hypothalamic amenorrhea. @code 237120002 */
  | "hypothalamic-amenorrhea"
  /** Perimenopausal state. @code 161541000119104 */
  | "perimenopause"
  /** Postmenopausal state. @code 76498008 */
  | "postmenopause";
minimal-teaching.model.json Three months of bleeding days, explained line by line starter example
{
  "bleeding": [
    { "date": "2026-01-05", "value": "moderate" },
    { "date": "2026-01-06", "value": "heavy" },
    { "date": "2026-01-07", "value": "moderate" },
    { "date": "2026-01-08", "value": "light" },
    { "date": "2026-01-09", "value": "spotting" },
    { "date": "2026-02-02", "value": "light" },
    { "date": "2026-02-03", "value": "heavy" },
    { "date": "2026-02-04", "value": "moderate" },
    { "date": "2026-02-05", "value": "light" },
    { "date": "2026-02-06", "value": "spotting" },
    { "date": "2026-03-03", "value": "moderate" },
    { "date": "2026-03-04", "value": "heavy" },
    { "date": "2026-03-05", "value": "moderate" },
    { "date": "2026-03-06", "value": "light" },
    { "date": "2026-03-07", "value": "spotting" }
  ]
}

Three periods of bleeding days and nothing else: a complete, valid cycle-log model. JSON has no comments, so each line of minimal-teaching.model.json is explained here.

linemeaning
{The model is one JSON object. Every field is optional and defined in model.d.ts (normative) and model.schema.json.
"bleeding": [Array of menstrual bleeding entries ({ date, value }), each dated by a FHIR DateTime (YYYY-MM-DD or with time and UTC offset). Every other field (pain, symptoms, mood, ...) is absent, which means not recorded.
{ "date": "2026-01-05", "value": "moderate" },First day of the first period (Monday 5 January 2026): moderate flow.
{ "date": "2026-01-06", "value": "heavy" },Day 2 of the first period: heavy flow.
{ "date": "2026-01-07", "value": "moderate" },Day 3: moderate flow.
{ "date": "2026-01-08", "value": "light" },Day 4: light flow.
{ "date": "2026-01-09", "value": "spotting" },Day 5: spotting. Days between 2026-01-10 and 2026-02-01 are omitted, which means nothing was logged — not "no bleeding". An explicit "I was not bleeding" would be "no-bleeding".
{ "date": "2026-02-02", "value": "light" },First day of the second period (28 days after the first): light flow.
{ "date": "2026-02-03", "value": "heavy" },Day 2 of the second period: heavy flow.
{ "date": "2026-02-04", "value": "moderate" },Day 3: moderate flow.
{ "date": "2026-02-05", "value": "light" },Day 4: light flow.
{ "date": "2026-02-06", "value": "spotting" },Day 5: spotting.
{ "date": "2026-03-03", "value": "moderate" },First day of the third period (29 days after the second): moderate flow.
{ "date": "2026-03-04", "value": "heavy" },Day 2 of the third period: heavy flow.
{ "date": "2026-03-05", "value": "moderate" },Day 3: moderate flow.
{ "date": "2026-03-06", "value": "light" },Day 4: light flow.
{ "date": "2026-03-07", "value": "spotting" }Day 5: spotting.
]Closes the "bleeding" array.
}Closes the root object. Nothing else is needed.

The codec accepts this file as it is (validateJson reports no problems, and it satisfies the schema). To say more, add fields from the field reference. For example:

  • "pain": [{ "date": "2026-01-05", "value": 3 }, { "date": "2026-01-06", "value": 6 }, { "date": "2026-01-07", "value": 2 }] gives pain scores for three days (0 = explicit "no pain").
  • "intervals": [{ "kind": "combined-pill", "start": "2026-01-05", "end": "2026-04-04" }] records a contraception state across a range of dates.
  • "exportedAt": "2026-04-05T09:00-05:00" records when the card was exported (mapped to FHIR Bundle.timestamp).