# akritivishwakarma2007/airiva architecture

> Architecture diagram of the GitHub repository akritivishwakarma2007/airiva, 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/akritivishwakarma2007/airiva
- Repository: https://github.com/akritivishwakarma2007/airiva

## Overview

Airiva is a high-frequency Indian domestic airfare index. Its principal workflow gathers airline and OTA fares, retains sold-out observations for audit while filtering and deduplicating quotes for analysis, computes passenger-weighted Törnqvist index series, stores them, and exposes results through a dashboard and REST API. The graph reflects README-documented capabilities and sampled source; unsampled modules are included only where their roles are documented, and uncertain internal wiring is omitted.

Main entry points: [`apix/index_engine/runner.py`](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/runner.py) (Index runner), [`apix/api/main.py`](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/main.py) (FastAPI application), [`apix/scraper/runner.py`](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/scraper/runner.py) (Scraper runner), [`apix/api/routers/quotes.py`](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/routers/quotes.py) (Quote endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Fare ingestion"]
  node_scraper_runner["Scraper runner<br/>[runner.py]"]
  node_carrier_scrapers["Carrier scrapers"]
  node_ota_scraper["OTA scraper<br/>[makemytrip.py]"]
  node_raw_storage["Raw scrape storage<br/>[storage.py]"]
end

subgraph group_process["Quote processing"]
  node_loader["Quote loader<br/>[loader.py]"]
  node_normalizer["Quote normalization<br/>[normalizer.py]"]
  node_deduplicator["Direct OTA deduplication<br/>[deduplicator.py]"]
  node_outlier_filter["IQR outlier filtering<br/>[outlier_filter.py]"]
  node_quote_store[("Quote database<br/>[db.py]")]
end

subgraph group_index["Index and validation"]
  node_index_runner["Index runner<br/>[runner.py]"]
  node_weights["DGCA route weights<br/>[weights.py]"]
  node_tornqvist["Törnqvist calculation<br/>[tornqvist.py]"]
  node_aggregator["Time aggregation<br/>[aggregator.py]"]
  node_index_store[("Index values<br/>[runner.py]")]
  node_backtest["Backtest and CPI benchmark"]
end

subgraph group_serve["API and dashboard"]
  node_api["FastAPI application<br/>[main.py]"]
  node_index_router["Index endpoints<br/>[index.py]"]
  node_quotes_router["Quote endpoints<br/>[quotes.py]"]
  node_admin_router["Admin endpoints<br/>[admin.py]"]
  node_auth["Role authorization<br/>[auth.py]"]
  node_dashboard["Interactive dashboard<br/>[app.js]"]
end

node_analyst(("Analyst or admin"))
node_airlines["Airline sites"]
node_ota["MakeMyTrip"]
node_dgca["DGCA statistics"]
node_supabase[("Supabase")]

node_scraper_runner -->|"dispatches"| node_carrier_scrapers
node_scraper_runner -->|"dispatches"| node_ota_scraper
node_carrier_scrapers -->|"collect fares"| node_airlines
node_ota_scraper -->|"collect fares"| node_ota
node_scraper_runner -->|"stores raw payloads"| node_raw_storage
node_raw_storage -.->|"uploads sanitized data"| node_supabase
node_loader -->|"processes quotes"| node_normalizer
node_normalizer -->|"normalizes quotes"| node_deduplicator
node_deduplicator -->|"flags duplicates"| node_outlier_filter
node_outlier_filter -->|"persists quotes and flags"| node_quote_store
node_index_runner -->|"reads quotes"| node_quote_store
node_index_runner -->|"loads route weights"| node_weights
node_weights -.->|"derives traffic weights"| node_dgca
node_index_runner -->|"computes index"| node_tornqvist
node_index_runner -->|"aggregates series"| node_aggregator
node_index_runner -->|"upserts index values"| node_index_store
node_backtest -.->|"parses published statistics"| node_dgca
node_analyst -->|"requests data"| node_api
node_api -->|"routes requests"| node_index_router
node_api -->|"routes requests"| node_quotes_router
node_api -->|"routes requests"| node_admin_router
node_index_router -->|"reads index series"| node_index_store
node_quotes_router -->|"reads raw quotes"| node_quote_store
node_admin_router -->|"checks permissions"| node_auth
node_quotes_router -->|"checks permissions"| node_auth
node_api -->|"serves dashboard"| node_dashboard
node_dashboard -.->|"queries fare quotes"| node_supabase

click node_scraper_runner "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/scraper/runner.py"
click node_carrier_scrapers "https://github.com/akritivishwakarma2007/airiva/tree/main/apix/scraper"
click node_ota_scraper "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/scraper/makemytrip.py"
click node_raw_storage "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/scraper/storage.py"
click node_loader "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/loader.py"
click node_normalizer "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/normalizer.py"
click node_deduplicator "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/deduplicator.py"
click node_outlier_filter "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/outlier_filter.py"
click node_quote_store "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/db.py"
click node_index_runner "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/runner.py"
click node_weights "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/weights.py"
click node_tornqvist "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/tornqvist.py"
click node_aggregator "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/aggregator.py"
click node_index_store "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/runner.py"
click node_backtest "https://github.com/akritivishwakarma2007/airiva/tree/main/apix/backtest"
click node_api "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/main.py"
click node_index_router "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/routers/index.py"
click node_quotes_router "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/routers/quotes.py"
click node_admin_router "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/routers/admin.py"
click node_auth "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/auth.py"
click node_dashboard "https://github.com/akritivishwakarma2007/airiva/blob/main/apix/dashboard/app.js"

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_scraper_runner,node_carrier_scrapers,node_ota_scraper,node_raw_storage toneBlue
class node_loader,node_normalizer,node_deduplicator,node_outlier_filter,node_quote_store,node_supabase toneAmber
class node_index_runner,node_weights,node_tornqvist,node_aggregator,node_index_store,node_backtest toneMint
class node_api,node_index_router,node_quotes_router,node_admin_router,node_auth,node_dashboard toneRose
class node_analyst,node_airlines,node_ota,node_dgca toneIndigo
```

## Components

### Fare ingestion

- [Scraper runner](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/scraper/runner.py): `apix/scraper/runner.py`
- [Carrier scrapers](https://github.com/akritivishwakarma2007/airiva/tree/main/apix/scraper): `apix/scraper`
- [OTA scraper](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/scraper/makemytrip.py): `apix/scraper/makemytrip.py`
- [Raw scrape storage](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/scraper/storage.py): `apix/scraper/storage.py`

### Quote processing

- [Quote loader](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/loader.py): `apix/pipeline/loader.py`
- [Quote normalization](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/normalizer.py): `apix/pipeline/normalizer.py`
- [Direct OTA deduplication](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/deduplicator.py): `apix/pipeline/deduplicator.py`
- [IQR outlier filtering](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/outlier_filter.py): `apix/pipeline/outlier_filter.py`
- [Quote database](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/pipeline/db.py): `apix/pipeline/db.py`

### Index and validation

- [Index runner](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/runner.py): `apix/index_engine/runner.py`
- [DGCA route weights](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/weights.py): `apix/index_engine/weights.py`
- [Törnqvist calculation](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/tornqvist.py): `apix/index_engine/tornqvist.py`
- [Time aggregation](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/aggregator.py): `apix/index_engine/aggregator.py`
- [Index values](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/index_engine/runner.py): `apix/index_engine/runner.py`
- [Backtest and CPI benchmark](https://github.com/akritivishwakarma2007/airiva/tree/main/apix/backtest): `apix/backtest`

### API and dashboard

- [FastAPI application](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/main.py): `apix/api/main.py`
- [Index endpoints](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/routers/index.py): `apix/api/routers/index.py`
- [Quote endpoints](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/routers/quotes.py): `apix/api/routers/quotes.py`
- [Admin endpoints](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/routers/admin.py): `apix/api/routers/admin.py`
- [Role authorization](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/api/auth.py): `apix/api/auth.py`
- [Interactive dashboard](https://github.com/akritivishwakarma2007/airiva/blob/main/apix/dashboard/app.js): `apix/dashboard/app.js`

### Other components

- **Analyst or admin**
- **Airline sites**
- **MakeMyTrip**
- **DGCA statistics**
- **Supabase**

## Connections

- Scraper runner → Carrier scrapers: dispatches
- Scraper runner → OTA scraper: dispatches
- Carrier scrapers → Airline sites: collect fares
- OTA scraper → MakeMyTrip: collect fares
- Scraper runner → Raw scrape storage: stores raw payloads
- Raw scrape storage → Supabase: uploads sanitized data
- Quote loader → Quote normalization: processes quotes
- Quote normalization → Direct OTA deduplication: normalizes quotes
- Direct OTA deduplication → IQR outlier filtering: flags duplicates
- IQR outlier filtering → Quote database: persists quotes and flags
- Index runner → Quote database: reads quotes
- Index runner → DGCA route weights: loads route weights
- DGCA route weights → DGCA statistics: derives traffic weights
- Index runner → Törnqvist calculation: computes index
- Index runner → Time aggregation: aggregates series
- Index runner → Index values: upserts index values
- Backtest and CPI benchmark → DGCA statistics: parses published statistics
- Analyst or admin → FastAPI application: requests data
- FastAPI application → Index endpoints: routes requests
- FastAPI application → Quote endpoints: routes requests
- FastAPI application → Admin endpoints: routes requests
- Index endpoints → Index values: reads index series
- Quote endpoints → Quote database: reads raw quotes
- Admin endpoints → Role authorization: checks permissions
- Quote endpoints → Role authorization: checks permissions
- FastAPI application → Interactive dashboard: serves dashboard
- Interactive dashboard → Supabase: queries fare quotes
