# shreyask95/context_aware_geospatial architecture

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

- Interactive diagram: https://gitdiagram.com/shreyask95/context_aware_geospatial
- Repository: https://github.com/shreyask95/context_aware_geospatial

## Overview

This is a Flask geospatial chat application. A user submits a query through the map interface; Flask dispatches it to context-aware processing, which interprets intent, retrieves location, POI, route, weather, or timezone data, and returns a response for map display. Sessions and SQLite support follow-up context and history. The source index identifies only main3.py as a core module; separate responsibilities below are therefore components implemented in that file, not independently sampled modules. Other capability links rely on the README where excerpts do not show the implementation.

Main entry points: [`main3.py`](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py) (Dynamic query handler), [`templates/map1_1.html`](https://github.com/shreyask95/context_aware_geospatial/blob/main/templates/map1_1.html) (Interactive map)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Interaction"]
  node_map["Interactive map<br/>[map1_1.html]"]
  node_flask["Flask query endpoints<br/>[main3.py]"]
end

subgraph group_conversation["Conversation processing"]
  node_query_handler["Dynamic query handler<br/>[main3.py]"]
  node_intent["Query interpretation<br/>[main3.py]"]
  node_response["Response generation<br/>[main3.py]"]
end

subgraph group_geo["Geospatial services"]
  node_geocoding["Geocoding<br/>[main3.py]"]
  node_poi["Nearby POIs<br/>[main3.py]"]
  node_routing["Route calculation<br/>[main3.py]"]
  node_weather_time["Weather and timezone<br/>[main3.py]"]
end

subgraph group_persistence["Context and history"]
  node_history["History management<br/>[main3.py]"]
  node_sessions[("Flask session context<br/>[main3.py]")]
  node_sqlite[("SQLite chat history<br/>[main3.py]")]
end

node_user(("User"))
node_gemini{{"Google Gemini"}}
node_nominatim{{"Nominatim"}}
node_overpass{{"Overpass API"}}
node_ors{{"OpenRouteService"}}
node_openweather{{"OpenWeatherMap"}}

node_user -->|"submits query"| node_map
node_map -->|"sends request"| node_flask
node_flask -->|"dispatches query"| node_query_handler
node_query_handler -->|"reads context"| node_sessions
node_query_handler -->|"interprets query"| node_intent
node_intent -->|"uses AI"| node_gemini
node_query_handler -->|"resolves places"| node_geocoding
node_geocoding -->|"geocodes locations"| node_nominatim
node_query_handler -->|"retrieves nearby POIs"| node_poi
node_poi -->|"queries features"| node_overpass
node_query_handler -->|"calculates route"| node_routing
node_routing -->|"requests directions"| node_ors
node_query_handler -->|"retrieves local details"| node_weather_time
node_weather_time -->|"requests weather"| node_openweather
node_query_handler -->|"generates answer"| node_response
node_response -->|"generates text"| node_gemini
node_query_handler -->|"maintains conversation"| node_history
node_history -->|"stores context"| node_sessions
node_history -->|"stores history"| node_sqlite
node_flask -->|"returns map data"| node_map

click node_map "https://github.com/shreyask95/context_aware_geospatial/blob/main/templates/map1_1.html"
click node_flask "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_query_handler "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_intent "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_response "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_geocoding "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_poi "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_routing "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_weather_time "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_history "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_sessions "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py"
click node_sqlite "https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.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_map,node_flask,node_user toneBlue
class node_query_handler,node_intent,node_response toneAmber
class node_geocoding,node_poi,node_routing,node_weather_time,node_overpass,node_ors toneMint
class node_history,node_sessions,node_sqlite toneRose
class node_gemini,node_nominatim,node_openweather toneIndigo
```

## Components

### Interaction

- [Interactive map](https://github.com/shreyask95/context_aware_geospatial/blob/main/templates/map1_1.html): `templates/map1_1.html`
- [Flask query endpoints](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`

### Conversation processing

- [Dynamic query handler](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`
- [Query interpretation](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`
- [Response generation](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`

### Geospatial services

- [Geocoding](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`
- [Nearby POIs](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`
- [Route calculation](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`
- [Weather and timezone](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`

### Context and history

- [History management](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`
- [Flask session context](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`
- [SQLite chat history](https://github.com/shreyask95/context_aware_geospatial/blob/main/main3.py): `main3.py`

### Other components

- **User**
- **Google Gemini**
- **Nominatim**
- **Overpass API**
- **OpenRouteService**
- **OpenWeatherMap**

## Connections

- User → Interactive map: submits query (evidence: `README.md`)
- Interactive map → Flask query endpoints: sends request (evidence: `README.md`)
- Flask query endpoints → Dynamic query handler: dispatches query (evidence: `main3.py`)
- Dynamic query handler → Flask session context: reads context (evidence: `main3.py`)
- Dynamic query handler → Query interpretation: interprets query (evidence: `README.md`)
- Query interpretation → Google Gemini: uses AI (evidence: `README.md`)
- Dynamic query handler → Geocoding: resolves places (evidence: `main3.py`)
- Geocoding → Nominatim: geocodes locations (evidence: `README.md`)
- Dynamic query handler → Nearby POIs: retrieves nearby POIs (evidence: `README.md`)
- Nearby POIs → Overpass API: queries features (evidence: `main3.py`)
- Dynamic query handler → Route calculation: calculates route (evidence: `main3.py`)
- Route calculation → OpenRouteService: requests directions (evidence: `main3.py`)
- Dynamic query handler → Weather and timezone: retrieves local details (evidence: `main3.py`)
- Weather and timezone → OpenWeatherMap: requests weather (evidence: `main3.py`)
- Dynamic query handler → Response generation: generates answer (evidence: `README.md`)
- Response generation → Google Gemini: generates text (evidence: `README.md`)
- Dynamic query handler → History management: maintains conversation (evidence: `README.md`)
- History management → Flask session context: stores context (evidence: `README.md`)
- History management → SQLite chat history: stores history (evidence: `README.md`)
- Flask query endpoints → Interactive map: returns map data (evidence: `README.md`)
