# jgushe/prototipo architecture

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

- Interactive diagram: https://gitdiagram.com/jgushe/prototipo
- Repository: https://github.com/jgushe/prototipo

## Overview

Dopalytics is a local-first Flutter/Android app for task and schedule planning alongside screen-use monitoring. The main workflow gathers device-use and planning context, evaluates recommendation rules, applies cooldown, persists new recommendations, and notifies for higher severities; users review usage, trends, and tips in the app. The README documents the Dart/native monitoring bridge and feature scope, but most Dart implementations were not sampled, so those links reflect documented behavior rather than inspected calls.

Main entry points: [`lib/services/ciclo_monitoreo_service.dart`](https://github.com/jgushe/prototipo/blob/master/lib/services/ciclo_monitoreo_service.dart) (Monitoring cycle), [`lib/database/database_helper.dart`](https://github.com/jgushe/prototipo/blob/master/lib/database/database_helper.dart) (Local SQLite), [`lib/main.dart`](https://github.com/jgushe/prototipo/blob/master/lib/main.dart) (App entry and navigation), [`lib/screens/uso_screen.dart`](https://github.com/jgushe/prototipo/blob/master/lib/screens/uso_screen.dart) (Usage screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["User interface"]
  node_main["App entry and navigation<br/>[main.dart]"]
  node_dashboard["Dashboard"]
  node_tasks_ui["Task management<br/>[tareas_screen.dart]"]
  node_usage_ui["Usage screen<br/>[uso_screen.dart]"]
  node_tips_ui["Recommendations screen"]
  node_settings_ui["Configuration screen"]
  node_theme["Appearance system"]
end

subgraph group_planning["Planning and profile"]
  node_tasks["Tasks and schedules<br/>[tarea.dart]"]
  node_profile["User profile<br/>[perfil.dart]"]
end

subgraph group_insights["Usage and insights"]
  node_usage_capture["Usage capture"]
  node_usage_read["Shared usage reading"]
  node_schedule_analysis["Schedule analysis"]
  node_history["Usage history and trends"]
end

subgraph group_recommendations["Recommendation engine"]
  node_context["Recommendation context"]
  node_rules["Rules and evaluation"]
  node_cooldown["Duplicate suppression"]
  node_cycle["Monitoring cycle"]
  node_alerts["Recommendation notifications"]
end

subgraph group_platform["Persistence and Android"]
  node_database[("Local SQLite")]
  node_native_activity["Android bridge and scheduler<br/>[MainActivity.kt]"]
  node_worker["Headless monitoring worker"]
end

node_user(("App user"))
node_android_usage["Android usage statistics"]
node_notifications["Local notifications"]

node_user -->|"opens"| node_main
node_main -->|"navigates to"| node_dashboard
node_user -->|"plans tasks"| node_tasks_ui
node_tasks_ui -->|"stores tasks"| node_database
node_user -->|"reviews usage"| node_usage_ui
node_usage_ui -->|"requests reading"| node_usage_read
node_usage_read -->|"reuses capture"| node_usage_capture
node_usage_capture -->|"reads device stats"| node_android_usage
node_usage_ui -->|"shows trends"| node_history
node_dashboard -->|"shows metrics"| node_history
node_user -->|"reviews tips"| node_tips_ui
node_cycle -->|"captures usage"| node_usage_capture
node_cycle -->|"builds context"| node_context
node_context -->|"uses planned tasks"| node_tasks
node_context -->|"uses schedule analysis"| node_schedule_analysis
node_cycle -->|"evaluates rules"| node_rules
node_cycle -->|"filters duplicates"| node_cooldown
node_cycle -->|"saves recommendations"| node_database
node_tips_ui -->|"reads history"| node_database
node_tips_ui -->|"stores ratings"| node_database
node_cycle -->|"dispatches alerts"| node_alerts
node_alerts -->|"sends notifications"| node_notifications
node_user -->|"configures profile"| node_settings_ui
node_settings_ui -->|"updates profile"| node_profile
node_settings_ui -->|"sets appearance"| node_theme
node_main -->|"bridges monitoring"| node_native_activity
node_native_activity -->|"schedules work"| node_worker
node_worker -->|"runs headless cycle"| node_cycle

click node_main "https://github.com/jgushe/prototipo/blob/master/lib/main.dart"
click node_dashboard "https://github.com/jgushe/prototipo/blob/master/lib/screens/dashboard_screen.dart"
click node_tasks_ui "https://github.com/jgushe/prototipo/blob/master/lib/screens/tareas_screen.dart"
click node_usage_ui "https://github.com/jgushe/prototipo/blob/master/lib/screens/uso_screen.dart"
click node_tips_ui "https://github.com/jgushe/prototipo/blob/master/lib/screens/recomendaciones_screen.dart"
click node_settings_ui "https://github.com/jgushe/prototipo/blob/master/lib/screens/configuracion_screen.dart"
click node_theme "https://github.com/jgushe/prototipo/blob/master/lib/theme/theme_controller.dart"
click node_tasks "https://github.com/jgushe/prototipo/blob/master/lib/models/tarea.dart"
click node_profile "https://github.com/jgushe/prototipo/blob/master/lib/models/perfil.dart"
click node_usage_capture "https://github.com/jgushe/prototipo/blob/master/lib/services/uso_pantalla_service.dart"
click node_usage_read "https://github.com/jgushe/prototipo/blob/master/lib/services/lectura_uso_controller.dart"
click node_schedule_analysis "https://github.com/jgushe/prototipo/blob/master/lib/services/analisis_horario_service.dart"
click node_history "https://github.com/jgushe/prototipo/blob/master/lib/models/evolucion_semanal.dart"
click node_context "https://github.com/jgushe/prototipo/blob/master/lib/services/contexto_recomendacion_service.dart"
click node_rules "https://github.com/jgushe/prototipo/blob/master/lib/services/reglas/evaluador_reglas.dart"
click node_cooldown "https://github.com/jgushe/prototipo/blob/master/lib/services/reglas/politica_cooldown.dart"
click node_cycle "https://github.com/jgushe/prototipo/blob/master/lib/services/ciclo_monitoreo_service.dart"
click node_alerts "https://github.com/jgushe/prototipo/blob/master/lib/services/recomendaciones_notificador.dart"
click node_database "https://github.com/jgushe/prototipo/blob/master/lib/database/database_helper.dart"
click node_native_activity "https://github.com/jgushe/prototipo/blob/master/android/app/src/main/kotlin/com/prototipo/prototipo_tesis/MainActivity.kt"
click node_worker "https://github.com/jgushe/prototipo/blob/master/android/app/src/main/kotlin/com/prototipo/prototipo_tesis/MonitoreoUsoWorker.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_main,node_dashboard,node_tasks_ui,node_usage_ui,node_tips_ui,node_settings_ui,node_theme,node_user toneBlue
class node_tasks,node_profile toneAmber
class node_usage_capture,node_usage_read,node_schedule_analysis,node_history toneMint
class node_context,node_rules,node_cooldown,node_cycle,node_alerts toneRose
class node_database,node_native_activity,node_worker,node_android_usage,node_notifications toneIndigo
```

## Components

### User interface

- [App entry and navigation](https://github.com/jgushe/prototipo/blob/master/lib/main.dart): `lib/main.dart`
- [Dashboard](https://github.com/jgushe/prototipo/blob/master/lib/screens/dashboard_screen.dart): `lib/screens/dashboard_screen.dart`
- [Task management](https://github.com/jgushe/prototipo/blob/master/lib/screens/tareas_screen.dart): `lib/screens/tareas_screen.dart`
- [Usage screen](https://github.com/jgushe/prototipo/blob/master/lib/screens/uso_screen.dart): `lib/screens/uso_screen.dart`
- [Recommendations screen](https://github.com/jgushe/prototipo/blob/master/lib/screens/recomendaciones_screen.dart): `lib/screens/recomendaciones_screen.dart`
- [Configuration screen](https://github.com/jgushe/prototipo/blob/master/lib/screens/configuracion_screen.dart): `lib/screens/configuracion_screen.dart`
- [Appearance system](https://github.com/jgushe/prototipo/blob/master/lib/theme/theme_controller.dart): `lib/theme/theme_controller.dart`

### Planning and profile

- [Tasks and schedules](https://github.com/jgushe/prototipo/blob/master/lib/models/tarea.dart): `lib/models/tarea.dart`
- [User profile](https://github.com/jgushe/prototipo/blob/master/lib/models/perfil.dart): `lib/models/perfil.dart`

### Usage and insights

- [Usage capture](https://github.com/jgushe/prototipo/blob/master/lib/services/uso_pantalla_service.dart): `lib/services/uso_pantalla_service.dart`
- [Shared usage reading](https://github.com/jgushe/prototipo/blob/master/lib/services/lectura_uso_controller.dart): `lib/services/lectura_uso_controller.dart`
- [Schedule analysis](https://github.com/jgushe/prototipo/blob/master/lib/services/analisis_horario_service.dart): `lib/services/analisis_horario_service.dart`
- [Usage history and trends](https://github.com/jgushe/prototipo/blob/master/lib/models/evolucion_semanal.dart): `lib/models/evolucion_semanal.dart`

### Recommendation engine

- [Recommendation context](https://github.com/jgushe/prototipo/blob/master/lib/services/contexto_recomendacion_service.dart): `lib/services/contexto_recomendacion_service.dart`
- [Rules and evaluation](https://github.com/jgushe/prototipo/blob/master/lib/services/reglas/evaluador_reglas.dart): `lib/services/reglas/evaluador_reglas.dart`
- [Duplicate suppression](https://github.com/jgushe/prototipo/blob/master/lib/services/reglas/politica_cooldown.dart): `lib/services/reglas/politica_cooldown.dart`
- [Monitoring cycle](https://github.com/jgushe/prototipo/blob/master/lib/services/ciclo_monitoreo_service.dart): `lib/services/ciclo_monitoreo_service.dart`
- [Recommendation notifications](https://github.com/jgushe/prototipo/blob/master/lib/services/recomendaciones_notificador.dart): `lib/services/recomendaciones_notificador.dart`

### Persistence and Android

- [Local SQLite](https://github.com/jgushe/prototipo/blob/master/lib/database/database_helper.dart): `lib/database/database_helper.dart`
- [Android bridge and scheduler](https://github.com/jgushe/prototipo/blob/master/android/app/src/main/kotlin/com/prototipo/prototipo_tesis/MainActivity.kt): `android/app/src/main/kotlin/com/prototipo/prototipo_tesis/MainActivity.kt`
- [Headless monitoring worker](https://github.com/jgushe/prototipo/blob/master/android/app/src/main/kotlin/com/prototipo/prototipo_tesis/MonitoreoUsoWorker.kt): `android/app/src/main/kotlin/com/prototipo/prototipo_tesis/MonitoreoUsoWorker.kt`

### Other components

- **App user**
- **Android usage statistics**
- **Local notifications**

## Connections

- App user → App entry and navigation: opens (evidence: `README.md`)
- App entry and navigation → Dashboard: navigates to (evidence: `README.md`)
- App user → Task management: plans tasks (evidence: `README.md`)
- Task management → Local SQLite: stores tasks (evidence: `README.md`)
- App user → Usage screen: reviews usage (evidence: `README.md`)
- Usage screen → Shared usage reading: requests reading (evidence: `README.md`)
- Shared usage reading → Usage capture: reuses capture (evidence: `README.md`)
- Usage capture → Android usage statistics: reads device stats (evidence: `README.md`)
- Usage screen → Usage history and trends: shows trends (evidence: `README.md`)
- Dashboard → Usage history and trends: shows metrics (evidence: `README.md`)
- App user → Recommendations screen: reviews tips (evidence: `README.md`)
- Monitoring cycle → Usage capture: captures usage (evidence: `README.md`)
- Monitoring cycle → Recommendation context: builds context (evidence: `README.md`)
- Recommendation context → Tasks and schedules: uses planned tasks (evidence: `README.md`)
- Recommendation context → Schedule analysis: uses schedule analysis (evidence: `README.md`)
- Monitoring cycle → Rules and evaluation: evaluates rules (evidence: `README.md`)
- Monitoring cycle → Duplicate suppression: filters duplicates (evidence: `README.md`)
- Monitoring cycle → Local SQLite: saves recommendations (evidence: `README.md`)
- Recommendations screen → Local SQLite: reads history (evidence: `README.md`)
- Recommendations screen → Local SQLite: stores ratings (evidence: `README.md`)
- Monitoring cycle → Recommendation notifications: dispatches alerts (evidence: `README.md`)
- Recommendation notifications → Local notifications: sends notifications (evidence: `README.md`)
- App user → Configuration screen: configures profile (evidence: `README.md`)
- Configuration screen → User profile: updates profile (evidence: `README.md`)
- Configuration screen → Appearance system: sets appearance (evidence: `README.md`)
- App entry and navigation → Android bridge and scheduler: bridges monitoring (evidence: `README.md`)
- Android bridge and scheduler → Headless monitoring worker: schedules work (evidence: `README.md`)
- Headless monitoring worker → Monitoring cycle: runs headless cycle (evidence: `README.md`)
