# epf-mde/oceens architecture

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

- Interactive diagram: https://gitdiagram.com/epf-mde/oceens
- Repository: https://github.com/epf-mde/oceens

## Overview

OcéEns II is a teaching-evaluation platform: staff configure survey templates and surveys, students submit answers, and staff review visualizations and CSV exports. Authentication supports Microsoft Entra ID and a development mode; role scopes govern staff access. A separate daemon processes queued LLM summaries and records generation data. The graph retains the documented prompt/provider and cost-management capabilities. Some route and service internals were not excerpted, so those links rely on README statements or SOURCE INDEX references rather than inferred call chains.

Main entry points: [`main.py`](https://github.com/epf-mde/oceens/blob/course-2026/main.py) (Web application), [`core/database.py`](https://github.com/epf-mde/oceens/blob/course-2026/core/database.py) (SQLite database), [`routers/surveys.py`](https://github.com/epf-mde/oceens/blob/course-2026/routers/surveys.py) (Survey responses), [`core/auth.py`](https://github.com/epf-mde/oceens/blob/course-2026/core/auth.py) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and app"]
  node_app["Web application<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_access_routes["Pages and roles<br/>[pages.py]"]
  node_database[("SQLite database<br/>[database.py]")]
  node_role_data["Role records<br/>[Role.py]"]
end

subgraph group_survey["Survey workflow"]
  node_survey_admin["Survey management"]
  node_question_admin["Question editing"]
  node_survey_routes["Survey responses<br/>[surveys.py]"]
  node_student_routes["Student enrollment<br/>[students.py]"]
  node_survey_ui["Questionnaire interface<br/>[survey.js]"]
  node_survey_data["Survey records<br/>[Survey.py]"]
  node_answer_data["Answer records<br/>[Answer.py]"]
  node_submission_data["Submission records<br/>[Submission.py]"]
  node_program_data["Program records<br/>[Program.py]"]
  node_question_data["Question records<br/>[Question.py]"]
end

subgraph group_insights["Analysis and summaries"]
  node_visualization["Response visualizations"]
  node_csv_export["CSV export<br/>[export_csv.py]"]
  node_summary_routes["Summary requests<br/>[summaries.py]"]
  node_summary_queue["Summary queue<br/>[Summary.py]"]
  node_summary_daemon["Summary generator"]
end

subgraph group_llm_admin["LLM administration"]
  node_llm_client["LLM client<br/>[llm_client.py]"]
  node_prompt_admin["Prompt management<br/>[prompts.py]"]
  node_provider_admin["Provider management<br/>[providers.py]"]
  node_cost_admin["LLM costs<br/>[costs.py]"]
  node_price_admin["Model pricing<br/>[prices.py]"]
end

node_browser(("User"))
node_identity["Microsoft identity"]
node_llm_service["LLM provider"]

node_browser -->|"uses"| node_app
node_app -->|"registers"| node_auth
node_auth -->|"authenticates with"| node_identity
node_auth -->|"resolves users"| node_database
node_app -->|"registers"| node_access_routes
node_access_routes -->|"reads and writes"| node_database
node_app -->|"registers"| node_survey_admin
node_survey_admin -->|"reads and writes"| node_database
node_app -->|"registers"| node_question_admin
node_question_admin -->|"reads and writes"| node_database
node_app -->|"registers"| node_survey_routes
node_survey_routes -->|"reads and writes"| node_database
node_browser -->|"fills out"| node_survey_ui
node_survey_ui -->|"submits answers"| node_survey_routes
node_survey_routes -->|"manages"| node_survey_data
node_survey_routes -->|"records submissions"| node_submission_data
node_survey_routes -->|"records answers"| node_answer_data
node_app -->|"registers"| node_student_routes
node_student_routes -->|"manages enrollment"| node_database
node_browser -->|"views results"| node_visualization
node_visualization -->|"reads responses"| node_database
node_browser -->|"requests export"| node_csv_export
node_survey_routes -->|"exports responses"| node_csv_export
node_browser -->|"requests summaries"| node_summary_routes
node_summary_routes -->|"queues generation"| node_summary_queue
node_summary_daemon -->|"processes queue"| node_summary_queue
node_summary_daemon -->|"generates summaries"| node_llm_client
node_llm_client -->|"calls"| node_llm_service
node_summary_daemon -->|"stores results"| node_database
node_app -->|"registers"| node_prompt_admin
node_prompt_admin -->|"manages prompts"| node_database
node_app -->|"registers"| node_provider_admin
node_provider_admin -->|"manages providers"| node_database
node_provider_admin -->|"configures"| node_llm_client
node_app -->|"registers"| node_cost_admin
node_cost_admin -->|"reads cost data"| node_database
node_app -->|"registers"| node_price_admin
node_price_admin -->|"manages prices"| node_database
node_survey_admin -.->|"targets programs"| node_program_data
node_auth -->|"checks roles"| node_role_data
node_question_admin -->|"edits questions"| node_question_data

click node_app "https://github.com/epf-mde/oceens/blob/course-2026/main.py"
click node_auth "https://github.com/epf-mde/oceens/blob/course-2026/core/auth.py"
click node_access_routes "https://github.com/epf-mde/oceens/blob/course-2026/routers/pages.py"
click node_database "https://github.com/epf-mde/oceens/blob/course-2026/core/database.py"
click node_survey_admin "https://github.com/epf-mde/oceens/blob/course-2026/routers/survey_templates.py"
click node_question_admin "https://github.com/epf-mde/oceens/blob/course-2026/routers/sections_questions.py"
click node_survey_routes "https://github.com/epf-mde/oceens/blob/course-2026/routers/surveys.py"
click node_student_routes "https://github.com/epf-mde/oceens/blob/course-2026/routers/students.py"
click node_survey_ui "https://github.com/epf-mde/oceens/blob/course-2026/static/js/survey.js"
click node_survey_data "https://github.com/epf-mde/oceens/blob/course-2026/models/Survey.py"
click node_answer_data "https://github.com/epf-mde/oceens/blob/course-2026/models/Answer.py"
click node_submission_data "https://github.com/epf-mde/oceens/blob/course-2026/models/Submission.py"
click node_visualization "https://github.com/epf-mde/oceens/blob/course-2026/services/visualisation_data.py"
click node_csv_export "https://github.com/epf-mde/oceens/blob/course-2026/services/export_csv.py"
click node_summary_routes "https://github.com/epf-mde/oceens/blob/course-2026/routers/summaries.py"
click node_summary_queue "https://github.com/epf-mde/oceens/blob/course-2026/models/Summary.py"
click node_summary_daemon "https://github.com/epf-mde/oceens/blob/course-2026/summaries_generator_daemon.py"
click node_llm_client "https://github.com/epf-mde/oceens/blob/course-2026/services/llm_client.py"
click node_prompt_admin "https://github.com/epf-mde/oceens/blob/course-2026/routers/prompts.py"
click node_provider_admin "https://github.com/epf-mde/oceens/blob/course-2026/routers/llm/providers.py"
click node_cost_admin "https://github.com/epf-mde/oceens/blob/course-2026/routers/llm/costs.py"
click node_price_admin "https://github.com/epf-mde/oceens/blob/course-2026/routers/llm/prices.py"
click node_program_data "https://github.com/epf-mde/oceens/blob/course-2026/models/Program.py"
click node_role_data "https://github.com/epf-mde/oceens/blob/course-2026/models/Role.py"
click node_question_data "https://github.com/epf-mde/oceens/blob/course-2026/models/Question.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_app,node_auth,node_access_routes,node_database,node_role_data,node_browser toneBlue
class node_survey_admin,node_question_admin,node_survey_routes,node_student_routes,node_survey_ui,node_survey_data,node_answer_data,node_submission_data,node_program_data,node_question_data toneAmber
class node_visualization,node_csv_export,node_summary_routes,node_summary_queue,node_summary_daemon toneMint
class node_llm_client,node_prompt_admin,node_provider_admin,node_cost_admin,node_price_admin toneRose
class node_identity,node_llm_service toneIndigo
```

## Components

### Access and app

- [Web application](https://github.com/epf-mde/oceens/blob/course-2026/main.py): `main.py`
- [Authentication](https://github.com/epf-mde/oceens/blob/course-2026/core/auth.py): `core/auth.py`
- [Pages and roles](https://github.com/epf-mde/oceens/blob/course-2026/routers/pages.py): `routers/pages.py`
- [SQLite database](https://github.com/epf-mde/oceens/blob/course-2026/core/database.py): `core/database.py`
- [Role records](https://github.com/epf-mde/oceens/blob/course-2026/models/Role.py): `models/Role.py`

### Survey workflow

- [Survey management](https://github.com/epf-mde/oceens/blob/course-2026/routers/survey_templates.py): `routers/survey_templates.py`
- [Question editing](https://github.com/epf-mde/oceens/blob/course-2026/routers/sections_questions.py): `routers/sections_questions.py`
- [Survey responses](https://github.com/epf-mde/oceens/blob/course-2026/routers/surveys.py): `routers/surveys.py`
- [Student enrollment](https://github.com/epf-mde/oceens/blob/course-2026/routers/students.py): `routers/students.py`
- [Questionnaire interface](https://github.com/epf-mde/oceens/blob/course-2026/static/js/survey.js): `static/js/survey.js`
- [Survey records](https://github.com/epf-mde/oceens/blob/course-2026/models/Survey.py): `models/Survey.py`
- [Answer records](https://github.com/epf-mde/oceens/blob/course-2026/models/Answer.py): `models/Answer.py`
- [Submission records](https://github.com/epf-mde/oceens/blob/course-2026/models/Submission.py): `models/Submission.py`
- [Program records](https://github.com/epf-mde/oceens/blob/course-2026/models/Program.py): `models/Program.py`
- [Question records](https://github.com/epf-mde/oceens/blob/course-2026/models/Question.py): `models/Question.py`

### Analysis and summaries

- [Response visualizations](https://github.com/epf-mde/oceens/blob/course-2026/services/visualisation_data.py): `services/visualisation_data.py`
- [CSV export](https://github.com/epf-mde/oceens/blob/course-2026/services/export_csv.py): `services/export_csv.py`
- [Summary requests](https://github.com/epf-mde/oceens/blob/course-2026/routers/summaries.py): `routers/summaries.py`
- [Summary queue](https://github.com/epf-mde/oceens/blob/course-2026/models/Summary.py): `models/Summary.py`
- [Summary generator](https://github.com/epf-mde/oceens/blob/course-2026/summaries_generator_daemon.py): `summaries_generator_daemon.py`

### LLM administration

- [LLM client](https://github.com/epf-mde/oceens/blob/course-2026/services/llm_client.py): `services/llm_client.py`
- [Prompt management](https://github.com/epf-mde/oceens/blob/course-2026/routers/prompts.py): `routers/prompts.py`
- [Provider management](https://github.com/epf-mde/oceens/blob/course-2026/routers/llm/providers.py): `routers/llm/providers.py`
- [LLM costs](https://github.com/epf-mde/oceens/blob/course-2026/routers/llm/costs.py): `routers/llm/costs.py`
- [Model pricing](https://github.com/epf-mde/oceens/blob/course-2026/routers/llm/prices.py): `routers/llm/prices.py`

### Other components

- **User**
- **Microsoft identity**
- **LLM provider**

## Connections

- User → Web application: uses
- Web application → Authentication: registers (evidence: `main.py`)
- Authentication → Microsoft identity: authenticates with (evidence: `core/auth.py`)
- Authentication → SQLite database: resolves users (evidence: `core/auth.py`)
- Web application → Pages and roles: registers (evidence: `main.py`)
- Pages and roles → SQLite database: reads and writes (evidence: `routers/pages.py`)
- Web application → Survey management: registers (evidence: `main.py`)
- Survey management → SQLite database: reads and writes (evidence: `routers/survey_templates.py`)
- Web application → Question editing: registers (evidence: `main.py`)
- Question editing → SQLite database: reads and writes (evidence: `routers/sections_questions.py`)
- Web application → Survey responses: registers (evidence: `main.py`)
- Survey responses → SQLite database: reads and writes (evidence: `routers/surveys.py`)
- User → Questionnaire interface: fills out
- Questionnaire interface → Survey responses: submits answers
- Survey responses → Survey records: manages (evidence: `routers/surveys.py`)
- Survey responses → Submission records: records submissions (evidence: `routers/surveys.py`)
- Survey responses → Answer records: records answers (evidence: `routers/surveys.py`)
- Web application → Student enrollment: registers (evidence: `main.py`)
- Student enrollment → SQLite database: manages enrollment
- User → Response visualizations: views results
- Response visualizations → SQLite database: reads responses (evidence: `services/visualisation_data.py`)
- User → CSV export: requests export
- Survey responses → CSV export: exports responses (evidence: `routers/surveys.py`)
- User → Summary requests: requests summaries
- Summary requests → Summary queue: queues generation
- Summary generator → Summary queue: processes queue (evidence: `models/Summary.py`)
- Summary generator → LLM client: generates summaries (evidence: `summaries_generator_daemon.py`)
- LLM client → LLM provider: calls
- Summary generator → SQLite database: stores results (evidence: `summaries_generator_daemon.py`)
- Web application → Prompt management: registers (evidence: `main.py`)
- Prompt management → SQLite database: manages prompts
- Web application → Provider management: registers (evidence: `main.py`)
- Provider management → SQLite database: manages providers (evidence: `routers/llm/providers.py`)
- Provider management → LLM client: configures (evidence: `routers/llm/providers.py`)
- Web application → LLM costs: registers (evidence: `main.py`)
- LLM costs → SQLite database: reads cost data (evidence: `routers/llm/costs.py`)
- Web application → Model pricing: registers (evidence: `main.py`)
- Model pricing → SQLite database: manages prices (evidence: `routers/llm/prices.py`)
- Survey management → Program records: targets programs
- Authentication → Role records: checks roles (evidence: `core/auth.py`)
- Question editing → Question records: edits questions (evidence: `routers/sections_questions.py`)
