# leoduarte2005/astrovital architecture

> Architecture diagram of the GitHub repository leoduarte2005/astrovital, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/leoduarte2005/astrovital
- Repository: https://github.com/leoduarte2005/astrovital

## Overview

AstroVital is an offline crew-health monitoring system: ESP32 mesh nodes capture Wi-Fi CSI and optional I²C readings; a Go central service receives and buffers them, exchanges windows with a Python edge-AI worker, and serves results to the React interface. The AI extracts features, runs inference, adapts per-crew baselines, and correlates symptoms with clinical knowledge. The interface presents crew health through vitals, a 3D twin, clinical chat, guided self-exam, and games. The graph follows documented README flows and sampled module references; unsampled internals are represented only at supported subsystem paths.

Main entry points: [`edge-ai/src/edgespace_ai/ipc/handlers.py`](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/ipc/handlers.py) (AI dispatcher), [`central/internal/httpws/server.go`](https://github.com/leoduarte2005/astrovital/blob/main/central/internal/httpws/server.go) (HTTP and WebSocket), [`central/internal/pipeline/pipeline.go`](https://github.com/leoduarte2005/astrovital/blob/main/central/internal/pipeline/pipeline.go) (CSI pipeline), [`edge-ai/src/edgespace_ai/correlation/correlator.py`](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/correlation/correlator.py) (Clinical correlation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_field["Sensor mesh"]
  node_firmware["ESP32 firmware<br/>[app_main.c]"]
  node_capture["CSI capture<br/>[csi_capture.c]"]
  node_tdm["TDM sync<br/>[tdm_sync.c]"]
  node_i2c["I²C sensors<br/>[i2c_sensors.c]"]
  node_udp_tx["UDP transport<br/>[udp_transport.c]"]
end

subgraph group_central["Central service"]
  node_central_app["Central wiring<br/>[wiring.go]"]
  node_udp_rx["UDP receiver<br/>[receiver.go]"]
  node_cluster["Cluster manager<br/>[manager.go]"]
  node_pipeline["CSI pipeline<br/>[pipeline.go]"]
  node_ipc["IPC client<br/>[ipc.go]"]
  node_store[("Local health store<br/>[store.go]")]
  node_httpws["HTTP and WebSocket<br/>[server.go]"]
end

subgraph group_ai["Edge intelligence"]
  node_ai_server["AI IPC server<br/>[server.py]"]
  node_dispatch["AI dispatcher<br/>[handlers.py]"]
  node_dsp["CSI feature pipeline"]
  node_inference["ONNX inference<br/>[session_manager.py]"]
  node_baseline[("Crew adaptation")]
end

subgraph group_clinical["Clinical knowledge"]
  node_clinical["Clinical correlation<br/>[correlator.py]"]
  node_symptoms["Symptom extraction"]
  node_causal["Causal knowledge<br/>[causal_graph.py]"]
end

subgraph group_ui["Crew interface"]
  node_tactical_ui["Crew health panel<br/>[VitalsPanel.tsx]"]
  node_twin["3D digital twin<br/>[TwinCanvas.tsx]"]
  node_chat["Clinical chat<br/>[ChatDrawer.tsx]"]
  node_self_exam["Self-exam games<br/>[catalog.ts]"]
  node_training["Crew training<br/>[TrainingScene.tsx]"]
end

node_crew(("Crew member"))

node_crew -.->|"views health"| node_tactical_ui
node_capture -.->|"sweeps links"| node_tdm
node_tdm -.->|"sends CSI"| node_udp_tx
node_i2c -.->|"sends readings"| node_udp_tx
node_udp_tx -.->|"transmits frames"| node_udp_rx
node_udp_rx -.->|"decodes and tracks"| node_cluster
node_cluster -.->|"routes CSI"| node_pipeline
node_pipeline -.->|"persists data"| node_store
node_pipeline -.->|"sends windows"| node_ipc
node_ipc -.->|"exchanges frames"| node_ai_server
node_ai_server -->|"dispatches messages"| node_dispatch
node_dispatch -->|"processes CSI"| node_dsp
node_dispatch -->|"runs models"| node_inference
node_dispatch -->|"uses crew baseline"| node_baseline
node_dispatch -->|"correlates reports"| node_clinical
node_clinical -->|"extracts symptoms"| node_symptoms
node_clinical -->|"assesses causes"| node_causal
node_dispatch -.->|"returns telemetry"| node_httpws
node_httpws -.->|"serves health data"| node_tactical_ui
node_httpws -.->|"updates twin"| node_twin
node_httpws -.->|"serves chat"| node_chat
node_crew -.->|"reports symptoms"| node_chat
node_crew -.->|"uses self-exam"| node_self_exam
node_crew -.->|"practices training"| node_training

click node_firmware "https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/app_main.c"
click node_capture "https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/csi_capture.c"
click node_tdm "https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/tdm_sync.c"
click node_i2c "https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/i2c_sensors.c"
click node_udp_tx "https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/udp_transport.c"
click node_central_app "https://github.com/leoduarte2005/astrovital/blob/main/central/cmd/edgespace-central/wiring.go"
click node_udp_rx "https://github.com/leoduarte2005/astrovital/blob/main/central/internal/udp/receiver.go"
click node_cluster "https://github.com/leoduarte2005/astrovital/blob/main/central/internal/cluster/manager.go"
click node_pipeline "https://github.com/leoduarte2005/astrovital/blob/main/central/internal/pipeline/pipeline.go"
click node_ipc "https://github.com/leoduarte2005/astrovital/blob/main/central/internal/ipc/ipc.go"
click node_store "https://github.com/leoduarte2005/astrovital/blob/main/central/internal/store/store.go"
click node_httpws "https://github.com/leoduarte2005/astrovital/blob/main/central/internal/httpws/server.go"
click node_ai_server "https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/ipc/server.py"
click node_dispatch "https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/ipc/handlers.py"
click node_dsp "https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/dsp/feature_extractor.py"
click node_inference "https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/inference/session_manager.py"
click node_baseline "https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/adaptation/baseline_registry.py"
click node_clinical "https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/correlation/correlator.py"
click node_symptoms "https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/correlation/symptom_extractor.py"
click node_causal "https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/correlation/causal_graph.py"
click node_tactical_ui "https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/vitals/VitalsPanel.tsx"
click node_twin "https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/twin3d/TwinCanvas.tsx"
click node_chat "https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/chat/ChatDrawer.tsx"
click node_self_exam "https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/games/catalog.ts"
click node_training "https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/training/TrainingScene.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_firmware,node_capture,node_tdm,node_i2c,node_udp_tx toneBlue
class node_central_app,node_udp_rx,node_cluster,node_pipeline,node_ipc,node_store,node_httpws toneAmber
class node_ai_server,node_dispatch,node_dsp,node_inference,node_baseline toneMint
class node_clinical,node_symptoms,node_causal toneRose
class node_tactical_ui,node_twin,node_chat,node_self_exam,node_training,node_crew toneIndigo
```

## Components

### Sensor mesh

- [ESP32 firmware](https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/app_main.c): `firmware/main/app_main.c`
- [CSI capture](https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/csi_capture.c): `firmware/main/csi_capture.c`
- [TDM sync](https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/tdm_sync.c): `firmware/main/tdm_sync.c`
- [I²C sensors](https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/i2c_sensors.c): `firmware/main/i2c_sensors.c`
- [UDP transport](https://github.com/leoduarte2005/astrovital/blob/main/firmware/main/udp_transport.c): `firmware/main/udp_transport.c`

### Central service

- [Central wiring](https://github.com/leoduarte2005/astrovital/blob/main/central/cmd/edgespace-central/wiring.go): `central/cmd/edgespace-central/wiring.go`
- [UDP receiver](https://github.com/leoduarte2005/astrovital/blob/main/central/internal/udp/receiver.go): `central/internal/udp/receiver.go`
- [Cluster manager](https://github.com/leoduarte2005/astrovital/blob/main/central/internal/cluster/manager.go): `central/internal/cluster/manager.go`
- [CSI pipeline](https://github.com/leoduarte2005/astrovital/blob/main/central/internal/pipeline/pipeline.go): `central/internal/pipeline/pipeline.go`
- [IPC client](https://github.com/leoduarte2005/astrovital/blob/main/central/internal/ipc/ipc.go): `central/internal/ipc/ipc.go`
- [Local health store](https://github.com/leoduarte2005/astrovital/blob/main/central/internal/store/store.go): `central/internal/store/store.go`
- [HTTP and WebSocket](https://github.com/leoduarte2005/astrovital/blob/main/central/internal/httpws/server.go): `central/internal/httpws/server.go`

### Edge intelligence

- [AI IPC server](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/ipc/server.py): `edge-ai/src/edgespace_ai/ipc/server.py`
- [AI dispatcher](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/ipc/handlers.py): `edge-ai/src/edgespace_ai/ipc/handlers.py`
- [CSI feature pipeline](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/dsp/feature_extractor.py): `edge-ai/src/edgespace_ai/dsp/feature_extractor.py`
- [ONNX inference](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/inference/session_manager.py): `edge-ai/src/edgespace_ai/inference/session_manager.py`
- [Crew adaptation](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/adaptation/baseline_registry.py): `edge-ai/src/edgespace_ai/adaptation/baseline_registry.py`

### Clinical knowledge

- [Clinical correlation](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/correlation/correlator.py): `edge-ai/src/edgespace_ai/correlation/correlator.py`
- [Symptom extraction](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/correlation/symptom_extractor.py): `edge-ai/src/edgespace_ai/correlation/symptom_extractor.py`
- [Causal knowledge](https://github.com/leoduarte2005/astrovital/blob/main/edge-ai/src/edgespace_ai/correlation/causal_graph.py): `edge-ai/src/edgespace_ai/correlation/causal_graph.py`

### Crew interface

- [Crew health panel](https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/vitals/VitalsPanel.tsx): `frontend/src/features/vitals/VitalsPanel.tsx`
- [3D digital twin](https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/twin3d/TwinCanvas.tsx): `frontend/src/features/twin3d/TwinCanvas.tsx`
- [Clinical chat](https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/chat/ChatDrawer.tsx): `frontend/src/features/chat/ChatDrawer.tsx`
- [Self-exam games](https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/games/catalog.ts): `frontend/src/features/games/catalog.ts`
- [Crew training](https://github.com/leoduarte2005/astrovital/blob/main/frontend/src/features/training/TrainingScene.tsx): `frontend/src/features/training/TrainingScene.tsx`

### Other components

- **Crew member**

## Connections

- Crew member → Crew health panel: views health (evidence: `README.md`)
- CSI capture → TDM sync: sweeps links (evidence: `README.md`)
- TDM sync → UDP transport: sends CSI (evidence: `README.md`)
- I²C sensors → UDP transport: sends readings (evidence: `README.md`)
- UDP transport → UDP receiver: transmits frames (evidence: `README.md`)
- UDP receiver → Cluster manager: decodes and tracks (evidence: `README.md`)
- Cluster manager → CSI pipeline: routes CSI (evidence: `README.md`)
- CSI pipeline → Local health store: persists data (evidence: `README.md`)
- CSI pipeline → IPC client: sends windows (evidence: `README.md`)
- IPC client → AI IPC server: exchanges frames (evidence: `README.md`)
- AI IPC server → AI dispatcher: dispatches messages (evidence: `edge-ai/src/edgespace_ai/ipc/server.py`)
- AI dispatcher → CSI feature pipeline: processes CSI (evidence: `edge-ai/src/edgespace_ai/ipc/handlers.py`)
- AI dispatcher → ONNX inference: runs models (evidence: `edge-ai/src/edgespace_ai/ipc/handlers.py`)
- AI dispatcher → Crew adaptation: uses crew baseline (evidence: `edge-ai/src/edgespace_ai/ipc/handlers.py`)
- AI dispatcher → Clinical correlation: correlates reports (evidence: `edge-ai/src/edgespace_ai/ipc/handlers.py`)
- Clinical correlation → Symptom extraction: extracts symptoms (evidence: `edge-ai/src/edgespace_ai/correlation/correlator.py`)
- Clinical correlation → Causal knowledge: assesses causes (evidence: `edge-ai/src/edgespace_ai/correlation/correlator.py`)
- AI dispatcher → HTTP and WebSocket: returns telemetry (evidence: `README.md`)
- HTTP and WebSocket → Crew health panel: serves health data (evidence: `README.md`)
- HTTP and WebSocket → 3D digital twin: updates twin (evidence: `README.md`)
- HTTP and WebSocket → Clinical chat: serves chat (evidence: `README.md`)
- Crew member → Clinical chat: reports symptoms (evidence: `README.md`)
- Crew member → Self-exam games: uses self-exam (evidence: `README.md`)
- Crew member → Crew training: practices training (evidence: `README.md`)
