# sairilseb-me/student-clearance-sample-python architecture

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

- Interactive diagram: https://gitdiagram.com/sairilseb-me/student-clearance-sample-python
- Repository: https://github.com/sairilseb-me/student-clearance-sample-python

## Overview

This is a Django + Vue/Inertia student-clearance signing app. Students submit semester requests, track office approvals, and resubmit rejected approvals; office approvers sign or reject them, with the request becoming approved only after every office signs. The backend also provides session-based accounts and a policy-grounded AI assistant. The core workflow and RAG implementation are shown in the excerpts; some route and frontend wiring is described only in the README or SOURCE INDEX, so those links are documented rather than source-inspected.

Main entry points: [`clearance/student/views.py`](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/student/views.py) (Student requests), [`clearance/approver/views.py`](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/approver/views.py) (Office sign-off), [`resources/js/Pages/Approver/SignOff.vue`](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/Pages/Approver/SignOff.vue) (Approver pages), [`accounts/models.py`](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/accounts/models.py) (Accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_accounts["Accounts<br/>[models.py]"]
  node_auth_views["Login and logout<br/>[views.py]"]
  node_session["Session identity<br/>[middleware.py]"]
end

subgraph group_clearance["Clearance workflow"]
  node_student_flow["Student requests<br/>[views.py]"]
  node_approver_flow["Office sign-off<br/>[views.py]"]
  node_domain[("Clearance records<br/>[models.py]")]
  node_serialization["Page data shaping<br/>[serializers.py]"]
  node_http["Inertia request parsing<br/>[http.py]"]
end

subgraph group_web["Web experience"]
  node_vue_app["Inertia Vue app<br/>[app.js]"]
  node_route_helper["Route helper<br/>[route.js]"]
  node_student_pages["Student pages<br/>[Dashboard.vue]"]
  node_approver_pages["Approver pages<br/>[SignOff.vue]"]
  node_signature["Signature pad<br/>[SignaturePad.vue]"]
  node_assistant_widget["Assistant widget"]
end

subgraph group_assistant["AI assistant"]
  node_assistant_api["Assistant chat API<br/>[views.py]"]
  node_rag["Retrieval and prompting<br/>[rag.py]"]
  node_chunks[("Policy chunks<br/>[models.py]")]
  node_ingestion["Document ingestion"]
  node_ollama_client["Ollama client<br/>[ollama_client.py]"]
end

node_student(("Student"))
node_approver(("Office approver"))
node_ollama["Ollama service"]

node_student -->|"signs in"| node_auth_views
node_approver -->|"signs in"| node_auth_views
node_auth_views -->|"authenticates"| node_accounts
node_accounts -->|"shares user data"| node_session
node_student -->|"uses"| node_student_pages
node_student_pages -->|"requests clearance"| node_student_flow
node_student_flow -->|"creates and updates"| node_domain
node_student_flow -->|"shapes page data"| node_serialization
node_student_flow -->|"parses request"| node_http
node_student_flow -->|"checks student role"| node_accounts
node_approver -->|"uses"| node_approver_pages
node_approver_pages -->|"submits sign-off"| node_approver_flow
node_approver_pages -->|"captures signature"| node_signature
node_approver_flow -->|"updates approval"| node_domain
node_approver_flow -->|"shapes page data"| node_serialization
node_approver_flow -->|"parses request"| node_http
node_approver_flow -->|"checks approver role"| node_accounts
node_student_pages -.->|"renders in"| node_vue_app
node_approver_pages -.->|"renders in"| node_vue_app
node_vue_app -->|"installs helper"| node_route_helper
node_assistant_widget -->|"sends questions"| node_assistant_api
node_assistant_api -->|"retrieves context"| node_rag
node_rag -->|"ranks chunks"| node_chunks
node_assistant_api -->|"embeds and generates"| node_ollama_client
node_ingestion -->|"embeds documents"| node_ollama_client
node_ingestion -->|"stores chunks"| node_chunks
node_ollama_client -->|"calls API"| node_ollama

click node_accounts "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/accounts/models.py"
click node_auth_views "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/accounts/views.py"
click node_session "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/accounts/middleware.py"
click node_student_flow "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/student/views.py"
click node_approver_flow "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/approver/views.py"
click node_domain "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/models.py"
click node_serialization "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/serializers.py"
click node_http "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/core/http.py"
click node_vue_app "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/app.js"
click node_route_helper "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/route.js"
click node_student_pages "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/Pages/Student/Dashboard.vue"
click node_approver_pages "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/Pages/Approver/SignOff.vue"
click node_signature "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/Components/SignaturePad.vue"
click node_assistant_widget "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/Components/AiClearanceAssistant.vue"
click node_assistant_api "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/assistant/views.py"
click node_rag "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/assistant/rag.py"
click node_chunks "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/assistant/models.py"
click node_ingestion "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/assistant/management/commands/ingest_assistant_docs.py"
click node_ollama_client "https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/core/ollama_client.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_accounts,node_auth_views,node_session toneBlue
class node_student_flow,node_approver_flow,node_domain,node_serialization,node_http toneAmber
class node_vue_app,node_route_helper,node_student_pages,node_approver_pages,node_signature,node_assistant_widget toneMint
class node_assistant_api,node_rag,node_chunks,node_ingestion,node_ollama_client toneRose
class node_student,node_approver,node_ollama toneIndigo
```

## Components

### Identity and access

- [Accounts](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/accounts/models.py): `accounts/models.py`
- [Login and logout](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/accounts/views.py): `accounts/views.py`
- [Session identity](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/accounts/middleware.py): `accounts/middleware.py`

### Clearance workflow

- [Student requests](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/student/views.py): `clearance/student/views.py`
- [Office sign-off](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/approver/views.py): `clearance/approver/views.py`
- [Clearance records](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/models.py): `clearance/models.py`
- [Page data shaping](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/clearance/serializers.py): `clearance/serializers.py`
- [Inertia request parsing](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/core/http.py): `core/http.py`

### Web experience

- [Inertia Vue app](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/app.js): `resources/js/app.js`
- [Route helper](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/route.js): `resources/js/route.js`
- [Student pages](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/Pages/Student/Dashboard.vue): `resources/js/Pages/Student/Dashboard.vue`
- [Approver pages](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/Pages/Approver/SignOff.vue): `resources/js/Pages/Approver/SignOff.vue`
- [Signature pad](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/Components/SignaturePad.vue): `resources/js/Components/SignaturePad.vue`
- [Assistant widget](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/resources/js/Components/AiClearanceAssistant.vue): `resources/js/Components/AiClearanceAssistant.vue`

### AI assistant

- [Assistant chat API](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/assistant/views.py): `assistant/views.py`
- [Retrieval and prompting](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/assistant/rag.py): `assistant/rag.py`
- [Policy chunks](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/assistant/models.py): `assistant/models.py`
- [Document ingestion](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/assistant/management/commands/ingest_assistant_docs.py): `assistant/management/commands/ingest_assistant_docs.py`
- [Ollama client](https://github.com/sairilseb-me/student-clearance-sample-python/blob/main/core/ollama_client.py): `core/ollama_client.py`

### Other components

- **Student**
- **Office approver**
- **Ollama service**

## Connections

- Student → Login and logout: signs in (evidence: `README.md`)
- Office approver → Login and logout: signs in (evidence: `README.md`)
- Login and logout → Accounts: authenticates (evidence: `accounts/views.py`)
- Accounts → Session identity: shares user data (evidence: `accounts/middleware.py`)
- Student → Student pages: uses (evidence: `README.md`)
- Student pages → Student requests: requests clearance (evidence: `README.md`)
- Student requests → Clearance records: creates and updates (evidence: `clearance/student/views.py`)
- Student requests → Page data shaping: shapes page data (evidence: `clearance/student/views.py`)
- Student requests → Inertia request parsing: parses request (evidence: `clearance/student/views.py`)
- Student requests → Accounts: checks student role (evidence: `clearance/student/views.py`)
- Office approver → Approver pages: uses (evidence: `README.md`)
- Approver pages → Office sign-off: submits sign-off (evidence: `README.md`)
- Approver pages → Signature pad: captures signature (evidence: `README.md`)
- Office sign-off → Clearance records: updates approval (evidence: `clearance/approver/views.py`)
- Office sign-off → Page data shaping: shapes page data (evidence: `clearance/approver/views.py`)
- Office sign-off → Inertia request parsing: parses request (evidence: `clearance/approver/views.py`)
- Office sign-off → Accounts: checks approver role (evidence: `clearance/approver/views.py`)
- Student pages → Inertia Vue app: renders in (evidence: `README.md`)
- Approver pages → Inertia Vue app: renders in (evidence: `README.md`)
- Inertia Vue app → Route helper: installs helper (evidence: `resources/js/app.js`)
- Assistant widget → Assistant chat API: sends questions (evidence: `README.md`)
- Assistant chat API → Retrieval and prompting: retrieves context (evidence: `assistant/views.py`)
- Retrieval and prompting → Policy chunks: ranks chunks (evidence: `assistant/rag.py`)
- Assistant chat API → Ollama client: embeds and generates (evidence: `assistant/views.py`)
- Document ingestion → Ollama client: embeds documents (evidence: `assistant/management/commands/ingest_assistant_docs.py`)
- Document ingestion → Policy chunks: stores chunks (evidence: `assistant/management/commands/ingest_assistant_docs.py`)
- Ollama client → Ollama service: calls API (evidence: `core/ollama_client.py`)
