# kskaushikram/cpr architecture

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

- Interactive diagram: https://gitdiagram.com/kskaushikram/cpr
- Repository: https://github.com/kskaushikram/cpr

## Overview

CPR is a Kivy-based augmentative communication app. A user enters or speaks a message in the AAC interface; the app is documented to normalize and match text, present pictogram-based communication choices, and provide speech output. A local SQLite model records sentences with time and location context and ranks recommendation candidates. The README also documents image generation, ARASAAC pictograms, voice input, and cloud backup/sync. Those broader capabilities are represented from documentation and tree paths; their internal wiring is not established by the sampled application source.

Main entry points: [`AAC/View/AACScreen.py`](https://github.com/kskaushikram/cpr/blob/main/AAC/View/AACScreen.py) (AAC interface), [`AAC/Control/Controller.py`](https://github.com/kskaushikram/cpr/blob/main/AAC/Control/Controller.py) (Screen controller), [`AAC/Model/Arasaac_helper.py`](https://github.com/kskaushikram/cpr/blob/main/AAC/Model/Arasaac_helper.py) (ARASAAC pictograms), [`AAC/Model/wordgen.py`](https://github.com/kskaushikram/cpr/blob/main/AAC/Model/wordgen.py) (Image generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application flow"]
  node_main["Kivy entry point<br/>[main.py]"]
  node_controller["Screen controller<br/>[Controller.py]"]
  node_splash["Splash screen<br/>[firstscreen.py]"]
end

subgraph group_communication["Communication tools"]
  node_screen["AAC interface<br/>[AACScreen.py]"]
  node_normalizer["Input normalization<br/>[input_norm.py]"]
  node_speech["Speech input and output<br/>[AACScreen.py]"]
  node_pictograms["ARASAAC pictograms<br/>[Arasaac_helper.py]"]
  node_wordgen["Image generation<br/>[wordgen.py]"]
end

subgraph group_intelligence["Matching and recommendations"]
  node_matching["Word matching<br/>[wordgen.py]"]
  node_recommendations["Context recommendations<br/>[Database.py]"]
end

subgraph group_data["Local and cloud data"]
  node_dbhelper["Recommendation access<br/>[Database_helper.py]"]
  node_db[("Sentence history<br/>[Database.py]")]
  node_controller_db["Insert helper<br/>[Controller.py]"]
end

node_user(("AAC user"))
node_arasaac{{"ARASAAC service"}}
node_openai{{"Image generation service"}}
node_sqlite[("SQLite store")]
node_drive{{"Google Drive"}}

node_user -->|"enters or speaks"| node_screen
node_main -->|"creates screens"| node_controller
node_controller -->|"adds screen"| node_splash
node_controller -->|"adds screen"| node_screen
node_screen -.->|"normalizes text"| node_normalizer
node_screen -.->|"matches input"| node_matching
node_screen -.->|"requests pictograms"| node_pictograms
node_pictograms -.->|"fetches pictograms"| node_arasaac
node_screen -.->|"requests images"| node_wordgen
node_wordgen -.->|"generates images"| node_openai
node_screen -.->|"provides speech"| node_speech
node_screen -.->|"requests suggestions"| node_dbhelper
node_dbhelper -->|"queries history"| node_recommendations
node_recommendations -->|"reads history"| node_sqlite
node_controller -->|"inserts sentence"| node_controller_db
node_controller_db -->|"calls insert"| node_db
node_db -->|"writes and reads"| node_sqlite
node_screen -.->|"syncs images"| node_drive

click node_main "https://github.com/kskaushikram/cpr/blob/main/AAC/main.py"
click node_controller "https://github.com/kskaushikram/cpr/blob/main/AAC/Control/Controller.py"
click node_splash "https://github.com/kskaushikram/cpr/blob/main/AAC/View/firstscreen.py"
click node_screen "https://github.com/kskaushikram/cpr/blob/main/AAC/View/AACScreen.py"
click node_normalizer "https://github.com/kskaushikram/cpr/blob/main/AAC/View/input_norm.py"
click node_speech "https://github.com/kskaushikram/cpr/blob/main/AAC/View/AACScreen.py"
click node_pictograms "https://github.com/kskaushikram/cpr/blob/main/AAC/Model/Arasaac_helper.py"
click node_wordgen "https://github.com/kskaushikram/cpr/blob/main/AAC/Model/wordgen.py"
click node_matching "https://github.com/kskaushikram/cpr/blob/main/AAC/Model/wordgen.py"
click node_recommendations "https://github.com/kskaushikram/cpr/blob/main/AAC/Model/Database.py"
click node_dbhelper "https://github.com/kskaushikram/cpr/blob/main/AAC/Control/Database_helper.py"
click node_db "https://github.com/kskaushikram/cpr/blob/main/AAC/Model/Database.py"
click node_controller_db "https://github.com/kskaushikram/cpr/blob/main/AAC/Control/Controller.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_main,node_controller,node_splash,node_user toneBlue
class node_screen,node_normalizer,node_speech,node_pictograms,node_wordgen,node_sqlite toneAmber
class node_matching,node_recommendations toneMint
class node_dbhelper,node_db,node_controller_db toneRose
class node_arasaac,node_openai,node_drive toneIndigo
```

## Components

### Application flow

- [Kivy entry point](https://github.com/kskaushikram/cpr/blob/main/AAC/main.py): `AAC/main.py`
- [Screen controller](https://github.com/kskaushikram/cpr/blob/main/AAC/Control/Controller.py): `AAC/Control/Controller.py`
- [Splash screen](https://github.com/kskaushikram/cpr/blob/main/AAC/View/firstscreen.py): `AAC/View/firstscreen.py`

### Communication tools

- [AAC interface](https://github.com/kskaushikram/cpr/blob/main/AAC/View/AACScreen.py): `AAC/View/AACScreen.py`
- [Input normalization](https://github.com/kskaushikram/cpr/blob/main/AAC/View/input_norm.py): `AAC/View/input_norm.py`
- [Speech input and output](https://github.com/kskaushikram/cpr/blob/main/AAC/View/AACScreen.py): `AAC/View/AACScreen.py`
- [ARASAAC pictograms](https://github.com/kskaushikram/cpr/blob/main/AAC/Model/Arasaac_helper.py): `AAC/Model/Arasaac_helper.py`
- [Image generation](https://github.com/kskaushikram/cpr/blob/main/AAC/Model/wordgen.py): `AAC/Model/wordgen.py`

### Matching and recommendations

- [Word matching](https://github.com/kskaushikram/cpr/blob/main/AAC/Model/wordgen.py): `AAC/Model/wordgen.py`
- [Context recommendations](https://github.com/kskaushikram/cpr/blob/main/AAC/Model/Database.py): `AAC/Model/Database.py`

### Local and cloud data

- [Recommendation access](https://github.com/kskaushikram/cpr/blob/main/AAC/Control/Database_helper.py): `AAC/Control/Database_helper.py`
- [Sentence history](https://github.com/kskaushikram/cpr/blob/main/AAC/Model/Database.py): `AAC/Model/Database.py`
- [Insert helper](https://github.com/kskaushikram/cpr/blob/main/AAC/Control/Controller.py): `AAC/Control/Controller.py`

### Other components

- **AAC user**
- **ARASAAC service**
- **Image generation service**
- **SQLite store**
- **Google Drive**

## Connections

- AAC user → AAC interface: enters or speaks
- Kivy entry point → Screen controller: creates screens
- Screen controller → Splash screen: adds screen
- Screen controller → AAC interface: adds screen
- AAC interface → Input normalization: normalizes text
- AAC interface → Word matching: matches input
- AAC interface → ARASAAC pictograms: requests pictograms
- ARASAAC pictograms → ARASAAC service: fetches pictograms
- AAC interface → Image generation: requests images
- Image generation → Image generation service: generates images
- AAC interface → Speech input and output: provides speech
- AAC interface → Recommendation access: requests suggestions
- Recommendation access → Context recommendations: queries history
- Context recommendations → SQLite store: reads history
- Screen controller → Insert helper: inserts sentence
- Insert helper → Sentence history: calls insert
- Sentence history → SQLite store: writes and reads
- AAC interface → Google Drive: syncs images
