# aarahman04/new_loyal_quiz architecture

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

- Interactive diagram: https://gitdiagram.com/aarahman04/new_loyal_quiz
- Repository: https://github.com/aarahman04/new_loyal_quiz

## Overview

#### Purpose and delivery model
Loyal’s MCQ is a static, browser-run learning site for KG-3 and Class 1 practice in Math, English, Science, and GK. It has no backend, database, package runtime, or build step; HTML pages, CSS, and ES6 browser JavaScript are deployed to any HTTP static host, including GitHub Pages. Primary entry point: `index.html`.

#### Learner navigation tree
Navigation is an explicit hierarchy of linked static pages: home → level/subject → subject topics → individual exercise. Key routing layers are `start-page/subject_level1.html`, `start-page2/Level 1/Level1_math_options.html`, and `start-page3/Level1_english/level1_eng_identify_options.html`. Exercise pages are terminal content-and-runtime units, not dynamically routed application views.

#### Shared page chrome and path boundary
All pages reserve header/footer placeholders; `js/partials.js` injects shared UI, favicon references, and footer icon dependencies. It derives the site root from its own script URL, insulating deeply nested exercise pages from relative-path depth. `partials/header.html` and `partials/footer.html` are reference markup, while runtime injection is owned by `js/partials.js`. HTTP serving is required for this shared-resource behavior.

#### Quiz engines
Four client-side interaction engines operate against page-embedded question banks:
- Standard MCQ lifecycle—random selection, answer evaluation, feedback/explanations, score, and emoji effects—is in `js/script.js`, used heavily by `question/Level 1 Maths/` and `question/level_1_GK/`.
- Picture/count selection is in `js/tap_select.js`, used by KG-3 exercises such as `question/KG-3_math/kg3_math_tap_and_count.html`.
- English manipulation exercises use `js/drag_and_drop.js`, with examples under `question/level-1/English/level1_eng_drag_&_drop/`.
- Listen-and-choose uses browser Web Speech APIs through `js/audio.js`.

#### Exercise content contract
Each exercise is a standalone HTML file containing its question data and selecting its engine at page load. MCQ pages expose `questions` and invoke `initMCQQuiz`; tap-select pages invoke `initTapSelectQuiz`. Engines copy/shuffle the source bank and present 25 questions from a typical 100-question bank, preserving the embedded array for repeat attempts. The shared quiz DOM contract and shell styling center on `css/question.css`; interaction-specific layers are `css/dnd.css` and `css/tap_select.css`.

#### Content domains and assets
Question-bank ownership follows subject folders: `question/Level 1 Maths/`, `question/level-1/English/`, `question/level-1_Science/`, and `question/level_1_GK/`. Visual prompts and local fonts are supplied from `image/`, while global presentation is split between `css/index.css` for navigation/shared UI and quiz-format stylesheets. Google Fonts and Bootstrap Icons are external browser-loaded UI services; audio depends on the browser’s speech implementation.

#### Generation and hosting
`gen_questions.py` and `gen_gk.py` are optional offline Python generators for math/GK question-bank content, outside the production site runtime. Deployment infrastructure is static-host oriented, with GitHub workflow configuration at `.github/workflows/static.yml`; local development can use Python’s HTTP server.

Main entry points: [`start-page/subject_level1.html`](https://github.com/aarahman04/new_loyal_quiz/blob/main/start-page/subject_level1.html) (Level and subject), [`css/question.css`](https://github.com/aarahman04/new_loyal_quiz/blob/main/css/question.css) (Quiz styles), [`index.html`](https://github.com/aarahman04/new_loyal_quiz/blob/main/index.html) (Home), [`start-page2/Level 1/Level1_math_options.html`](https://github.com/aarahman04/new_loyal_quiz/blob/main/start-page2/Level%201/Level1_math_options.html) (Math topic menu)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_delivery["Static delivery"]
  node_host{{"Static HTTP host<br/>hosting"}}
end

subgraph group_navigation["Navigation"]
  node_home["Home<br/>HTML entry<br/>[index.html]"]
  node_level_subject["Level and subject<br/>HTML route"]
  node_topic_menu["Math topic menu<br/>HTML route"]
  node_english_menu["English exercise menu<br/>HTML route"]
end

subgraph group_shared["Shared chrome"]
  node_partials["Chrome injector<br/>browser JS<br/>[partials.js]"]
  node_reference_markup["Header and footer markup<br/>HTML partials<br/>[header.html]"]
  node_global_css["Navigation styles<br/>CSS<br/>[index.css]"]
end

subgraph group_quiz["Quiz runtime"]
  node_mcq["Standard MCQ engine<br/>browser JS<br/>[script.js]"]
  node_tap["Tap-select engine<br/>browser JS<br/>[tap_select.js]"]
  node_drag["Drag-and-drop engine<br/>browser JS<br/>[drag_and_drop.js]"]
  node_audio["Listen-and-choose<br/>browser JS<br/>[audio.js]"]
  node_quiz_css["Quiz styles<br/>CSS<br/>[question.css]"]
end

subgraph group_content["Exercise content"]
  node_exercise_pages["Exercise pages<br/>standalone HTML"]
  node_subject_banks["Subject question banks<br/>HTML folders"]
  node_assets["Images and fonts<br/>local assets"]
end

subgraph group_offline["Offline tooling"]
  node_generators["Question generators<br/>Python scripts<br/>[gen_questions.py]"]
  node_github_pages["GitHub Pages workflow<br/>deployment workflow<br/>[static.yml]"]
end

node_host -->|"serves"| node_home
node_home -->|"links"| node_level_subject
node_level_subject -->|"links"| node_topic_menu
node_level_subject -->|"links"| node_english_menu
node_topic_menu -->|"links to exercises"| node_exercise_pages
node_english_menu -->|"links to exercises"| node_exercise_pages
node_exercise_pages -.->|"organized under"| node_subject_banks
node_exercise_pages -->|"loads"| node_partials
node_partials -->|"injects chrome from"| node_reference_markup
node_exercise_pages -.->|"uses"| node_global_css
node_exercise_pages -->|"uses prompts and fonts"| node_assets
node_exercise_pages -->|"initializes MCQ"| node_mcq
node_exercise_pages -->|"initializes tap-select"| node_tap
node_exercise_pages -->|"initializes drag-and-drop"| node_drag
node_exercise_pages -->|"enables listening"| node_audio
node_mcq -.->|"uses"| node_quiz_css
node_tap -.->|"uses"| node_quiz_css
node_drag -.->|"uses"| node_quiz_css
node_generators -.->|"generates optional content for"| node_subject_banks
node_github_pages -->|"deploys to"| node_host

click node_home "https://github.com/aarahman04/new_loyal_quiz/blob/main/index.html"
click node_level_subject "https://github.com/aarahman04/new_loyal_quiz/blob/main/start-page/subject_level1.html"
click node_topic_menu "https://github.com/aarahman04/new_loyal_quiz/blob/main/start-page2/Level%201/Level1_math_options.html"
click node_english_menu "https://github.com/aarahman04/new_loyal_quiz/blob/main/start-page3/Level1_english/level1_eng_identify_options.html"
click node_partials "https://github.com/aarahman04/new_loyal_quiz/blob/main/js/partials.js"
click node_reference_markup "https://github.com/aarahman04/new_loyal_quiz/blob/main/partials/header.html"
click node_global_css "https://github.com/aarahman04/new_loyal_quiz/blob/main/css/index.css"
click node_mcq "https://github.com/aarahman04/new_loyal_quiz/blob/main/js/script.js"
click node_tap "https://github.com/aarahman04/new_loyal_quiz/blob/main/js/tap_select.js"
click node_drag "https://github.com/aarahman04/new_loyal_quiz/blob/main/js/drag_and_drop.js"
click node_audio "https://github.com/aarahman04/new_loyal_quiz/blob/main/js/audio.js"
click node_quiz_css "https://github.com/aarahman04/new_loyal_quiz/blob/main/css/question.css"
click node_generators "https://github.com/aarahman04/new_loyal_quiz/blob/main/gen_questions.py"
click node_github_pages "https://github.com/aarahman04/new_loyal_quiz/blob/main/.github/workflows/static.yml"

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_host toneBlue
class node_home,node_level_subject,node_topic_menu,node_english_menu toneAmber
class node_partials,node_reference_markup,node_global_css toneMint
class node_mcq,node_tap,node_drag,node_audio,node_quiz_css toneRose
class node_exercise_pages,node_subject_banks,node_assets toneIndigo
class node_generators,node_github_pages toneTeal
```

## Components

### Static delivery

Browser-served files with no application backend.

- **Static HTTP host**: hosting · Serves the site files; HTTP is required for shared-resource loading.

### Navigation

Linked static-page hierarchy.

- [Home](https://github.com/aarahman04/new_loyal_quiz/blob/main/index.html): HTML entry · `index.html`
- [Level and subject](https://github.com/aarahman04/new_loyal_quiz/blob/main/start-page/subject_level1.html): HTML route · `start-page/subject_level1.html`
- [Math topic menu](https://github.com/aarahman04/new_loyal_quiz/blob/main/start-page2/Level%201/Level1_math_options.html): HTML route · `start-page2/Level 1/Level1_math_options.html`
- [English exercise menu](https://github.com/aarahman04/new_loyal_quiz/blob/main/start-page3/Level1_english/level1_eng_identify_options.html): HTML route · `start-page3/Level1_english/level1_eng_identify_options.html`

### Shared chrome

Runtime-injected page shell and shared styling.

- [Chrome injector](https://github.com/aarahman04/new_loyal_quiz/blob/main/js/partials.js): browser JS · Derives the site root from its script URL and injects shared UI. · `js/partials.js`
- [Header and footer markup](https://github.com/aarahman04/new_loyal_quiz/blob/main/partials/header.html): HTML partials · Reference markup for the injected page chrome. · `partials/header.html`
- [Navigation styles](https://github.com/aarahman04/new_loyal_quiz/blob/main/css/index.css): CSS · `css/index.css`

### Quiz runtime

Page-selected browser interaction engines.

- [Standard MCQ engine](https://github.com/aarahman04/new_loyal_quiz/blob/main/js/script.js): browser JS · Shuffles a copied bank, runs 25 questions, scores, and shows feedback. · `js/script.js`
- [Tap-select engine](https://github.com/aarahman04/new_loyal_quiz/blob/main/js/tap_select.js): browser JS · `js/tap_select.js`
- [Drag-and-drop engine](https://github.com/aarahman04/new_loyal_quiz/blob/main/js/drag_and_drop.js): browser JS · `js/drag_and_drop.js`
- [Listen-and-choose](https://github.com/aarahman04/new_loyal_quiz/blob/main/js/audio.js): browser JS · Uses browser Web Speech APIs. · `js/audio.js`
- [Quiz styles](https://github.com/aarahman04/new_loyal_quiz/blob/main/css/question.css): CSS · Shared shell plus tap-select and drag-and-drop layers. · `css/question.css`

### Exercise content

Standalone pages with embedded question banks.

- **Exercise pages**: standalone HTML · Embed question arrays and select an engine at page load.
- **Subject question banks**: HTML folders · Math, English, Science, and GK exercise ownership.
- **Images and fonts**: local assets

### Offline tooling

Optional content generation and static deployment.

- [Question generators](https://github.com/aarahman04/new_loyal_quiz/blob/main/gen_questions.py): Python scripts · Optional offline math and GK content generation. · `gen_questions.py`
- [GitHub Pages workflow](https://github.com/aarahman04/new_loyal_quiz/blob/main/.github/workflows/static.yml): deployment workflow · `.github/workflows/static.yml`

## Connections

- Static HTTP host → Home: serves
- Home → Level and subject: links
- Level and subject → Math topic menu: links
- Level and subject → English exercise menu: links
- Math topic menu → Exercise pages: links to exercises
- English exercise menu → Exercise pages: links to exercises
- Exercise pages → Subject question banks: organized under
- Exercise pages → Chrome injector: loads
- Chrome injector → Header and footer markup: injects chrome from
- Exercise pages → Navigation styles: uses
- Exercise pages → Images and fonts: uses prompts and fonts
- Exercise pages → Standard MCQ engine: initializes MCQ
- Exercise pages → Tap-select engine: initializes tap-select
- Exercise pages → Drag-and-drop engine: initializes drag-and-drop
- Exercise pages → Listen-and-choose: enables listening
- Standard MCQ engine → Quiz styles: uses
- Tap-select engine → Quiz styles: uses
- Drag-and-drop engine → Quiz styles: uses
- Question generators → Subject question banks: generates optional content for
- GitHub Pages workflow → Static HTTP host: deploys to
