This repository contains two main parts:
- Backend: A FastAPI service that generates a synthetic landmine‐risk map for Ukraine, partitions it among partners, and caches the result as a PNG.
- Frontend: A React application (Vite + Tailwind via CDN) providing role‑based dashboards for:
- Operator
- Team Lead
- NGO / Partner
- Government / UN
- Node.js & npm (v16+)
- Python 3.8+
- pip (or conda / venv) for Python packages
- Git for code branching
tum-science-hack25/ # Project root (Git repo)
├── backend/ # FastAPI + Python map generator
│ ├── ua.json # Ukraine GeoJSON boundary
│ ├── map_generator.py # Risk map logic
│ └── server.py # FastAPI app (caches map PNG)
├── src/ # React app
│ ├── pages/ # Role-based page components
│ │ ├── Login.jsx
│ │ ├── OperatorHome.jsx
│ │ ├── OperatorTasks.jsx
│ │ ├── OperatorIncidents.jsx
│ │ ├── TeamLeadHome.jsx
│ │ ├── TeamLeadAssignments.jsx
│ │ ├── TeamLeadIncidents.jsx
│ │ ├── NgoHome.jsx
│ │ ├── NgoOperations.jsx
│ │ ├── NgoReports.jsx
│ │ ├── GovOverview.jsx
│ │ ├── GovRegional.jsx
│ │ └── GovDownload.jsx
│ ├── App.jsx # Main app with login & tabs
│ ├── main.jsx # React entry point
│ └── index.html # HTML template (includes Tailwind CDN)
├── package.json # Frontend dependencies & scripts
├── vite.config.js # Vite config (optional)
└── README.md # This file
Work on a separate branch for the React frontend and avoid disturbing main
:
git checkout -b react-frontend
# make your changes, then:
git add .
git commit -m "Initial React frontend MVP"
git pull --rebase origin react-frontend
# resolve any conflicts, then:
git push -u origin react-frontend
If the remote already has commits,
git pull --rebase origin react-frontend
brings them in before pushing.
- Open a new terminal and navigate to the backend directory:
cd tum-science-hack25/backend
- (Recommended) Create & activate a Python virtual environment:
python -m venv .venv source .venv/bin/activate # Linux/macOS .\.venv\\Scripts\\activate # Windows
- Install dependencies:
pip install fastapi uvicorn geopandas shapely rtree matplotlib openpyxl fpdf
- Start the FastAPI server (map is generated & cached at startup):
You should see a message with the PNG endpoint:
uvicorn server:app --reload --port 8000
🗺️ Risk map ready at -> http://localhost:8000/risk-map/png
- Open another terminal at the project root:
cd tum-science-hack25
- Install npm dependencies:
npm install react-chartjs-2 chart.js jspdf leaflet
- Start the development server:
npm run dev
- Open your browser to:
http://localhost:5173
- Login: On the React app, select your role, enter any non-empty username/password, and click Sign In.
- Navigate: Use the tabs to switch between pages for your role.
- Generate Risk Map: In Government / UN → Overview, click Generate Risk Map to fetch the cached PNG instantly.
- Map PNG:
http://localhost:8000/risk-map/png
Fetches the precomputed risk map as a PNG image.
- The map generation runs only once at backend startup for speed (cached).
- Tailwind CSS is loaded via CDN in
index.html
, so no extra build step for CSS. - To adjust resolution or partner shares, modify
map_generator.py
in the backend.
Happy hacking and good luck at the TUM Science Hackathon! 🚀