# srey5/drone-risk architecture

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

- Interactive diagram: https://gitdiagram.com/srey5/drone-risk
- Repository: https://github.com/srey5/drone-risk

## Overview

This is a Streamlit UAS ground-risk analyzer and flight planner. Operators configure a drone and wind, place start/end markers, and request a risk map and risk-weighted route. The app delegates risk-grid generation and pathfinding to the engine, then renders the results on the map. A planned route can also be sent to the simulation API for telemetry and a summary; mission context can be sent to the Gemini co-pilot. The README documents live building ingestion, rasterization, GPU-accelerated risk convolution, and multi-objective A*. Simulation internals and some UI wiring are only partially sampled, so uncertain links are omitted.

Main entry points: [`app/main.py`](https://github.com/srey5/drone-risk/blob/main/app/main.py) (Mission Planner UI), [`core/engine/interface.py`](https://github.com/srey5/drone-risk/blob/main/core/engine/interface.py) (Risk and Path Interface), [`sim_api/main.py`](https://github.com/srey5/drone-risk/blob/main/sim_api/main.py) (Simulation API), [`sim_api/omni_runner.py`](https://github.com/srey5/drone-risk/blob/main/sim_api/omni_runner.py) (Flight Simulation Runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mission_ui["Mission UI"]
  node_streamlit_app["Mission Planner UI<br/>[main.py]"]
  node_map_view["Map and Overlays<br/>[main.py]"]
end

subgraph group_risk_engine["Risk and Routing"]
  node_risk_interface["Risk and Path Interface<br/>[interface.py]"]
  node_building_ingestion["Building Data Raster<br/>[interface.py]"]
  node_risk_kernel["Risk Convolution Kernel<br/>[physics.py]"]
  node_astar["Weighted A*<br/>[pathfinding.py]"]
end

subgraph group_simulation["Flight Simulation"]
  node_simulation_api["Simulation API<br/>[main.py]"]
  node_flight_runner["Flight Simulation Runner<br/>[omni_runner.py]"]
end

subgraph group_copilot["Mission Co-pilot"]
  node_copilot_module["Co-pilot Context and Client<br/>[gemini_copilot.py]"]
end

node_operator(("Operator"))
node_osm[("OpenStreetMap Buildings")]
node_isaac_lab["Isaac Lab"]
node_gemini["Gemini API"]

node_operator -->|"sets mission"| node_streamlit_app
node_streamlit_app -->|"renders map"| node_map_view
node_streamlit_app -->|"requests risk grid"| node_risk_interface
node_risk_interface -->|"fetches and rasterizes"| node_building_ingestion
node_building_ingestion -->|"queries buildings"| node_osm
node_risk_interface -->|"computes convolution"| node_risk_kernel
node_streamlit_app -->|"requests route"| node_risk_interface
node_risk_interface -->|"runs weighted search"| node_astar
node_streamlit_app -->|"posts flight path"| node_simulation_api
node_simulation_api -->|"runs simulation"| node_flight_runner
node_flight_runner -.->|"uses physics runtime"| node_isaac_lab
node_streamlit_app -->|"sends query and context"| node_copilot_module
node_copilot_module -->|"generates response"| node_gemini

click node_streamlit_app "https://github.com/srey5/drone-risk/blob/main/app/main.py"
click node_map_view "https://github.com/srey5/drone-risk/blob/main/app/main.py"
click node_risk_interface "https://github.com/srey5/drone-risk/blob/main/core/engine/interface.py"
click node_building_ingestion "https://github.com/srey5/drone-risk/blob/main/core/engine/interface.py"
click node_risk_kernel "https://github.com/srey5/drone-risk/blob/main/core/engine/physics.py"
click node_astar "https://github.com/srey5/drone-risk/blob/main/core/engine/pathfinding.py"
click node_simulation_api "https://github.com/srey5/drone-risk/blob/main/sim_api/main.py"
click node_flight_runner "https://github.com/srey5/drone-risk/blob/main/sim_api/omni_runner.py"
click node_copilot_module "https://github.com/srey5/drone-risk/blob/main/core/agent/gemini_copilot.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_streamlit_app,node_map_view toneBlue
class node_risk_interface,node_building_ingestion,node_risk_kernel,node_astar,node_osm toneAmber
class node_simulation_api,node_flight_runner,node_gemini toneMint
class node_copilot_module toneRose
class node_operator,node_isaac_lab toneIndigo
```

## Components

### Mission UI

- [Mission Planner UI](https://github.com/srey5/drone-risk/blob/main/app/main.py): `app/main.py`
- [Map and Overlays](https://github.com/srey5/drone-risk/blob/main/app/main.py): `app/main.py`

### Risk and Routing

- [Risk and Path Interface](https://github.com/srey5/drone-risk/blob/main/core/engine/interface.py): `core/engine/interface.py`
- [Building Data Raster](https://github.com/srey5/drone-risk/blob/main/core/engine/interface.py): `core/engine/interface.py`
- [Risk Convolution Kernel](https://github.com/srey5/drone-risk/blob/main/core/engine/physics.py): `core/engine/physics.py`
- [Weighted A*](https://github.com/srey5/drone-risk/blob/main/core/engine/pathfinding.py): `core/engine/pathfinding.py`

### Flight Simulation

- [Simulation API](https://github.com/srey5/drone-risk/blob/main/sim_api/main.py): `sim_api/main.py`
- [Flight Simulation Runner](https://github.com/srey5/drone-risk/blob/main/sim_api/omni_runner.py): `sim_api/omni_runner.py`

### Mission Co-pilot

- [Co-pilot Context and Client](https://github.com/srey5/drone-risk/blob/main/core/agent/gemini_copilot.py): `core/agent/gemini_copilot.py`

### Other components

- **Operator**
- **OpenStreetMap Buildings**
- **Isaac Lab**
- **Gemini API**

## Connections

- Operator → Mission Planner UI: sets mission
- Mission Planner UI → Map and Overlays: renders map
- Mission Planner UI → Risk and Path Interface: requests risk grid
- Risk and Path Interface → Building Data Raster: fetches and rasterizes
- Building Data Raster → OpenStreetMap Buildings: queries buildings
- Risk and Path Interface → Risk Convolution Kernel: computes convolution
- Mission Planner UI → Risk and Path Interface: requests route
- Risk and Path Interface → Weighted A*: runs weighted search
- Mission Planner UI → Simulation API: posts flight path
- Simulation API → Flight Simulation Runner: runs simulation
- Flight Simulation Runner → Isaac Lab: uses physics runtime
- Mission Planner UI → Co-pilot Context and Client: sends query and context
- Co-pilot Context and Client → Gemini API: generates response
