# srikargovindula/sih_mindsaathi architecture

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

- Interactive diagram: https://gitdiagram.com/srikargovindula/sih_mindsaathi
- Repository: https://github.com/srikargovindula/sih_mindsaathi

## Overview

Smriti-NER is a local-first cognitive therapy and memory-support application for older adults with dementia or MCI, with caregiver and clinician tools. The patient workflow is to enter the app, choose a culturally grounded game or wellness activity, receive adaptive feedback, and have session data retained for tracking and later sync. Reminders, multilingual voice interaction, reminiscence, dashboards, and offline PWA operation are distinct supporting capabilities. The graph follows documented capabilities and sampled call paths; some unsampled module wiring is therefore left unspecified.

Main entry points: [`js/app.js`](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/app.js) (Game selection), [`js/storage-db.js`](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/storage-db.js) (IndexedDB and sync queue), [`js/games/memory-match.js`](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/memory-match.js) (Memory match), [`js/cogni-adapt-engine.js`](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/cogni-adapt-engine.js) (CogniAdapt engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient experience"]
  node_app["App navigation<br/>[app.js]"]
  node_games["Game selection<br/>[app.js]"]
end

subgraph group_therapy["Cognitive therapy"]
  node_memory["Memory match<br/>[memory-match.js]"]
  node_tea["Tea garden<br/>[tea-garden.js]"]
  node_routine["Routine sequence"]
  node_weave["Pattern weave<br/>[pattern-weave.js]"]
  node_breathing["Calm breathing<br/>[calm-breathing.js]"]
  node_adapt["CogniAdapt engine"]
  node_reminiscence["Reminiscence prompts"]
end

subgraph group_care["Care support"]
  node_reminders["Smart reminders<br/>[reminders.js]"]
  node_care_dashboard["Caregiver dashboard"]
  node_doctor_dashboard["Doctor portal"]
  node_auth["Role access<br/>[auth-manager.js]"]
end

subgraph group_data["Local data and sync"]
  node_storage[("IndexedDB and sync queue<br/>[storage-db.js]")]
  node_backend["Telemetry API<br/>[server.py]"]
  node_store[("Backend telemetry store<br/>[server.py]")]
end

subgraph group_platform["Language and offline"]
  node_voice["Voice assistant<br/>[voice-assistant.js]"]
  node_i18n["Translations<br/>[i18n.js]"]
  node_ai_caretaker["AI caretaker<br/>[ai-caretaker.js]"]
  node_ai_responses["Fallback responses"]
  node_gemini["Gemini service"]
  node_sw["Offline app cache<br/>[sw.js]"]
end

node_patient(("Older adult"))
node_caregiver(("Caregiver / ASHA"))
node_network(("Network / sync service"))

node_patient -->|"uses"| node_app
node_caregiver -->|"opens portal"| node_app
node_app -->|"checks role"| node_auth
node_app -->|"routes to"| node_games
node_games -->|"starts"| node_memory
node_games -->|"starts"| node_tea
node_games -->|"starts"| node_routine
node_games -->|"starts"| node_weave
node_games -->|"starts"| node_breathing
node_memory -->|"starts session"| node_adapt
node_routine -->|"starts session"| node_adapt
node_weave -->|"starts session"| node_adapt
node_memory -->|"speaks story"| node_voice
node_memory -.->|"uses prompts"| node_reminiscence
node_breathing -->|"logs mood"| node_care_dashboard
node_adapt -.->|"stores telemetry"| node_storage
node_reminders -.->|"stores logs"| node_storage
node_care_dashboard -.->|"reads history"| node_storage
node_doctor_dashboard -.->|"reads records"| node_storage
node_app -->|"sets language"| node_i18n
node_app -->|"plays greeting"| node_voice
node_ai_caretaker -.->|"uses fallbacks"| node_ai_responses
node_ai_caretaker -.->|"requests response"| node_gemini
node_reminiscence -->|"adds chat bubble"| node_voice
node_storage -->|"posts queued items"| node_backend
node_network -->|"serves sync API"| node_backend
node_backend -->|"reads and writes"| node_store
node_sw -->|"fetches uncached assets"| node_network

click node_app "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/app.js"
click node_games "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/app.js"
click node_memory "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/memory-match.js"
click node_tea "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/tea-garden.js"
click node_routine "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/routine-sequence.js"
click node_weave "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/pattern-weave.js"
click node_breathing "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/calm-breathing.js"
click node_adapt "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/cogni-adapt-engine.js"
click node_reminiscence "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/reminiscence-engine.js"
click node_reminders "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/reminders.js"
click node_care_dashboard "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/caregiver-dashboard.js"
click node_doctor_dashboard "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/doctor-dashboard.js"
click node_auth "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/auth-manager.js"
click node_voice "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/voice-assistant.js"
click node_i18n "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/i18n.js"
click node_ai_caretaker "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/ai-caretaker.js"
click node_ai_responses "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/ai-caretaker-responses.js"
click node_gemini "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/gemini-ai-service.js"
click node_sw "https://github.com/srikargovindula/sih_mindsaathi/blob/main/sw.js"
click node_storage "https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/storage-db.js"
click node_backend "https://github.com/srikargovindula/sih_mindsaathi/blob/main/backend/server.py"
click node_store "https://github.com/srikargovindula/sih_mindsaathi/blob/main/backend/server.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_app,node_games toneBlue
class node_memory,node_tea,node_routine,node_weave,node_breathing,node_adapt,node_reminiscence toneAmber
class node_reminders,node_care_dashboard,node_doctor_dashboard,node_auth toneMint
class node_storage,node_backend,node_store toneRose
class node_voice,node_i18n,node_ai_caretaker,node_ai_responses,node_gemini,node_sw,node_patient,node_caregiver,node_network toneIndigo
```

## Components

### Patient experience

- [App navigation](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/app.js): `js/app.js`
- [Game selection](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/app.js): `js/app.js`

### Cognitive therapy

- [Memory match](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/memory-match.js): `js/games/memory-match.js`
- [Tea garden](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/tea-garden.js): `js/games/tea-garden.js`
- [Routine sequence](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/routine-sequence.js): `js/games/routine-sequence.js`
- [Pattern weave](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/pattern-weave.js): `js/games/pattern-weave.js`
- [Calm breathing](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/games/calm-breathing.js): `js/games/calm-breathing.js`
- [CogniAdapt engine](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/cogni-adapt-engine.js): `js/cogni-adapt-engine.js`
- [Reminiscence prompts](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/reminiscence-engine.js): `js/reminiscence-engine.js`

### Care support

- [Smart reminders](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/reminders.js): `js/reminders.js`
- [Caregiver dashboard](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/caregiver-dashboard.js): `js/caregiver-dashboard.js`
- [Doctor portal](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/doctor-dashboard.js): `js/doctor-dashboard.js`
- [Role access](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/auth-manager.js): `js/auth-manager.js`

### Local data and sync

- [IndexedDB and sync queue](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/storage-db.js): `js/storage-db.js`
- [Telemetry API](https://github.com/srikargovindula/sih_mindsaathi/blob/main/backend/server.py): `backend/server.py`
- [Backend telemetry store](https://github.com/srikargovindula/sih_mindsaathi/blob/main/backend/server.py): `backend/server.py`

### Language and offline

- [Voice assistant](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/voice-assistant.js): `js/voice-assistant.js`
- [Translations](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/i18n.js): `js/i18n.js`
- [AI caretaker](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/ai-caretaker.js): `js/ai-caretaker.js`
- [Fallback responses](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/ai-caretaker-responses.js): `js/ai-caretaker-responses.js`
- [Gemini service](https://github.com/srikargovindula/sih_mindsaathi/blob/main/js/gemini-ai-service.js): `js/gemini-ai-service.js`
- [Offline app cache](https://github.com/srikargovindula/sih_mindsaathi/blob/main/sw.js): `sw.js`

### Other components

- **Older adult**
- **Caregiver / ASHA**
- **Network / sync service**

## Connections

- Older adult → App navigation: uses
- Caregiver / ASHA → App navigation: opens portal
- App navigation → Role access: checks role
- App navigation → Game selection: routes to
- Game selection → Memory match: starts
- Game selection → Tea garden: starts
- Game selection → Routine sequence: starts
- Game selection → Pattern weave: starts
- Game selection → Calm breathing: starts
- Memory match → CogniAdapt engine: starts session
- Routine sequence → CogniAdapt engine: starts session
- Pattern weave → CogniAdapt engine: starts session
- Memory match → Voice assistant: speaks story
- Memory match → Reminiscence prompts: uses prompts
- Calm breathing → Caregiver dashboard: logs mood
- CogniAdapt engine → IndexedDB and sync queue: stores telemetry
- Smart reminders → IndexedDB and sync queue: stores logs
- Caregiver dashboard → IndexedDB and sync queue: reads history
- Doctor portal → IndexedDB and sync queue: reads records
- App navigation → Translations: sets language
- App navigation → Voice assistant: plays greeting
- AI caretaker → Fallback responses: uses fallbacks
- AI caretaker → Gemini service: requests response
- Reminiscence prompts → Voice assistant: adds chat bubble
- IndexedDB and sync queue → Telemetry API: posts queued items
- Network / sync service → Telemetry API: serves sync API
- Telemetry API → Backend telemetry store: reads and writes
- Offline app cache → Network / sync service: fetches uncached assets
