# ihsibo/personalized-ai-notifications architecture

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

- Interactive diagram: https://gitdiagram.com/ihsibo/personalized-ai-notifications
- Repository: https://github.com/ihsibo/personalized-ai-notifications

## Overview

Personalized AI Notifications is an Android library for generating personalized push-notification text, with a demo app and optional scheduled delivery. The principal flow is app input → library configuration and prompt construction → selected AI provider → success/error result; the background path schedules work, checks frequency, generates text, then displays a notification. The README documents tone, locale, crash context, provider choice, and A/B variants. Source excerpts support the main calls; unsampled cache behavior and some provider dispatch details are not expanded.

Main entry points: [`notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt) (Notification API), [`notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt`](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt) (Notification worker), [`app/src/main/java/com/compose/personalizedainotifications/MainActivity.kt`](https://github.com/ihsibo/personalized-ai-notifications/blob/main/app/src/main/java/com/compose/personalizedainotifications/MainActivity.kt) (Demo controls), [`notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt`](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt) (OpenAI client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_demo["Demo app"]
  node_demoapp["Demo controls<br/>[MainActivity.kt]"]
end

subgraph group_generation["Generation API"]
  node_facade["Notification API<br/>[NotificationAI.kt]"]
  node_prompt["Prompt builder<br/>[PromptBuilder.kt]"]
  node_config["Generation config"]
  node_result["Generation result"]
  node_providerenum["Provider options<br/>[AIProvider.kt]"]
  node_cache[("Notification cache")]
end

subgraph group_providers["AI providers"]
  node_clientinterface["Client contract<br/>[AIClient.kt]"]
  node_openai["OpenAI client<br/>[OpenAIClient.kt]"]
  node_gemini["Gemini client<br/>[GeminiClient.kt]"]
  node_huggingface["Hugging Face client"]
  node_ollama["Ollama client<br/>[OllamaClient.kt]"]
  node_openaimodels["OpenAI payload models<br/>[OpenAIModels.kt]"]
end

subgraph group_delivery["Background delivery"]
  node_backgroundscheduler["Work scheduler"]
  node_bootreceiver["Boot receiver"]
  node_worker["Notification worker"]
  node_freqscheduler["Frequency tracker"]
  node_display["Notification display"]
end

node_user(("App developer"))
node_openaiservice{{"OpenAI service"}}
node_geminiservice{{"Gemini service"}}
node_hfservice{{"Hugging Face service"}}
node_ollamaservice{{"Ollama server"}}

node_user -->|"configures"| node_demoapp
node_demoapp -->|"requests generation"| node_facade
node_facade -->|"selects provider"| node_providerenum
node_facade -->|"builds config"| node_config
node_facade -->|"builds prompt"| node_prompt
node_prompt -->|"reads settings"| node_config
node_facade -->|"calls client"| node_clientinterface
node_facade -->|"dispatches"| node_openai
node_facade -->|"dispatches"| node_gemini
node_facade -->|"dispatches"| node_huggingface
node_facade -->|"dispatches"| node_ollama
node_openai -->|"sends requests"| node_openaiservice
node_gemini -->|"sends requests"| node_geminiservice
node_huggingface -->|"sends requests"| node_hfservice
node_ollama -->|"sends requests"| node_ollamaservice
node_facade -->|"returns outcome"| node_result
node_demoapp -.->|"can schedule"| node_backgroundscheduler
node_bootreceiver -->|"reschedules"| node_backgroundscheduler
node_backgroundscheduler -->|"enqueues work"| node_worker
node_worker -->|"checks frequency"| node_freqscheduler
node_worker -->|"generates text"| node_facade
node_worker -->|"shows notification"| node_display
node_openai -->|"uses payload types"| node_openaimodels

click node_demoapp "https://github.com/ihsibo/personalized-ai-notifications/blob/main/app/src/main/java/com/compose/personalizedainotifications/MainActivity.kt"
click node_facade "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt"
click node_prompt "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/PromptBuilder.kt"
click node_config "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/models/NotificationConfig.kt"
click node_result "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/models/NotificationResult.kt"
click node_providerenum "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/models/AIProvider.kt"
click node_clientinterface "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/AIClient.kt"
click node_openai "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt"
click node_gemini "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/GeminiClient.kt"
click node_huggingface "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/HuggingFaceClient.kt"
click node_ollama "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/OllamaClient.kt"
click node_backgroundscheduler "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/background/BackgroundNotificationScheduler.kt"
click node_bootreceiver "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationBootReceiver.kt"
click node_worker "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt"
click node_freqscheduler "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/utils/NotificationScheduler.kt"
click node_display "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationDisplayManager.kt"
click node_cache "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/utils/NotificationCache.kt"
click node_openaimodels "https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/models/OpenAIModels.kt"

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_demoapp toneBlue
class node_facade,node_prompt,node_config,node_result,node_providerenum,node_cache toneAmber
class node_clientinterface,node_openai,node_gemini,node_huggingface,node_ollama,node_openaimodels,node_ollamaservice toneMint
class node_backgroundscheduler,node_bootreceiver,node_worker,node_freqscheduler,node_display toneRose
class node_user,node_openaiservice,node_geminiservice,node_hfservice toneIndigo
```

## Components

### Demo app

- [Demo controls](https://github.com/ihsibo/personalized-ai-notifications/blob/main/app/src/main/java/com/compose/personalizedainotifications/MainActivity.kt): `app/src/main/java/com/compose/personalizedainotifications/MainActivity.kt`

### Generation API

- [Notification API](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`
- [Prompt builder](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/PromptBuilder.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/PromptBuilder.kt`
- [Generation config](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/models/NotificationConfig.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/models/NotificationConfig.kt`
- [Generation result](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/models/NotificationResult.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/models/NotificationResult.kt`
- [Provider options](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/models/AIProvider.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/models/AIProvider.kt`
- [Notification cache](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/utils/NotificationCache.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/utils/NotificationCache.kt`

### AI providers

- [Client contract](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/AIClient.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/api/AIClient.kt`
- [OpenAI client](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt`
- [Gemini client](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/GeminiClient.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/api/GeminiClient.kt`
- [Hugging Face client](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/HuggingFaceClient.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/api/HuggingFaceClient.kt`
- [Ollama client](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/api/OllamaClient.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/api/OllamaClient.kt`
- [OpenAI payload models](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/models/OpenAIModels.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/models/OpenAIModels.kt`

### Background delivery

- [Work scheduler](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/background/BackgroundNotificationScheduler.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/background/BackgroundNotificationScheduler.kt`
- [Boot receiver](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationBootReceiver.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationBootReceiver.kt`
- [Notification worker](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt`
- [Frequency tracker](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/utils/NotificationScheduler.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/utils/NotificationScheduler.kt`
- [Notification display](https://github.com/ihsibo/personalized-ai-notifications/blob/main/notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationDisplayManager.kt): `notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationDisplayManager.kt`

### Other components

- **App developer**
- **OpenAI service**
- **Gemini service**
- **Hugging Face service**
- **Ollama server**

## Connections

- App developer → Demo controls: configures (evidence: `README.md`)
- Demo controls → Notification API: requests generation (evidence: `app/src/main/java/com/compose/personalizedainotifications/MainActivity.kt`)
- Notification API → Provider options: selects provider (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`)
- Notification API → Generation config: builds config (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`)
- Notification API → Prompt builder: builds prompt (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`)
- Prompt builder → Generation config: reads settings (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/PromptBuilder.kt`)
- Notification API → Client contract: calls client (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`)
- Notification API → OpenAI client: dispatches (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`)
- Notification API → Gemini client: dispatches (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`)
- Notification API → Hugging Face client: dispatches (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`)
- Notification API → Ollama client: dispatches (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`)
- OpenAI client → OpenAI service: sends requests (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt`)
- Gemini client → Gemini service: sends requests (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/api/GeminiClient.kt`)
- Hugging Face client → Hugging Face service: sends requests (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/api/HuggingFaceClient.kt`)
- Ollama client → Ollama server: sends requests (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/api/OllamaClient.kt`)
- Notification API → Generation result: returns outcome (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt`)
- Demo controls → Work scheduler: can schedule (evidence: `README.md`)
- Boot receiver → Work scheduler: reschedules (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationBootReceiver.kt`)
- Work scheduler → Notification worker: enqueues work (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/background/BackgroundNotificationScheduler.kt`)
- Notification worker → Frequency tracker: checks frequency (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt`)
- Notification worker → Notification API: generates text (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt`)
- Notification worker → Notification display: shows notification (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt`)
- OpenAI client → OpenAI payload models: uses payload types (evidence: `notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt`)
