# mrphoenix81/saws architecture

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

- Interactive diagram: https://gitdiagram.com/mrphoenix81/saws
- Repository: https://github.com/mrphoenix81/saws

## Overview

SDMS is a role-based student discontinuation and records-management app. Users work through the browser UI; requests reach a Flask API, which dispatches authentication, student workflows, and supporting operations against Neon-backed data. The principal discontinuation flow requires SCM submission, HOF and Manager input, then Head Office and Admin approval; inactive and transfer requests use separate Head Office-to-Admin workflows. The README also documents daily, write-only Google Sheets backups. Some frontend-to-API and unsampled feature links are documented rather than confirmed from implementation excerpts.

Main entry points: [`api.py`](https://github.com/mrphoenix81/saws/blob/main/api.py) (Action router), [`db_utils.py`](https://github.com/mrphoenix81/saws/blob/main/db_utils.py) (Data access and cache), [`frontend/src/App.tsx`](https://github.com/mrphoenix81/saws/blob/main/frontend/src/App.tsx) (Web app routes), [`students.py`](https://github.com/mrphoenix81/saws/blob/main/students.py) (Discontinuation workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser application"]
  node_webapp["Web app routes<br/>[App.tsx]"]
  node_studentui["Student records<br/>[Students.tsx]"]
  node_inactiveui["Inactive requests<br/>[Inactive.tsx]"]
  node_transferui["Transfers<br/>[Transfer.tsx]"]
  node_dataui["Data administration<br/>[Data.tsx]"]
  node_overviewui["Overview<br/>[Overview.tsx]"]
end

subgraph group_workflows["Student workflows"]
  node_discontinue["Discontinuation workflow<br/>[students.py]"]
  node_inactive["Inactive workflow<br/>[inactive.py]"]
  node_transfer["Transfer workflow<br/>[transfer.py]"]
end

subgraph group_services["API and services"]
  node_api["Action router<br/>[api.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_users["User management<br/>[users.py]"]
  node_branches["Branch management<br/>[branches.py]"]
  node_dashboard["Dashboard data<br/>[dashboard.py]"]
  node_bulk["Bulk operations<br/>[bulk.py]"]
  node_notifications["Notifications<br/>[notifications.py]"]
  node_audit["Audit log<br/>[audit_log.py]"]
  node_filters["Data filters<br/>[filters.py]"]
  node_storage["Screenshot storage<br/>[storage.py]"]
  node_config["System configuration<br/>[config.py]"]
  node_app["Flask application<br/>[app.py]"]
end

subgraph group_data["Persistence and backup"]
  node_dbutils["Data access and cache<br/>[db_utils.py]"]
  node_postgres[("Neon Postgres")]
  node_backup["Sheets backup"]
end

node_user(("Staff user"))
node_sheets[("Google Sheets")]

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_studentui
node_webapp -->|"routes to"| node_inactiveui
node_webapp -->|"routes to"| node_transferui
node_webapp -->|"routes to"| node_dataui
node_webapp -->|"routes to"| node_overviewui
node_webapp -->|"calls API"| node_api
node_app -->|"mounts"| node_api
node_api -->|"dispatches"| node_auth
node_api -->|"dispatches"| node_discontinue
node_api -->|"dispatches"| node_inactive
node_api -->|"dispatches"| node_transfer
node_api -->|"dispatches"| node_branches
node_api -->|"dispatches"| node_users
node_api -->|"dispatches"| node_dashboard
node_api -->|"dispatches"| node_bulk
node_api -->|"dispatches"| node_notifications
node_api -->|"dispatches"| node_audit
node_discontinue -->|"reads and writes"| node_dbutils
node_inactive -->|"reads and writes"| node_dbutils
node_transfer -->|"reads and writes"| node_dbutils
node_auth -->|"reads and writes"| node_dbutils
node_audit -->|"reads and writes"| node_dbutils
node_notifications -->|"reads and writes"| node_dbutils
node_dashboard -->|"reads"| node_dbutils
node_filters -->|"uses settings"| node_config
node_discontinue -->|"notifies roles"| node_notifications
node_inactive -->|"notifies roles"| node_notifications
node_transfer -->|"notifies roles"| node_notifications
node_discontinue -->|"logs actions"| node_audit
node_inactive -->|"logs actions"| node_audit
node_transfer -->|"logs actions"| node_audit
node_discontinue -->|"uploads screenshots"| node_storage
node_dbutils -->|"persists data"| node_postgres
node_backup -->|"reads snapshot"| node_dbutils
node_backup -->|"writes backup"| node_sheets
node_app -->|"initializes data"| node_dbutils
node_app -.->|"configures services"| node_config
node_app -->|"schedules optionally"| node_backup

click node_webapp "https://github.com/mrphoenix81/saws/blob/main/frontend/src/App.tsx"
click node_studentui "https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Students.tsx"
click node_inactiveui "https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Inactive.tsx"
click node_transferui "https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Transfer.tsx"
click node_dataui "https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Data.tsx"
click node_overviewui "https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Overview.tsx"
click node_discontinue "https://github.com/mrphoenix81/saws/blob/main/students.py"
click node_inactive "https://github.com/mrphoenix81/saws/blob/main/inactive.py"
click node_transfer "https://github.com/mrphoenix81/saws/blob/main/transfer.py"
click node_api "https://github.com/mrphoenix81/saws/blob/main/api.py"
click node_auth "https://github.com/mrphoenix81/saws/blob/main/auth.py"
click node_users "https://github.com/mrphoenix81/saws/blob/main/users.py"
click node_branches "https://github.com/mrphoenix81/saws/blob/main/branches.py"
click node_dashboard "https://github.com/mrphoenix81/saws/blob/main/dashboard.py"
click node_bulk "https://github.com/mrphoenix81/saws/blob/main/bulk.py"
click node_notifications "https://github.com/mrphoenix81/saws/blob/main/notifications.py"
click node_audit "https://github.com/mrphoenix81/saws/blob/main/audit_log.py"
click node_filters "https://github.com/mrphoenix81/saws/blob/main/filters.py"
click node_storage "https://github.com/mrphoenix81/saws/blob/main/storage.py"
click node_dbutils "https://github.com/mrphoenix81/saws/blob/main/db_utils.py"
click node_backup "https://github.com/mrphoenix81/saws/blob/main/backup_to_sheets.py"
click node_config "https://github.com/mrphoenix81/saws/blob/main/config.py"
click node_app "https://github.com/mrphoenix81/saws/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_webapp,node_studentui,node_inactiveui,node_transferui,node_dataui,node_overviewui,node_user toneBlue
class node_discontinue,node_inactive,node_transfer,node_sheets toneAmber
class node_api,node_auth,node_users,node_branches,node_dashboard,node_bulk,node_notifications,node_audit,node_filters,node_storage,node_config,node_app toneMint
class node_dbutils,node_postgres,node_backup toneRose
```

## Components

### Browser application

- [Web app routes](https://github.com/mrphoenix81/saws/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Student records](https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Students.tsx): `frontend/src/pages/Students.tsx`
- [Inactive requests](https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Inactive.tsx): `frontend/src/pages/Inactive.tsx`
- [Transfers](https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Transfer.tsx): `frontend/src/pages/Transfer.tsx`
- [Data administration](https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Data.tsx): `frontend/src/pages/Data.tsx`
- [Overview](https://github.com/mrphoenix81/saws/blob/main/frontend/src/pages/Overview.tsx): `frontend/src/pages/Overview.tsx`

### Student workflows

- [Discontinuation workflow](https://github.com/mrphoenix81/saws/blob/main/students.py): `students.py`
- [Inactive workflow](https://github.com/mrphoenix81/saws/blob/main/inactive.py): `inactive.py`
- [Transfer workflow](https://github.com/mrphoenix81/saws/blob/main/transfer.py): `transfer.py`

### API and services

- [Action router](https://github.com/mrphoenix81/saws/blob/main/api.py): `api.py`
- [Authentication](https://github.com/mrphoenix81/saws/blob/main/auth.py): `auth.py`
- [User management](https://github.com/mrphoenix81/saws/blob/main/users.py): `users.py`
- [Branch management](https://github.com/mrphoenix81/saws/blob/main/branches.py): `branches.py`
- [Dashboard data](https://github.com/mrphoenix81/saws/blob/main/dashboard.py): `dashboard.py`
- [Bulk operations](https://github.com/mrphoenix81/saws/blob/main/bulk.py): `bulk.py`
- [Notifications](https://github.com/mrphoenix81/saws/blob/main/notifications.py): `notifications.py`
- [Audit log](https://github.com/mrphoenix81/saws/blob/main/audit_log.py): `audit_log.py`
- [Data filters](https://github.com/mrphoenix81/saws/blob/main/filters.py): `filters.py`
- [Screenshot storage](https://github.com/mrphoenix81/saws/blob/main/storage.py): `storage.py`
- [System configuration](https://github.com/mrphoenix81/saws/blob/main/config.py): `config.py`
- [Flask application](https://github.com/mrphoenix81/saws/blob/main/app.py): `app.py`

### Persistence and backup

- [Data access and cache](https://github.com/mrphoenix81/saws/blob/main/db_utils.py): `db_utils.py`
- **Neon Postgres**
- [Sheets backup](https://github.com/mrphoenix81/saws/blob/main/backup_to_sheets.py): `backup_to_sheets.py`

### Other components

- **Staff user**
- **Google Sheets**

## Connections

- Staff user → Web app routes: uses (evidence: `README.md`)
- Web app routes → Student records: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Inactive requests: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Transfers: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Data administration: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Overview: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Action router: calls API
- Flask application → Action router: mounts (evidence: `app.py`)
- Action router → Authentication: dispatches (evidence: `api.py`)
- Action router → Discontinuation workflow: dispatches (evidence: `api.py`)
- Action router → Inactive workflow: dispatches (evidence: `api.py`)
- Action router → Transfer workflow: dispatches (evidence: `api.py`)
- Action router → Branch management: dispatches (evidence: `api.py`)
- Action router → User management: dispatches (evidence: `api.py`)
- Action router → Dashboard data: dispatches (evidence: `api.py`)
- Action router → Bulk operations: dispatches (evidence: `api.py`)
- Action router → Notifications: dispatches (evidence: `api.py`)
- Action router → Audit log: dispatches (evidence: `api.py`)
- Discontinuation workflow → Data access and cache: reads and writes (evidence: `students.py`)
- Inactive workflow → Data access and cache: reads and writes (evidence: `inactive.py`)
- Transfer workflow → Data access and cache: reads and writes (evidence: `transfer.py`)
- Authentication → Data access and cache: reads and writes (evidence: `auth.py`)
- Audit log → Data access and cache: reads and writes (evidence: `audit_log.py`)
- Notifications → Data access and cache: reads and writes (evidence: `notifications.py`)
- Dashboard data → Data access and cache: reads (evidence: `dashboard.py`)
- Data filters → System configuration: uses settings (evidence: `filters.py`)
- Discontinuation workflow → Notifications: notifies roles (evidence: `students.py`)
- Inactive workflow → Notifications: notifies roles (evidence: `inactive.py`)
- Transfer workflow → Notifications: notifies roles (evidence: `transfer.py`)
- Discontinuation workflow → Audit log: logs actions (evidence: `students.py`)
- Inactive workflow → Audit log: logs actions (evidence: `inactive.py`)
- Transfer workflow → Audit log: logs actions (evidence: `transfer.py`)
- Discontinuation workflow → Screenshot storage: uploads screenshots (evidence: `students.py`)
- Data access and cache → Neon Postgres: persists data (evidence: `README.md`)
- Sheets backup → Data access and cache: reads snapshot (evidence: `backup_to_sheets.py`)
- Sheets backup → Google Sheets: writes backup (evidence: `README.md`)
- Flask application → Data access and cache: initializes data (evidence: `app.py`)
- Flask application → System configuration: configures services
- Flask application → Sheets backup: schedules optionally (evidence: `app.py`)
