# someshwar-prox/geoai-v2 architecture

> Architecture diagram of the GitHub repository someshwar-prox/geoai-v2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/someshwar-prox/geoai-v2
- Repository: https://github.com/someshwar-prox/geoai-v2

## Overview

GeoAI Outdoor Assistant is a FastAPI backend that turns an outdoor-activity question into a location-aware recommendation: the API submits the question to the pipeline, which parses intent, gathers geospatial and environmental context, scores venue-and-hour options, generates an explanation, and verifies it. Context gathering covers geocoding, venues and hazards, weather, air quality, routes, daylight, and hiking elevation. Source adapters share cached, rate-limited HTTP and circuit-breaker support. Relationships shown are those evidenced by the README or excerpts; unsampled source behavior is not inferred.

Main entry points: [`app/context.py`](https://github.com/someshwar-prox/geoai-v2/blob/main/app/context.py) (Context gathering), [`app/sources/base.py`](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/base.py) (Source cache and resilience), [`app/pipeline.py`](https://github.com/someshwar-prox/geoai-v2/blob/main/app/pipeline.py) (Recommendation pipeline), [`app/sources/airquality.py`](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/airquality.py) (Air quality)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_api["FastAPI endpoints<br/>[main.py]"]
end

subgraph group_workflow["Recommendation workflow"]
  node_pipeline["Recommendation pipeline<br/>[pipeline.py]"]
  node_intent["Intent parsing and explanation<br/>[slm.py]"]
  node_verifier["Response verification<br/>[verifier.py]"]
end

subgraph group_context["Context and scoring"]
  node_context["Context gathering<br/>[context.py]"]
  node_scoring["Exposure scoring<br/>[exposure_engine.py]"]
end

subgraph group_sources["Data sources"]
  node_geocode["Geocoding<br/>[geocode.py]"]
  node_venues["Venue and hazard search<br/>[overpass.py]"]
  node_weather["Weather forecast<br/>[weather.py]"]
  node_air["Air quality<br/>[airquality.py]"]
  node_routing["Travel times<br/>[routing.py]"]
  node_daylight["Daylight<br/>[daylight.py]"]
  node_elevation["Elevation<br/>[elevation.py]"]
end

subgraph group_infra["Source infrastructure"]
  node_config["Runtime settings<br/>[config.py]"]
  node_sourcebase["Source cache and resilience<br/>[base.py]"]
end

node_user(("Outdoor user"))
node_osm["OpenStreetMap services"]
node_meteo["Open-Meteo"]
node_osrm["OSRM"]
node_waqi["WAQI"]
node_astral["Astral"]

node_user -->|"asks"| node_api
node_api -->|"runs question"| node_pipeline
node_api -->|"gathers context"| node_context
node_pipeline -->|"parses and explains"| node_intent
node_pipeline -->|"gathers data"| node_context
node_pipeline -->|"scores options"| node_scoring
node_pipeline -->|"verifies answer"| node_verifier
node_context -->|"geocodes location"| node_geocode
node_context -->|"finds venues and hazards"| node_venues
node_context -->|"fetches forecast"| node_weather
node_context -->|"fetches air quality"| node_air
node_context -->|"gets travel times"| node_routing
node_context -->|"gets daylight"| node_daylight
node_context -->|"gets hiking elevation"| node_elevation
node_scoring -->|"scores venue data"| node_venues
node_geocode -->|"uses fetch support"| node_sourcebase
node_venues -->|"uses fetch support"| node_sourcebase
node_weather -.->|"uses fetch support"| node_sourcebase
node_air -->|"uses fetch support"| node_sourcebase
node_routing -->|"uses fetch support"| node_sourcebase
node_daylight -->|"uses fetch support"| node_sourcebase
node_elevation -.->|"uses fetch support"| node_sourcebase
node_sourcebase -->|"reads settings"| node_config
node_geocode -->|"queries Nominatim and Photon"| node_osm
node_venues -->|"queries Overpass"| node_osm
node_weather -.->|"fetches forecast"| node_meteo
node_air -->|"fetches forecast"| node_meteo
node_air -->|"optional bias correction"| node_waqi
node_routing -->|"requests travel table"| node_osrm
node_daylight -->|"tries sunrise and sunset"| node_meteo
node_daylight -->|"fallback calculation"| node_astral

click node_api "https://github.com/someshwar-prox/geoai-v2/blob/main/app/main.py"
click node_pipeline "https://github.com/someshwar-prox/geoai-v2/blob/main/app/pipeline.py"
click node_intent "https://github.com/someshwar-prox/geoai-v2/blob/main/app/slm.py"
click node_verifier "https://github.com/someshwar-prox/geoai-v2/blob/main/app/verifier.py"
click node_context "https://github.com/someshwar-prox/geoai-v2/blob/main/app/context.py"
click node_scoring "https://github.com/someshwar-prox/geoai-v2/blob/main/app/exposure_engine.py"
click node_config "https://github.com/someshwar-prox/geoai-v2/blob/main/app/config.py"
click node_sourcebase "https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/base.py"
click node_geocode "https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/geocode.py"
click node_venues "https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/overpass.py"
click node_weather "https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/weather.py"
click node_air "https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/airquality.py"
click node_routing "https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/routing.py"
click node_daylight "https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/daylight.py"
click node_elevation "https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/elevation.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_api,node_user toneBlue
class node_pipeline,node_intent,node_verifier toneAmber
class node_context,node_scoring toneMint
class node_geocode,node_venues,node_weather,node_air,node_routing,node_daylight,node_elevation toneRose
class node_config,node_sourcebase,node_osm,node_meteo,node_osrm,node_waqi,node_astral toneIndigo
```

## Components

### API

- [FastAPI endpoints](https://github.com/someshwar-prox/geoai-v2/blob/main/app/main.py): `app/main.py`

### Recommendation workflow

- [Recommendation pipeline](https://github.com/someshwar-prox/geoai-v2/blob/main/app/pipeline.py): `app/pipeline.py`
- [Intent parsing and explanation](https://github.com/someshwar-prox/geoai-v2/blob/main/app/slm.py): `app/slm.py`
- [Response verification](https://github.com/someshwar-prox/geoai-v2/blob/main/app/verifier.py): `app/verifier.py`

### Context and scoring

- [Context gathering](https://github.com/someshwar-prox/geoai-v2/blob/main/app/context.py): `app/context.py`
- [Exposure scoring](https://github.com/someshwar-prox/geoai-v2/blob/main/app/exposure_engine.py): `app/exposure_engine.py`

### Data sources

- [Geocoding](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/geocode.py): `app/sources/geocode.py`
- [Venue and hazard search](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/overpass.py): `app/sources/overpass.py`
- [Weather forecast](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/weather.py): `app/sources/weather.py`
- [Air quality](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/airquality.py): `app/sources/airquality.py`
- [Travel times](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/routing.py): `app/sources/routing.py`
- [Daylight](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/daylight.py): `app/sources/daylight.py`
- [Elevation](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/elevation.py): `app/sources/elevation.py`

### Source infrastructure

- [Runtime settings](https://github.com/someshwar-prox/geoai-v2/blob/main/app/config.py): `app/config.py`
- [Source cache and resilience](https://github.com/someshwar-prox/geoai-v2/blob/main/app/sources/base.py): `app/sources/base.py`

### Other components

- **Outdoor user**
- **OpenStreetMap services**
- **Open-Meteo**
- **OSRM**
- **WAQI**
- **Astral**

## Connections

- Outdoor user → FastAPI endpoints: asks (evidence: `app/main.py`)
- FastAPI endpoints → Recommendation pipeline: runs question (evidence: `app/main.py`)
- FastAPI endpoints → Context gathering: gathers context (evidence: `app/main.py`)
- Recommendation pipeline → Intent parsing and explanation: parses and explains (evidence: `app/pipeline.py`)
- Recommendation pipeline → Context gathering: gathers data (evidence: `app/pipeline.py`)
- Recommendation pipeline → Exposure scoring: scores options (evidence: `app/pipeline.py`)
- Recommendation pipeline → Response verification: verifies answer (evidence: `app/pipeline.py`)
- Context gathering → Geocoding: geocodes location (evidence: `app/context.py`)
- Context gathering → Venue and hazard search: finds venues and hazards (evidence: `app/context.py`)
- Context gathering → Weather forecast: fetches forecast (evidence: `app/context.py`)
- Context gathering → Air quality: fetches air quality (evidence: `app/context.py`)
- Context gathering → Travel times: gets travel times (evidence: `app/context.py`)
- Context gathering → Daylight: gets daylight (evidence: `app/context.py`)
- Context gathering → Elevation: gets hiking elevation (evidence: `app/context.py`)
- Exposure scoring → Venue and hazard search: scores venue data (evidence: `app/exposure_engine.py`)
- Geocoding → Source cache and resilience: uses fetch support (evidence: `app/sources/geocode.py`)
- Venue and hazard search → Source cache and resilience: uses fetch support (evidence: `app/sources/overpass.py`)
- Weather forecast → Source cache and resilience: uses fetch support (evidence: `app/sources/weather.py`)
- Air quality → Source cache and resilience: uses fetch support (evidence: `app/sources/airquality.py`)
- Travel times → Source cache and resilience: uses fetch support (evidence: `app/sources/routing.py`)
- Daylight → Source cache and resilience: uses fetch support (evidence: `app/sources/daylight.py`)
- Elevation → Source cache and resilience: uses fetch support (evidence: `app/sources/elevation.py`)
- Source cache and resilience → Runtime settings: reads settings (evidence: `app/sources/base.py`)
- Geocoding → OpenStreetMap services: queries Nominatim and Photon (evidence: `app/sources/geocode.py`)
- Venue and hazard search → OpenStreetMap services: queries Overpass (evidence: `app/sources/overpass.py`)
- Weather forecast → Open-Meteo: fetches forecast
- Air quality → Open-Meteo: fetches forecast (evidence: `app/sources/airquality.py`)
- Air quality → WAQI: optional bias correction (evidence: `app/sources/airquality.py`)
- Travel times → OSRM: requests travel table (evidence: `README.md`)
- Daylight → Open-Meteo: tries sunrise and sunset (evidence: `app/sources/daylight.py`)
- Daylight → Astral: fallback calculation (evidence: `app/sources/daylight.py`)
