# thenabbu/opensrm architecture

> Architecture diagram of the GitHub repository thenabbu/opensrm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thenabbu/opensrm
- Repository: https://github.com/thenabbu/opensrm

## Overview

OpenSRM is a self-hosted student dashboard that combines two independent SRM sources in one SQLite-backed web app. The main workflow is portal login and sync plus optional SCOPE sync, followed by rendering stored data into dashboard and feature views; push reminders are a separate capability. The README documents the two-source storage and major surfaces. Source excerpts show selected routing, parsing, storage, and view behavior; unsampled wiring is not asserted beyond documented relationships.

Main entry points: [`app/views/dashboard.py`](https://github.com/thenabbu/opensrm/blob/main/app/views/dashboard.py) (Dashboard assembly), [`app/routes_sync.py`](https://github.com/thenabbu/opensrm/blob/main/app/routes_sync.py) (Sync routes), [`app/http_scraper.py`](https://github.com/thenabbu/opensrm/blob/main/app/http_scraper.py) (Portal scraper), [`app/scope_sync.py`](https://github.com/thenabbu/opensrm/blob/main/app/scope_sync.py) (SCOPE sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_flask["Web app<br/>[app.py]"]
  node_login["Login and sessions<br/>[auth.py]"]
  node_sync_routes["Sync routes<br/>[routes_sync.py]"]
  node_push_routes["Push API and tick<br/>[routes_push.py]"]
end

subgraph group_portal["Student Portal"]
  node_scraper["Portal scraper<br/>[http_scraper.py]"]
  node_portal_parsers["Portal parsers"]
  node_timetable_parser["Timetable parser<br/>[timetable.py]"]
end

subgraph group_scope["SCOPE integration"]
  node_scope_sync["SCOPE sync<br/>[scope_sync.py]"]
  node_scope_ops["SCOPE operations<br/>[ops.py]"]
  node_scope_client["SCOPE client<br/>[client.py]"]
end

subgraph group_data["Student data"]
  node_database[("SQLite student store<br/>[db.py]")]
  node_push_store["Push subscription store<br/>[push_store.py]"]
end

subgraph group_features["Dashboard features"]
  node_dashboard["Dashboard assembly<br/>[dashboard.py]"]
  node_attendance["Attendance views<br/>[attendance.py]"]
  node_timetable["Timetable views<br/>[timetable.py]"]
  node_ticker["Class ticker<br/>[ticker.py]"]
  node_academics["Academics views<br/>[academics.py]"]
  node_fees["Fees views<br/>[fees.py]"]
  node_push_calc["Reminder calculation<br/>[push_calc.py]"]
  node_push_send["Push delivery<br/>[push_send.py]"]
end

node_student(("Student"))
node_portal_service["Student Portal"]
node_scope_service["SCOPE backend"]

node_student -->|"uses"| node_flask
node_flask -->|"authenticates"| node_login
node_flask -->|"routes requests"| node_sync_routes
node_sync_routes -.->|"runs portal sync"| node_scraper
node_scraper -->|"scrapes HTML"| node_portal_service
node_scraper -.->|"parses responses"| node_portal_parsers
node_scraper -.->|"parses timetable"| node_timetable_parser
node_sync_routes -->|"starts SCOPE sync"| node_scope_sync
node_scope_sync -->|"selects operations"| node_scope_ops
node_scope_sync -.->|"uses client"| node_scope_client
node_scope_client -->|"calls SOAP API"| node_scope_service
node_sync_routes -->|"stores sync data"| node_database
node_scope_sync -->|"stores SCOPE data"| node_database
node_dashboard -->|"reads student data"| node_database
node_dashboard -->|"uses view model"| node_attendance
node_dashboard -->|"builds academics view"| node_academics
node_dashboard -->|"builds fees view"| node_fees
node_dashboard -.->|"renders timetable"| node_timetable
node_timetable -->|"uses ticker helpers"| node_ticker
node_push_routes -->|"calculates reminders"| node_push_calc
node_push_routes -->|"reads and records"| node_push_store
node_push_routes -->|"sends notifications"| node_push_send
node_push_send -.->|"delivers reminders"| node_student

click node_flask "https://github.com/thenabbu/opensrm/blob/main/app/app.py"
click node_login "https://github.com/thenabbu/opensrm/blob/main/app/auth.py"
click node_sync_routes "https://github.com/thenabbu/opensrm/blob/main/app/routes_sync.py"
click node_scraper "https://github.com/thenabbu/opensrm/blob/main/app/http_scraper.py"
click node_portal_parsers "https://github.com/thenabbu/opensrm/tree/main/app/portal/parsers"
click node_timetable_parser "https://github.com/thenabbu/opensrm/blob/main/app/portal/parsers/timetable.py"
click node_scope_sync "https://github.com/thenabbu/opensrm/blob/main/app/scope_sync.py"
click node_scope_ops "https://github.com/thenabbu/opensrm/blob/main/app/scope/ops.py"
click node_scope_client "https://github.com/thenabbu/opensrm/blob/main/app/scope/client.py"
click node_database "https://github.com/thenabbu/opensrm/blob/main/app/db.py"
click node_dashboard "https://github.com/thenabbu/opensrm/blob/main/app/views/dashboard.py"
click node_attendance "https://github.com/thenabbu/opensrm/blob/main/app/views/attendance.py"
click node_timetable "https://github.com/thenabbu/opensrm/blob/main/app/views/timetable.py"
click node_ticker "https://github.com/thenabbu/opensrm/blob/main/app/views/ticker.py"
click node_academics "https://github.com/thenabbu/opensrm/blob/main/app/views/academics.py"
click node_fees "https://github.com/thenabbu/opensrm/blob/main/app/views/fees.py"
click node_push_routes "https://github.com/thenabbu/opensrm/blob/main/app/routes_push.py"
click node_push_calc "https://github.com/thenabbu/opensrm/blob/main/app/push_calc.py"
click node_push_send "https://github.com/thenabbu/opensrm/blob/main/app/push_send.py"
click node_push_store "https://github.com/thenabbu/opensrm/blob/main/app/push_store.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_flask,node_login,node_sync_routes,node_push_routes toneBlue
class node_scraper,node_portal_parsers,node_timetable_parser toneAmber
class node_scope_sync,node_scope_ops,node_scope_client toneMint
class node_database,node_push_store toneRose
class node_dashboard,node_attendance,node_timetable,node_ticker,node_academics,node_fees,node_push_calc,node_push_send,node_student,node_portal_service,node_scope_service toneIndigo
```

## Components

### Web application

- [Web app](https://github.com/thenabbu/opensrm/blob/main/app/app.py): `app/app.py`
- [Login and sessions](https://github.com/thenabbu/opensrm/blob/main/app/auth.py): `app/auth.py`
- [Sync routes](https://github.com/thenabbu/opensrm/blob/main/app/routes_sync.py): `app/routes_sync.py`
- [Push API and tick](https://github.com/thenabbu/opensrm/blob/main/app/routes_push.py): `app/routes_push.py`

### Student Portal

- [Portal scraper](https://github.com/thenabbu/opensrm/blob/main/app/http_scraper.py): `app/http_scraper.py`
- [Portal parsers](https://github.com/thenabbu/opensrm/tree/main/app/portal/parsers): `app/portal/parsers`
- [Timetable parser](https://github.com/thenabbu/opensrm/blob/main/app/portal/parsers/timetable.py): `app/portal/parsers/timetable.py`

### SCOPE integration

- [SCOPE sync](https://github.com/thenabbu/opensrm/blob/main/app/scope_sync.py): `app/scope_sync.py`
- [SCOPE operations](https://github.com/thenabbu/opensrm/blob/main/app/scope/ops.py): `app/scope/ops.py`
- [SCOPE client](https://github.com/thenabbu/opensrm/blob/main/app/scope/client.py): `app/scope/client.py`

### Student data

- [SQLite student store](https://github.com/thenabbu/opensrm/blob/main/app/db.py): `app/db.py`
- [Push subscription store](https://github.com/thenabbu/opensrm/blob/main/app/push_store.py): `app/push_store.py`

### Dashboard features

- [Dashboard assembly](https://github.com/thenabbu/opensrm/blob/main/app/views/dashboard.py): `app/views/dashboard.py`
- [Attendance views](https://github.com/thenabbu/opensrm/blob/main/app/views/attendance.py): `app/views/attendance.py`
- [Timetable views](https://github.com/thenabbu/opensrm/blob/main/app/views/timetable.py): `app/views/timetable.py`
- [Class ticker](https://github.com/thenabbu/opensrm/blob/main/app/views/ticker.py): `app/views/ticker.py`
- [Academics views](https://github.com/thenabbu/opensrm/blob/main/app/views/academics.py): `app/views/academics.py`
- [Fees views](https://github.com/thenabbu/opensrm/blob/main/app/views/fees.py): `app/views/fees.py`
- [Reminder calculation](https://github.com/thenabbu/opensrm/blob/main/app/push_calc.py): `app/push_calc.py`
- [Push delivery](https://github.com/thenabbu/opensrm/blob/main/app/push_send.py): `app/push_send.py`

### Other components

- **Student**
- **Student Portal**
- **SCOPE backend**

## Connections

- Student → Web app: uses
- Web app → Login and sessions: authenticates (evidence: `app/app.py`)
- Web app → Sync routes: routes requests (evidence: `app/app.py`)
- Sync routes → Portal scraper: runs portal sync (evidence: `app/routes_sync.py`)
- Portal scraper → Student Portal: scrapes HTML
- Portal scraper → Portal parsers: parses responses
- Portal scraper → Timetable parser: parses timetable
- Sync routes → SCOPE sync: starts SCOPE sync (evidence: `app/routes_sync.py`)
- SCOPE sync → SCOPE operations: selects operations (evidence: `app/scope_sync.py`)
- SCOPE sync → SCOPE client: uses client
- SCOPE client → SCOPE backend: calls SOAP API
- Sync routes → SQLite student store: stores sync data (evidence: `app/routes_sync.py`)
- SCOPE sync → SQLite student store: stores SCOPE data (evidence: `app/scope_sync.py`)
- Dashboard assembly → SQLite student store: reads student data (evidence: `app/views/dashboard.py`)
- Dashboard assembly → Attendance views: uses view model (evidence: `app/views/dashboard.py`)
- Dashboard assembly → Academics views: builds academics view (evidence: `app/views/dashboard.py`)
- Dashboard assembly → Fees views: builds fees view (evidence: `app/views/dashboard.py`)
- Dashboard assembly → Timetable views: renders timetable (evidence: `app/views/dashboard.py`)
- Timetable views → Class ticker: uses ticker helpers (evidence: `app/views/timetable.py`)
- Push API and tick → Reminder calculation: calculates reminders (evidence: `app/routes_push.py`)
- Push API and tick → Push subscription store: reads and records (evidence: `app/routes_push.py`)
- Push API and tick → Push delivery: sends notifications (evidence: `app/routes_push.py`)
- Push delivery → Student: delivers reminders
