Skip to content
StatusConceptualVerified on

Target Architecture ​

Partly implemented

This page is the design target from the product spec (PROJECT_MASTER.md, sections 7 and 10). Part of it now exists in the AHI API: the modular monolith, ingestion, observations, registry, NASA connectors, SQLite or PostgreSQL with Alembic, Docker Compose. Still conceptual: the engine services on the server, background jobs, Redis, authentication and role based access. The running system is described in Architecture overview.

The Astronaut Health Intelligence Platform (AHI) was built browser first so the hackathon demo is reliable offline, and its contracts (canonical HealthObservation, device adapter interface, data_origin, versioned rules) were chosen so that the server could be added without changing the engine rules or the UI. That is how the backend was added.

Architectural decision ​

Modular monolith with asynchronous processing (spec section 7.1): one deployable backend with clear internal modules, background jobs for imports and analytics, and no microservices, Kafka or Kubernetes in the MVP. A language model must not be the core of any clinical decision.

Context ​

Conceptual (not implemented). Adapted from the product spec, section 7.3.

Components ​

Conceptual (not implemented). Adapted from the product spec, section 7.4.

LayerTechnologyStatus
FrontendReact + TypeScript + Vite, Tailwind CSS, RechartsImplemented (without shadcn/ui)
Backend APIPython + FastAPI, Pydantic schemasImplemented Backend and API
ORM and migrationsSQLAlchemy + AlembicImplemented
DatabasePostgreSQL, TimescaleDB optionalImplemented PostgreSQL 17 with Docker Compose, SQLite by default; no TimescaleDB
Cache and jobsRedis; Celery, RQ or an asyncio workerPlanned (in process 15 min cache for NASA data only)
Data sciencepandas, NumPy, SciPyImplemented NumPy only, for the analytics endpoint
ML and explainabilityscikit-learn, XGBoost, SHAPExperimental scikit-learn Isolation Forest; XGBoost and SHAP not implemented (AI and analytics)
Testspytest, httpx, PlaywrightImplemented pytest with mocked HTTP; vitest for the engine
ObservabilityOpenTelemetry, structured logsImplemented structured request logs; Planned OpenTelemetry
DeploymentDocker ComposeImplemented docker-compose.yml (PostgreSQL and the API)

Processing flow ​

Partly implemented: ingestion, validation and persistence exist; the server side engine job does not. Adapted from the product spec, section 7.5.

API of the spec (section 10) ​

Base URL http://localhost:8000/api/v1.

MethodEndpointPurposeStatus
POST/observationsIngest a batch of observationsImplemented
GET/observationsQuery observations of one subjectImplemented
POST/datasets/importCreate an import jobPlanned
GET/datasets, /data-sourcesList imported datasets and sourcesPlanned
POST, GET/astronauts, /missions, /devicesPseudonymized registryImplemented
GET/astronauts/{id}/health, /history, /baseline, /anomalies, /risks, /predictions, /recommendationsPer astronaut viewsPlanned (needs the Python engine)
POST/alerts/{id}/acknowledgeAcknowledge an alertPlanned
POST/interventionsLog an interventionPlanned
POST/scenarios/{scenario_id}/runRun a simulationPlanned
GET/devices/{id}/statusDevice statusPlanned
GET/health, /health/ready, /health/liveStatus, readiness and livenessImplemented

POST /observations answers 202 Accepted with accepted_count, rejected_count and the batch data_origin. The batch format is shown in Pipeline, normalization and quality.

Role based access ​

Planned Roles match the personas: crew member, crew medical officer, flight surgeon, Mission Control, researcher and admin or data engineer. Each role sees only what it needs (Use cases and stakeholders).

What carries over from the prototype ​

TodayIn the target
HealthObservation in domain.tsPydantic schema with the same fields
DeviceAdapter (read(), status())Python adapters (connect, disconnect, read_observations, normalize, get_device_status)
Engine modules (baseline, anomaly, risk, forecast, recommendations, alerts)Backend services with the same rules and versions; the seam (HealthEngine protocol) already exists in backend/app/modules/engine
In-memory auditPersistent audit table
FHIR R4 export in the browserSame export, server side when needed; FHIR stays an exchange format, not a sensor protocol

Next steps ​

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