# sey4192/exaisemproj architecture

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

- Interactive diagram: https://gitdiagram.com/sey4192/exaisemproj
- Repository: https://github.com/sey4192/exaisemproj

## Overview

EXAI is a mobile-centered check-in and intervention product: users enter session details or request a simulated session, receive a risk result, and can review explanations and trends. Tymeout’s app context coordinates prediction, local history, and reminders; the Flask backend provides prediction and model metrics. The README also documents simulated-data training, SHAP/LIME explanations, and a rule-based persuasion engine. Backend internals were not excerpted, so their connections are documented at the product level rather than inferred as code calls.

Main entry points: [`mobile/src/context/AppContext.js`](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/context/AppContext.js) (App workflow), [`mobile/App.js`](https://github.com/sey4192/exaisemproj/blob/main/mobile/App.js) (App navigation), [`backend/app.py`](https://github.com/sey4192/exaisemproj/blob/main/backend/app.py) (Flask API), [`mobile/src/screens/CheckScreen.js`](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/CheckScreen.js) (Session check-in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Tymeout app"]
  node_app["App navigation<br/>[App.js]"]
  node_check["Session check-in<br/>[CheckScreen.js]"]
  node_context["App workflow<br/>[AppContext.js]"]
  node_api["API client<br/>[client.js]"]
  node_alert["High-risk alert<br/>[AlertScreen.js]"]
  node_lowresult["Low-risk result"]
  node_explanation["Explanation view"]
  node_historyview["Check-in history<br/>[HistoryScreen.js]"]
  node_insights["Personal insights<br/>[InsightsScreen.js]"]
  node_dashboard["Dashboard<br/>[DashboardScreen.js]"]
  node_onboarding["Onboarding"]
  node_settings["Settings<br/>[SettingsScreen.js]"]
end

subgraph group_backend["Risk service"]
  node_backendapi["Flask API<br/>[app.py]"]
  node_persuasion["Persuasion rules<br/>[app.py]"]
  node_metrics["Model metrics<br/>[app.py]"]
end

subgraph group_ml["Model and explanations"]
  node_model["Risk prediction<br/>[train_model.py]"]
  node_explain["SHAP and LIME<br/>[explainability.py]"]
  node_data["Simulated data<br/>[generate_data.py]"]
  node_evaluation["Model evaluation<br/>[evaluate_extra.py]"]
end

subgraph group_support["Local state and reminders"]
  node_storage[("Local persistence<br/>[storage.js]")]
  node_notifications["Reminder scheduling<br/>[notifications.js]"]
  node_background["Background reminders<br/>[backgroundTask.js]"]
end

node_person(("User"))
node_external["Notification service"]

node_person -->|"uses"| node_app
node_app -->|"routes to"| node_onboarding
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_check
node_app -->|"routes to"| node_historyview
node_app -->|"routes to"| node_insights
node_person -->|"enters session"| node_check
node_check -->|"uses workflow"| node_context
node_context -->|"requests prediction"| node_api
node_context -->|"loads and saves"| node_storage
node_context -->|"configures"| node_notifications
node_context -->|"registers"| node_background
node_api -->|"sends requests"| node_backendapi
node_backendapi -.->|"predicts risk"| node_model
node_backendapi -.->|"explains prediction"| node_explain
node_backendapi -.->|"selects intervention"| node_persuasion
node_data -.->|"trains with"| node_model
node_model -.->|"evaluated by"| node_evaluation
node_backendapi -->|"serves metrics"| node_metrics
node_context -->|"navigates on high risk"| node_alert
node_context -->|"navigates on low risk"| node_lowresult
node_person -->|"reviews"| node_explanation
node_person -->|"reviews"| node_historyview
node_person -->|"reviews"| node_insights
node_notifications -.->|"schedules alerts"| node_external
node_settings -->|"updates preferences"| node_context
node_insights -->|"fetches metrics"| node_api

click node_app "https://github.com/sey4192/exaisemproj/blob/main/mobile/App.js"
click node_check "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/CheckScreen.js"
click node_context "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/context/AppContext.js"
click node_api "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/api/client.js"
click node_backendapi "https://github.com/sey4192/exaisemproj/blob/main/backend/app.py"
click node_model "https://github.com/sey4192/exaisemproj/blob/main/backend/ml/train_model.py"
click node_explain "https://github.com/sey4192/exaisemproj/blob/main/backend/ml/explainability.py"
click node_persuasion "https://github.com/sey4192/exaisemproj/blob/main/backend/app.py"
click node_data "https://github.com/sey4192/exaisemproj/blob/main/backend/ml/generate_data.py"
click node_evaluation "https://github.com/sey4192/exaisemproj/blob/main/backend/ml/evaluate_extra.py"
click node_alert "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/AlertScreen.js"
click node_lowresult "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/LowRiskResultScreen.js"
click node_explanation "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/ExplanationScreen.js"
click node_historyview "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/HistoryScreen.js"
click node_insights "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/InsightsScreen.js"
click node_dashboard "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/DashboardScreen.js"
click node_onboarding "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/OnboardingScreen.js"
click node_settings "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/SettingsScreen.js"
click node_storage "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/storage/storage.js"
click node_notifications "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/notifications/notifications.js"
click node_background "https://github.com/sey4192/exaisemproj/blob/main/mobile/src/notifications/backgroundTask.js"
click node_metrics "https://github.com/sey4192/exaisemproj/blob/main/backend/app.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_check,node_context,node_api,node_alert,node_lowresult,node_explanation,node_historyview,node_insights,node_dashboard,node_onboarding,node_settings,node_person toneBlue
class node_backendapi,node_persuasion,node_metrics toneAmber
class node_model,node_explain,node_data,node_evaluation toneMint
class node_storage,node_notifications,node_background toneRose
class node_external toneIndigo
```

## Components

### Tymeout app

- [App navigation](https://github.com/sey4192/exaisemproj/blob/main/mobile/App.js): `mobile/App.js`
- [Session check-in](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/CheckScreen.js): `mobile/src/screens/CheckScreen.js`
- [App workflow](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/context/AppContext.js): `mobile/src/context/AppContext.js`
- [API client](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/api/client.js): `mobile/src/api/client.js`
- [High-risk alert](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/AlertScreen.js): `mobile/src/screens/AlertScreen.js`
- [Low-risk result](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/LowRiskResultScreen.js): `mobile/src/screens/LowRiskResultScreen.js`
- [Explanation view](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/ExplanationScreen.js): `mobile/src/screens/ExplanationScreen.js`
- [Check-in history](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/HistoryScreen.js): `mobile/src/screens/HistoryScreen.js`
- [Personal insights](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/InsightsScreen.js): `mobile/src/screens/InsightsScreen.js`
- [Dashboard](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/DashboardScreen.js): `mobile/src/screens/DashboardScreen.js`
- [Onboarding](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/OnboardingScreen.js): `mobile/src/screens/OnboardingScreen.js`
- [Settings](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/screens/SettingsScreen.js): `mobile/src/screens/SettingsScreen.js`

### Risk service

- [Flask API](https://github.com/sey4192/exaisemproj/blob/main/backend/app.py): `backend/app.py`
- [Persuasion rules](https://github.com/sey4192/exaisemproj/blob/main/backend/app.py): `backend/app.py`
- [Model metrics](https://github.com/sey4192/exaisemproj/blob/main/backend/app.py): `backend/app.py`

### Model and explanations

- [Risk prediction](https://github.com/sey4192/exaisemproj/blob/main/backend/ml/train_model.py): `backend/ml/train_model.py`
- [SHAP and LIME](https://github.com/sey4192/exaisemproj/blob/main/backend/ml/explainability.py): `backend/ml/explainability.py`
- [Simulated data](https://github.com/sey4192/exaisemproj/blob/main/backend/ml/generate_data.py): `backend/ml/generate_data.py`
- [Model evaluation](https://github.com/sey4192/exaisemproj/blob/main/backend/ml/evaluate_extra.py): `backend/ml/evaluate_extra.py`

### Local state and reminders

- [Local persistence](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/storage/storage.js): `mobile/src/storage/storage.js`
- [Reminder scheduling](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/notifications/notifications.js): `mobile/src/notifications/notifications.js`
- [Background reminders](https://github.com/sey4192/exaisemproj/blob/main/mobile/src/notifications/backgroundTask.js): `mobile/src/notifications/backgroundTask.js`

### Other components

- **User**
- **Notification service**

## Connections

- User → App navigation: uses
- App navigation → Onboarding: routes to (evidence: `mobile/App.js`)
- App navigation → Dashboard: routes to (evidence: `mobile/App.js`)
- App navigation → Session check-in: routes to (evidence: `mobile/App.js`)
- App navigation → Check-in history: routes to (evidence: `mobile/App.js`)
- App navigation → Personal insights: routes to (evidence: `mobile/App.js`)
- User → Session check-in: enters session
- Session check-in → App workflow: uses workflow (evidence: `mobile/src/screens/CheckScreen.js`)
- App workflow → API client: requests prediction (evidence: `mobile/src/context/AppContext.js`)
- App workflow → Local persistence: loads and saves (evidence: `mobile/src/context/AppContext.js`)
- App workflow → Reminder scheduling: configures (evidence: `mobile/src/context/AppContext.js`)
- App workflow → Background reminders: registers (evidence: `mobile/src/context/AppContext.js`)
- API client → Flask API: sends requests (evidence: `mobile/src/api/client.js`)
- Flask API → Risk prediction: predicts risk
- Flask API → SHAP and LIME: explains prediction
- Flask API → Persuasion rules: selects intervention (evidence: `backend/app.py`)
- Simulated data → Risk prediction: trains with
- Risk prediction → Model evaluation: evaluated by
- Flask API → Model metrics: serves metrics (evidence: `backend/app.py`)
- App workflow → High-risk alert: navigates on high risk (evidence: `mobile/src/context/AppContext.js`)
- App workflow → Low-risk result: navigates on low risk (evidence: `mobile/src/context/AppContext.js`)
- User → Explanation view: reviews
- User → Check-in history: reviews
- User → Personal insights: reviews
- Reminder scheduling → Notification service: schedules alerts
- Settings → App workflow: updates preferences (evidence: `mobile/src/screens/SettingsScreen.js`)
- Personal insights → API client: fetches metrics (evidence: `mobile/src/screens/InsightsScreen.js`)
