# loganthp/spaceml architecture

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

- Interactive diagram: https://gitdiagram.com/loganthp/spaceml
- Repository: https://github.com/loganthp/spaceml

## Overview

Space ML Mission Control is a web application for running machine-learning workflows on real space data, examining results, and exporting reviewed evidence. The principal flow is dashboard request → API run handling → background inference → persisted run/result → human review. Separate domain branches cover telemetry, exoplanets, Mars, missions, space weather, and user-supplied workbench data. README descriptions establish capabilities whose implementation was not sampled; edges are limited to those descriptions or shown references, so some internal domain wiring is omitted.

Main entry points: [`backend/app/worker.py`](https://github.com/loganthp/spaceml/blob/main/backend/app/worker.py) (Background worker), [`frontend/src/main.tsx`](https://github.com/loganthp/spaceml/blob/main/frontend/src/main.tsx) (Dashboard routes), [`frontend/src/lib/api.ts`](https://github.com/loganthp/spaceml/blob/main/frontend/src/lib/api.ts) (API client), [`backend/spaceml/mars/data.py`](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/mars/data.py) (Mars data access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web dashboard"]
  node_frontend["Dashboard routes<br/>[main.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_ui["Shared UI<br/>[ui.tsx]"]
  node_capabilities["Runtime capabilities<br/>[capabilities.tsx]"]
  node_mission_workspace["Mission workspace"]
  node_review_ui["Review Studio<br/>[ReviewStudio.tsx]"]
end

subgraph group_runtime["API and runtime"]
  node_api["FastAPI application<br/>[main.py]"]
  node_handlers["Run handlers<br/>[handlers.py]"]
  node_worker["Background worker<br/>[worker.py]"]
  node_progress["Progress reporting<br/>[progress.py]"]
end

subgraph group_science["Science workflows"]
  node_telemetry["Telemetry ML"]
  node_exoplanet["Exoplanet search"]
  node_mars["Mars segmentation<br/>[infer.py]"]
  node_mars_data["Mars data access<br/>[data.py]"]
  node_mars_local["Validated Mars pairs<br/>[local.py]"]
  node_mars_traverse["Rover traverse<br/>[traverse.py]"]
  node_missions["Mission workflows"]
  node_spaceweather["Space weather data<br/>[data.py]"]
  node_space_forecast["Space weather forecasts<br/>[forecast.py]"]
  node_workbench["Workbench analyses<br/>[analyses.py]"]
end

subgraph group_review["Results and review"]
  node_reviews[("Review records<br/>[reviews.py]")]
end

subgraph group_state["Data and state"]
  node_db[("Run database<br/>[db.py]")]
  node_config["Shared configuration<br/>[config.py]"]
  node_mission_store[("Mission model store<br/>[store.py]")]
  node_workbench_store[("Workbench storage<br/>[store.py]")]
  node_fetch["Data fetching<br/>[fetch.py]"]
  node_runs["Run results<br/>[worker.py]"]
end

node_user(("Researcher"))

node_user -->|"uses"| node_frontend
node_frontend -->|"requests"| node_api_client
node_frontend -->|"renders"| node_ui
node_frontend -->|"checks access"| node_capabilities
node_mission_workspace -->|"requests"| node_api_client
node_review_ui -->|"updates reviews"| node_api_client
node_api_client -.->|"calls"| node_api
node_api -->|"dispatches runs"| node_worker
node_worker -->|"executes"| node_handlers
node_worker -->|"updates run rows"| node_db
node_worker -->|"writes results"| node_runs
node_worker -->|"runs inference"| node_telemetry
node_worker -->|"runs inference"| node_exoplanet
node_worker -->|"runs inference"| node_mars
node_handlers -->|"loads samples"| node_mars_data
node_handlers -->|"loads rover images"| node_mars_traverse
node_mars -->|"uses data access"| node_mars_data
node_mars_local -.->|"prepares pairs"| node_mars_data
node_worker -.->|"runs workflows"| node_missions
node_worker -->|"loads mission models"| node_mission_store
node_worker -->|"runs analyses"| node_workbench
node_workbench -->|"uses storage"| node_workbench_store
node_space_forecast -.->|"uses observations"| node_spaceweather
node_spaceweather -->|"fetches data"| node_fetch
node_mars_data -->|"reports progress"| node_progress
node_worker -->|"reads settings"| node_config
node_review_ui -->|"saves verdicts"| node_reviews
node_reviews -->|"stores reviews"| node_db
node_runs -.->|"provides evidence"| node_review_ui

click node_frontend "https://github.com/loganthp/spaceml/blob/main/frontend/src/main.tsx"
click node_api_client "https://github.com/loganthp/spaceml/blob/main/frontend/src/lib/api.ts"
click node_ui "https://github.com/loganthp/spaceml/blob/main/frontend/src/components/ui.tsx"
click node_capabilities "https://github.com/loganthp/spaceml/blob/main/frontend/src/lib/capabilities.tsx"
click node_mission_workspace "https://github.com/loganthp/spaceml/blob/main/frontend/src/components/missions/MissionWorkspace.tsx"
click node_review_ui "https://github.com/loganthp/spaceml/blob/main/frontend/src/pages/ReviewStudio.tsx"
click node_api "https://github.com/loganthp/spaceml/blob/main/backend/app/main.py"
click node_handlers "https://github.com/loganthp/spaceml/blob/main/backend/app/handlers.py"
click node_worker "https://github.com/loganthp/spaceml/blob/main/backend/app/worker.py"
click node_db "https://github.com/loganthp/spaceml/blob/main/backend/app/db.py"
click node_config "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/config.py"
click node_telemetry "https://github.com/loganthp/spaceml/tree/main/backend/spaceml/telemetry"
click node_exoplanet "https://github.com/loganthp/spaceml/tree/main/backend/spaceml/exoplanet"
click node_mars "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/mars/infer.py"
click node_mars_data "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/mars/data.py"
click node_mars_local "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/mars/local.py"
click node_mars_traverse "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/mars/traverse.py"
click node_missions "https://github.com/loganthp/spaceml/tree/main/backend/spaceml/missions"
click node_mission_store "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/missions/store.py"
click node_spaceweather "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/spaceweather/data.py"
click node_space_forecast "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/spaceweather/forecast.py"
click node_workbench "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/workbench/analyses.py"
click node_workbench_store "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/workbench/store.py"
click node_fetch "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/common/fetch.py"
click node_progress "https://github.com/loganthp/spaceml/blob/main/backend/spaceml/common/progress.py"
click node_runs "https://github.com/loganthp/spaceml/blob/main/backend/app/worker.py"
click node_reviews "https://github.com/loganthp/spaceml/blob/main/backend/app/routers/reviews.py"

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_frontend,node_api_client,node_ui,node_capabilities,node_mission_workspace,node_review_ui toneBlue
class node_api,node_handlers,node_worker,node_progress toneAmber
class node_telemetry,node_exoplanet,node_mars,node_mars_data,node_mars_local,node_mars_traverse,node_missions,node_spaceweather,node_space_forecast,node_workbench toneMint
class node_reviews toneRose
class node_db,node_config,node_mission_store,node_workbench_store,node_fetch,node_runs,node_user toneIndigo
```

## Components

### Web dashboard

- [Dashboard routes](https://github.com/loganthp/spaceml/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [API client](https://github.com/loganthp/spaceml/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Shared UI](https://github.com/loganthp/spaceml/blob/main/frontend/src/components/ui.tsx): `frontend/src/components/ui.tsx`
- [Runtime capabilities](https://github.com/loganthp/spaceml/blob/main/frontend/src/lib/capabilities.tsx): `frontend/src/lib/capabilities.tsx`
- [Mission workspace](https://github.com/loganthp/spaceml/blob/main/frontend/src/components/missions/MissionWorkspace.tsx): `frontend/src/components/missions/MissionWorkspace.tsx`
- [Review Studio](https://github.com/loganthp/spaceml/blob/main/frontend/src/pages/ReviewStudio.tsx): `frontend/src/pages/ReviewStudio.tsx`

### API and runtime

- [FastAPI application](https://github.com/loganthp/spaceml/blob/main/backend/app/main.py): `backend/app/main.py`
- [Run handlers](https://github.com/loganthp/spaceml/blob/main/backend/app/handlers.py): `backend/app/handlers.py`
- [Background worker](https://github.com/loganthp/spaceml/blob/main/backend/app/worker.py): `backend/app/worker.py`
- [Progress reporting](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/common/progress.py): `backend/spaceml/common/progress.py`

### Science workflows

- [Telemetry ML](https://github.com/loganthp/spaceml/tree/main/backend/spaceml/telemetry): `backend/spaceml/telemetry`
- [Exoplanet search](https://github.com/loganthp/spaceml/tree/main/backend/spaceml/exoplanet): `backend/spaceml/exoplanet`
- [Mars segmentation](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/mars/infer.py): `backend/spaceml/mars/infer.py`
- [Mars data access](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/mars/data.py): `backend/spaceml/mars/data.py`
- [Validated Mars pairs](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/mars/local.py): `backend/spaceml/mars/local.py`
- [Rover traverse](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/mars/traverse.py): `backend/spaceml/mars/traverse.py`
- [Mission workflows](https://github.com/loganthp/spaceml/tree/main/backend/spaceml/missions): `backend/spaceml/missions`
- [Space weather data](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/spaceweather/data.py): `backend/spaceml/spaceweather/data.py`
- [Space weather forecasts](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/spaceweather/forecast.py): `backend/spaceml/spaceweather/forecast.py`
- [Workbench analyses](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/workbench/analyses.py): `backend/spaceml/workbench/analyses.py`

### Results and review

- [Review records](https://github.com/loganthp/spaceml/blob/main/backend/app/routers/reviews.py): `backend/app/routers/reviews.py`

### Data and state

- [Run database](https://github.com/loganthp/spaceml/blob/main/backend/app/db.py): `backend/app/db.py`
- [Shared configuration](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/config.py): `backend/spaceml/config.py`
- [Mission model store](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/missions/store.py): `backend/spaceml/missions/store.py`
- [Workbench storage](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/workbench/store.py): `backend/spaceml/workbench/store.py`
- [Data fetching](https://github.com/loganthp/spaceml/blob/main/backend/spaceml/common/fetch.py): `backend/spaceml/common/fetch.py`
- [Run results](https://github.com/loganthp/spaceml/blob/main/backend/app/worker.py): `backend/app/worker.py`

### Other components

- **Researcher**

## Connections

- Researcher → Dashboard routes: uses (evidence: `README.md`)
- Dashboard routes → API client: requests (evidence: `frontend/src/main.tsx`)
- Dashboard routes → Shared UI: renders (evidence: `frontend/src/main.tsx`)
- Dashboard routes → Runtime capabilities: checks access (evidence: `frontend/src/main.tsx`)
- Mission workspace → API client: requests (evidence: `frontend/src/components/missions/MissionWorkspace.tsx`)
- Review Studio → API client: updates reviews (evidence: `frontend/src/pages/ReviewStudio.tsx`)
- API client → FastAPI application: calls
- FastAPI application → Background worker: dispatches runs
- Background worker → Run handlers: executes (evidence: `backend/app/worker.py`)
- Background worker → Run database: updates run rows (evidence: `backend/app/worker.py`)
- Background worker → Run results: writes results (evidence: `backend/app/worker.py`)
- Background worker → Telemetry ML: runs inference (evidence: `backend/app/handlers.py`)
- Background worker → Exoplanet search: runs inference (evidence: `backend/app/handlers.py`)
- Background worker → Mars segmentation: runs inference (evidence: `backend/app/handlers.py`)
- Run handlers → Mars data access: loads samples (evidence: `backend/app/handlers.py`)
- Run handlers → Rover traverse: loads rover images (evidence: `backend/app/handlers.py`)
- Mars segmentation → Mars data access: uses data access (evidence: `backend/spaceml/mars/infer.py`)
- Validated Mars pairs → Mars data access: prepares pairs (evidence: `backend/spaceml/mars/local.py`)
- Background worker → Mission workflows: runs workflows (evidence: `backend/app/worker.py`)
- Background worker → Mission model store: loads mission models (evidence: `backend/app/worker.py`)
- Background worker → Workbench analyses: runs analyses (evidence: `backend/app/worker.py`)
- Workbench analyses → Workbench storage: uses storage (evidence: `backend/spaceml/workbench/analyses.py`)
- Space weather forecasts → Space weather data: uses observations
- Space weather data → Data fetching: fetches data (evidence: `backend/spaceml/spaceweather/data.py`)
- Mars data access → Progress reporting: reports progress (evidence: `backend/spaceml/mars/data.py`)
- Background worker → Shared configuration: reads settings (evidence: `backend/app/worker.py`)
- Review Studio → Review records: saves verdicts (evidence: `frontend/src/pages/ReviewStudio.tsx`)
- Review records → Run database: stores reviews (evidence: `backend/app/routers/reviews.py`)
- Run results → Review Studio: provides evidence
