# aaryanverma17/ride-sharing-analytics architecture

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

- Interactive diagram: https://gitdiagram.com/aaryanverma17/ride-sharing-analytics
- Repository: https://github.com/aaryanverma17/ride-sharing-analytics

## Overview

Ride-Sharing Analytics is a Flask and MySQL dashboard for exploring synthetic ride-hailing trips. Users open the dashboard, choose city, vehicle, payment, and date filters, and receive cached JSON analytics rendered as KPI cards, findings, and Plotly charts across four tabs. The analytics cover revenue, riders, drivers, cancellations, demand, and routes; completed trips alone count as revenue, while cancelled fares are tracked separately. The repository also includes synthetic-data generation and a standalone SQL-query showcase. The API and database flow is visible in sampled source; some dashboard capabilities are documented but their full implementation was not sampled.

Main entry points: [`app.py`](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/app.py) (Dashboard and API routes), [`static/app.js`](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/static/app.js) (Tabs and filters), [`db.py`](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/db.py) (Database access), [`templates/index.html`](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/templates/index.html) (Dashboard page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data and analytics"]
  node_generator["Synthetic data generator<br/>[seed_data.py]"]
  node_schema["Trip data schema<br/>[schema.sql]"]
  node_mysql[("MySQL database")]
  node_sqlshowcase["SQL query showcase<br/>[analysis.sql]"]
end

subgraph group_service["Flask API"]
  node_routes["Dashboard and API routes<br/>[app.py]"]
  node_filtering["Filter validation<br/>[app.py]"]
  node_analytics["Analytics queries<br/>[app.py]"]
  node_cache["Response cache<br/>[app.py]"]
  node_dbaccess["Database access<br/>[db.py]"]
end

subgraph group_dashboard["Browser dashboard"]
  node_page["Dashboard page<br/>[index.html]"]
  node_controls["Tabs and filters<br/>[app.js]"]
  node_metrics["KPIs and findings<br/>[app.js]"]
  node_charts["Analytics charts<br/>[app.js]"]
end

node_visitor(("Dashboard user"))

node_visitor -->|"opens"| node_page
node_page -->|"loads"| node_controls
node_controls -->|"requests analytics"| node_routes
node_routes -->|"validates filters"| node_filtering
node_routes -->|"checks cache"| node_cache
node_routes -->|"builds dashboard"| node_analytics
node_analytics -->|"opens connection"| node_dbaccess
node_dbaccess -->|"queries"| node_mysql
node_analytics -->|"reads trip view"| node_mysql
node_routes -->|"renders page"| node_page
node_routes -->|"returns JSON"| node_controls
node_controls -->|"renders"| node_metrics
node_controls -->|"renders"| node_charts
node_generator -->|"uses connection"| node_dbaccess
node_generator -->|"inserts generated data"| node_mysql
node_schema -->|"defines tables and view"| node_mysql

click node_generator "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/seed_data.py"
click node_schema "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/schema.sql"
click node_sqlshowcase "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/analysis.sql"
click node_routes "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/app.py"
click node_filtering "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/app.py"
click node_analytics "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/app.py"
click node_cache "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/app.py"
click node_dbaccess "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/db.py"
click node_page "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/templates/index.html"
click node_controls "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/static/app.js"
click node_metrics "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/static/app.js"
click node_charts "https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/static/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_generator,node_schema,node_mysql,node_sqlshowcase,node_visitor toneBlue
class node_routes,node_filtering,node_analytics,node_cache,node_dbaccess toneAmber
class node_page,node_controls,node_metrics,node_charts toneMint
```

## Components

### Data and analytics

- [Synthetic data generator](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/seed_data.py): `seed_data.py`
- [Trip data schema](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/schema.sql): `schema.sql`
- **MySQL database**
- [SQL query showcase](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/analysis.sql): `analysis.sql`

### Flask API

- [Dashboard and API routes](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/app.py): `app.py`
- [Filter validation](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/app.py): `app.py`
- [Analytics queries](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/app.py): `app.py`
- [Response cache](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/app.py): `app.py`
- [Database access](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/db.py): `db.py`

### Browser dashboard

- [Dashboard page](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/templates/index.html): `templates/index.html`
- [Tabs and filters](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/static/app.js): `static/app.js`
- [KPIs and findings](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/static/app.js): `static/app.js`
- [Analytics charts](https://github.com/aaryanverma17/ride-sharing-analytics/blob/main/static/app.js): `static/app.js`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Dashboard page: opens (evidence: `README.md`)
- Dashboard page → Tabs and filters: loads (evidence: `README.md`)
- Tabs and filters → Dashboard and API routes: requests analytics (evidence: `static/app.js`)
- Dashboard and API routes → Filter validation: validates filters (evidence: `app.py`)
- Dashboard and API routes → Response cache: checks cache (evidence: `app.py`)
- Dashboard and API routes → Analytics queries: builds dashboard (evidence: `app.py`)
- Analytics queries → Database access: opens connection (evidence: `app.py`)
- Database access → MySQL database: queries (evidence: `db.py`)
- Analytics queries → MySQL database: reads trip view (evidence: `app.py`)
- Dashboard and API routes → Dashboard page: renders page (evidence: `app.py`)
- Dashboard and API routes → Tabs and filters: returns JSON (evidence: `README.md`)
- Tabs and filters → KPIs and findings: renders (evidence: `static/app.js`)
- Tabs and filters → Analytics charts: renders (evidence: `static/app.js`)
- Synthetic data generator → Database access: uses connection (evidence: `seed_data.py`)
- Synthetic data generator → MySQL database: inserts generated data (evidence: `seed_data.py`)
- Trip data schema → MySQL database: defines tables and view (evidence: `README.md`)
