Skip to content
StatusImplementedVerified on

Frontend & State ​

The user interface of the Astronaut Health Intelligence Platform (AHI) is a single page React 19 application in frontend/web/src, built with Vite 8 and styled with Tailwind CSS v4.

App shell ​

src/app/App.tsx starts the ticker, registers global shortcuts and the critical alert sound, and renders one of two views over the same live state:

ViewLayoutFor
Ground viewTop bar; crew rail, center stage (headline and 3D body), attention panel; status timeline; vitals stripFlight surgeon and Mission Control
Crew viewOne astronaut, big status word, top two actions, check-in, "Your body vs your normal"The astronaut

The reading order of the Ground view is deliberate: who (crew) > what (body and headline) > why and what to do (attention panel) > when (timeline) > live values (vitals). Overlays (alerts drawer, shortcuts help, guided tour) sit on top of either view. A "Skip to what needs attention" link is the first focusable element.

Feature modules ​

FolderContent
features/topbarIdentity, SIMULATED chip and provenance popover, scenario player, Earth link control, tools menu, priority collapse on narrow widths
features/crewCrew rail cards
features/stageCenter stage: headline, body system chips, lazy 3D viewer
features/anatomy3D body: atlas viewer, health mapping, procedural fallback (3D anatomy)
features/attentionOverall status, recommended actions, autonomy badges, factors, forecasts, region detail, structure detail, alerts and flags per body system
features/sharedShared hooks and selection helpers (focusTarget, clearSelection, useSelectedStructure)
features/timelineStatus lanes and event markers
features/vitalsLive vitals, cabin, devices indicator
features/alertsAlerts drawer, banner support, optional chime
features/commsEarth link messages and delay phrases (shown in the Earth link tab of the Mission and Earth link panel)
features/checkinDaily check-in dialog
features/crewviewCrew view
features/missionMission overview
features/reportShift handover report and FHIR export button
features/whatifWhat-if comparison
features/datasourcesData and model dialog (real datasets, simulated devices, model card, data origins)
features/tour10 step guided demo
features/labDevelopment only lab page with fake state
components/Shared pieces: trend chart, sparkline, risk gauge, status, metric value, baseline info, formatting
lib/status.ts (status colors and labels), fhir.ts (FHIR R4 export)

State ​

Two zustand stores keep domain state and UI preferences apart.

App store (src/state/store.ts) ​

Implements the AppState contract of src/types/domain.ts (plus the additive v2 slices). It owns one HealthEngine.

Slice groupContent
Referencemission, crew, devices, scenarios, commProfiles, missionPlan
Clockclock (scenarioId, running, speed, simNow, startedAt)
Analyticshealth (per astronaut: metrics, regions, risk, predictions), environment, history, anomalies, alerts, recommendations, interventions, audit
v2comms, checkIns, missionDays, statusTimeline, commProfileId
SelectionselectedAstronautId, selectedRegion, selectedMetric, selectedStructureId with selectAstronaut, selectRegion, selectMetric, selectStructure (selection contract)
ActionssetScenario, play, pause, setSpeed, reset, acknowledgeAlert, logIntervention, dismissRecommendation, fastForward, setCommProfile, sendToGround, submitCheckIn, compareIntervention

Publishing model. A ticker (startTicker(), every 100 ms real time) advances the sim clock. Analytics are re-evaluated at most every 250 ms real time, and only slices whose engine version changed get new object references. Components subscribe with narrow selectors and re-render only when their own data changes. Details: Engine and simulation.

UI store (src/app/uiStore.ts) ​

View mode (Ground or Crew), presentation mode, alert sound preference, alerts drawer and shortcuts help visibility, critical banners hidden by the user, and guided tour state. View, presentation and sound persist in localStorage; if storage is unavailable, preferences simply do not persist.

Rendering decisions ​

DecisionWhy
Slice versioning plus narrow selectorsA publication every 250 ms does not re-render the whole tree
3D scene reads vitals from the store without subscribingAnimation every frame with zero React renders
Floating 3D labels are plain DOM positioned by a projectorCrisp text, no per frame React work
Lazy chunks for the 3D viewer, Data and model dialog and OSDR panelsFaster first paint
The 3D atlas is one file per anatomical system, fetched on demand and cached for the sessionThe default view downloads about 3 MB; switching astronaut never reloads geometry
The right panel has three levels: structure, body region, overviewA structure selected in the 3D body reuses the region detail, so the data is shown one way only
fastForward(simMs)The guided demo jumps the simulation synchronously (for example to sim hour 48 of the fatigue scenario)

Layout modes ​

Pure CSS (no JavaScript) screen modes defined in src/index.css:

ModeWhenWhat changes
ShortDesktop width with a viewport height up to 820 px (for example 1280x720)Timeline becomes a slim ribbon that expands on hover or focus, vitals drop sparklines, crew cards become compact rows
DefaultTypical laptop and desktopFull layout
Roomy1680x1000 and largerWider attention panel, taller timeline, an extra crew vital, all forecasts expanded
PresentationP or Tools menuText floor of 13 px, larger type, secondary details hidden

Visual language, colors and accessibility measures: Design system and accessibility.

Status ​

Implemented Covered by store.test.ts (v2 slices published, references stable when unchanged, actions wired) and selection.test.ts (structure, region and metric selection). UI components have no automated tests yet; end to end tests are planned.

Next steps ​

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