/** * 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[]; /** * 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[]; /** * 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[]; /** * 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[]; /** 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[]; /** LH (ovulation) test result entries. Omitted dates: not recorded. Explicit negative: "negative". */ ovulationTest?: ObservationEntry[]; /** Progesterone (PdG) urine test result entries. Omitted dates: not recorded. Explicit negative: "negative". */ progesteroneTest?: ObservationEntry[]; /** Pregnancy test result entries. Omitted dates: not recorded. Explicit negative: "negative". */ pregnancyTest?: ObservationEntry[]; /** Sexual intercourse entries. Omitted dates: not recorded. Explicit negative: "none". */ sex?: ObservationEntry[]; /** 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[]; /** Energy entries on a 4-point scale. Omitted dates: not recorded. */ energy?: ObservationEntry[]; /** * 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[]; /** * Contraceptive pill log entries. Which pill is named by the contraception * interval covering the date. Omitted dates: not recorded. Explicit negative: * "missed". */ pill?: ObservationEntry[]; /** * 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 { /** 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 | 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[]; } /** 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[]; } /** 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[]; } /** * 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";