# l4ntly/english-learning-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/l4ntly/english-learning-chatbot
- Repository: https://github.com/l4ntly/english-learning-chatbot

## Overview

This repository is an English-learning assistant with two main workflows: a Streamlit chat that sends teaching prompts to a local Ollama model, and a batch process that selects vocabulary without questions, generates quiz content, and saves it. A separate import workflow loads vocabulary and example translations into SQL Server. The README also describes the database-backed quiz capability. Connections shown are supported by the excerpts or README; database schema details and runtime deployment wiring were not inspected.

Main entry points: [`src/database.py`](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/database.py) (Vocabulary store), [`src/main.py`](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/main.py) (Quiz generator), [`src/import_dataset.py`](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/import_dataset.py) (Vocabulary import), [`src/app.py`](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/app.py) (Chat interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning experience"]
  node_chat_ui["Chat interface<br/>[app.py]"]
  node_chat_prompt["Teaching prompt<br/>[app.py]"]
  node_chat_model_call["Chat response<br/>[llm.py]"]
end

subgraph group_content["Vocabulary and quizzes"]
  node_vocabulary_data["Vocabulary CSV<br/>[dataset1.csv]"]
  node_translation_data["Translation CSV<br/>[dataset2.csv]"]
  node_vocabulary_import["Vocabulary import<br/>[import_dataset.py]"]
  node_translation_update["Translation update<br/>[import_dataset.py]"]
  node_quiz_runner["Quiz generator<br/>[main.py]"]
  node_quiz_prompt["Quiz generation<br/>[llm.py]"]
  node_quiz_records[("Quiz records<br/>[database_setup.sql]")]
end

subgraph group_services["Model and persistence"]
  node_vocabulary_store[("Vocabulary store<br/>[database.py]")]
  node_sql_server[("SQL Server")]
  node_ollama["Ollama Llama 3.2"]
end

node_learner(("Learner"))
node_operator(("Dataset operator"))

node_learner -->|"sends prompt"| node_chat_ui
node_chat_ui -->|"formats request"| node_chat_prompt
node_chat_prompt -->|"requests response"| node_chat_model_call
node_chat_model_call -->|"calls chat API"| node_ollama
node_operator -.->|"starts import"| node_vocabulary_import
node_vocabulary_data -->|"provides words"| node_vocabulary_import
node_translation_data -->|"provides translations"| node_translation_update
node_vocabulary_import -->|"inserts words"| node_vocabulary_store
node_translation_update -->|"updates translations"| node_vocabulary_store
node_quiz_runner -->|"gets unenriched words"| node_vocabulary_store
node_quiz_runner -->|"requests question"| node_quiz_prompt
node_quiz_prompt -->|"calls chat API"| node_ollama
node_quiz_runner -->|"saves questions"| node_quiz_records
node_vocabulary_store -->|"queries and writes"| node_sql_server
node_quiz_records -.->|"stored in"| node_sql_server

click node_chat_ui "https://github.com/l4ntly/english-learning-chatbot/blob/main/src/app.py"
click node_chat_prompt "https://github.com/l4ntly/english-learning-chatbot/blob/main/src/app.py"
click node_chat_model_call "https://github.com/l4ntly/english-learning-chatbot/blob/main/src/llm.py"
click node_vocabulary_data "https://github.com/l4ntly/english-learning-chatbot/blob/main/data/dataset1.csv"
click node_translation_data "https://github.com/l4ntly/english-learning-chatbot/blob/main/data/dataset2.csv"
click node_vocabulary_import "https://github.com/l4ntly/english-learning-chatbot/blob/main/src/import_dataset.py"
click node_translation_update "https://github.com/l4ntly/english-learning-chatbot/blob/main/src/import_dataset.py"
click node_quiz_runner "https://github.com/l4ntly/english-learning-chatbot/blob/main/src/main.py"
click node_quiz_prompt "https://github.com/l4ntly/english-learning-chatbot/blob/main/src/llm.py"
click node_quiz_records "https://github.com/l4ntly/english-learning-chatbot/blob/main/database_setup.sql"
click node_vocabulary_store "https://github.com/l4ntly/english-learning-chatbot/blob/main/src/database.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_chat_ui,node_chat_prompt,node_chat_model_call toneBlue
class node_vocabulary_data,node_translation_data,node_vocabulary_import,node_translation_update,node_quiz_runner,node_quiz_prompt,node_quiz_records toneAmber
class node_vocabulary_store,node_sql_server,node_ollama toneMint
class node_learner,node_operator toneIndigo
```

## Components

### Learning experience

- [Chat interface](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/app.py): `src/app.py`
- [Teaching prompt](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/app.py): `src/app.py`
- [Chat response](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/llm.py): `src/llm.py`

### Vocabulary and quizzes

- [Vocabulary CSV](https://github.com/l4ntly/english-learning-chatbot/blob/main/data/dataset1.csv): `data/dataset1.csv`
- [Translation CSV](https://github.com/l4ntly/english-learning-chatbot/blob/main/data/dataset2.csv): `data/dataset2.csv`
- [Vocabulary import](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/import_dataset.py): `src/import_dataset.py`
- [Translation update](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/import_dataset.py): `src/import_dataset.py`
- [Quiz generator](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/main.py): `src/main.py`
- [Quiz generation](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/llm.py): `src/llm.py`
- [Quiz records](https://github.com/l4ntly/english-learning-chatbot/blob/main/database_setup.sql): `database_setup.sql`

### Model and persistence

- [Vocabulary store](https://github.com/l4ntly/english-learning-chatbot/blob/main/src/database.py): `src/database.py`
- **SQL Server**
- **Ollama Llama 3.2**

### Other components

- **Learner**
- **Dataset operator**

## Connections

- Learner → Chat interface: sends prompt (evidence: `src/app.py`)
- Chat interface → Teaching prompt: formats request (evidence: `src/app.py`)
- Teaching prompt → Chat response: requests response (evidence: `src/app.py`)
- Chat response → Ollama Llama 3.2: calls chat API (evidence: `src/llm.py`)
- Dataset operator → Vocabulary import: starts import
- Vocabulary CSV → Vocabulary import: provides words (evidence: `src/import_dataset.py`)
- Translation CSV → Translation update: provides translations (evidence: `src/import_dataset.py`)
- Vocabulary import → Vocabulary store: inserts words (evidence: `src/import_dataset.py`)
- Translation update → Vocabulary store: updates translations (evidence: `src/import_dataset.py`)
- Quiz generator → Vocabulary store: gets unenriched words (evidence: `src/main.py`)
- Quiz generator → Quiz generation: requests question (evidence: `src/main.py`)
- Quiz generation → Ollama Llama 3.2: calls chat API (evidence: `src/llm.py`)
- Quiz generator → Quiz records: saves questions (evidence: `src/main.py`)
- Vocabulary store → SQL Server: queries and writes (evidence: `src/database.py`)
- Quiz records → SQL Server: stored in
