# avnipahal624/mool_1 architecture

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

- Interactive diagram: https://gitdiagram.com/avnipahal624/mool_1
- Repository: https://github.com/avnipahal624/mool_1

## Overview

MOOL is a prototype cognitive and independence companion for older adults and caregivers. Caregivers add memories and routines; patients use personalized activities and everyday-support features, while activity performance and comfort feedback influence future sessions. State is primarily persisted in browser localStorage, with a patient context that also attempts API synchronization. The README documents diary, music, voice, safety, alerts, and reports, though several implementations were not sampled; those branches are shown at their existing directories. Arrows reflect cited calls or README-documented behavior; unsampled details are not inferred.

Main entry points: [`src/pages/App.tsx`](https://github.com/avnipahal624/mool_1/blob/main/src/pages/App.tsx) (App routes), [`src/services/adaptationEngine.ts`](https://github.com/avnipahal624/mool_1/blob/main/src/services/adaptationEngine.ts) (Difficulty adaptation), [`src/services/memoryService.ts`](https://github.com/avnipahal624/mool_1/blob/main/src/services/memoryService.ts) (Memory eligibility), [`src/pages/patient/Games1.tsx`](https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Games1.tsx) (Activity games)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App foundation"]
  node_app_shell["App routes<br/>[App.tsx]"]
  node_app_state["App state<br/>[AppContext.tsx]"]
  node_patient_state["Patient data<br/>[PatientContext.tsx]"]
  node_language["Language settings"]
  node_translations["Translations<br/>[translations.ts]"]
  node_storage[("Browser storage<br/>[storage.ts]")]
  node_api["API adapter<br/>[api.ts]"]
  node_seed["Demo data<br/>[seed.ts]"]
end

subgraph group_care["Caregiver tools"]
  node_care_home["Caregiver overview<br/>[Caregiver.tsx]"]
  node_memory_bank["Memory bank<br/>[Memories.tsx]"]
  node_care_tools["Routines and insights<br/>[Care.tsx]"]
  node_care_extensions["Care extensions"]
end

subgraph group_patient["Patient experience"]
  node_patient_home["Patient home<br/>[Home.tsx]"]
  node_games["Activity games<br/>[Games1.tsx]"]
  node_game_variants["Game variants<br/>[Games2.tsx]"]
  node_life["Diary and music<br/>[Life.tsx]"]
  node_wallet["Safety wallet<br/>[Wallet.tsx]"]
  node_motifs["Cultural motifs<br/>[motifs.tsx]"]
end

subgraph group_personalization["Personalization services"]
  node_activity_generator["Activity generation"]
  node_adaptation["Difficulty adaptation"]
  node_memory_service["Memory eligibility<br/>[memoryService.ts]"]
  node_sound["Audio and voice<br/>[soundService.ts]"]
end

node_user(("Patient or caregiver"))

node_user -->|"uses"| node_app_shell
node_app_shell -->|"provides state"| node_app_state
node_app_shell -->|"provides data"| node_patient_state
node_app_shell -->|"provides language"| node_language
node_language -->|"persists settings"| node_storage
node_language -->|"resolves text"| node_translations
node_app_state -->|"persists state"| node_storage
node_patient_state -->|"persists patient data"| node_storage
node_patient_state -->|"loads demo data"| node_seed
node_patient_state -->|"syncs data"| node_api
node_care_home -->|"reads activity insights"| node_adaptation
node_memory_bank -->|"uses memory rules"| node_memory_service
node_care_tools -->|"uses activity insights"| node_adaptation
node_care_tools -->|"uses memory rules"| node_memory_service
node_care_tools -->|"uses audio"| node_sound
node_app_shell -->|"routes caregiver features"| node_care_extensions
node_patient_home -->|"uses personalization"| node_adaptation
node_patient_home -->|"uses memory rules"| node_memory_service
node_patient_home -->|"uses audio"| node_sound
node_games -->|"generates activities"| node_activity_generator
node_games -->|"adapts sessions"| node_adaptation
node_games -->|"filters memories"| node_memory_service
node_games -->|"uses audio"| node_sound
node_games -->|"renders motifs"| node_motifs
node_game_variants -->|"generates activities"| node_activity_generator
node_game_variants -->|"adapts sessions"| node_adaptation
node_game_variants -->|"uses audio"| node_sound
node_game_variants -->|"renders motifs"| node_motifs
node_life -->|"uses personalization"| node_adaptation
node_life -->|"uses memory rules"| node_memory_service
node_life -->|"uses audio"| node_sound
node_life -->|"renders motifs"| node_motifs
node_app_shell -->|"routes patient"| node_patient_home
node_app_shell -->|"routes games"| node_games
node_app_shell -->|"routes games"| node_game_variants
node_app_shell -->|"routes life features"| node_life
node_app_shell -->|"routes wallet"| node_wallet
node_activity_generator -->|"filters memories"| node_memory_service
node_activity_generator -->|"uses topic selection"| node_adaptation
node_adaptation -->|"uses topic profiles"| node_memory_service
node_adaptation -->|"stores feedback"| node_storage
node_memory_service -->|"maps topics"| node_motifs

click node_app_shell "https://github.com/avnipahal624/mool_1/blob/main/src/pages/App.tsx"
click node_app_state "https://github.com/avnipahal624/mool_1/blob/main/src/context/AppContext.tsx"
click node_patient_state "https://github.com/avnipahal624/mool_1/blob/main/src/context/PatientContext.tsx"
click node_language "https://github.com/avnipahal624/mool_1/blob/main/src/context/LanguageContext.tsx"
click node_translations "https://github.com/avnipahal624/mool_1/blob/main/src/data/translations.ts"
click node_storage "https://github.com/avnipahal624/mool_1/blob/main/src/lib/storage.ts"
click node_api "https://github.com/avnipahal624/mool_1/blob/main/src/lib/api.ts"
click node_seed "https://github.com/avnipahal624/mool_1/blob/main/src/data/seed.ts"
click node_care_home "https://github.com/avnipahal624/mool_1/blob/main/src/pages/caregiver/Caregiver.tsx"
click node_memory_bank "https://github.com/avnipahal624/mool_1/blob/main/src/pages/caregiver/Memories.tsx"
click node_care_tools "https://github.com/avnipahal624/mool_1/blob/main/src/pages/caregiver/Care.tsx"
click node_care_extensions "https://github.com/avnipahal624/mool_1/tree/main/src/pages/caregiver"
click node_patient_home "https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Home.tsx"
click node_games "https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Games1.tsx"
click node_game_variants "https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Games2.tsx"
click node_life "https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Life.tsx"
click node_wallet "https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Wallet.tsx"
click node_motifs "https://github.com/avnipahal624/mool_1/blob/main/src/data/motifs.tsx"
click node_activity_generator "https://github.com/avnipahal624/mool_1/blob/main/src/services/activityGenerator.ts"
click node_adaptation "https://github.com/avnipahal624/mool_1/blob/main/src/services/adaptationEngine.ts"
click node_memory_service "https://github.com/avnipahal624/mool_1/blob/main/src/services/memoryService.ts"
click node_sound "https://github.com/avnipahal624/mool_1/blob/main/src/services/soundService.ts"

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_shell,node_app_state,node_patient_state,node_language,node_translations,node_storage,node_api,node_seed toneBlue
class node_care_home,node_memory_bank,node_care_tools,node_care_extensions toneAmber
class node_patient_home,node_games,node_game_variants,node_life,node_wallet,node_motifs toneMint
class node_activity_generator,node_adaptation,node_memory_service,node_sound toneRose
class node_user toneIndigo
```

## Components

### App foundation

- [App routes](https://github.com/avnipahal624/mool_1/blob/main/src/pages/App.tsx): `src/pages/App.tsx`
- [App state](https://github.com/avnipahal624/mool_1/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`
- [Patient data](https://github.com/avnipahal624/mool_1/blob/main/src/context/PatientContext.tsx): `src/context/PatientContext.tsx`
- [Language settings](https://github.com/avnipahal624/mool_1/blob/main/src/context/LanguageContext.tsx): `src/context/LanguageContext.tsx`
- [Translations](https://github.com/avnipahal624/mool_1/blob/main/src/data/translations.ts): `src/data/translations.ts`
- [Browser storage](https://github.com/avnipahal624/mool_1/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- [API adapter](https://github.com/avnipahal624/mool_1/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Demo data](https://github.com/avnipahal624/mool_1/blob/main/src/data/seed.ts): `src/data/seed.ts`

### Caregiver tools

- [Caregiver overview](https://github.com/avnipahal624/mool_1/blob/main/src/pages/caregiver/Caregiver.tsx): `src/pages/caregiver/Caregiver.tsx`
- [Memory bank](https://github.com/avnipahal624/mool_1/blob/main/src/pages/caregiver/Memories.tsx): `src/pages/caregiver/Memories.tsx`
- [Routines and insights](https://github.com/avnipahal624/mool_1/blob/main/src/pages/caregiver/Care.tsx): `src/pages/caregiver/Care.tsx`
- [Care extensions](https://github.com/avnipahal624/mool_1/tree/main/src/pages/caregiver): `src/pages/caregiver`

### Patient experience

- [Patient home](https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Home.tsx): `src/pages/patient/Home.tsx`
- [Activity games](https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Games1.tsx): `src/pages/patient/Games1.tsx`
- [Game variants](https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Games2.tsx): `src/pages/patient/Games2.tsx`
- [Diary and music](https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Life.tsx): `src/pages/patient/Life.tsx`
- [Safety wallet](https://github.com/avnipahal624/mool_1/blob/main/src/pages/patient/Wallet.tsx): `src/pages/patient/Wallet.tsx`
- [Cultural motifs](https://github.com/avnipahal624/mool_1/blob/main/src/data/motifs.tsx): `src/data/motifs.tsx`

### Personalization services

- [Activity generation](https://github.com/avnipahal624/mool_1/blob/main/src/services/activityGenerator.ts): `src/services/activityGenerator.ts`
- [Difficulty adaptation](https://github.com/avnipahal624/mool_1/blob/main/src/services/adaptationEngine.ts): `src/services/adaptationEngine.ts`
- [Memory eligibility](https://github.com/avnipahal624/mool_1/blob/main/src/services/memoryService.ts): `src/services/memoryService.ts`
- [Audio and voice](https://github.com/avnipahal624/mool_1/blob/main/src/services/soundService.ts): `src/services/soundService.ts`

### Other components

- **Patient or caregiver**

## Connections

- Patient or caregiver → App routes: uses (evidence: `README.md`)
- App routes → App state: provides state (evidence: `src/pages/App.tsx`)
- App routes → Patient data: provides data (evidence: `src/pages/App.tsx`)
- App routes → Language settings: provides language (evidence: `src/pages/App.tsx`)
- Language settings → Browser storage: persists settings (evidence: `src/context/LanguageContext.tsx`)
- Language settings → Translations: resolves text (evidence: `src/context/LanguageContext.tsx`)
- App state → Browser storage: persists state (evidence: `src/context/AppContext.tsx`)
- Patient data → Browser storage: persists patient data (evidence: `src/context/PatientContext.tsx`)
- Patient data → Demo data: loads demo data (evidence: `src/context/PatientContext.tsx`)
- Patient data → API adapter: syncs data (evidence: `src/context/PatientContext.tsx`)
- Caregiver overview → Difficulty adaptation: reads activity insights (evidence: `src/pages/caregiver/Caregiver.tsx`)
- Memory bank → Memory eligibility: uses memory rules (evidence: `src/pages/caregiver/Memories.tsx`)
- Routines and insights → Difficulty adaptation: uses activity insights (evidence: `src/pages/caregiver/Care.tsx`)
- Routines and insights → Memory eligibility: uses memory rules (evidence: `src/pages/caregiver/Care.tsx`)
- Routines and insights → Audio and voice: uses audio (evidence: `src/pages/caregiver/Care.tsx`)
- App routes → Care extensions: routes caregiver features (evidence: `src/pages/App.tsx`)
- Patient home → Difficulty adaptation: uses personalization (evidence: `src/pages/patient/Home.tsx`)
- Patient home → Memory eligibility: uses memory rules (evidence: `src/pages/patient/Home.tsx`)
- Patient home → Audio and voice: uses audio (evidence: `src/pages/patient/Home.tsx`)
- Activity games → Activity generation: generates activities (evidence: `src/pages/patient/Games1.tsx`)
- Activity games → Difficulty adaptation: adapts sessions (evidence: `src/pages/patient/Games1.tsx`)
- Activity games → Memory eligibility: filters memories (evidence: `src/pages/patient/Games1.tsx`)
- Activity games → Audio and voice: uses audio (evidence: `src/pages/patient/Games1.tsx`)
- Activity games → Cultural motifs: renders motifs (evidence: `src/pages/patient/Games1.tsx`)
- Game variants → Activity generation: generates activities (evidence: `src/pages/patient/Games2.tsx`)
- Game variants → Difficulty adaptation: adapts sessions (evidence: `src/pages/patient/Games2.tsx`)
- Game variants → Audio and voice: uses audio (evidence: `src/pages/patient/Games2.tsx`)
- Game variants → Cultural motifs: renders motifs (evidence: `src/pages/patient/Games2.tsx`)
- Diary and music → Difficulty adaptation: uses personalization (evidence: `src/pages/patient/Life.tsx`)
- Diary and music → Memory eligibility: uses memory rules (evidence: `src/pages/patient/Life.tsx`)
- Diary and music → Audio and voice: uses audio (evidence: `src/pages/patient/Life.tsx`)
- Diary and music → Cultural motifs: renders motifs (evidence: `src/pages/patient/Life.tsx`)
- App routes → Patient home: routes patient (evidence: `src/pages/App.tsx`)
- App routes → Activity games: routes games (evidence: `src/pages/App.tsx`)
- App routes → Game variants: routes games (evidence: `src/pages/App.tsx`)
- App routes → Diary and music: routes life features (evidence: `src/pages/App.tsx`)
- App routes → Safety wallet: routes wallet (evidence: `src/pages/App.tsx`)
- Activity generation → Memory eligibility: filters memories (evidence: `src/services/activityGenerator.ts`)
- Activity generation → Difficulty adaptation: uses topic selection (evidence: `src/services/activityGenerator.ts`)
- Difficulty adaptation → Memory eligibility: uses topic profiles (evidence: `src/services/adaptationEngine.ts`)
- Difficulty adaptation → Browser storage: stores feedback (evidence: `src/services/adaptationEngine.ts`)
- Memory eligibility → Cultural motifs: maps topics (evidence: `src/services/memoryService.ts`)
