# unb-mds/g2-2026-2 architecture

> Architecture diagram of the GitHub repository unb-mds/g2-2026-2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/unb-mds/g2-2026-2
- Repository: https://github.com/unb-mds/g2-2026-2

## Overview

AvaliaAi UnB is a Flask web platform for students to find professors and disciplines, inspect discipline-specific teaching evaluations and averages, and submit their own ratings. The implemented flow covers account registration and login, authenticated evaluation submission, and public catalog/profile consultation. The README also describes comparison, rankings, advanced filters, moderation, favorites, and charts as planned post-MVP capabilities; they are included as documented but unsampled branches, without asserted runtime wiring. Relationships reflect sampled routes, repositories, session handling, and SQLite access.

Main entry points: [`app/routes/professor_routes.py`](https://github.com/unb-mds/g2-2026-2/blob/main/app/routes/professor_routes.py) (Professor routes), [`app/routes/auth_routes.py`](https://github.com/unb-mds/g2-2026-2/blob/main/app/routes/auth_routes.py) (Auth routes), [`app/database.py`](https://github.com/unb-mds/g2-2026-2/blob/main/app/database.py) (SQLite database), [`app/controllers/session_controller.py`](https://github.com/unb-mds/g2-2026-2/blob/main/app/controllers/session_controller.py) (Session controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_templates["Web templates"]
  node_styles["Interface styles<br/>[indicadores.css]"]
end

subgraph group_account["Accounts and sessions"]
  node_authroutes["Auth routes<br/>[auth_routes.py]"]
  node_session["Session controller"]
  node_validation["Input validation<br/>[validacoes.py]"]
  node_userrepo["User repository<br/>[repositorio.py]"]
end

subgraph group_catalog["Academic catalog"]
  node_professoroutes["Professor routes"]
  node_professorrepo["Professor repository<br/>[repositorio.py]"]
  node_disciplinarepo["Discipline repository<br/>[repositorio.py]"]
  node_favorites["Professor favorites<br/>[README.md]"]
end

subgraph group_ratings["Evaluations and insights"]
  node_ratingrepo["Evaluation repository<br/>[repositorio.py]"]
  node_models["Domain models<br/>[models.py]"]
  node_comparison["Professor comparison<br/>[README.md]"]
  node_ranking["Professor ranking<br/>[README.md]"]
  node_moderation["Rating moderation<br/>[README.md]"]
  node_charts["Performance charts<br/>[README.md]"]
end

subgraph group_storage["Persistence"]
  node_sqlite[("SQLite database<br/>[database.py]")]
end

node_student(("Student"))
node_teacher(("Teacher"))

node_student -->|"registers / logs in"| node_authroutes
node_student -->|"searches / rates"| node_professoroutes
node_teacher -->|"views profile"| node_professoroutes
node_authroutes -->|"validates signup"| node_validation
node_authroutes -->|"creates / finds user"| node_userrepo
node_authroutes -->|"creates / ends session"| node_session
node_session -->|"reads / writes sessions"| node_sqlite
node_session -->|"loads current user"| node_userrepo
node_authroutes -->|"renders account pages"| node_templates
node_professoroutes -->|"filters / loads professors"| node_professorrepo
node_professoroutes -->|"loads linked disciplines"| node_disciplinarepo
node_professoroutes -->|"calculates / saves ratings"| node_ratingrepo
node_professoroutes -->|"validates rating"| node_validation
node_professoroutes -->|"requires authenticated user"| node_session
node_professoroutes -->|"renders catalog and rating pages"| node_templates
node_templates -->|"loads styles"| node_styles
node_userrepo -->|"reads / writes users"| node_sqlite
node_professorrepo -->|"reads professor catalog"| node_sqlite
node_disciplinarepo -->|"reads disciplines"| node_sqlite
node_ratingrepo -->|"reads / writes ratings"| node_sqlite

click node_authroutes "https://github.com/unb-mds/g2-2026-2/blob/main/app/routes/auth_routes.py"
click node_session "https://github.com/unb-mds/g2-2026-2/blob/main/app/controllers/session_controller.py"
click node_validation "https://github.com/unb-mds/g2-2026-2/blob/main/app/validacoes.py"
click node_userrepo "https://github.com/unb-mds/g2-2026-2/blob/main/app/repositorio.py"
click node_professoroutes "https://github.com/unb-mds/g2-2026-2/blob/main/app/routes/professor_routes.py"
click node_professorrepo "https://github.com/unb-mds/g2-2026-2/blob/main/app/repositorio.py"
click node_disciplinarepo "https://github.com/unb-mds/g2-2026-2/blob/main/app/repositorio.py"
click node_ratingrepo "https://github.com/unb-mds/g2-2026-2/blob/main/app/repositorio.py"
click node_models "https://github.com/unb-mds/g2-2026-2/blob/main/app/models.py"
click node_templates "https://github.com/unb-mds/g2-2026-2/tree/main/app/templates"
click node_styles "https://github.com/unb-mds/g2-2026-2/blob/main/app/static/indicadores.css"
click node_sqlite "https://github.com/unb-mds/g2-2026-2/blob/main/app/database.py"
click node_comparison "https://github.com/unb-mds/g2-2026-2/blob/main/README.md"
click node_ranking "https://github.com/unb-mds/g2-2026-2/blob/main/README.md"
click node_moderation "https://github.com/unb-mds/g2-2026-2/blob/main/README.md"
click node_favorites "https://github.com/unb-mds/g2-2026-2/blob/main/README.md"
click node_charts "https://github.com/unb-mds/g2-2026-2/blob/main/README.md"

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_templates,node_styles toneBlue
class node_authroutes,node_session,node_validation,node_userrepo toneAmber
class node_professoroutes,node_professorrepo,node_disciplinarepo,node_favorites toneMint
class node_ratingrepo,node_models,node_comparison,node_ranking,node_moderation,node_charts toneRose
class node_sqlite,node_student,node_teacher toneIndigo
```

## Components

### Web interface

- [Web templates](https://github.com/unb-mds/g2-2026-2/tree/main/app/templates): `app/templates`
- [Interface styles](https://github.com/unb-mds/g2-2026-2/blob/main/app/static/indicadores.css): `app/static/indicadores.css`

### Accounts and sessions

- [Auth routes](https://github.com/unb-mds/g2-2026-2/blob/main/app/routes/auth_routes.py): `app/routes/auth_routes.py`
- [Session controller](https://github.com/unb-mds/g2-2026-2/blob/main/app/controllers/session_controller.py): `app/controllers/session_controller.py`
- [Input validation](https://github.com/unb-mds/g2-2026-2/blob/main/app/validacoes.py): `app/validacoes.py`
- [User repository](https://github.com/unb-mds/g2-2026-2/blob/main/app/repositorio.py): `app/repositorio.py`

### Academic catalog

- [Professor routes](https://github.com/unb-mds/g2-2026-2/blob/main/app/routes/professor_routes.py): `app/routes/professor_routes.py`
- [Professor repository](https://github.com/unb-mds/g2-2026-2/blob/main/app/repositorio.py): `app/repositorio.py`
- [Discipline repository](https://github.com/unb-mds/g2-2026-2/blob/main/app/repositorio.py): `app/repositorio.py`
- [Professor favorites](https://github.com/unb-mds/g2-2026-2/blob/main/README.md): `README.md`

### Evaluations and insights

- [Evaluation repository](https://github.com/unb-mds/g2-2026-2/blob/main/app/repositorio.py): `app/repositorio.py`
- [Domain models](https://github.com/unb-mds/g2-2026-2/blob/main/app/models.py): `app/models.py`
- [Professor comparison](https://github.com/unb-mds/g2-2026-2/blob/main/README.md): `README.md`
- [Professor ranking](https://github.com/unb-mds/g2-2026-2/blob/main/README.md): `README.md`
- [Rating moderation](https://github.com/unb-mds/g2-2026-2/blob/main/README.md): `README.md`
- [Performance charts](https://github.com/unb-mds/g2-2026-2/blob/main/README.md): `README.md`

### Persistence

- [SQLite database](https://github.com/unb-mds/g2-2026-2/blob/main/app/database.py): `app/database.py`

### Other components

- **Student**
- **Teacher**

## Connections

- Student → Auth routes: registers / logs in
- Student → Professor routes: searches / rates
- Teacher → Professor routes: views profile
- Auth routes → Input validation: validates signup
- Auth routes → User repository: creates / finds user
- Auth routes → Session controller: creates / ends session
- Session controller → SQLite database: reads / writes sessions
- Session controller → User repository: loads current user
- Auth routes → Web templates: renders account pages
- Professor routes → Professor repository: filters / loads professors
- Professor routes → Discipline repository: loads linked disciplines
- Professor routes → Evaluation repository: calculates / saves ratings
- Professor routes → Input validation: validates rating
- Professor routes → Session controller: requires authenticated user
- Professor routes → Web templates: renders catalog and rating pages
- Web templates → Interface styles: loads styles
- User repository → SQLite database: reads / writes users
- Professor repository → SQLite database: reads professor catalog
- Discipline repository → SQLite database: reads disciplines
- Evaluation repository → SQLite database: reads / writes ratings
