# arya-221/hindi-olab architecture

> Architecture diagram of the GitHub repository arya-221/hindi-olab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arya-221/hindi-olab
- Repository: https://github.com/arya-221/hindi-olab

## Overview

1. **Repository shape**
   - This is a small Django project named **`olab`** with one main app, **`eng`**.
   - The app implements a **“Clause Simulator”** for grammar exercises, backed by template-rendered pages and text-file vocabularies rather than a heavy database model.

2. **Two feature slices**
   - The application is split into two exercise flows:
     - **Independent clause identification**
     - **Dependent clause identification**
   - Each flow has its own backend logic and its own set of templates, but both follow the same pattern: present a sentence, evaluate the learner’s choice, then show explanation/theory pages.

3. **Django request boundary**
   - The main routing boundary is the Django URL configuration:
     - Project routes live in **`olab/urls.py`**
     - App routes live in **`eng/urls.py`**
   - Requests enter through Django’s standard WSGI/ASGI entry points in **`olab/wsgi.py`** and **`olab/asgi.py`**.

4. **Backend logic layer**
   - The core rule-based processing is in **`eng/views.py`** and **`eng/views2.py`**.
   - These files act as the application’s “engine”: they likely assemble sentences, classify clauses, and decide which feedback page to show.
   - The README refers to `views1.py` for the dependent-clause exercise, but the tree shows the actual file as **`views2.py`**.

5. **Lexicon/rule data layer**
   - The app relies heavily on many **plain-text word lists** under `eng/`.
   - These files store categorized vocabulary such as names, verbs, places, food words, playing/watching/drinking/cooking words, days, groups, etc.
   - This means the architecture is closer to a **dictionary-driven parser/rule matcher** than a database-backed content system.

6. **Exercise-specific data sets**
   - For the independent-clause exercise, the backend uses files like:
     - `names.txt`, `verbs.txt`, `places.txt`, `days.txt`, `group.txt`
     - plus semantic sets like `drinkable.txt`, `eatable.txt`, `playable.txt`, `watchable.txt`, `cookable.txt`
   - For the dependent-clause exercise, it uses files such as:
     - `names1.txt`, `names2.txt`, `verb1.txt`, `verb2.txt`, `verb3.txt`
     - `food1.txt`, `hungry.txt`, `places1.txt`, `class.txt`, `books.txt`

7. **Template/presentation layer**
   - The UI is template-driven using Django HTML templates in **`templates/`**.
   - Independent-clause screens: `ex1.html`, `next.html`, `explanation.html`, `theory.html`
   - Dependent-clause screens: `ex2.html`, `next2.html`, `explanation2.html`, `theory2.html`
   - This suggests a staged user journey: exercise input/result page → explanation page → theory/reference page.

8. **Static assets**
   - Frontend styling is minimal and centralized in **`static/css/style.css`**.
   - There is also an image asset under **`static/images/`** for the tab icon, indicating a lightweight presentation layer with no complex frontend framework.

9. **Data persistence**
   - The repository includes **`db.sqlite3`**, but the architecture does not appear to depend on rich relational persistence for the learning logic.
   - The dominant “content store” is the collection of text files; SQLite is likely just the default Django database and may be used lightly or not at all for the core exercises.

10. **Supporting Django app structure**
   - `eng/models.py`, `admin.py`, `apps.py`, and `migrations/` are present, but the repo’s main behavior is driven by view logic and text resources rather than model-centric workflows.
   - `eng/tests.py` exists for automated checks, though the repository appears oriented more toward instructional/demo behavior than a large test suite.

11. **Core data flow**
   - A learner hits an exercise route.
   - Django routes the request to the relevant view in `eng`.
   - The view reads one or more word-list files, constructs or evaluates a clause/sentence, and renders a template.
   - The user sees feedback and explanation pages, with the theory pages acting as static instructional content.

12. **Architectural character**
   - Overall, this is a **rule-based educational web application** built with Django.
   - The main architectural boundary is between:
     - **presentation**: HTML templates + CSS
     - **logic**: view functions
     - **content/rules**: text-based lexical lists
   - It is not a microservice system and not a data-heavy CRUD app; it is a compact, server-rendered teaching tool.

Main entry points: [`eng/views2.py`](https://github.com/arya-221/hindi-olab/blob/master/eng/views2.py) (Clause engine 2), [`eng/views.py`](https://github.com/arya-221/hindi-olab/blob/master/eng/views.py) (Clause engine), [`eng/urls.py`](https://github.com/arya-221/hindi-olab/blob/master/eng/urls.py) (App URLs), [`templates/ex1.html`](https://github.com/arya-221/hindi-olab/blob/master/templates/ex1.html) (Exercise 1)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_project["Django project"]
  node_olab_asgi["ASGI entry<br/>django entrypoint<br/>[asgi.py]"]
  node_olab_wsgi["WSGI entry<br/>django entrypoint<br/>[wsgi.py]"]
  node_olab_urls["Project URLs<br/>django routing<br/>[urls.py]"]
end

subgraph group_app["eng app"]
  node_eng_urls["App URLs<br/>django routing<br/>[urls.py]"]
  node_eng_views["Clause engine<br/>independent flow<br/>[views.py]"]
  node_eng_views2["Clause engine 2<br/>dependent flow<br/>[views2.py]"]
  node_eng_dependent["Dependent helpers<br/>support module<br/>[dependent.py]"]
  node_eng_models[("Models<br/>django model layer<br/>[models.py]")]
  node_eng_admin["Admin<br/>[admin.py]"]
end

subgraph group_templates["Templates"]
  node_ex1["Exercise 1<br/>template<br/>[ex1.html]"]
  node_next1["Feedback 1<br/>template<br/>[next.html]"]
  node_explanation1["Explain 1<br/>template<br/>[explanation.html]"]
  node_theory1["Theory 1<br/>template<br/>[theory.html]"]
  node_ex2["Exercise 2<br/>template<br/>[ex2.html]"]
  node_next2["Feedback 2<br/>template<br/>[next2.html]"]
  node_explanation2["Explain 2<br/>template<br/>[explanation2.html]"]
  node_theory2["Theory 2<br/>template<br/>[theory2.html]"]
end

subgraph group_static["Static assets"]
  node_style["Stylesheet<br/>css<br/>[style.css]"]
  node_tab_icon["Tab icon<br/>image asset"]
end

subgraph group_data["Text vocab"]
  node_independent_data{{"Independent lexicon<br/>text vocab set"}}
  node_dependent_data{{"Dependent lexicon<br/>text vocab set"}}
end

node_olab_asgi -->|"serve app"| node_olab_urls
node_olab_wsgi -->|"serve app"| node_olab_urls
node_olab_urls -->|"include"| node_eng_urls
node_eng_urls -->|"route"| node_eng_views
node_eng_urls -->|"route"| node_eng_views2
node_eng_views -->|"read"| node_independent_data
node_eng_views2 -->|"read"| node_dependent_data
node_eng_views2 -->|"use"| node_eng_dependent
node_eng_views -->|"render"| node_ex1
node_eng_views -->|"render"| node_next1
node_eng_views -->|"render"| node_explanation1
node_eng_views -->|"render"| node_theory1
node_eng_views2 -->|"render"| node_ex2
node_eng_views2 -->|"render"| node_next2
node_eng_views2 -->|"render"| node_explanation2
node_eng_views2 -->|"render"| node_theory2
node_ex1 -->|"style"| node_style
node_ex2 -->|"style"| node_style
node_ex1 -->|"asset"| node_tab_icon
node_ex2 -->|"asset"| node_tab_icon
node_eng_admin -->|"register"| node_eng_models

click node_olab_asgi "https://github.com/arya-221/hindi-olab/blob/master/olab/asgi.py"
click node_olab_wsgi "https://github.com/arya-221/hindi-olab/blob/master/olab/wsgi.py"
click node_olab_urls "https://github.com/arya-221/hindi-olab/blob/master/olab/urls.py"
click node_eng_urls "https://github.com/arya-221/hindi-olab/blob/master/eng/urls.py"
click node_eng_views "https://github.com/arya-221/hindi-olab/blob/master/eng/views.py"
click node_eng_views2 "https://github.com/arya-221/hindi-olab/blob/master/eng/views2.py"
click node_eng_dependent "https://github.com/arya-221/hindi-olab/blob/master/eng/dependent.py"
click node_eng_models "https://github.com/arya-221/hindi-olab/blob/master/eng/models.py"
click node_eng_admin "https://github.com/arya-221/hindi-olab/blob/master/eng/admin.py"
click node_ex1 "https://github.com/arya-221/hindi-olab/blob/master/templates/ex1.html"
click node_next1 "https://github.com/arya-221/hindi-olab/blob/master/templates/next.html"
click node_explanation1 "https://github.com/arya-221/hindi-olab/blob/master/templates/explanation.html"
click node_theory1 "https://github.com/arya-221/hindi-olab/blob/master/templates/theory.html"
click node_ex2 "https://github.com/arya-221/hindi-olab/blob/master/templates/ex2.html"
click node_next2 "https://github.com/arya-221/hindi-olab/blob/master/templates/next2.html"
click node_explanation2 "https://github.com/arya-221/hindi-olab/blob/master/templates/explanation2.html"
click node_theory2 "https://github.com/arya-221/hindi-olab/blob/master/templates/theory2.html"
click node_style "https://github.com/arya-221/hindi-olab/blob/master/static/css/style.css"
click node_tab_icon "https://github.com/arya-221/hindi-olab/tree/master/static/images/tab_icon_image"

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_olab_asgi,node_olab_wsgi,node_olab_urls toneBlue
class node_eng_urls,node_eng_views,node_eng_views2,node_eng_dependent,node_eng_models,node_eng_admin toneAmber
class node_ex1,node_next1,node_explanation1,node_theory1,node_ex2,node_next2,node_explanation2,node_theory2 toneMint
class node_style,node_tab_icon toneRose
class node_independent_data,node_dependent_data toneIndigo
```

## Components

### Django project

Framework entry points and root routing.

- [ASGI entry](https://github.com/arya-221/hindi-olab/blob/master/olab/asgi.py): django entrypoint · Async deployment entry for the Django project. · `olab/asgi.py`
- [WSGI entry](https://github.com/arya-221/hindi-olab/blob/master/olab/wsgi.py): django entrypoint · Sync deployment entry for the Django project. · `olab/wsgi.py`
- [Project URLs](https://github.com/arya-221/hindi-olab/blob/master/olab/urls.py): django routing · Root URL configuration for the site. · `olab/urls.py`

### eng app

Exercise routing, view logic, and optional model/admin scaffolding.

- [App URLs](https://github.com/arya-221/hindi-olab/blob/master/eng/urls.py): django routing · Routes exercise requests into the eng app. · `eng/urls.py`
- [Clause engine](https://github.com/arya-221/hindi-olab/blob/master/eng/views.py): independent flow · Rule-based logic for independent clause identification. · `eng/views.py`
- [Clause engine 2](https://github.com/arya-221/hindi-olab/blob/master/eng/views2.py): dependent flow · Rule-based logic for dependent clause identification. · `eng/views2.py`
- [Dependent helpers](https://github.com/arya-221/hindi-olab/blob/master/eng/dependent.py): support module · Additional dependent-clause support logic. · `eng/dependent.py`
- [Models](https://github.com/arya-221/hindi-olab/blob/master/eng/models.py): django model layer · Present but not central to the exercise logic. · `eng/models.py`
- [Admin](https://github.com/arya-221/hindi-olab/blob/master/eng/admin.py): django admin · Admin registration layer for the app. · `eng/admin.py`

### Templates

Server-rendered pages for the two clause flows.

- [Exercise 1](https://github.com/arya-221/hindi-olab/blob/master/templates/ex1.html): template · Independent-clause exercise page. · `templates/ex1.html`
- [Feedback 1](https://github.com/arya-221/hindi-olab/blob/master/templates/next.html): template · Independent-clause result/next page. · `templates/next.html`
- [Explain 1](https://github.com/arya-221/hindi-olab/blob/master/templates/explanation.html): template · Independent-clause explanation page. · `templates/explanation.html`
- [Theory 1](https://github.com/arya-221/hindi-olab/blob/master/templates/theory.html): template · Independent-clause theory/reference page. · `templates/theory.html`
- [Exercise 2](https://github.com/arya-221/hindi-olab/blob/master/templates/ex2.html): template · Dependent-clause exercise page. · `templates/ex2.html`
- [Feedback 2](https://github.com/arya-221/hindi-olab/blob/master/templates/next2.html): template · Dependent-clause result/next page. · `templates/next2.html`
- [Explain 2](https://github.com/arya-221/hindi-olab/blob/master/templates/explanation2.html): template · Dependent-clause explanation page. · `templates/explanation2.html`
- [Theory 2](https://github.com/arya-221/hindi-olab/blob/master/templates/theory2.html): template · Dependent-clause theory/reference page. · `templates/theory2.html`

### Static assets

Minimal CSS and image assets.

- [Stylesheet](https://github.com/arya-221/hindi-olab/blob/master/static/css/style.css): css · Central styling for the server-rendered UI. · `static/css/style.css`
- [Tab icon](https://github.com/arya-221/hindi-olab/tree/master/static/images/tab_icon_image): image asset · Small image asset used by the site. · `static/images/tab_icon_image`

### Text vocab

Dictionary-like word lists and rule inputs used by the exercises.

- **Independent lexicon**: text vocab set · Word lists used to generate and evaluate independent clauses.
- **Dependent lexicon**: text vocab set · Word lists used to generate and evaluate dependent clauses.

## Connections

- ASGI entry → Project URLs: serve app · ASGI requests reach the Django URL layer.
- WSGI entry → Project URLs: serve app · WSGI requests reach the Django URL layer.
- Project URLs → App URLs: include · Project routes delegate exercise paths to the app.
- App URLs → Clause engine: route · Independent-clause endpoints resolve to the main view module.
- App URLs → Clause engine 2: route · Dependent-clause endpoints resolve to the second view module.
- Clause engine → Independent lexicon: read · Independent exercise logic consumes text-based vocabularies.
- Clause engine 2 → Dependent lexicon: read · Dependent exercise logic consumes text-based vocabularies.
- Clause engine 2 → Dependent helpers: use · Dependent flow shares helper logic with the support module.
- Clause engine → Exercise 1: render · Independent exercise page is rendered by the view layer.
- Clause engine → Feedback 1: render · Independent feedback/next page is rendered by the view layer.
- Clause engine → Explain 1: render · Independent explanation page is rendered after evaluation.
- Clause engine → Theory 1: render · Independent theory page is part of the learning flow.
- Clause engine 2 → Exercise 2: render · Dependent exercise page is rendered by the view layer.
- Clause engine 2 → Feedback 2: render · Dependent feedback/next page is rendered by the view layer.
- Clause engine 2 → Explain 2: render · Dependent explanation page is rendered after evaluation.
- Clause engine 2 → Theory 2: render · Dependent theory page is part of the learning flow.
- Exercise 1 → Stylesheet: style · Templates use the shared stylesheet.
- Exercise 2 → Stylesheet: style · Templates use the shared stylesheet.
- Exercise 1 → Tab icon: asset · The UI references the tab icon image.
- Exercise 2 → Tab icon: asset · The UI references the tab icon image.
- Admin → Models: register · Admin scaffolding is attached to the model layer.
