# mithhsss/drone-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/mithhsss/drone-analysis
- Repository: https://github.com/mithhsss/drone-analysis

## Overview

Drone Intelligence System is an India-focused dashboard for drone research, regulatory guidance, business calculations, and operational analytics. Users ask questions in chat or select a specialized tool; the backend keeps conversation history, invokes the AI agent, and returns answers with citations. Separate calculator, compliance, and recommendation capabilities support direct tool workflows; document upload feeds the knowledge base, which is also populated by ingestion. The README describes these broader connections, but excerpts only verify selected chat, storage, compliance, ingestion, and MCP-server behavior, so uncertain implementation links are omitted.

Main entry points: [`api/main.py`](https://github.com/mithhsss/drone-analysis/blob/main/api/main.py) (FastAPI application), [`frontend/src/App.tsx`](https://github.com/mithhsss/drone-analysis/blob/main/frontend/src/App.tsx) (Dashboard shell), [`api/routes/chat.py`](https://github.com/mithhsss/drone-analysis/blob/main/api/routes/chat.py) (Chat and history routes), [`mcp_server/server.py`](https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/server.py) (MCP tool server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard"]
  node_app["Dashboard shell<br/>[App.tsx]"]
  node_chatui["Chat assistant<br/>[ChatAssistant.tsx]"]
  node_rightpanel["Tool panel<br/>[RightPanel.tsx]"]
  node_viz["Analytics view<br/>[DashboardViz.tsx]"]
end

subgraph group_backend["API and Services"]
  node_api["FastAPI application<br/>[main.py]"]
  node_chatroute["Chat and history routes<br/>[chat.py]"]
  node_chatservice["Conversation service<br/>[chat_service.py]"]
  node_agent["AI agent<br/>[agent.py]"]
  node_dbservice["Chat persistence service<br/>[db_service.py]"]
  node_chatdb[("Chat database<br/>[chats.db]")]
end

subgraph group_knowledge["Knowledge Base"]
  node_uploadroute["Document upload<br/>[upload.py]"]
  node_ingest["Knowledge ingestion<br/>[ingest.py]"]
  node_ragbridge["RAG retrieval bridge<br/>[rag_bridge.py]"]
  node_pinecone[("Vector index")]
end

subgraph group_tools["Drone Tools"]
  node_mcp["MCP tool server<br/>[server.py]"]
  node_flight["Flight-time calculator<br/>[flight_time.py]"]
  node_roi["ROI calculator<br/>[roi_calc.py]"]
  node_compliance["Compliance checker"]
  node_selector["Drone recommender<br/>[drone_selector.py]"]
  node_calculate["Calculation routes<br/>[calculate.py]"]
  node_complianceroute["Compliance route<br/>[compliance.py]"]
  node_recommendroute["Recommendation route<br/>[recommend.py]"]
end

subgraph group_insights["Analytics"]
  node_analyticsroute["Analytics route<br/>[analytics.py]"]
  node_analyticsservice["Analytics service"]
  node_analyticsapi(("Analytics API"))
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_chatui
node_app -->|"renders"| node_rightpanel
node_app -->|"renders"| node_viz
node_chatui -->|"sends chat"| node_api
node_app -->|"loads history"| node_chatroute
node_api -->|"routes requests"| node_chatroute
node_api -->|"mounts routes"| node_calculate
node_api -->|"mounts routes"| node_complianceroute
node_api -->|"mounts routes"| node_recommendroute
node_api -->|"mounts routes"| node_uploadroute
node_api -->|"mounts routes"| node_analyticsroute
node_chatroute -->|"handles chat"| node_chatservice
node_chatservice -->|"executes query"| node_agent
node_chatservice -->|"reads and writes"| node_dbservice
node_chatroute -->|"loads history"| node_dbservice
node_dbservice -->|"reads and writes"| node_chatdb
node_uploadroute -->|"indexes documents"| node_pinecone
node_ingest -->|"upserts chunks"| node_pinecone
node_ragbridge -->|"queries vectors"| node_pinecone
node_mcp -->|"dispatches tool"| node_flight
node_mcp -->|"dispatches tool"| node_roi
node_mcp -->|"dispatches tool"| node_compliance
node_mcp -->|"dispatches tool"| node_selector
node_compliance -->|"retrieves rules"| node_ragbridge
node_calculate -.->|"offers calculation"| node_flight
node_calculate -.->|"offers calculation"| node_roi
node_complianceroute -.->|"offers check"| node_compliance
node_recommendroute -.->|"offers selection"| node_selector
node_analyticsapi -->|"views metrics"| node_viz
node_viz -.->|"requests metrics"| node_analyticsroute
node_analyticsroute -->|"tracks metrics"| node_analyticsservice
node_chatroute -->|"tracks requests"| node_analyticsservice

click node_app "https://github.com/mithhsss/drone-analysis/blob/main/frontend/src/App.tsx"
click node_chatui "https://github.com/mithhsss/drone-analysis/blob/main/frontend/src/components/chat/ChatAssistant.tsx"
click node_rightpanel "https://github.com/mithhsss/drone-analysis/blob/main/frontend/src/components/layout/RightPanel.tsx"
click node_viz "https://github.com/mithhsss/drone-analysis/blob/main/frontend/src/components/viz/DashboardViz.tsx"
click node_api "https://github.com/mithhsss/drone-analysis/blob/main/api/main.py"
click node_chatroute "https://github.com/mithhsss/drone-analysis/blob/main/api/routes/chat.py"
click node_chatservice "https://github.com/mithhsss/drone-analysis/blob/main/api/services/chat_service.py"
click node_agent "https://github.com/mithhsss/drone-analysis/blob/main/api/services/agent.py"
click node_dbservice "https://github.com/mithhsss/drone-analysis/blob/main/api/services/db_service.py"
click node_chatdb "https://github.com/mithhsss/drone-analysis/blob/main/data/chats.db"
click node_uploadroute "https://github.com/mithhsss/drone-analysis/blob/main/api/routes/upload.py"
click node_ingest "https://github.com/mithhsss/drone-analysis/blob/main/rag/ingest.py"
click node_ragbridge "https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/rag_bridge.py"
click node_mcp "https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/server.py"
click node_flight "https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/tools/flight_time.py"
click node_roi "https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/tools/roi_calc.py"
click node_compliance "https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/tools/compliance_checker.py"
click node_selector "https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/tools/drone_selector.py"
click node_calculate "https://github.com/mithhsss/drone-analysis/blob/main/api/routes/calculate.py"
click node_complianceroute "https://github.com/mithhsss/drone-analysis/blob/main/api/routes/compliance.py"
click node_recommendroute "https://github.com/mithhsss/drone-analysis/blob/main/api/routes/recommend.py"
click node_analyticsroute "https://github.com/mithhsss/drone-analysis/blob/main/api/routes/analytics.py"
click node_analyticsservice "https://github.com/mithhsss/drone-analysis/blob/main/api/services/analytics_service.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_app,node_chatui,node_rightpanel,node_viz,node_user toneBlue
class node_api,node_chatroute,node_chatservice,node_agent,node_dbservice,node_chatdb toneAmber
class node_uploadroute,node_ingest,node_ragbridge,node_pinecone toneMint
class node_mcp,node_flight,node_roi,node_compliance,node_selector,node_calculate,node_complianceroute,node_recommendroute toneRose
class node_analyticsroute,node_analyticsservice,node_analyticsapi toneIndigo
```

## Components

### Dashboard

- [Dashboard shell](https://github.com/mithhsss/drone-analysis/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Chat assistant](https://github.com/mithhsss/drone-analysis/blob/main/frontend/src/components/chat/ChatAssistant.tsx): `frontend/src/components/chat/ChatAssistant.tsx`
- [Tool panel](https://github.com/mithhsss/drone-analysis/blob/main/frontend/src/components/layout/RightPanel.tsx): `frontend/src/components/layout/RightPanel.tsx`
- [Analytics view](https://github.com/mithhsss/drone-analysis/blob/main/frontend/src/components/viz/DashboardViz.tsx): `frontend/src/components/viz/DashboardViz.tsx`

### API and Services

- [FastAPI application](https://github.com/mithhsss/drone-analysis/blob/main/api/main.py): `api/main.py`
- [Chat and history routes](https://github.com/mithhsss/drone-analysis/blob/main/api/routes/chat.py): `api/routes/chat.py`
- [Conversation service](https://github.com/mithhsss/drone-analysis/blob/main/api/services/chat_service.py): `api/services/chat_service.py`
- [AI agent](https://github.com/mithhsss/drone-analysis/blob/main/api/services/agent.py): `api/services/agent.py`
- [Chat persistence service](https://github.com/mithhsss/drone-analysis/blob/main/api/services/db_service.py): `api/services/db_service.py`
- [Chat database](https://github.com/mithhsss/drone-analysis/blob/main/data/chats.db): `data/chats.db`

### Knowledge Base

- [Document upload](https://github.com/mithhsss/drone-analysis/blob/main/api/routes/upload.py): `api/routes/upload.py`
- [Knowledge ingestion](https://github.com/mithhsss/drone-analysis/blob/main/rag/ingest.py): `rag/ingest.py`
- [RAG retrieval bridge](https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/rag_bridge.py): `mcp_server/rag_bridge.py`
- **Vector index**

### Drone Tools

- [MCP tool server](https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/server.py): `mcp_server/server.py`
- [Flight-time calculator](https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/tools/flight_time.py): `mcp_server/tools/flight_time.py`
- [ROI calculator](https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/tools/roi_calc.py): `mcp_server/tools/roi_calc.py`
- [Compliance checker](https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/tools/compliance_checker.py): `mcp_server/tools/compliance_checker.py`
- [Drone recommender](https://github.com/mithhsss/drone-analysis/blob/main/mcp_server/tools/drone_selector.py): `mcp_server/tools/drone_selector.py`
- [Calculation routes](https://github.com/mithhsss/drone-analysis/blob/main/api/routes/calculate.py): `api/routes/calculate.py`
- [Compliance route](https://github.com/mithhsss/drone-analysis/blob/main/api/routes/compliance.py): `api/routes/compliance.py`
- [Recommendation route](https://github.com/mithhsss/drone-analysis/blob/main/api/routes/recommend.py): `api/routes/recommend.py`

### Analytics

- [Analytics route](https://github.com/mithhsss/drone-analysis/blob/main/api/routes/analytics.py): `api/routes/analytics.py`
- [Analytics service](https://github.com/mithhsss/drone-analysis/blob/main/api/services/analytics_service.py): `api/services/analytics_service.py`
- **Analytics API**

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Dashboard shell: uses
- Dashboard shell → Chat assistant: renders
- Dashboard shell → Tool panel: renders
- Dashboard shell → Analytics view: renders
- Chat assistant → FastAPI application: sends chat
- Dashboard shell → Chat and history routes: loads history
- FastAPI application → Chat and history routes: routes requests
- FastAPI application → Calculation routes: mounts routes
- FastAPI application → Compliance route: mounts routes
- FastAPI application → Recommendation route: mounts routes
- FastAPI application → Document upload: mounts routes
- FastAPI application → Analytics route: mounts routes
- Chat and history routes → Conversation service: handles chat
- Conversation service → AI agent: executes query
- Conversation service → Chat persistence service: reads and writes
- Chat and history routes → Chat persistence service: loads history
- Chat persistence service → Chat database: reads and writes
- Document upload → Vector index: indexes documents
- Knowledge ingestion → Vector index: upserts chunks
- RAG retrieval bridge → Vector index: queries vectors
- MCP tool server → Flight-time calculator: dispatches tool
- MCP tool server → ROI calculator: dispatches tool
- MCP tool server → Compliance checker: dispatches tool
- MCP tool server → Drone recommender: dispatches tool
- Compliance checker → RAG retrieval bridge: retrieves rules
- Calculation routes → Flight-time calculator: offers calculation
- Calculation routes → ROI calculator: offers calculation
- Compliance route → Compliance checker: offers check
- Recommendation route → Drone recommender: offers selection
- Analytics API → Analytics view: views metrics
- Analytics view → Analytics route: requests metrics
- Analytics route → Analytics service: tracks metrics
- Chat and history routes → Analytics service: tracks requests
