# baludbr/cheportal architecture

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

- Interactive diagram: https://gitdiagram.com/baludbr/cheportal
- Repository: https://github.com/baludbr/cheportal

## Overview

This is a Django portal for managing university compliance audits. Users sign in (with optional email-based two-factor verification), university staff complete questionnaire responses and upload evidence, and reviewers track submissions, request revisions, approve responses, and produce audit reports. The graph separates identity, audit workflows, persistence, and runtime configuration/integrations. Source excerpts are partial, so links among audit stages are limited to references shown in the index or excerpts; unsampled behavior is not inferred.

Main entry points: [`audit/views.py`](https://github.com/baludbr/cheportal/blob/main/audit/views.py) (Audit workflows), [`accounts/views.py`](https://github.com/baludbr/cheportal/blob/main/accounts/views.py) (Sign-in and accounts), [`accounts/services.py`](https://github.com/baludbr/cheportal/blob/main/accounts/services.py) (Account services), [`che_portal/settings/base.py`](https://github.com/baludbr/cheportal/blob/main/che_portal/settings/base.py) (Base settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_account_views["Sign-in and accounts<br/>[views.py]"]
  node_account_forms["Account forms<br/>[forms.py]"]
  node_account_services["Account services<br/>[services.py]"]
end

subgraph group_audit["Audit workflows"]
  node_audit_views["Audit workflows<br/>[views.py]"]
  node_audit_forms["Audit forms<br/>[forms.py]"]
  node_access_control["Audit access control<br/>[decorators.py]"]
  node_rag_client["RAG client<br/>[rag_service.py]"]
  node_question_import["Question bank import"]
end

subgraph group_data["Domain data"]
  node_account_data[("Users and universities<br/>[models.py]")]
  node_audit_data[("Audit records<br/>[models.py]")]
  node_audit_log[("System audit log<br/>[models.py]")]
end

subgraph group_runtime["Runtime and integrations"]
  node_account_routes["Account routes<br/>[urls.py]"]
  node_audit_routes["Audit routes<br/>[urls.py]"]
  node_portal_routes["Portal routing<br/>[urls.py]"]
  node_base_settings["Base settings<br/>[base.py]"]
  node_dev_settings["Development settings<br/>[dev.py]"]
  node_prod_settings["Production settings<br/>[prod.py]"]
end

node_user(("Portal user"))
node_relational_db[("Relational database")]
node_object_storage[("S3 object storage")]
node_mail_service["Email service"]
node_rag_service["RAG service"]

node_user -->|"requests account access"| node_account_routes
node_account_routes -->|"routes to"| node_account_views
node_account_views -->|"validates credentials"| node_account_forms
node_account_views -->|"logs actions"| node_account_services
node_account_views -->|"loads users"| node_account_data
node_account_services -->|"writes events"| node_audit_log
node_account_services -->|"sends notifications"| node_mail_service
node_user -->|"uses portal"| node_portal_routes
node_portal_routes -->|"routes to"| node_audit_views
node_audit_routes -->|"routes to"| node_audit_views
node_audit_views -->|"validates responses"| node_audit_forms
node_audit_views -->|"uses permissions"| node_access_control
node_audit_views -->|"reads and writes"| node_audit_data
node_audit_views -->|"loads user roles"| node_account_data
node_audit_views -->|"logs and notifies"| node_account_services
node_audit_views -->|"requests RAG operations"| node_rag_client
node_question_import -->|"imports questions"| node_audit_data
node_base_settings -->|"configures user model"| node_account_data
node_dev_settings -->|"extends"| node_base_settings
node_prod_settings -->|"extends"| node_base_settings
node_dev_settings -->|"configures MySQL"| node_relational_db
node_prod_settings -->|"configures SQLite"| node_relational_db
node_dev_settings -->|"configures S3"| node_object_storage
node_prod_settings -->|"configures local files"| node_object_storage
node_base_settings -->|"sets service options"| node_rag_client
node_rag_client -->|"calls HTTP API"| node_rag_service

click node_account_views "https://github.com/baludbr/cheportal/blob/main/accounts/views.py"
click node_account_forms "https://github.com/baludbr/cheportal/blob/main/accounts/forms.py"
click node_account_services "https://github.com/baludbr/cheportal/blob/main/accounts/services.py"
click node_audit_views "https://github.com/baludbr/cheportal/blob/main/audit/views.py"
click node_audit_forms "https://github.com/baludbr/cheportal/blob/main/audit/forms.py"
click node_access_control "https://github.com/baludbr/cheportal/blob/main/audit/decorators.py"
click node_rag_client "https://github.com/baludbr/cheportal/blob/main/audit/rag_service.py"
click node_question_import "https://github.com/baludbr/cheportal/blob/main/audit/management/commands/import_question_bank.py"
click node_account_data "https://github.com/baludbr/cheportal/blob/main/accounts/models.py"
click node_audit_data "https://github.com/baludbr/cheportal/blob/main/audit/models.py"
click node_audit_log "https://github.com/baludbr/cheportal/blob/main/accounts/models.py"
click node_account_routes "https://github.com/baludbr/cheportal/blob/main/accounts/urls.py"
click node_audit_routes "https://github.com/baludbr/cheportal/blob/main/audit/urls.py"
click node_portal_routes "https://github.com/baludbr/cheportal/blob/main/che_portal/urls.py"
click node_base_settings "https://github.com/baludbr/cheportal/blob/main/che_portal/settings/base.py"
click node_dev_settings "https://github.com/baludbr/cheportal/blob/main/che_portal/settings/dev.py"
click node_prod_settings "https://github.com/baludbr/cheportal/blob/main/che_portal/settings/prod.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_account_views,node_account_forms,node_account_services,node_user toneBlue
class node_audit_views,node_audit_forms,node_access_control,node_rag_client,node_question_import,node_relational_db,node_object_storage toneAmber
class node_account_data,node_audit_data,node_audit_log toneMint
class node_account_routes,node_audit_routes,node_portal_routes,node_base_settings,node_dev_settings,node_prod_settings toneRose
class node_mail_service,node_rag_service toneIndigo
```

## Components

### Identity and access

- [Sign-in and accounts](https://github.com/baludbr/cheportal/blob/main/accounts/views.py): `accounts/views.py`
- [Account forms](https://github.com/baludbr/cheportal/blob/main/accounts/forms.py): `accounts/forms.py`
- [Account services](https://github.com/baludbr/cheportal/blob/main/accounts/services.py): `accounts/services.py`

### Audit workflows

- [Audit workflows](https://github.com/baludbr/cheportal/blob/main/audit/views.py): `audit/views.py`
- [Audit forms](https://github.com/baludbr/cheportal/blob/main/audit/forms.py): `audit/forms.py`
- [Audit access control](https://github.com/baludbr/cheportal/blob/main/audit/decorators.py): `audit/decorators.py`
- [RAG client](https://github.com/baludbr/cheportal/blob/main/audit/rag_service.py): `audit/rag_service.py`
- [Question bank import](https://github.com/baludbr/cheportal/blob/main/audit/management/commands/import_question_bank.py): `audit/management/commands/import_question_bank.py`

### Domain data

- [Users and universities](https://github.com/baludbr/cheportal/blob/main/accounts/models.py): `accounts/models.py`
- [Audit records](https://github.com/baludbr/cheportal/blob/main/audit/models.py): `audit/models.py`
- [System audit log](https://github.com/baludbr/cheportal/blob/main/accounts/models.py): `accounts/models.py`

### Runtime and integrations

- [Account routes](https://github.com/baludbr/cheportal/blob/main/accounts/urls.py): `accounts/urls.py`
- [Audit routes](https://github.com/baludbr/cheportal/blob/main/audit/urls.py): `audit/urls.py`
- [Portal routing](https://github.com/baludbr/cheportal/blob/main/che_portal/urls.py): `che_portal/urls.py`
- [Base settings](https://github.com/baludbr/cheportal/blob/main/che_portal/settings/base.py): `che_portal/settings/base.py`
- [Development settings](https://github.com/baludbr/cheportal/blob/main/che_portal/settings/dev.py): `che_portal/settings/dev.py`
- [Production settings](https://github.com/baludbr/cheportal/blob/main/che_portal/settings/prod.py): `che_portal/settings/prod.py`

### Other components

- **Portal user**
- **Relational database**
- **S3 object storage**
- **Email service**
- **RAG service**

## Connections

- Portal user → Account routes: requests account access
- Account routes → Sign-in and accounts: routes to (evidence: `accounts/urls.py`)
- Sign-in and accounts → Account forms: validates credentials (evidence: `accounts/views.py`)
- Sign-in and accounts → Account services: logs actions (evidence: `accounts/views.py`)
- Sign-in and accounts → Users and universities: loads users (evidence: `accounts/views.py`)
- Account services → System audit log: writes events (evidence: `accounts/services.py`)
- Account services → Email service: sends notifications (evidence: `accounts/services.py`)
- Portal user → Portal routing: uses portal
- Portal routing → Audit workflows: routes to (evidence: `che_portal/urls.py`)
- Audit routes → Audit workflows: routes to (evidence: `audit/urls.py`)
- Audit workflows → Audit forms: validates responses (evidence: `audit/views.py`)
- Audit workflows → Audit access control: uses permissions (evidence: `audit/views.py`)
- Audit workflows → Audit records: reads and writes (evidence: `audit/views.py`)
- Audit workflows → Users and universities: loads user roles (evidence: `audit/views.py`)
- Audit workflows → Account services: logs and notifies (evidence: `audit/views.py`)
- Audit workflows → RAG client: requests RAG operations (evidence: `audit/views.py`)
- Question bank import → Audit records: imports questions (evidence: `audit/management/commands/import_question_bank.py`)
- Base settings → Users and universities: configures user model (evidence: `che_portal/settings/base.py`)
- Development settings → Base settings: extends (evidence: `che_portal/settings/dev.py`)
- Production settings → Base settings: extends (evidence: `che_portal/settings/prod.py`)
- Development settings → Relational database: configures MySQL (evidence: `che_portal/settings/dev.py`)
- Production settings → Relational database: configures SQLite (evidence: `che_portal/settings/prod.py`)
- Development settings → S3 object storage: configures S3 (evidence: `che_portal/settings/dev.py`)
- Production settings → S3 object storage: configures local files (evidence: `che_portal/settings/prod.py`)
- Base settings → RAG client: sets service options (evidence: `che_portal/settings/base.py`)
- RAG client → RAG service: calls HTTP API (evidence: `audit/rag_service.py`)
