# gayatri-education/gayatri-demo architecture

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

- Interactive diagram: https://gitdiagram.com/gayatri-education/gayatri-demo
- Repository: https://github.com/gayatri-education/gayatri-demo

## Overview

Gayatri is an offline adaptive-learning desktop platform. A learner submits a question through the application bridge; the tutor scopes retrieval to the active course, evaluates the turn using Socratic pedagogy, synthesizes a grounded response, and records learning state. Curriculum ingestion and teacher/admin visibility are separate product branches. The README describes additional capabilities, but the supplied tree has no UI asset directory and source excerpts are partial; the graph therefore follows only relationships shown in excerpts, the source index, or README statements.

Main entry points: [`central_platform/rag/service.py`](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/service.py) (Scoped RAG service), [`app/windows/main_window.py`](https://github.com/gayatri-education/gayatri-demo/blob/main/app/windows/main_window.py) (Desktop window), [`central_platform/tutor/orchestrator.py`](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/tutor/orchestrator.py) (Tutor orchestrator), [`central_platform/courses/service.py`](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/courses/service.py) (Course catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop application"]
  node_entry["Application entry<br/>[main.py]"]
  node_window["Desktop window<br/>[main_window.py]"]
  node_bridge["Web channel bridge<br/>[facade.py]"]
  node_teacher_portal["Teacher portal<br/>[controller.py]"]
  node_admin_portal["Admin portal<br/>[controller.py]"]
end

subgraph group_curriculum["Curriculum management"]
  node_course_service["Course catalog<br/>[service.py]"]
  node_course_container["Curriculum container<br/>[packer.py]"]
end

subgraph group_tutoring["Socratic tutoring"]
  node_tutor["Tutor orchestrator<br/>[orchestrator.py]"]
  node_policy["Pedagogical evaluation<br/>[actions.py]"]
  node_inference["Local response engine<br/>[adapters.py]"]
end

subgraph group_knowledge["Knowledge retrieval"]
  node_rag_service["Scoped RAG service<br/>[service.py]"]
  node_document_parsers["Document parsers<br/>[parsers.py]"]
  node_text_cleaner["Text cleaning<br/>[cleaner.py]"]
  node_ingestion_security["Ingestion security<br/>[security.py]"]
  node_hybrid_fusion["Rank fusion<br/>[fusion.py]"]
  node_semantic_retrieval["Semantic retrieval<br/>[semantic.py]"]
end

subgraph group_insight["Learning and governance"]
  node_learning_state[("Learner state<br/>[state.py]")]
  node_domain_models["Domain schemas<br/>[schema.py]"]
  node_configuration["Runtime configuration<br/>[config.py]"]
  node_tamper_checks["Runtime integrity checks<br/>[tamper.py]"]
  node_obfuscation["Obfuscation utilities<br/>[obfuscation.py]"]
end

node_learner(("Learner"))
node_teacher(("Teacher"))
node_administrator(("Administrator"))

node_learner -->|"starts app"| node_entry
node_entry -->|"opens window"| node_window
node_entry -->|"enforces checks"| node_tamper_checks
node_window -->|"creates"| node_course_service
node_window -->|"creates"| node_rag_service
node_window -->|"creates"| node_learning_state
node_window -->|"creates"| node_tutor
node_window -->|"registers"| node_bridge
node_learner -->|"submits query"| node_bridge
node_bridge -->|"processes turn"| node_tutor
node_bridge -->|"ingests upload"| node_rag_service
node_tutor -->|"gets course"| node_course_service
node_tutor -->|"retrieves evidence"| node_rag_service
node_tutor -->|"evaluates turn"| node_policy
node_tutor -->|"synthesizes response"| node_inference
node_tutor -->|"records event"| node_learning_state
node_course_service -->|"loads bundle"| node_course_container
node_rag_service -->|"loads curriculum"| node_course_container
node_rag_service -->|"parses uploads"| node_document_parsers
node_document_parsers -->|"cleans text"| node_text_cleaner
node_rag_service -->|"validates ingestion"| node_ingestion_security
node_rag_service -->|"fuses rankings"| node_hybrid_fusion
node_rag_service -->|"queries index"| node_semantic_retrieval
node_teacher -->|"views cohort"| node_teacher_portal
node_teacher_portal -->|"gets course"| node_course_service
node_teacher_portal -->|"reads progress"| node_learning_state
node_administrator -->|"views topology"| node_admin_portal
node_admin_portal -->|"lists courses"| node_course_service
node_admin_portal -->|"counts indexed cards"| node_rag_service
node_course_service -->|"builds course models"| node_domain_models
node_rag_service -->|"builds chunks"| node_domain_models
node_learning_state -->|"uses state models"| node_domain_models
node_policy -->|"uses event models"| node_domain_models
node_inference -->|"uses shared schemas"| node_domain_models
node_inference -->|"uses utilities"| node_obfuscation
node_entry -->|"reads settings"| node_configuration
node_window -->|"reads window settings"| node_configuration
node_rag_service -->|"reads retrieval settings"| node_configuration

click node_entry "https://github.com/gayatri-education/gayatri-demo/blob/main/app/main.py"
click node_window "https://github.com/gayatri-education/gayatri-demo/blob/main/app/windows/main_window.py"
click node_bridge "https://github.com/gayatri-education/gayatri-demo/blob/main/app/bridge/facade.py"
click node_teacher_portal "https://github.com/gayatri-education/gayatri-demo/blob/main/app/portals/teacher/controller.py"
click node_admin_portal "https://github.com/gayatri-education/gayatri-demo/blob/main/app/portals/admin/controller.py"
click node_course_service "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/courses/service.py"
click node_course_container "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/courses/packer.py"
click node_tutor "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/tutor/orchestrator.py"
click node_policy "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/learning/actions.py"
click node_inference "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/ai/adapters.py"
click node_rag_service "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/service.py"
click node_document_parsers "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/parsers.py"
click node_text_cleaner "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/cleaner.py"
click node_ingestion_security "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/security.py"
click node_hybrid_fusion "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/fusion.py"
click node_semantic_retrieval "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/semantic.py"
click node_learning_state "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/learning/state.py"
click node_domain_models "https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/models/schema.py"
click node_configuration "https://github.com/gayatri-education/gayatri-demo/blob/main/core/config.py"
click node_tamper_checks "https://github.com/gayatri-education/gayatri-demo/blob/main/core/tamper.py"
click node_obfuscation "https://github.com/gayatri-education/gayatri-demo/blob/main/core/obfuscation.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_entry,node_window,node_bridge,node_teacher_portal,node_admin_portal toneBlue
class node_course_service,node_course_container toneAmber
class node_tutor,node_policy,node_inference toneMint
class node_rag_service,node_document_parsers,node_text_cleaner,node_ingestion_security,node_hybrid_fusion,node_semantic_retrieval toneRose
class node_learning_state,node_domain_models,node_configuration,node_tamper_checks,node_obfuscation,node_learner,node_teacher,node_administrator toneIndigo
```

## Components

### Desktop application

- [Application entry](https://github.com/gayatri-education/gayatri-demo/blob/main/app/main.py): `app/main.py`
- [Desktop window](https://github.com/gayatri-education/gayatri-demo/blob/main/app/windows/main_window.py): `app/windows/main_window.py`
- [Web channel bridge](https://github.com/gayatri-education/gayatri-demo/blob/main/app/bridge/facade.py): `app/bridge/facade.py`
- [Teacher portal](https://github.com/gayatri-education/gayatri-demo/blob/main/app/portals/teacher/controller.py): `app/portals/teacher/controller.py`
- [Admin portal](https://github.com/gayatri-education/gayatri-demo/blob/main/app/portals/admin/controller.py): `app/portals/admin/controller.py`

### Curriculum management

- [Course catalog](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/courses/service.py): `central_platform/courses/service.py`
- [Curriculum container](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/courses/packer.py): `central_platform/courses/packer.py`

### Socratic tutoring

- [Tutor orchestrator](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/tutor/orchestrator.py): `central_platform/tutor/orchestrator.py`
- [Pedagogical evaluation](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/learning/actions.py): `central_platform/learning/actions.py`
- [Local response engine](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/ai/adapters.py): `central_platform/ai/adapters.py`

### Knowledge retrieval

- [Scoped RAG service](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/service.py): `central_platform/rag/service.py`
- [Document parsers](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/parsers.py): `central_platform/rag/parsers.py`
- [Text cleaning](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/cleaner.py): `central_platform/rag/cleaner.py`
- [Ingestion security](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/security.py): `central_platform/rag/security.py`
- [Rank fusion](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/fusion.py): `central_platform/rag/fusion.py`
- [Semantic retrieval](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/rag/semantic.py): `central_platform/rag/semantic.py`

### Learning and governance

- [Learner state](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/learning/state.py): `central_platform/learning/state.py`
- [Domain schemas](https://github.com/gayatri-education/gayatri-demo/blob/main/central_platform/models/schema.py): `central_platform/models/schema.py`
- [Runtime configuration](https://github.com/gayatri-education/gayatri-demo/blob/main/core/config.py): `core/config.py`
- [Runtime integrity checks](https://github.com/gayatri-education/gayatri-demo/blob/main/core/tamper.py): `core/tamper.py`
- [Obfuscation utilities](https://github.com/gayatri-education/gayatri-demo/blob/main/core/obfuscation.py): `core/obfuscation.py`

### Other components

- **Learner**
- **Teacher**
- **Administrator**

## Connections

- Learner → Application entry: starts app (evidence: `README.md`)
- Application entry → Desktop window: opens window (evidence: `app/main.py`)
- Application entry → Runtime integrity checks: enforces checks (evidence: `app/main.py`)
- Desktop window → Course catalog: creates (evidence: `app/windows/main_window.py`)
- Desktop window → Scoped RAG service: creates (evidence: `app/windows/main_window.py`)
- Desktop window → Learner state: creates (evidence: `app/windows/main_window.py`)
- Desktop window → Tutor orchestrator: creates (evidence: `app/windows/main_window.py`)
- Desktop window → Web channel bridge: registers (evidence: `app/windows/main_window.py`)
- Learner → Web channel bridge: submits query (evidence: `app/bridge/facade.py`)
- Web channel bridge → Tutor orchestrator: processes turn (evidence: `app/bridge/facade.py`)
- Web channel bridge → Scoped RAG service: ingests upload (evidence: `app/bridge/facade.py`)
- Tutor orchestrator → Course catalog: gets course (evidence: `central_platform/tutor/orchestrator.py`)
- Tutor orchestrator → Scoped RAG service: retrieves evidence (evidence: `central_platform/tutor/orchestrator.py`)
- Tutor orchestrator → Pedagogical evaluation: evaluates turn (evidence: `central_platform/tutor/orchestrator.py`)
- Tutor orchestrator → Local response engine: synthesizes response (evidence: `central_platform/tutor/orchestrator.py`)
- Tutor orchestrator → Learner state: records event (evidence: `central_platform/tutor/orchestrator.py`)
- Course catalog → Curriculum container: loads bundle (evidence: `central_platform/courses/service.py`)
- Scoped RAG service → Curriculum container: loads curriculum (evidence: `central_platform/rag/service.py`)
- Scoped RAG service → Document parsers: parses uploads (evidence: `central_platform/rag/service.py`)
- Document parsers → Text cleaning: cleans text (evidence: `central_platform/rag/parsers.py`)
- Scoped RAG service → Ingestion security: validates ingestion (evidence: `central_platform/rag/service.py`)
- Scoped RAG service → Rank fusion: fuses rankings (evidence: `central_platform/rag/service.py`)
- Scoped RAG service → Semantic retrieval: queries index (evidence: `central_platform/rag/service.py`)
- Teacher → Teacher portal: views cohort (evidence: `README.md`)
- Teacher portal → Course catalog: gets course (evidence: `app/portals/teacher/controller.py`)
- Teacher portal → Learner state: reads progress (evidence: `app/portals/teacher/controller.py`)
- Administrator → Admin portal: views topology (evidence: `README.md`)
- Admin portal → Course catalog: lists courses (evidence: `app/portals/admin/controller.py`)
- Admin portal → Scoped RAG service: counts indexed cards (evidence: `app/portals/admin/controller.py`)
- Course catalog → Domain schemas: builds course models (evidence: `central_platform/courses/service.py`)
- Scoped RAG service → Domain schemas: builds chunks (evidence: `central_platform/rag/service.py`)
- Learner state → Domain schemas: uses state models (evidence: `central_platform/learning/state.py`)
- Pedagogical evaluation → Domain schemas: uses event models (evidence: `central_platform/learning/actions.py`)
- Local response engine → Domain schemas: uses shared schemas (evidence: `central_platform/ai/adapters.py`)
- Local response engine → Obfuscation utilities: uses utilities (evidence: `central_platform/ai/adapters.py`)
- Application entry → Runtime configuration: reads settings (evidence: `app/main.py`)
- Desktop window → Runtime configuration: reads window settings (evidence: `app/windows/main_window.py`)
- Scoped RAG service → Runtime configuration: reads retrieval settings (evidence: `central_platform/rag/service.py`)
