# omar-scitech/activelearn-ai architecture

> Architecture diagram of the GitHub repository omar-scitech/activelearn-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/omar-scitech/activelearn-ai
- Repository: https://github.com/omar-scitech/activelearn-ai

## Overview

ActiveLearn AI is an adaptive study platform for students and instructors. A student uses the browser interface to answer a quiz; the Flask API records the attempt, refreshes chapter mastery using the selected knowledge-tracing model, and chooses later questions based on mastery and difficulty. The same application supports chapter practice, question-bank management, reports, and feedback. Model preparation and training, database setup, and analytics are supporting product capabilities. Edges follow the README and shown imports/calls; unsampled API details are not inferred.

Main entry points: [`backend/activelearn.db`](https://github.com/omar-scitech/activelearn-ai/blob/main/backend/activelearn.db) (Application database), [`backend/app.py`](https://github.com/omar-scitech/activelearn-ai/blob/main/backend/app.py) (Flask API), [`backend/mastery.py`](https://github.com/omar-scitech/activelearn-ai/blob/main/backend/mastery.py) (Mastery hook), [`frontend/index.html`](https://github.com/omar-scitech/activelearn-ai/blob/main/frontend/index.html) (Web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Student Interface"]
  node_frontend["Web interface<br/>[index.html]"]
end

subgraph group_app["Learning Application"]
  node_api["Flask API<br/>[app.py]"]
  node_adaptive["Quiz selection<br/>[app.py]"]
  node_mastery["Mastery hook<br/>[mastery.py]"]
  node_instructor_tools["Class and question tools<br/>[app.py]"]
  node_feedback["Feedback handling<br/>[app.py]"]
end

subgraph group_data["Learning Data"]
  node_db[("Application database<br/>[activelearn.db]")]
  node_schema["Schema and course seed<br/>[create_database.py]"]
  node_simulator["Student simulator"]
end

subgraph group_ai["Models and Analytics"]
  node_trainer["Model training<br/>[train.py]"]
  node_preparation["Sequence preparation<br/>[prepare_data.py]"]
  node_architecture["DKT, DKT-Q, SAKT<br/>[dkt.py]"]
  node_predictor["PyTorch inference<br/>[predictor.py]"]
  node_numpy_predictor["NumPy inference<br/>[predictor_np.py]"]
  node_reports["Reports and queries<br/>[reports.sql]"]
  node_charts["Report charts<br/>[make_charts.py]"]
  node_export["Attempt export<br/>[export_for_ai.py]"]
end

node_student(("Student"))
node_instructor(("Instructor"))

node_student -->|"uses"| node_frontend
node_instructor -->|"uses"| node_frontend
node_frontend -->|"calls API"| node_api
node_api -->|"records attempts"| node_db
node_api -->|"updates mastery"| node_mastery
node_api -->|"starts quiz"| node_adaptive
node_adaptive -->|"reads and selects"| node_db
node_mastery -->|"loads model"| node_predictor
node_mastery -->|"fallback inference"| node_numpy_predictor
node_predictor -->|"builds model"| node_architecture
node_api -->|"serves tools"| node_instructor_tools
node_instructor_tools -->|"reads and edits"| node_db
node_api -->|"handles messages"| node_feedback
node_feedback -->|"saves messages"| node_db
node_schema -->|"creates tables"| node_db
node_simulator -->|"writes histories"| node_db
node_preparation -->|"loads course data"| node_schema
node_trainer -->|"trains models"| node_architecture
node_api -->|"serves reports"| node_reports
node_reports -->|"queries tables"| node_db
node_charts -->|"reads tables"| node_db
node_export -.->|"exports attempts"| node_db

click node_frontend "https://github.com/omar-scitech/activelearn-ai/blob/main/frontend/index.html"
click node_api "https://github.com/omar-scitech/activelearn-ai/blob/main/backend/app.py"
click node_adaptive "https://github.com/omar-scitech/activelearn-ai/blob/main/backend/app.py"
click node_mastery "https://github.com/omar-scitech/activelearn-ai/blob/main/backend/mastery.py"
click node_instructor_tools "https://github.com/omar-scitech/activelearn-ai/blob/main/backend/app.py"
click node_feedback "https://github.com/omar-scitech/activelearn-ai/blob/main/backend/app.py"
click node_db "https://github.com/omar-scitech/activelearn-ai/blob/main/backend/activelearn.db"
click node_schema "https://github.com/omar-scitech/activelearn-ai/blob/main/database/create_database.py"
click node_simulator "https://github.com/omar-scitech/activelearn-ai/blob/main/database/simulate_students.py"
click node_trainer "https://github.com/omar-scitech/activelearn-ai/blob/main/model/train.py"
click node_preparation "https://github.com/omar-scitech/activelearn-ai/blob/main/model/prepare_data.py"
click node_architecture "https://github.com/omar-scitech/activelearn-ai/blob/main/model/dkt.py"
click node_predictor "https://github.com/omar-scitech/activelearn-ai/blob/main/model/predictor.py"
click node_numpy_predictor "https://github.com/omar-scitech/activelearn-ai/blob/main/model/predictor_np.py"
click node_reports "https://github.com/omar-scitech/activelearn-ai/blob/main/analysis/reports.sql"
click node_charts "https://github.com/omar-scitech/activelearn-ai/blob/main/analysis/make_charts.py"
click node_export "https://github.com/omar-scitech/activelearn-ai/blob/main/analysis/export_for_ai.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_frontend toneBlue
class node_api,node_adaptive,node_mastery,node_instructor_tools,node_feedback toneAmber
class node_db,node_schema,node_simulator toneMint
class node_trainer,node_preparation,node_architecture,node_predictor,node_numpy_predictor,node_reports,node_charts,node_export toneRose
class node_student,node_instructor toneIndigo
```

## Components

### Student Interface

- [Web interface](https://github.com/omar-scitech/activelearn-ai/blob/main/frontend/index.html): `frontend/index.html`

### Learning Application

- [Flask API](https://github.com/omar-scitech/activelearn-ai/blob/main/backend/app.py): `backend/app.py`
- [Quiz selection](https://github.com/omar-scitech/activelearn-ai/blob/main/backend/app.py): `backend/app.py`
- [Mastery hook](https://github.com/omar-scitech/activelearn-ai/blob/main/backend/mastery.py): `backend/mastery.py`
- [Class and question tools](https://github.com/omar-scitech/activelearn-ai/blob/main/backend/app.py): `backend/app.py`
- [Feedback handling](https://github.com/omar-scitech/activelearn-ai/blob/main/backend/app.py): `backend/app.py`

### Learning Data

- [Application database](https://github.com/omar-scitech/activelearn-ai/blob/main/backend/activelearn.db): `backend/activelearn.db`
- [Schema and course seed](https://github.com/omar-scitech/activelearn-ai/blob/main/database/create_database.py): `database/create_database.py`
- [Student simulator](https://github.com/omar-scitech/activelearn-ai/blob/main/database/simulate_students.py): `database/simulate_students.py`

### Models and Analytics

- [Model training](https://github.com/omar-scitech/activelearn-ai/blob/main/model/train.py): `model/train.py`
- [Sequence preparation](https://github.com/omar-scitech/activelearn-ai/blob/main/model/prepare_data.py): `model/prepare_data.py`
- [DKT, DKT-Q, SAKT](https://github.com/omar-scitech/activelearn-ai/blob/main/model/dkt.py): `model/dkt.py`
- [PyTorch inference](https://github.com/omar-scitech/activelearn-ai/blob/main/model/predictor.py): `model/predictor.py`
- [NumPy inference](https://github.com/omar-scitech/activelearn-ai/blob/main/model/predictor_np.py): `model/predictor_np.py`
- [Reports and queries](https://github.com/omar-scitech/activelearn-ai/blob/main/analysis/reports.sql): `analysis/reports.sql`
- [Report charts](https://github.com/omar-scitech/activelearn-ai/blob/main/analysis/make_charts.py): `analysis/make_charts.py`
- [Attempt export](https://github.com/omar-scitech/activelearn-ai/blob/main/analysis/export_for_ai.py): `analysis/export_for_ai.py`

### Other components

- **Student**
- **Instructor**

## Connections

- Student → Web interface: uses (evidence: `README.md`)
- Instructor → Web interface: uses (evidence: `README.md`)
- Web interface → Flask API: calls API (evidence: `README.md`)
- Flask API → Application database: records attempts (evidence: `README.md`)
- Flask API → Mastery hook: updates mastery (evidence: `backend/app.py`)
- Flask API → Quiz selection: starts quiz (evidence: `README.md`)
- Quiz selection → Application database: reads and selects (evidence: `README.md`)
- Mastery hook → PyTorch inference: loads model (evidence: `backend/mastery.py`)
- Mastery hook → NumPy inference: fallback inference (evidence: `backend/mastery.py`)
- PyTorch inference → DKT, DKT-Q, SAKT: builds model (evidence: `model/predictor.py`)
- Flask API → Class and question tools: serves tools (evidence: `README.md`)
- Class and question tools → Application database: reads and edits (evidence: `README.md`)
- Flask API → Feedback handling: handles messages (evidence: `backend/app.py`)
- Feedback handling → Application database: saves messages (evidence: `README.md`)
- Schema and course seed → Application database: creates tables (evidence: `README.md`)
- Student simulator → Application database: writes histories (evidence: `database/simulate_students.py`)
- Sequence preparation → Schema and course seed: loads course data (evidence: `model/prepare_data.py`)
- Model training → DKT, DKT-Q, SAKT: trains models (evidence: `model/train.py`)
- Flask API → Reports and queries: serves reports (evidence: `README.md`)
- Reports and queries → Application database: queries tables (evidence: `README.md`)
- Report charts → Application database: reads tables (evidence: `README.md`)
- Attempt export → Application database: exports attempts
