# srikarsistla-ctrl/sochsaathi architecture

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

- Interactive diagram: https://gitdiagram.com/srikarsistla-ctrl/sochsaathi
- Repository: https://github.com/srikarsistla-ctrl/sochsaathi

## Overview

SochSaathi is a voice-first Telugu fraction tutor for students in Classes 6–8. Students explain fraction comparisons or additions, confirm the tutor’s read-back, receive misconception-sensitive guidance, and complete a transfer check; completed responses can then be reviewed in Teacher view. The graph covers the sampled browser, API, rule-based tutor, provider, and persistence responsibilities. The README documents additional voice and translation fallbacks; links not visible in the excerpts are omitted rather than inferred.

Main entry points: [`frontend/app.js`](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/frontend/app.js) (Practice interface), [`backend/main.py`](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/main.py) (Analysis API), [`backend/providers.py`](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/providers.py) (Speech endpoints), [`backend/tutor.py`](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/tutor.py) (Reasoning rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_practice["Student practice"]
  node_practice_ui["Practice interface<br/>[app.js]"]
  node_speech_capture["Speech capture<br/>[app.js]"]
  node_fraction_board["Fraction board<br/>[app.js]"]
end

subgraph group_tutoring["Tutor assessment"]
  node_analysis_api["Analysis API<br/>[main.py]"]
  node_question_bank["Question bank<br/>[tutor.py]"]
  node_reasoning_rules["Reasoning rules<br/>[tutor.py]"]
  node_guidance["Hints and feedback<br/>[tutor.py]"]
end

subgraph group_services["Speech and translation"]
  node_speech_api["Speech endpoints<br/>[providers.py]"]
  node_local_speech["Local Telugu speech<br/>[providers.py]"]
  node_sarvam["Sarvam services"]
  node_gemini["Gemini translation"]
end

subgraph group_records["Teacher records"]
  node_session_api["Session API<br/>[main.py]"]
  node_session_store[("SQLite sessions<br/>[main.py]")]
  node_teacher_view["Teacher view<br/>[app.js]"]
end

node_student(("Student"))
node_teacher(("Teacher"))

node_student -->|"explains fractions"| node_practice_ui
node_practice_ui -->|"shows fractions"| node_fraction_board
node_practice_ui -->|"starts listening"| node_speech_capture
node_speech_capture -->|"submits transcript"| node_practice_ui
node_practice_ui -->|"posts explanation"| node_analysis_api
node_analysis_api -->|"analyzes response"| node_reasoning_rules
node_analysis_api -->|"selects question"| node_question_bank
node_reasoning_rules -->|"generates guidance"| node_guidance
node_analysis_api -->|"requests translation"| node_gemini
node_practice_ui -->|"saves responses"| node_session_api
node_session_api -->|"writes sessions"| node_session_store
node_teacher -->|"opens records"| node_teacher_view
node_teacher_view -->|"requests sessions"| node_session_api
node_session_api -->|"reads sessions"| node_session_store
node_speech_api -->|"requests speech services"| node_sarvam
node_speech_api -->|"falls back to"| node_local_speech
node_speech_capture -->|"posts recording"| node_speech_api

click node_practice_ui "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/frontend/app.js"
click node_speech_capture "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/frontend/app.js"
click node_fraction_board "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/frontend/app.js"
click node_analysis_api "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/main.py"
click node_question_bank "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/tutor.py"
click node_reasoning_rules "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/tutor.py"
click node_guidance "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/tutor.py"
click node_speech_api "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/providers.py"
click node_local_speech "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/providers.py"
click node_session_api "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/main.py"
click node_session_store "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/main.py"
click node_teacher_view "https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/frontend/app.js"

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_practice_ui,node_speech_capture,node_fraction_board toneBlue
class node_analysis_api,node_question_bank,node_reasoning_rules,node_guidance toneAmber
class node_speech_api,node_local_speech,node_sarvam,node_gemini toneMint
class node_session_api,node_session_store,node_teacher_view toneRose
class node_student,node_teacher toneIndigo
```

## Components

### Student practice

- [Practice interface](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/frontend/app.js): `frontend/app.js`
- [Speech capture](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/frontend/app.js): `frontend/app.js`
- [Fraction board](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/frontend/app.js): `frontend/app.js`

### Tutor assessment

- [Analysis API](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/main.py): `backend/main.py`
- [Question bank](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/tutor.py): `backend/tutor.py`
- [Reasoning rules](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/tutor.py): `backend/tutor.py`
- [Hints and feedback](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/tutor.py): `backend/tutor.py`

### Speech and translation

- [Speech endpoints](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/providers.py): `backend/providers.py`
- [Local Telugu speech](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/providers.py): `backend/providers.py`
- **Sarvam services**
- **Gemini translation**

### Teacher records

- [Session API](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/main.py): `backend/main.py`
- [SQLite sessions](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/backend/main.py): `backend/main.py`
- [Teacher view](https://github.com/srikarsistla-ctrl/sochsaathi/blob/main/frontend/app.js): `frontend/app.js`

### Other components

- **Student**
- **Teacher**

## Connections

- Student → Practice interface: explains fractions (evidence: `README.md`)
- Practice interface → Fraction board: shows fractions (evidence: `frontend/app.js`)
- Practice interface → Speech capture: starts listening (evidence: `frontend/app.js`)
- Speech capture → Practice interface: submits transcript (evidence: `frontend/app.js`)
- Practice interface → Analysis API: posts explanation (evidence: `frontend/app.js`)
- Analysis API → Reasoning rules: analyzes response (evidence: `backend/main.py`)
- Analysis API → Question bank: selects question (evidence: `backend/main.py`)
- Reasoning rules → Hints and feedback: generates guidance (evidence: `backend/tutor.py`)
- Analysis API → Gemini translation: requests translation
- Practice interface → Session API: saves responses (evidence: `frontend/app.js`)
- Session API → SQLite sessions: writes sessions (evidence: `backend/main.py`)
- Teacher → Teacher view: opens records (evidence: `README.md`)
- Teacher view → Session API: requests sessions (evidence: `frontend/app.js`)
- Session API → SQLite sessions: reads sessions (evidence: `backend/main.py`)
- Speech endpoints → Sarvam services: requests speech services (evidence: `backend/providers.py`)
- Speech endpoints → Local Telugu speech: falls back to (evidence: `backend/providers.py`)
- Speech capture → Speech endpoints: posts recording (evidence: `frontend/app.js`)
