# kothavivek55/churn-prediction-intervention architecture

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

- Interactive diagram: https://gitdiagram.com/kothavivek55/churn-prediction-intervention
- Repository: https://github.com/kothavivek55/churn-prediction-intervention

## Overview

This repository combines school analytics dashboards with a Node.js account and intervention API. The primary workflow is an administrator using the frontend to open an analytics tool, upload school data, and review churn-risk or growth results; high-risk cases can lead to a WhatsApp intervention. The README describes a reverse-proxy deployment, but the sampled server code instead exposes hosted analytics URLs, so the graph avoids asserting a working proxy. Some revenue and deployment wiring is unsampled; uncertain links are omitted.

Main entry points: [`ai_school/main_app.py`](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/ai_school/main_app.py) (Analytics tabs), [`backend/server.js`](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/server.js) (Express server), [`backend/controllers/whatsappController.js`](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/controllers/whatsappController.js) (Alert generation), [`backend/routes/whatsappRoutes.js`](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/routes/whatsappRoutes.js) (WhatsApp route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Admin interface"]
  node_frontend["Web dashboard<br/>[index.html]"]
  node_frontend_js["Dashboard logic<br/>[script.js]"]
end

subgraph group_analytics["School analytics"]
  node_python_hub["Analytics tabs<br/>[main_app.py]"]
  node_churn["Churn analysis<br/>[app.py]"]
  node_growth["Growth analytics"]
  node_future["Future forecast<br/>[dashboard.py]"]
  node_revenue_dashboard["Revenue comparison"]
  node_prediction_dashboard["Revenue prediction UI<br/>[dashboard.py]"]
  node_prediction_model["Prediction model<br/>[model.py]"]
  node_prediction_data["Prediction dataset<br/>[dataset.py]"]
end

subgraph group_backend["API and accounts"]
  node_node_server["Express server<br/>[server.js]"]
  node_auth_routes["Auth routes<br/>[authRoutes.js]"]
  node_auth_controller["Authentication<br/>[authController.js]"]
  node_user_model["User records<br/>[User.js]"]
end

subgraph group_intervention["Parent intervention"]
  node_wa_routes["WhatsApp route<br/>[whatsappRoutes.js]"]
  node_wa_controller["Alert generation"]
end

node_admin(("School admin"))
node_mongodb[("MongoDB")]
node_parent(("Student parent"))
node_tmpfiles["Temporary file host"]
node_twilio["Twilio WhatsApp"]

node_admin -->|"uses"| node_frontend
node_frontend -->|"loads"| node_frontend_js
node_frontend_js -.->|"requests config"| node_node_server
node_node_server -->|"mounts"| node_auth_routes
node_node_server -->|"mounts"| node_wa_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"reads and saves"| node_user_model
node_node_server -->|"connects"| node_mongodb
node_wa_routes -->|"dispatches"| node_wa_controller
node_admin -.->|"opens analytics"| node_python_hub
node_python_hub -->|"creates tab"| node_churn
node_python_hub -->|"creates tab"| node_growth
node_python_hub -->|"creates tab"| node_future
node_admin -->|"uploads data"| node_revenue_dashboard
node_admin -.->|"uploads data"| node_prediction_dashboard
node_churn -.->|"requests alert"| node_wa_routes
node_wa_controller -->|"uploads PDF"| node_tmpfiles
node_wa_controller -->|"sends message"| node_twilio
node_twilio -->|"delivers report"| node_parent

click node_frontend "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/public/index.html"
click node_frontend_js "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/public/script.js"
click node_node_server "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/server.js"
click node_auth_routes "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/routes/authRoutes.js"
click node_auth_controller "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/controllers/authController.js"
click node_user_model "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/models/User.js"
click node_wa_routes "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/routes/whatsappRoutes.js"
click node_wa_controller "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/controllers/whatsappController.js"
click node_python_hub "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/ai_school/main_app.py"
click node_churn "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/ai_school/churn/app.py"
click node_growth "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/ai_school/growth/revenue_dashboard.py"
click node_future "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/ai_school/future/dashboard.py"
click node_revenue_dashboard "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/revenue/revenue_dashboard.py"
click node_prediction_dashboard "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/revenue/revenue_prediction/dashboard.py"
click node_prediction_model "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/revenue/revenue_prediction/model.py"
click node_prediction_data "https://github.com/kothavivek55/churn-prediction-intervention/blob/main/revenue/revenue_prediction/dataset.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_frontend,node_frontend_js toneBlue
class node_python_hub,node_churn,node_growth,node_future,node_revenue_dashboard,node_prediction_dashboard,node_prediction_model,node_prediction_data,node_mongodb toneAmber
class node_node_server,node_auth_routes,node_auth_controller,node_user_model toneMint
class node_wa_routes,node_wa_controller toneRose
class node_admin,node_parent,node_tmpfiles,node_twilio toneIndigo
```

## Components

### Admin interface

- [Web dashboard](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/public/index.html): `backend/public/index.html`
- [Dashboard logic](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/public/script.js): `backend/public/script.js`

### School analytics

- [Analytics tabs](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/ai_school/main_app.py): `ai_school/main_app.py`
- [Churn analysis](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/ai_school/churn/app.py): `ai_school/churn/app.py`
- [Growth analytics](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/ai_school/growth/revenue_dashboard.py): `ai_school/growth/revenue_dashboard.py`
- [Future forecast](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/ai_school/future/dashboard.py): `ai_school/future/dashboard.py`
- [Revenue comparison](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/revenue/revenue_dashboard.py): `revenue/revenue_dashboard.py`
- [Revenue prediction UI](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/revenue/revenue_prediction/dashboard.py): `revenue/revenue_prediction/dashboard.py`
- [Prediction model](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/revenue/revenue_prediction/model.py): `revenue/revenue_prediction/model.py`
- [Prediction dataset](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/revenue/revenue_prediction/dataset.py): `revenue/revenue_prediction/dataset.py`

### API and accounts

- [Express server](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/server.js): `backend/server.js`
- [Auth routes](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Authentication](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [User records](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/models/User.js): `backend/models/User.js`

### Parent intervention

- [WhatsApp route](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/routes/whatsappRoutes.js): `backend/routes/whatsappRoutes.js`
- [Alert generation](https://github.com/kothavivek55/churn-prediction-intervention/blob/main/backend/controllers/whatsappController.js): `backend/controllers/whatsappController.js`

### Other components

- **School admin**
- **MongoDB**
- **Student parent**
- **Temporary file host**
- **Twilio WhatsApp**

## Connections

- School admin → Web dashboard: uses (evidence: `README.md`)
- Web dashboard → Dashboard logic: loads
- Dashboard logic → Express server: requests config
- Express server → Auth routes: mounts (evidence: `backend/server.js`)
- Express server → WhatsApp route: mounts (evidence: `backend/server.js`)
- Auth routes → Authentication: dispatches (evidence: `backend/routes/authRoutes.js`)
- Authentication → User records: reads and saves (evidence: `backend/controllers/authController.js`)
- Express server → MongoDB: connects (evidence: `backend/server.js`)
- WhatsApp route → Alert generation: dispatches (evidence: `backend/routes/whatsappRoutes.js`)
- School admin → Analytics tabs: opens analytics
- Analytics tabs → Churn analysis: creates tab (evidence: `ai_school/main_app.py`)
- Analytics tabs → Growth analytics: creates tab (evidence: `ai_school/main_app.py`)
- Analytics tabs → Future forecast: creates tab (evidence: `ai_school/main_app.py`)
- School admin → Revenue comparison: uploads data (evidence: `revenue/revenue_dashboard.py`)
- School admin → Revenue prediction UI: uploads data
- Churn analysis → WhatsApp route: requests alert (evidence: `README.md`)
- Alert generation → Temporary file host: uploads PDF (evidence: `backend/controllers/whatsappController.js`)
- Alert generation → Twilio WhatsApp: sends message (evidence: `backend/controllers/whatsappController.js`)
- Twilio WhatsApp → Student parent: delivers report (evidence: `README.md`)
