# sahana-bs-dev/student_refund_portal architecture

> Architecture diagram of the GitHub repository sahana-bs-dev/student_refund_portal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sahana-bs-dev/student_refund_portal
- Repository: https://github.com/sahana-bs-dev/student_refund_portal

## Overview

This is a campus event-permission and student-grant/refund portal, with student, HOD, and administrator workflows. Students apply for event permission and refunds; HODs review requests (including department-level team decisions), and administrators manage payment, records, and academic-year rollover. The tree and excerpts support distinct permission, refund, review, reporting, and maintenance areas. UI-to-endpoint wiring is not established by the available excerpts, so those links are shown as unverified; several backend modules are represented by their exact paths without assuming their internal behavior.

Main entry points: [`backend/db.php`](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/db.php) (Application database), [`backend/academic_lib.php`](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/academic_lib.php) (Academic-year rules), [`student/student.js`](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/student/student.js) (Student portal), [`backend/refund_lib.php`](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/refund_lib.php) (Refund allocation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Role interfaces"]
  node_student["Student portal<br/>[student.js]"]
  node_hod["HOD portal<br/>[hod.js]"]
  node_admin["Admin portal<br/>[admin.js]"]
end

subgraph group_permissions["Event permissions"]
  node_permission_apply["Permission application"]
  node_permission_actions["HOD permission review<br/>[hod_action.php]"]
  node_permission_logic["Permission rules<br/>[permission_lib.php]"]
  node_permission_reads["Permission queries"]
  node_permission_view["Request listing<br/>[view_requests.php]"]
  node_event_checks["Event checks"]
end

subgraph group_refunds["Refund processing"]
  node_refund_apply["Refund application<br/>[apply_refund.php]"]
  node_refund_actions["Refund decisions"]
  node_refund_logic["Refund allocation<br/>[refund_lib.php]"]
  node_refund_status["Group refund status"]
  node_approval["Admin payment approval"]
end

subgraph group_operations["Administration and reporting"]
  node_admin_refunds["Admin refund queues<br/>[admin_requests.php]"]
  node_archive_view["Archived requests"]
  node_export["Refund export<br/>[download_excel.php]"]
  node_grant_report["Student grant report"]
  node_academic["Academic-year rules<br/>[academic_lib.php]"]
  node_rollover["Year rollover"]
  node_student_import["Student import"]
  node_student_template["Student template"]
  node_auth["Session authorization<br/>[auth_check.php]"]
  node_crypto["Sensitive-data encryption<br/>[crypto.php]"]
end

node_database[("Application database<br/>[db.php]")]
node_actor_student(("Student"))
node_actor_hod(("HOD"))
node_actor_admin(("Administrator"))

node_actor_student -.->|"uses"| node_student
node_actor_hod -.->|"uses"| node_hod
node_actor_admin -.->|"uses"| node_admin
node_student -.->|"submits"| node_permission_apply
node_student -.->|"applies"| node_refund_apply
node_student -.->|"checks"| node_refund_status
node_hod -.->|"reviews"| node_permission_actions
node_hod -.->|"reviews"| node_refund_actions
node_admin -.->|"manages"| node_admin_refunds
node_permission_actions -->|"calls"| node_permission_logic
node_permission_apply -.->|"reads/writes"| node_database
node_refund_apply -->|"reads/writes"| node_database
node_refund_apply -->|"uses"| node_academic
node_refund_actions -->|"calls"| node_refund_logic
node_approval -->|"calls"| node_refund_logic
node_admin_refunds -->|"decrypts"| node_crypto
node_admin_refunds -->|"uses"| node_academic
node_archive_view -->|"decrypts"| node_crypto
node_archive_view -->|"uses"| node_academic
node_export -->|"uses"| node_refund_logic
node_export -->|"uses"| node_crypto
node_grant_report -->|"calls"| node_refund_logic
node_grant_report -->|"uses"| node_academic
node_rollover -->|"uses"| node_academic
node_rollover -->|"archives"| node_database
node_student_import -.->|"writes"| node_database
node_student_template -->|"reads"| node_database
node_permission_reads -->|"queries"| node_database
node_permission_view -->|"queries"| node_database
node_event_checks -.->|"checks"| node_database
node_auth -.->|"authenticates"| node_actor_student

click node_student "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/student/student.js"
click node_hod "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/hod/hod.js"
click node_admin "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/admin/admin.js"
click node_permission_apply "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/apply_permission.php"
click node_permission_actions "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/hod_action.php"
click node_permission_logic "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/permission_lib.php"
click node_permission_reads "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/fetch_permissions.php"
click node_permission_view "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/view_requests.php"
click node_event_checks "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/check_event_duplicate.php"
click node_refund_apply "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/apply_refund.php"
click node_refund_actions "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/hod_refund_action.php"
click node_refund_logic "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/refund_lib.php"
click node_refund_status "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/fetch_group_refund_status.php"
click node_approval "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/approve_request.php"
click node_admin_refunds "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/admin_requests.php"
click node_archive_view "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/admin_archive_requests.php"
click node_export "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/download_excel.php"
click node_grant_report "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/student_grant_report.php"
click node_academic "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/academic_lib.php"
click node_rollover "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/rollover_academic_year.php"
click node_student_import "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/upload_students.php"
click node_student_template "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/download_student_template.php"
click node_auth "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/auth_check.php"
click node_database "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/db.php"
click node_crypto "https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/crypto.php"

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_student,node_hod,node_admin toneBlue
class node_permission_apply,node_permission_actions,node_permission_logic,node_permission_reads,node_permission_view,node_event_checks,node_database toneAmber
class node_refund_apply,node_refund_actions,node_refund_logic,node_refund_status,node_approval toneMint
class node_admin_refunds,node_archive_view,node_export,node_grant_report,node_academic,node_rollover,node_student_import,node_student_template,node_auth,node_crypto toneRose
class node_actor_student,node_actor_hod,node_actor_admin toneIndigo
```

## Components

### Role interfaces

- [Student portal](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/student/student.js): `student/student.js`
- [HOD portal](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/hod/hod.js): `hod/hod.js`
- [Admin portal](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/admin/admin.js): `admin/admin.js`

### Event permissions

- [Permission application](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/apply_permission.php): `backend/apply_permission.php`
- [HOD permission review](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/hod_action.php): `backend/hod_action.php`
- [Permission rules](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/permission_lib.php): `backend/permission_lib.php`
- [Permission queries](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/fetch_permissions.php): `backend/fetch_permissions.php`
- [Request listing](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/view_requests.php): `backend/view_requests.php`
- [Event checks](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/check_event_duplicate.php): `backend/check_event_duplicate.php`

### Refund processing

- [Refund application](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/apply_refund.php): `backend/apply_refund.php`
- [Refund decisions](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/hod_refund_action.php): `backend/hod_refund_action.php`
- [Refund allocation](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/refund_lib.php): `backend/refund_lib.php`
- [Group refund status](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/fetch_group_refund_status.php): `backend/fetch_group_refund_status.php`
- [Admin payment approval](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/approve_request.php): `backend/approve_request.php`

### Administration and reporting

- [Admin refund queues](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/admin_requests.php): `backend/admin_requests.php`
- [Archived requests](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/admin_archive_requests.php): `backend/admin_archive_requests.php`
- [Refund export](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/download_excel.php): `backend/download_excel.php`
- [Student grant report](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/student_grant_report.php): `backend/student_grant_report.php`
- [Academic-year rules](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/academic_lib.php): `backend/academic_lib.php`
- [Year rollover](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/rollover_academic_year.php): `backend/rollover_academic_year.php`
- [Student import](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/upload_students.php): `backend/upload_students.php`
- [Student template](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/download_student_template.php): `backend/download_student_template.php`
- [Session authorization](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/auth_check.php): `backend/auth_check.php`
- [Sensitive-data encryption](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/crypto.php): `backend/crypto.php`

### Other components

- [Application database](https://github.com/sahana-bs-dev/student_refund_portal/blob/main/backend/db.php): `backend/db.php`
- **Student**
- **HOD**
- **Administrator**

## Connections

- Student → Student portal: uses
- HOD → HOD portal: uses
- Administrator → Admin portal: uses
- Student portal → Permission application: submits
- Student portal → Refund application: applies
- Student portal → Group refund status: checks
- HOD portal → HOD permission review: reviews
- HOD portal → Refund decisions: reviews
- Admin portal → Admin refund queues: manages
- HOD permission review → Permission rules: calls (evidence: `backend/hod_action.php`)
- Permission application → Application database: reads/writes
- Refund application → Application database: reads/writes (evidence: `backend/apply_refund.php`)
- Refund application → Academic-year rules: uses (evidence: `backend/apply_refund.php`)
- Refund decisions → Refund allocation: calls (evidence: `backend/hod_refund_action.php`)
- Admin payment approval → Refund allocation: calls (evidence: `backend/approve_request.php`)
- Admin refund queues → Sensitive-data encryption: decrypts (evidence: `backend/admin_requests.php`)
- Admin refund queues → Academic-year rules: uses (evidence: `backend/admin_requests.php`)
- Archived requests → Sensitive-data encryption: decrypts (evidence: `backend/admin_archive_requests.php`)
- Archived requests → Academic-year rules: uses (evidence: `backend/admin_archive_requests.php`)
- Refund export → Refund allocation: uses (evidence: `backend/download_excel.php`)
- Refund export → Sensitive-data encryption: uses (evidence: `backend/download_excel.php`)
- Student grant report → Refund allocation: calls (evidence: `backend/student_grant_report.php`)
- Student grant report → Academic-year rules: uses (evidence: `backend/student_grant_report.php`)
- Year rollover → Academic-year rules: uses (evidence: `backend/rollover_academic_year.php`)
- Year rollover → Application database: archives (evidence: `backend/rollover_academic_year.php`)
- Student import → Application database: writes (evidence: `backend/upload_students.php`)
- Student template → Application database: reads (evidence: `backend/download_student_template.php`)
- Permission queries → Application database: queries (evidence: `backend/fetch_permissions.php`)
- Request listing → Application database: queries (evidence: `backend/view_requests.php`)
- Event checks → Application database: checks
- Session authorization → Student: authenticates
