Skip to content
StatusImplementedVerified on

Data Model & Contracts ​

The single source of truth for the data contracts of the Astronaut Health Intelligence Platform (AHI) is frontend/web/src/types/domain.ts, shared by the engine, the store and every UI feature. It follows section 6 of PROJECT_MASTER.md. The list of metric codes, units and regions is in the Data dictionary.

Additive changes only

domain.ts is a shared contract. Add new optional fields or new union members; never rename or remove fields that other modules use. TypeScript enum is not allowed (erasableSyntaxOnly), so enumerations are string unions.

HealthObservation (canonical model) ​

One record per measurement. Vitals, cabin readings (subject_id: "CABIN"), lab results and self report all use the same shape.

json
{
  "observation_id": "uuid or an idempotent key from the source",
  "subject_id": "AST-01",
  "mission_id": "MISSION-001",
  "device_id": "DEV-BIO-AST-01",
  "metric_code": "HEART_RATE",
  "value": 72.4,
  "unit": "bpm",
  "measured_at": "2026-11-13T14:30:00Z",
  "received_at": "2026-11-13T14:30:02Z",
  "data_origin": "SIMULATED",
  "source_reference": {
    "repository": null,
    "dataset_accession": null,
    "file_name": null,
    "record_reference": null
  },
  "quality": { "status": "VALID", "confidence": 1.0, "is_estimated": false },
  "context": { "mission_phase": "IN_FLIGHT", "activity": "REST" },
  "metadata": {}
}
FieldRequiredTypeRules
observation_idyesstringUnique. Use an idempotent key from the source to deduplicate
subject_idyesstringPseudonym (AST-01...), or "CABIN" for the environment
mission_idrecommendedstringMission or study
device_idrecommendedstringLogical device or instrument
metric_codeyesMetricCodeOne of the codes in the Data dictionary
valueyesnumber or nullnull when missing, never zero
unityesstringCanonical unit after normalization
measured_atyesISO 8601 UTCAlways UTC
received_atrecommendedISO 8601 UTCIngestion time
data_originyesDataOriginREAL_PUBLIC, DERIVED, SIMULATED or MANUAL
source_referenceyes if importedobjectRepository, accession, file and record
quality.statusyesQualityStatusVALID, QUESTIONABLE, INVALID, MISSING
quality.confidencerecommended0 to 1Lower for estimated or doubtful values
quality.is_estimatedrecommendedbooleantrue for derived or interpolated values
context.mission_phaserecommendedMissionPhasePRE_FLIGHT, IN_FLIGHT, POST_FLIGHT
context.activityrecommendedActivityContextSLEEP, REST, WORK, EXERCISE, EVA
metadataoptionalobjectOriginal value and unit, time point label, population type

Rules from the spec: store timestamps in UTC, normalize units without deleting the original value, never replace a missing value with zero, record quality and source for every imported record, and deduplicate by observation_id.

Entities ​

EntityPurposeKey fields
AstronautPseudonymized crew memberid (AST-01), callsign, role, roleShort, age, sex, missionDay, color
MissionMission and phaseid, name, vehicle, phase, startedAt, commDelaySec (one way)
DeviceLogical device and its stateid, kind, name, assignedTo, state, batteryPct, signalPct, lastSeenAt, data_origin, metrics, detail
MetricStateLatest state of one metric for one subjectcurrent, status, zScore, ewma, trendPerHour, baseline, quality, driftZ, deviationPct, persistenceHours, baselineContext, contextBaselines, ruleId, explanation
BaselinePersonal normal for one metricstatus (READY or INSUFFICIENT_DATA), n, median, mad, mean, sd, p05, p95, low, high, windowLabel, version
AnomalyA detected deviationmetric, detectedAt, method (ROBUST_Z, EWMA, PERSISTENCE, COMBINED, DATA_QUALITY), severity, explanation
RiskAssessmentAttention level of one astronautrisk_level, risk_score (0 to 100), contributing_factors, triggered_rules, confidence, model_version, evaluated_at, data_window, limitations, headline
PredictionShort term forecast of one metricmethod, horizonHours, points (t, v, lo, hi), intervalLabel, hoursToBandExit, eligible, disclaimer
RecommendationNon-prescriptive next stepruleId, title, rationale, priority, audience, region, requiresHumanReview, status, interventionKind, active, catalogVersion, autonomy
InterventionAn action logged by a personkind, recommendationId, loggedAt, actor, note
AlertNotification with acknowledgementseverity, title, detail, region, metric, ruleId, createdAt, acknowledgedAt, acknowledgedBy, resolvedAt, escalatedAt, escalationLevel
AuditEventAudit trail entryat, actor, action, detail
CheckInDaily subjective check-inmood, fatigue, stress, sleepQuality (1 to 5), symptoms, note, data_origin
CommMessageMessage between vehicle and Earthdirection, kind, title, body, sentAt, arrivesAt, status, relatedRecommendationId, relatedAlertId, data_origin
MissionDaySummaryOne mission day for the long term viewmissionDay, date, sleepHours, exerciseMinutes, exercisePlannedMinutes, restingHr, hrv, radiationDoseMgy, cumulativeDoseMgy, riskLevel, exerciseLoadPct, synthesized
MissionPlanLong term budgets (demo configuration)plannedDurationDays, radiationBudgetMgy, exercisePlanMinutesPerDay, sleepTargetHours, note
StatusFrameSnapshot for the timeline, every 15 sim minutest, levels (astronaut id or CABIN to status)
InterventionComparisonWhat-if resultmetric, kind, horizonHours, without, with, band, assumptions, disclaimer
DatasetRecordProvenance of a real public datasetsource_name, source_url, dataset_accession, dataset_version, title, downloaded_at, license, access_classification, file_name, sha256, parser_version, study_population, mission, study_design, collection_phase, notes, data_origin

Other shared types: RegionState (status and summary per body region), AstronautHealth (activity, metrics, regions, risk, predictions), EnvironmentState (cabin metrics, status, forecasts, headline), ScenarioDefinition, SimulationClock, CommProfile, EngineEvaluation, and the store contract AppState / AppStateV2.

Enumerations ​

TypeValuesNotes
DataOriginREAL_PUBLIC, DERIVED, SIMULATED, MANUALRequired on every record. See Data origins
QualityStatusVALID, QUESTIONABLE, INVALID, MISSINGQuestionable data is capped at MODERATE
RiskLevelLOW, MODERATE, HIGH, CRITICALOperational attention level, not a medical classification
StatusRiskLevel plus NO_DATANO_DATA covers stale data and offline devices
MissionPhasePRE_FLIGHT, IN_FLIGHT, POST_FLIGHT
ActivityContextSLEEP, REST, WORK, EXERCISE, EVABaselines use SLEEP, REST, WORK, EXERCISE. Context comes from the schedule today
DeviceKindBIO_MONITOR, ACTIGRAPHY, BP_MONITOR, EXERCISE_CEVIS, EXERCISE_ARED, EXERCISE_T2, ENV_SENSOR, DOSIMETER
DeviceStateONLINE, DEGRADED, DATA_STALE, OFFLINEDegraded values are QUESTIONABLE
BodyRegionIdbrain, heart, lungs, kidneys, muscles, bones, skinPlus environment for cabin metrics
InterventionKindREST_PROTOCOL, SLEEP_EXTENSION, HYDRATION, EXERCISE_ADJUSTMENT, SENSOR_CHECK, CABIN_VENTILATION, MEDICAL_CONSULT
Recommendation.audienceCREW, FLIGHT_SURGEON, MISSION_CONTROL
Recommendation.autonomyONBOARD, GROUND_REVIEWWho can close the loop
AuditEvent.actionALERT_ACK, INTERVENTION_LOGGED, SCENARIO_CHANGED, RULE_EVALUATED, RECOMMENDATION_UPDATED, ALERT_ESCALATED, COMM_SENT, COMM_RECEIVED, COMM_PROFILE_CHANGED, CHECKIN_RECORDED
CommProfileIdISS, MOON, MARS_NEAR, MARS_FAR
CommMessage.kindHEALTH_PACKET, CONSULT_REQUEST, GROUND_REPLY, HANDOVER_REPORTDirection DOWNLINK (to Earth) or UPLINK (to the vehicle)
ScenarioIdNOMINAL, PROGRESSIVE_FATIGUE, ENVIRONMENTAL_CO2, PERFORMANCE_DECLINE, SENSOR_FAILURE, ACUTE_CARDIOSee Demo scenarios

Anatomy to health mapping ​

The 3D atlas has 250 anatomical structures; the platform monitors seven body regions. One file, src/features/anatomy/atlas/health.ts, decides which region a structure reports under. It is the only place that links anatomy to health data: it reuses BodyRegionId and the metric catalog and adds no data of its own. This table is the canonical copy of that mapping.

Structures (rule)RegionRelated metrics (from the catalog)In the atlasHow to read it
Integumentary system: skinskinSKIN_TEMPERATURE1One surface reading from the smart shirt. It is not a map of the whole skin
Skeletal system: bones and cartilagebonesRADIATION_DOSE39Accumulated dose is whole body exposure, shown as long term bone health context. No device measures bone density
Skeletal system: teeth (tissue tooth)nonenone2Context only
Muscular system: muscles and tendonsmusclesACTIVITY_LEVEL, EXERCISE_LOAD133Activity and exercise performance describe the muscles as a whole. They are not measurements of the selected muscle
Cardiovascular system: heart, arteries, veinsheartHEART_RATE, HRV_RMSSD, SYSTOLIC_BP, DIASTOLIC_BP29They describe the heart and circulation as a whole, not one vessel
Respiratory system: lungs, airways, larynx, diaphragmlungsSPO2, RESPIRATORY_RATE6They describe breathing and gas exchange as a whole
Nervous system: brain structures only (cortex, deep structures of the cerebrum, cerebellum, brainstem)brainSLEEP_DURATION, SLEEP_EFFICIENCY, REACTION_TIME, MOOD, PERCEIVED_FATIGUE, STRESS4Related indicators of alertness and recovery. They are behavioral and self reported signals, never neurological measurements
Nervous system: spinal cord and nervesnonenone13Context only
Urinary system: kidneys (tissue kidney)kidneysHYDRATION2Hydration index estimated from fluid intake logs. A related indicator, not a measurement of kidney function
Urinary system: ureters and bladdernonenone2Context only
Digestive system; other organs (glands, thymus, spleen, eyes)nonenone19Context only

Rules of the mapping:

  • Related indicators, not measurements. A metric belongs to a region, never to one structure. The structure panel says so in plain words for every region (REGION_RELATION), so an indicator is never read as a measurement of the selected structure, and never as a diagnosis.
  • Context only means no device or metric of the prototype relates to the structure. It can be explored, but it never shows a health status, not even "All good": no status is shown because nothing is measured, which is not the same as normal.
  • Metrics always come from the catalog. relatedMetrics() returns the codes whose region in METRIC_CATALOG matches; the mapping file never lists or invents indicators. Metric definitions: Data dictionary.
  • Missing data is never normal. A monitored structure whose astronaut has no health state yet is NO_DATA.
  • The manifest holds anatomy only. The asset pipeline never encodes monitoring rules, so the atlas can be rebuilt without touching health logic.

Main functions (all pure TypeScript, unit tested in health.test.ts):

FunctionReturns
regionOfStructure(s)The BodyRegionId a structure reports under, or null when it is context only
isContextOnly(s)true when nothing monitors the structure
relatedMetrics(s), metricsOfRegion(region)Catalog metric codes of the region
structureStatus(health, s)Status of the structure's region, NO_DATA when health is missing, null when context only
primaryStructureOfRegion(manifest, region)The organ a region is named after (camera target); null for muscles and bones on purpose
selectStructureHealth(state, astronautId, s)Everything the panel shows: region, status, summary, metrics, missing metrics, active alerts and recent statistical flags
regionAlerts(...), regionAnomalies(...)Active alerts (most severe first) and anomalies (newest first) of one astronaut in one region

Selection contract ​

The app store keeps one selection that every panel and the 3D viewer share. The structure fields are additive (marked "Additive (v3, anatomical atlas)" in domain.ts).

State or actionBehavior
selectedStructureId (string or null)Id of the structure selected in the 3D viewer. null when only a region, or nothing, is selected
selectStructure(id, region?)Sets the structure and its region in one update and clears the selected metric. For a context only structure the region is null. selectStructure(null) clears structure, region and metric
selectRegion(region)Selects the whole region and clears the structure (a body system chip always means the whole region)
selectAstronaut(id)Clears structure, region and metric
selectMetric(metric)Keeps the structure and the region
  • The viewer calls selectStructure(id, regionOfStructure(structure)), so a structure and its region can never disagree.
  • Alerts, factors and vitals use focusTarget() (src/features/shared/hooks.ts): it selects the region and clears a structure of another region, but keeps a structure of the same region and only opens the metric.
  • Esc and the Overview button clear the selection (clearSelection()).
  • A clock tick never touches the selection.

Covered by src/state/selection.test.ts (13 tests).

Contracts between modules ​

ContractRule
domain.tsAdditive changes only: new optional fields or new union members; never rename or remove a used field
Device adapterid, kind, name, assignedTo, metrics, read(simNow) returning HealthObservation[], optional readEvents(from, to), status(simNow) (Extending)
Engine to storeEngineEvaluation slices with a version per slice; unchanged slices keep their references
Store to UIAppState / AppStateV2 (state plus actions), including the selection contract
Asset pipeline to viewerAtlasManifest in public/anatomy/manifest.json (Manifest contract)
Anatomy to healthatlas/health.ts only (Anatomy to health mapping)
ExportFHIR R4 Bundle (collection) with Patient, Device, Observation (FHIR export)

The planned REST API that would expose the same entities is described in Target architecture.

Next steps ​

Astronaut Health Intelligence Platform. Decision support only: not a diagnosis and not a medical device. Device data is simulated.