Interactive analysis of NASA's human spaceflight risk DAGs with a FastAPI backend and a React + Cytoscape frontend. The app merges 29 risk graphs, computes structural metrics and DRM-aware rankings, and presents them in a searchable, filterable UI.
backend/- FastAPI service (graph parsing/merging, centrality and scoring endpoints).frontend/- React + Vite client for visualization and ranking exploration.data/- All required inputs (*.dag,NODE definition.json,LC score.csv).START_BACKEND.bat/START_FRONTEND.bat- Convenience launchers for Windows.requirements.txt- Backend Python dependencies (installed into a virtual environment).
- Python 3.10+ with
pip - Node.js 18+ with
npm - Windows users can rely on the
.batfiles; macOS/Linux users can follow the manual steps below.
START_BACKEND.bat- Creates
backend/venvif missing. - Installs
requirements.txt. - Runs
backend/test_startup.pyto confirm imports and data presence indata/. - Starts Uvicorn on
http://localhost:8000.
- Creates
- In a new terminal,
START_FRONTEND.bat- Installs
frontenddependencies (ifnode_modulesis absent). - Starts Vite dev server on
http://localhost:5173with API pointed tolocalhost:8000.
- Installs
Backend:
cd backend
python -m venv venv
source venv/bin/activate
pip install -r ../requirements.txt
cd src
uvicorn main:app --reload --host 0.0.0.0 --port 8000Frontend:
cd frontend
npm install
npm run dev -- --hostConfigure the API base (if not default) via frontend/.env (VITE_API_BASE=https://human-space-flight-risk-network.onrender.com by default in the example).
All required inputs live in data/:
*.dag- 29 risk DAGs in GraphViz format.NODE definition.json- Node definitions and notes.LC score.csv- Likelihood x Consequence scores used for DRM-aware ranking.
The backend loads directly from repo_root/data at startup; no database setup is needed.
- Framework: FastAPI + Uvicorn.
- Key modules: DAG parsing/merging (
graph/), LxC parsing (data/), metrics and scoring (metrics/), CSV export helpers (utils/export.py). - Primary endpoints:
/api/graph,/api/risks,/api/drms,/api/centrality,/api/score,/api/top10,/api/export/*. - Recommended runtime: Python 3.11 (Render config pins
pythonVersion: 3.11.7to avoid pandas build issues on 3.13).
- Stack: React 18, TypeScript, Vite, Cytoscape.js, Axios.
- Entry points:
frontend/src/App.tsxwith supporting components underfrontend/src/components/. - Expects the API base URL from
VITE_API_BASE(defaults tohttps://human-space-flight-risk-network.onrender.comin.env.example). - GitHub Pages ready:
npm run deployfromfrontend/builds todist/and publishes to thegh-pagesbranch (Vitebaseis set to/Human-Space-Flight-Risk-Network/andhomepageis configured).
- Push this repo (including
data/) to GitHub. - In Render, create a New Web Service from the repo; it will read
render.yaml.- Build command:
pip install -r requirements.txt - Start command:
cd backend/src && uvicorn main:app --host 0.0.0.0 --port $PORT - Plan: Free (service may sleep when idle).
- Build command:
- After deploy, note the public URL (e.g.,
https://human-space-flight-risk-network.onrender.com). - Set
VITE_API_BASEinfrontend/.envto that URL (the example already matches), then fromfrontend/runnpm run deployto republish GitHub Pages so the static site calls the hosted backend.
- Temporary environments are ignored via
.gitignore(backend/venv,frontend/node_modules, caches, etc.). - No additional documentation is required beyond this README; data artifacts are all in
data/.