⚡ GPON System Architecture & Wiring Portal
8561
server.py Lines
4162
app.js Lines
51
API Endpoints
95
Frontend Functions
13
LocalStorage Keys
Backend Route Wiring & RBAC Access Matrix
| Method | Route Path | Lines | Handler Function | RBAC Security Gate |
|---|---|---|---|---|
| POST | /api/login | L1032-L1115 | login() |
Public/Session |
| POST | /api/logout | L1118-L1120 | api_logout() |
Public/Session |
| GET | /api/user-profile | L1123-L1156 | get_user_profile() |
require_any_auth |
| GET | /api/users | L1159-L1180 | get_users() |
require_admin_auth |
| POST | /api/users | L1183-L1252 | create_user() |
require_admin_auth |
| GET | /api/download-users-template | L1255-L1333 | download_users_template() |
Public/Session |
| POST | /api/upload-users-excel | L1336-L1490 | upload_users_excel() |
require_admin_auth |
| POST | /api/request-password-reset-otp | L1587-L1673 | request_password_reset_otp() |
Public/Session |
| POST | /api/test-smtp | L1676-L1772 | test_smtp_endpoint() |
require_super_admin_auth |
| POST | /api/verify-password-reset-otp | L1775-L1828 | verify_password_reset_otp() |
Public/Session |
| POST | /api/change-password | L1831-L1877 | change_password() |
require_any_auth |
| DELETE | /api/users/{username} | L1880-L1898 | delete_user() |
require_admin_auth |
| GET | /api/config/users | L1901-L1905 | export_users_config() |
require_super_admin_auth |
| POST | /api/config/users | L1908-L1920 | import_users_config() |
require_super_admin_auth |
| GET | /api/hierarchy | L1927-L1945 | get_hierarchy() |
Public/Session |
| POST | /api/upload-hierarchy | L1948-L1982 | upload_hierarchy() |
require_admin_auth |
| POST | /api/upload-hierarchy-excel | L1985-L2131 | upload_hierarchy_excel() |
require_admin_auth |
| POST | /api/hierarchy/olt | L2134-L2186 | save_or_edit_olt() |
require_admin_auth |
| DELETE | /api/hierarchy/olt | L2189-L2209 | delete_olt() |
require_admin_auth |
| POST | /api/hierarchy/bulk-delete | L2212-L2236 | bulk_delete_olts() |
require_admin_auth |
| DELETE | /api/hierarchy/clear | L2239-L2241 | clear_hierarchy() |
require_super_admin_auth |
| DELETE | /api/hierarchy/center | L2244-L2257 | delete_hierarchy_center() |
require_super_admin_auth |
| GET | /api/download-project-ppt | L2259-L2267 | download_project_ppt() |
Public/Session |
| GET | /api/backup-status | L2279-L2316 | get_backup_status() |
Public/Session |
| GET | /api/backup/config | L2319-L2341 | get_backup_config() |
require_admin_auth |
| POST | /api/backup/config | L2344-L2398 | save_backup_config_endpoint() |
require_super_admin_auth |
| POST | /api/backup/run-now | L2401-L2426 | run_backup_now_endpoint() |
require_super_admin_auth |
| GET | /api/backup/download-latest | L2429-L2443 | download_latest_backup_archive() |
require_admin_auth |
| GET | /api/backup/list | L2446-L2453 | list_local_backups_endpoint() |
require_admin_auth |
| POST | /api/backup/restore-local | L2456-L2488 | restore_local_backup_endpoint() |
require_super_admin_auth |
| POST | /api/backup/restore-upload | L2491-L2525 | restore_uploaded_backup_endpoint() |
require_super_admin_auth |
| GET | /api/download-hierarchy-template | L2528-L2565 | download_hierarchy_template() |
Public/Session |
| GET | /api/health | L2572-L2578 | health_check() |
Public/Session |
| GET | /api/surveyed-points | L2614-L2730 | get_surveyed_points() |
require_any_auth |
| POST | /api/sync | L2733-L2906 | sync_records() |
require_any_auth |
| GET | /api/records | L2910-L2973 | get_all_records() |
require_management_auth |
| PUT | /api/records/{client_uuid} | L2976-L3041 | update_survey_record() |
require_admin_auth |
| DELETE | /api/records/{client_uuid} | L3044-L3084 | delete_record() |
require_any_auth |
| POST | /api/records/bulk-delete | L3087-L3110 | bulk_delete_records() |
require_any_auth |
| POST | /api/records/clear-center | L3113-L3132 | clear_center_records() |
require_super_admin_auth |
| GET | /api/export-excel | L3135-L3173 | export_server_excel() |
require_management_auth |
| GET | /api/export-center-excel | L3176-L3261 | export_center_excel() |
require_export_auth |
| GET | /api/export-data-zip | L3264-L3336 | export_data_zip() |
require_management_auth |
| GET | /api/reports/catalog | L3350-L3352 | api_reports_catalog() |
require_export_auth |
| GET | /api/reports/download/{report_type} | L3355-L3402 | api_download_report() |
require_export_auth |
| POST | /api/upload-survey-excel | L3405-L3564 | upload_survey_excel() |
require_admin_auth |
| GET | /api/data-folders-summary | L3567-L3649 | get_data_folders_summary() |
require_management_auth |
| POST | /api/resync-data-folders | L3652-L3660 | resync_data_folders() |
require_admin_auth |
| GET | /docs/wiring | L3665-L3670 | get_wiring_report() |
Public/Session |
| GET | /manifest.json | L3673-L3685 | get_pwa_manifest() |
Public/Session |
| GET | /admin | L3689-L8553 | admin_dashboard() |
Public/Session |
💥 What Happens When Code Changes? (Blast Radius Analysis)
Cross-system impact prediction when modifying specific functions, lines, schemas, or storage keys.
| Component / Line Target | Action / Code Change | Blast Radius & Failure Cascades | Severity |
|---|---|---|---|
app.js L1090updateEnclosureId() |
Modifying calculation logic or regex pattern |
Compound Code Inconsistency: Breaks server-side validation in compute_server_enclosure_id(). PWA records get duplicated during sync. Excel exports display mismatched enclosure codes.
|
CRITICAL |
app.js L12STORAGE_KEY |
Renaming 'gpon_survey_records_v1' |
Total Field Data Isolation: Field surveyors lose access to pending offline records on device. App displays 0 records until key is restored. | CRITICAL |
server.py L379init_db() |
Renaming or deleting SQLite columns without ALTER TABLE |
Sync Crash & 500 Errors: Incoming survey sync payloads fail with sqlite3.OperationalError. PWA retry loop triggers exponential backoff.
|
CRITICAL |
server.py L285normalize_role() |
Modifying role strings or hierarchy tiers | Access Lockout / Privilege Escalation: ACSO or RCSM accounts get denied access to download endpoints, or Field Techs gain admin console permissions. | HIGH |
server.py L676build_excel_workbook() |
Reordering columns in in-memory streaming engine | Downstream Tooling Failure: SW Maps converter scripts and automated telecom reporting pipelines fail to parse columns by index. | HIGH |
PWA Geolocation, Storage & Synchronization Engine
| Storage Key | Location | Role in Offline Reliability |
|---|---|---|
| gpon_auth_token | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_custom_hierarchy | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_device_id | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_hierarchy_version | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_logged_in_user | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_network_surveyed_points | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_offline_user_ | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_pending_deletions | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_remember_creds | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_remembered_password | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_remembered_username | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_server_url | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
| gpon_session_expires_at | Client localStorage | Maintains state persistence across app restarts, reboots, and network disconnects. |
SQLite Schema & In-Memory Streaming Topology
Primary SQLite store: gpon_survey_data.db. Backed up dynamically to users_config.json and streamed on-the-fly via io.BytesIO.
-- Core Survey Records Table
CREATE TABLE survey_records (
client_uuid TEXT PRIMARY KEY,
region TEXT, center TEXT, rt_room TEXT, technology TEXT,
olt_name TEXT, port_number TEXT, kseb_post_number TEXT,
landmark TEXT, enclosure_number TEXT, enclosure_id TEXT,
lat_long TEXT, splitter_id TEXT, splitter_ratio TEXT,
customers_connected INTEGER DEFAULT 0,
device_id TEXT, created_at TEXT, synced_at TEXT,
surveyor_username TEXT, surveyor_name TEXT,
splitter_lead_color TEXT, adl_subscriber_id TEXT,
acs_subscriber_id TEXT, survey_date_time TEXT
);
Diagnostic Fault Trees & Recovery Runbooks
Technician Sync Failure Checklist:
- Verify local device Wi-Fi or cellular connectivity.
- Check server uptime via
GET /api/health. - Confirm session token validity; if expired, prompt user to log in again.
- Check SQLite lock state on server (inspect for hanging transactions).