# pavithrav2005/flight-and-weather-assistant architecture

> Architecture diagram of the GitHub repository pavithrav2005/flight-and-weather-assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pavithrav2005/flight-and-weather-assistant
- Repository: https://github.com/pavithrav2005/flight-and-weather-assistant

## Overview

The product is a Streamlit flight-and-weather chatbot backed by a FastAPI API. A user prompt is analyzed, resolved into tool calls, executed against flight/weather capabilities, and assembled into a chat response; direct flight endpoints also combine flight status with airport weather. The README documents chat history and theme support, but sampled source does not establish their persistence or implementation details. Edges follow the shown backend wiring and imports; Streamlit-to-API is documented in the README.

Main entry points: [`app/main.py`](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/main.py) (FastAPI app), [`app/services/chatbot.py`](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/chatbot.py) (Chat orchestration), [`app/services/openweather.py`](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/openweather.py) (Weather provider), [`app/routes`](https://github.com/pavithrav2005/flight-and-weather-assistant/tree/main/app/routes) (API routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User interface"]
  node_streamlit["Streamlit app<br/>[streamlit_app.py]"]
end

subgraph group_api["API and orchestration"]
  node_fastapi["FastAPI app<br/>[main.py]"]
  node_routes["API routes"]
  node_chatroute["Chat endpoint<br/>[chat.py]"]
  node_flightroute["Flight endpoint<br/>[flight.py]"]
  node_healthroute["Health endpoint<br/>[health.py]"]
  node_mcproute["MCP endpoint<br/>[mcp.py]"]
end

subgraph group_chat["Chat and tools"]
  node_chatbot["Chat orchestration<br/>[chatbot.py]"]
  node_analyzer["Prompt analysis<br/>[prompt_analyzer.py]"]
  node_executor["Tool executor<br/>[executor.py]"]
  node_registry["Tool registry<br/>[registry.py]"]
  node_tools["Flight and weather tools<br/>[tools.py]"]
  node_chatmodels["Chat models<br/>[chat.py]"]
end

subgraph group_domain["Flight and weather data"]
  node_flightinfo["Flight information<br/>[flight_info.py]"]
  node_aviation["Flight data provider<br/>[aviationstack.py]"]
  node_weather["Weather provider<br/>[openweather.py]"]
  node_flightmodels["Flight models<br/>[flight.py]"]
  node_weathermodels["Weather models<br/>[weather.py]"]
end

subgraph group_support["Runtime support"]
  node_cache[("In-memory cache<br/>[cache.py]")]
  node_base["External service base<br/>[base.py]"]
  node_config["Settings<br/>[config.py]"]
  node_context["Request context<br/>[context.py]"]
  node_logging["Structured logging<br/>[logging.py]"]
  node_exceptions["Application errors<br/>[exceptions.py]"]
end

node_user(("User"))
node_nim{{"NVIDIA NIM"}}
node_aviationstack{{"Aviationstack"}}
node_openweather{{"OpenWeather"}}

node_user -->|"submits query"| node_streamlit
node_streamlit -->|"HTTP requests"| node_fastapi
node_fastapi -->|"mounts routes"| node_routes
node_routes -->|"includes"| node_chatroute
node_routes -->|"includes"| node_flightroute
node_routes -->|"includes"| node_healthroute
node_routes -->|"includes"| node_mcproute
node_chatroute -->|"handles prompt"| node_chatbot
node_flightroute -->|"requests flight data"| node_flightinfo
node_chatbot -->|"analyzes prompt"| node_analyzer
node_analyzer -->|"requests analysis"| node_nim
node_chatbot -->|"executes tool calls"| node_executor
node_executor -->|"looks up tool"| node_registry
node_fastapi -->|"registers tools"| node_registry
node_fastapi -->|"registers tools"| node_tools
node_tools -->|"calls flight service"| node_flightinfo
node_tools -->|"calls weather service"| node_weather
node_flightinfo -->|"gets flight status"| node_aviation
node_flightinfo -->|"gets airport weather"| node_weather
node_aviation -->|"requests flight data"| node_aviationstack
node_weather -->|"requests weather"| node_openweather
node_aviation -->|"reads and writes"| node_cache
node_weather -->|"uses cache"| node_cache
node_flightinfo -->|"reads and writes"| node_cache
node_aviation -->|"parses responses"| node_flightmodels
node_weather -->|"returns weather model"| node_weathermodels
node_chatbot -->|"builds response"| node_chatmodels
node_chatbot -->|"validates tool results"| node_flightmodels
node_chatbot -->|"uses weather results"| node_weathermodels
node_aviation -->|"extends"| node_base
node_weather -->|"extends"| node_base
node_analyzer -->|"extends"| node_base
node_fastapi -->|"loads settings"| node_config
node_fastapi -->|"configures logging"| node_logging
node_fastapi -->|"sets request ID"| node_context
node_fastapi -->|"handles errors"| node_exceptions
node_logging -->|"reads request ID"| node_context

click node_streamlit "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/streamlit_app.py"
click node_fastapi "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/main.py"
click node_routes "https://github.com/pavithrav2005/flight-and-weather-assistant/tree/main/app/routes"
click node_chatroute "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/routes/chat.py"
click node_flightroute "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/routes/flight.py"
click node_healthroute "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/routes/health.py"
click node_mcproute "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/routes/mcp.py"
click node_chatbot "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/chatbot.py"
click node_analyzer "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/prompt_analyzer.py"
click node_executor "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/mcp/executor.py"
click node_registry "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/mcp/registry.py"
click node_tools "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/mcp/tools.py"
click node_flightinfo "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/flight_info.py"
click node_aviation "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/aviationstack.py"
click node_weather "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/openweather.py"
click node_flightmodels "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/models/flight.py"
click node_weathermodels "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/models/weather.py"
click node_chatmodels "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/models/chat.py"
click node_cache "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/cache.py"
click node_base "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/base.py"
click node_config "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/core/config.py"
click node_context "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/core/context.py"
click node_logging "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/core/logging.py"
click node_exceptions "https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/core/exceptions.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,node_user toneBlue
class node_fastapi,node_routes,node_chatroute,node_flightroute,node_healthroute,node_mcproute toneAmber
class node_chatbot,node_analyzer,node_executor,node_registry,node_tools,node_chatmodels toneMint
class node_flightinfo,node_aviation,node_weather,node_flightmodels,node_weathermodels toneRose
class node_cache,node_base,node_config,node_context,node_logging,node_exceptions,node_nim,node_aviationstack,node_openweather toneIndigo
```

## Components

### User interface

- [Streamlit app](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/streamlit_app.py): `streamlit_app.py`

### API and orchestration

- [FastAPI app](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/main.py): `app/main.py`
- [API routes](https://github.com/pavithrav2005/flight-and-weather-assistant/tree/main/app/routes): `app/routes`
- [Chat endpoint](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/routes/chat.py): `app/routes/chat.py`
- [Flight endpoint](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/routes/flight.py): `app/routes/flight.py`
- [Health endpoint](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/routes/health.py): `app/routes/health.py`
- [MCP endpoint](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/routes/mcp.py): `app/routes/mcp.py`

### Chat and tools

- [Chat orchestration](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/chatbot.py): `app/services/chatbot.py`
- [Prompt analysis](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/prompt_analyzer.py): `app/services/prompt_analyzer.py`
- [Tool executor](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/mcp/executor.py): `app/mcp/executor.py`
- [Tool registry](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/mcp/registry.py): `app/mcp/registry.py`
- [Flight and weather tools](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/mcp/tools.py): `app/mcp/tools.py`
- [Chat models](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/models/chat.py): `app/models/chat.py`

### Flight and weather data

- [Flight information](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/flight_info.py): `app/services/flight_info.py`
- [Flight data provider](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/aviationstack.py): `app/services/aviationstack.py`
- [Weather provider](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/openweather.py): `app/services/openweather.py`
- [Flight models](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/models/flight.py): `app/models/flight.py`
- [Weather models](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/models/weather.py): `app/models/weather.py`

### Runtime support

- [In-memory cache](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/cache.py): `app/services/cache.py`
- [External service base](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/services/base.py): `app/services/base.py`
- [Settings](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/core/config.py): `app/core/config.py`
- [Request context](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/core/context.py): `app/core/context.py`
- [Structured logging](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/core/logging.py): `app/core/logging.py`
- [Application errors](https://github.com/pavithrav2005/flight-and-weather-assistant/blob/main/app/core/exceptions.py): `app/core/exceptions.py`

### Other components

- **User**
- **NVIDIA NIM**
- **Aviationstack**
- **OpenWeather**

## Connections

- User → Streamlit app: submits query (evidence: `README.md`)
- Streamlit app → FastAPI app: HTTP requests (evidence: `README.md`)
- FastAPI app → API routes: mounts routes (evidence: `app/main.py`)
- API routes → Chat endpoint: includes (evidence: `app/routes/__init__.py`)
- API routes → Flight endpoint: includes (evidence: `app/routes/__init__.py`)
- API routes → Health endpoint: includes (evidence: `app/routes/__init__.py`)
- API routes → MCP endpoint: includes (evidence: `app/routes/__init__.py`)
- Chat endpoint → Chat orchestration: handles prompt (evidence: `app/routes/chat.py`)
- Flight endpoint → Flight information: requests flight data (evidence: `app/routes/flight.py`)
- Chat orchestration → Prompt analysis: analyzes prompt (evidence: `app/services/chatbot.py`)
- Prompt analysis → NVIDIA NIM: requests analysis (evidence: `app/services/prompt_analyzer.py`)
- Chat orchestration → Tool executor: executes tool calls (evidence: `app/services/chatbot.py`)
- Tool executor → Tool registry: looks up tool (evidence: `app/mcp/executor.py`)
- FastAPI app → Tool registry: registers tools (evidence: `app/main.py`)
- FastAPI app → Flight and weather tools: registers tools (evidence: `app/main.py`)
- Flight and weather tools → Flight information: calls flight service (evidence: `app/mcp/tools.py`)
- Flight and weather tools → Weather provider: calls weather service (evidence: `app/mcp/tools.py`)
- Flight information → Flight data provider: gets flight status (evidence: `app/services/flight_info.py`)
- Flight information → Weather provider: gets airport weather (evidence: `app/services/flight_info.py`)
- Flight data provider → Aviationstack: requests flight data (evidence: `app/services/aviationstack.py`)
- Weather provider → OpenWeather: requests weather (evidence: `app/services/openweather.py`)
- Flight data provider → In-memory cache: reads and writes (evidence: `app/services/aviationstack.py`)
- Weather provider → In-memory cache: uses cache (evidence: `app/services/openweather.py`)
- Flight information → In-memory cache: reads and writes (evidence: `app/services/flight_info.py`)
- Flight data provider → Flight models: parses responses (evidence: `app/services/aviationstack.py`)
- Weather provider → Weather models: returns weather model (evidence: `app/services/openweather.py`)
- Chat orchestration → Chat models: builds response (evidence: `app/services/chatbot.py`)
- Chat orchestration → Flight models: validates tool results (evidence: `app/services/chatbot.py`)
- Chat orchestration → Weather models: uses weather results (evidence: `app/services/chatbot.py`)
- Flight data provider → External service base: extends (evidence: `app/services/aviationstack.py`)
- Weather provider → External service base: extends (evidence: `app/services/openweather.py`)
- Prompt analysis → External service base: extends (evidence: `app/services/prompt_analyzer.py`)
- FastAPI app → Settings: loads settings (evidence: `app/main.py`)
- FastAPI app → Structured logging: configures logging (evidence: `app/main.py`)
- FastAPI app → Request context: sets request ID (evidence: `app/main.py`)
- FastAPI app → Application errors: handles errors (evidence: `app/main.py`)
- Structured logging → Request context: reads request ID (evidence: `app/core/logging.py`)
