# hubertpluta/inf03-inf04theoryexammaker architecture

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

- Interactive diagram: https://gitdiagram.com/hubertpluta/inf03-inf04theoryexammaker
- Repository: https://github.com/hubertpluta/inf03-inf04theoryexammaker

## Overview

This is an interactive Selenium scraper and answer helper for INF.03/INF.04 exams on egzamin-programista.pl. The user selects a mode and exam; the runner opens the exam, collects questions, answers, and images, matches questions against stored answers, selects known answers (or random choices when unknown), checks the exam, and saves newly revealed correct answers. The graph separates browser collection/actions from answer storage. The image collector’s implementation was not excerpted, so its connection is shown only where the runner explicitly calls it.

Main entry points: [`scraperFunctions/startScraper.py`](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/startScraper.py) (Exam runner), [`scraperFunctions/insert_new_questions_with_answers.py`](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/insert_new_questions_with_answers.py) (New answer storage), [`scraperFunctions/clicking_answers.py`](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/clicking_answers.py) (Answer selection), [`scraperFunctions/find_and_fill_answer_from_database.py`](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/find_and_fill_answer_from_database.py) (Answer lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Exam workflow"]
  node_main["Mode selection<br/>[main.py]"]
  node_runner["Exam runner<br/>[startScraper.py]"]
  node_builder["Question builder"]
  node_normalizer["Text normalizer<br/>[remove_prefix.py]"]
end

subgraph group_browser["Browser interaction"]
  node_questions["Question scraper"]
  node_answers["Answer scraper"]
  node_images["Image scraper"]
  node_selection["Answer selection"]
  node_check["Check answers"]
  node_correct["Correct-answer scraper"]
end

subgraph group_storage["Answer storage"]
  node_lookup["Answer lookup"]
  node_dbconfig["Database connector"]
  node_database[("MySQL answers")]
  node_insert["New answer storage"]
end

node_user(("Exam user"))
node_exam_site["Exam website"]

node_user -->|"chooses exam"| node_main
node_main -->|"starts run"| node_runner
node_runner -->|"opens exam"| node_exam_site
node_runner -->|"scrapes questions"| node_questions
node_runner -->|"scrapes choices"| node_answers
node_runner -->|"scrapes images"| node_images
node_runner -->|"builds question data"| node_builder
node_builder -->|"normalizes text"| node_normalizer
node_runner -->|"looks up answers"| node_lookup
node_lookup -->|"opens connection"| node_dbconfig
node_lookup -->|"queries answers"| node_database
node_dbconfig -->|"connects to"| node_database
node_runner -->|"selects answers"| node_selection
node_selection -->|"compares text"| node_normalizer
node_selection -->|"clicks choices"| node_exam_site
node_runner -->|"checks exam"| node_check
node_check -->|"submits answers"| node_exam_site
node_runner -->|"scrapes correct answers"| node_correct
node_runner -->|"stores new answers"| node_insert
node_insert -->|"normalizes answers"| node_normalizer
node_insert -->|"opens connection"| node_dbconfig
node_insert -->|"inserts answers"| node_database

click node_main "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/main.py"
click node_runner "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/startScraper.py"
click node_questions "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/get_questions_from_website.py"
click node_answers "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/get_answers_from_website.py"
click node_images "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/get_images_from_website.py"
click node_builder "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/build_questions_data.py"
click node_normalizer "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/utils/remove_prefix.py"
click node_lookup "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/find_and_fill_answer_from_database.py"
click node_dbconfig "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/config/database_connection.py"
click node_selection "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/clicking_answers.py"
click node_check "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/click_check_answers_button.py"
click node_correct "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/get_correct_answers_from_website.py"
click node_insert "https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/insert_new_questions_with_answers.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_main,node_runner,node_builder,node_normalizer,node_user toneBlue
class node_questions,node_answers,node_images,node_selection,node_check,node_correct toneAmber
class node_lookup,node_dbconfig,node_database,node_insert toneMint
class node_exam_site toneIndigo
```

## Components

### Exam workflow

- [Mode selection](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/main.py): `main.py`
- [Exam runner](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/startScraper.py): `scraperFunctions/startScraper.py`
- [Question builder](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/build_questions_data.py): `scraperFunctions/build_questions_data.py`
- [Text normalizer](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/utils/remove_prefix.py): `utils/remove_prefix.py`

### Browser interaction

- [Question scraper](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/get_questions_from_website.py): `scraperFunctions/get_questions_from_website.py`
- [Answer scraper](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/get_answers_from_website.py): `scraperFunctions/get_answers_from_website.py`
- [Image scraper](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/get_images_from_website.py): `scraperFunctions/get_images_from_website.py`
- [Answer selection](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/clicking_answers.py): `scraperFunctions/clicking_answers.py`
- [Check answers](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/click_check_answers_button.py): `scraperFunctions/click_check_answers_button.py`
- [Correct-answer scraper](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/get_correct_answers_from_website.py): `scraperFunctions/get_correct_answers_from_website.py`

### Answer storage

- [Answer lookup](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/find_and_fill_answer_from_database.py): `scraperFunctions/find_and_fill_answer_from_database.py`
- [Database connector](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/config/database_connection.py): `config/database_connection.py`
- **MySQL answers**
- [New answer storage](https://github.com/hubertpluta/inf03-inf04theoryexammaker/blob/main/scraperFunctions/insert_new_questions_with_answers.py): `scraperFunctions/insert_new_questions_with_answers.py`

### Other components

- **Exam user**
- **Exam website**

## Connections

- Exam user → Mode selection: chooses exam (evidence: `main.py`)
- Mode selection → Exam runner: starts run (evidence: `main.py`)
- Exam runner → Exam website: opens exam (evidence: `scraperFunctions/startScraper.py`)
- Exam runner → Question scraper: scrapes questions (evidence: `scraperFunctions/startScraper.py`)
- Exam runner → Answer scraper: scrapes choices (evidence: `scraperFunctions/startScraper.py`)
- Exam runner → Image scraper: scrapes images (evidence: `scraperFunctions/startScraper.py`)
- Exam runner → Question builder: builds question data (evidence: `scraperFunctions/startScraper.py`)
- Question builder → Text normalizer: normalizes text (evidence: `scraperFunctions/build_questions_data.py`)
- Exam runner → Answer lookup: looks up answers (evidence: `scraperFunctions/startScraper.py`)
- Answer lookup → Database connector: opens connection (evidence: `scraperFunctions/find_and_fill_answer_from_database.py`)
- Answer lookup → MySQL answers: queries answers (evidence: `scraperFunctions/find_and_fill_answer_from_database.py`)
- Database connector → MySQL answers: connects to (evidence: `config/database_connection.py`)
- Exam runner → Answer selection: selects answers (evidence: `scraperFunctions/startScraper.py`)
- Answer selection → Text normalizer: compares text (evidence: `scraperFunctions/clicking_answers.py`)
- Answer selection → Exam website: clicks choices (evidence: `scraperFunctions/clicking_answers.py`)
- Exam runner → Check answers: checks exam (evidence: `scraperFunctions/startScraper.py`)
- Check answers → Exam website: submits answers (evidence: `scraperFunctions/click_check_answers_button.py`)
- Exam runner → Correct-answer scraper: scrapes correct answers (evidence: `scraperFunctions/startScraper.py`)
- Exam runner → New answer storage: stores new answers (evidence: `scraperFunctions/startScraper.py`)
- New answer storage → Text normalizer: normalizes answers (evidence: `scraperFunctions/insert_new_questions_with_answers.py`)
- New answer storage → Database connector: opens connection (evidence: `scraperFunctions/insert_new_questions_with_answers.py`)
- New answer storage → MySQL answers: inserts answers (evidence: `scraperFunctions/insert_new_questions_with_answers.py`)
