# gandamallapradyumn/server---copy--2- architecture

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

- Interactive diagram: https://gitdiagram.com/gandamallapradyumn/server---copy--2-
- Repository: https://github.com/gandamallapradyumn/server---copy--2-

## Overview

TGSRTC’s platform serves role-based operational portals, analytics and forecasts, an AI insights API, and a T+2 scheduling workflow. The graph preserves the documented capabilities and principal stages; unsampled links are included only where the README or source index supports them. Several implementation details and dashboard-to-data relationships were not shown, so those connections are omitted rather than inferred.

Main entry points: [`login.py`](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/login.py) (Role-based dashboard), [`dynamic_scheduling_master/app.py`](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/app.py) (Scheduling interface), [`depot_dashboard_dm.py`](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/depot_dashboard_dm.py) (Depot dashboards), [`dynamic_scheduling_master/src/dynamic_scheduling/data_pipeline.py`](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/src/dynamic_scheduling/data_pipeline.py) (Operations ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portals["User portals"]
  node_login["Role-based dashboard<br/>[login.py]"]
  node_admin_portal["Admin portal<br/>[app_ui_admin.py]"]
  node_depot_portal["Depot portal<br/>[depot_UI.py]"]
  node_depot_analytics["Depot dashboards"]
  node_driver_analytics["Driver dashboards"]
end

subgraph group_operations["Operations analytics"]
  node_daily_inputs["Tiered operational inputs<br/>[Input_Data_DM.py]"]
  node_ratios["Core ratio analytics<br/>[eight_ratios_DM.py]"]
  node_action_plans["Action planning<br/>[action_plan.py]"]
  node_service_cuts["Service cut analysis"]
end

subgraph group_scheduling["Dynamic scheduling"]
  node_scheduler_ui["Scheduling interface<br/>[app.py]"]
  node_ingestion["Operations ingestion<br/>[data_pipeline.py]"]
  node_demand["T+2 demand prediction"]
  node_supply["Supply policy engine"]
  node_schedule_dashboard["Schedule and accuracy views"]
end

subgraph group_intelligence["AI and forecasting"]
  node_forecast["KMs and hours forecasts<br/>[kms_hrs.py]"]
  node_rag_prep["RAG document preparation"]
  node_retriever["Vector retrieval<br/>[retriever.py]"]
  node_insights_api["Operational insights API<br/>[app.py]"]
  node_llm{{"Groq language models"}}
end

subgraph group_platform["Data and security"]
  node_etl["Daily ETL<br/>[Etl_main.py]"]
  node_database[("MySQL database")]
  node_auth["Authentication<br/>[auth.py]"]
end

node_corporation(("Corporation users"))
node_regional(("Regional managers"))
node_depot_manager(("Depot managers"))
node_admin_user(("Administrators"))

node_corporation -->|"uses portal"| node_login
node_regional -->|"uses portal"| node_login
node_depot_manager -->|"uses portal"| node_login
node_admin_user -->|"uses portal"| node_admin_portal
node_login -->|"authenticates"| node_auth
node_login -->|"dispatches to"| node_depot_portal
node_login -->|"dispatches to"| node_depot_analytics
node_login -->|"dispatches to"| node_driver_analytics
node_login -->|"dispatches to"| node_admin_portal
node_daily_inputs -->|"checks access"| node_auth
node_etl -->|"loads operations"| node_database
node_etl -.->|"builds analytics data"| node_corporation
node_depot_analytics -.->|"presents KPIs"| node_ratios
node_depot_analytics -.->|"presents cut analysis"| node_service_cuts
node_action_plans -->|"stores plans"| node_database
node_database -->|"supplies operational data"| node_ratios
node_database -->|"supplies source data"| node_rag_prep
node_scheduler_ui -->|"runs pipeline"| node_ingestion
node_scheduler_ui -->|"runs prediction"| node_demand
node_scheduler_ui -->|"runs scheduling"| node_supply
node_scheduler_ui -->|"shows comparisons"| node_schedule_dashboard
node_ingestion -->|"upserts raw data"| node_database
node_ingestion -.->|"builds prediction data"| node_demand
node_demand -->|"provides demand"| node_supply
node_supply -.->|"provides schedules"| node_schedule_dashboard
node_forecast -->|"serves forecast views"| node_login
node_rag_prep -->|"prepares retrieval corpus"| node_retriever
node_retriever -->|"retrieves context"| node_insights_api
node_insights_api -->|"requests reasoning"| node_llm

click node_login "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/login.py"
click node_admin_portal "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/app_ui_admin.py"
click node_depot_portal "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/depot_UI.py"
click node_depot_analytics "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/depot_dashboard_dm.py"
click node_driver_analytics "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/driver_dashboard_DM.py"
click node_daily_inputs "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/Input_Data_DM.py"
click node_ratios "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/eight_ratios_DM.py"
click node_action_plans "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/action_plan.py"
click node_service_cuts "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/krmr_cut_services_analysis.py"
click node_etl "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/Etl_main.py"
click node_auth "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/auth.py"
click node_scheduler_ui "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/app.py"
click node_ingestion "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/src/dynamic_scheduling/data_pipeline.py"
click node_demand "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/src/dynamic_scheduling/demand_prediction.py"
click node_supply "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/src/dynamic_scheduling/supply_scheduling.py"
click node_schedule_dashboard "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/src/dynamic_scheduling/prediction_vs_actual.py"
click node_forecast "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/kms_hrs.py"
click node_rag_prep "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/create_rag_documents.py"
click node_retriever "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/retriever.py"
click node_insights_api "https://github.com/gandamallapradyumn/server---copy--2-/blob/main/app.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_login,node_admin_portal,node_depot_portal,node_depot_analytics,node_driver_analytics,node_corporation toneBlue
class node_daily_inputs,node_ratios,node_action_plans,node_service_cuts toneAmber
class node_scheduler_ui,node_ingestion,node_demand,node_supply,node_schedule_dashboard toneMint
class node_forecast,node_rag_prep,node_retriever,node_insights_api,node_llm toneRose
class node_etl,node_database,node_auth,node_regional,node_depot_manager,node_admin_user toneIndigo
```

## Components

### User portals

- [Role-based dashboard](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/login.py): `login.py`
- [Admin portal](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/app_ui_admin.py): `app_ui_admin.py`
- [Depot portal](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/depot_UI.py): `depot_UI.py`
- [Depot dashboards](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/depot_dashboard_dm.py): `depot_dashboard_dm.py`
- [Driver dashboards](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/driver_dashboard_DM.py): `driver_dashboard_DM.py`

### Operations analytics

- [Tiered operational inputs](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/Input_Data_DM.py): `Input_Data_DM.py`
- [Core ratio analytics](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/eight_ratios_DM.py): `eight_ratios_DM.py`
- [Action planning](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/action_plan.py): `action_plan.py`
- [Service cut analysis](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/krmr_cut_services_analysis.py): `krmr_cut_services_analysis.py`

### Dynamic scheduling

- [Scheduling interface](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/app.py): `dynamic_scheduling_master/app.py`
- [Operations ingestion](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/src/dynamic_scheduling/data_pipeline.py): `dynamic_scheduling_master/src/dynamic_scheduling/data_pipeline.py`
- [T+2 demand prediction](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/src/dynamic_scheduling/demand_prediction.py): `dynamic_scheduling_master/src/dynamic_scheduling/demand_prediction.py`
- [Supply policy engine](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/src/dynamic_scheduling/supply_scheduling.py): `dynamic_scheduling_master/src/dynamic_scheduling/supply_scheduling.py`
- [Schedule and accuracy views](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/dynamic_scheduling_master/src/dynamic_scheduling/prediction_vs_actual.py): `dynamic_scheduling_master/src/dynamic_scheduling/prediction_vs_actual.py`

### AI and forecasting

- [KMs and hours forecasts](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/kms_hrs.py): `kms_hrs.py`
- [RAG document preparation](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/create_rag_documents.py): `create_rag_documents.py`
- [Vector retrieval](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/retriever.py): `retriever.py`
- [Operational insights API](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/app.py): `app.py`
- **Groq language models**

### Data and security

- [Daily ETL](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/Etl_main.py): `Etl_main.py`
- **MySQL database**
- [Authentication](https://github.com/gandamallapradyumn/server---copy--2-/blob/main/auth.py): `auth.py`

### Other components

- **Corporation users**
- **Regional managers**
- **Depot managers**
- **Administrators**

## Connections

- Corporation users → Role-based dashboard: uses portal
- Regional managers → Role-based dashboard: uses portal
- Depot managers → Role-based dashboard: uses portal
- Administrators → Admin portal: uses portal
- Role-based dashboard → Authentication: authenticates (evidence: `login.py`)
- Role-based dashboard → Depot portal: dispatches to (evidence: `login.py`)
- Role-based dashboard → Depot dashboards: dispatches to (evidence: `login.py`)
- Role-based dashboard → Driver dashboards: dispatches to (evidence: `login.py`)
- Role-based dashboard → Admin portal: dispatches to
- Tiered operational inputs → Authentication: checks access (evidence: `Input_Data_DM.py`)
- Daily ETL → MySQL database: loads operations
- Daily ETL → Corporation users: builds analytics data
- Depot dashboards → Core ratio analytics: presents KPIs
- Depot dashboards → Service cut analysis: presents cut analysis
- Action planning → MySQL database: stores plans
- MySQL database → Core ratio analytics: supplies operational data
- MySQL database → RAG document preparation: supplies source data
- Scheduling interface → Operations ingestion: runs pipeline (evidence: `dynamic_scheduling_master/app.py`)
- Scheduling interface → T+2 demand prediction: runs prediction (evidence: `dynamic_scheduling_master/app.py`)
- Scheduling interface → Supply policy engine: runs scheduling (evidence: `dynamic_scheduling_master/app.py`)
- Scheduling interface → Schedule and accuracy views: shows comparisons (evidence: `dynamic_scheduling_master/app.py`)
- Operations ingestion → MySQL database: upserts raw data (evidence: `dynamic_scheduling_master/src/dynamic_scheduling/data_pipeline.py`)
- Operations ingestion → T+2 demand prediction: builds prediction data
- T+2 demand prediction → Supply policy engine: provides demand
- Supply policy engine → Schedule and accuracy views: provides schedules
- KMs and hours forecasts → Role-based dashboard: serves forecast views (evidence: `login.py`)
- RAG document preparation → Vector retrieval: prepares retrieval corpus
- Vector retrieval → Operational insights API: retrieves context
- Operational insights API → Groq language models: requests reasoning
