# wkkyu088/senior_health_care architecture

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

- Interactive diagram: https://gitdiagram.com/wkkyu088/senior_health_care
- Repository: https://github.com/wkkyu088/senior_health_care

## Overview

1. **Project type and runtime**
   - This is a **Flutter client application** called *Senior Health Care*, built to run across **Android, iOS, web, macOS, Linux, and Windows** from a single Dart codebase.
   - The app’s business logic is mostly in `lib/`; the `android/`, `ios/`, `web/`, `macos/`, `linux/`, and `windows/` folders are platform shells and launch/runtime configuration.

2. **Primary product boundary**
   - The app appears to support **elderly health self-reporting / care tracking** for metrics such as **blood pressure, blood sugar, heart rate, and weight**.
   - The main product flow is: **authenticate user → enter health measurements → store to cloud → view results/history/summary**.

3. **App entry and global initialization**
   - `lib/main.dart` is the app entry point.
   - `lib/firebase_options.dart` indicates Firebase is initialized through FlutterFire configuration, so app startup likely wires Firebase before routing to screens.
   - `lib/constants.dart` likely holds shared app-wide values such as colors, sizes, or keys.

4. **Authentication subsystem**
   - `lib/screens/login_screen.dart`, `lib/screens/singup_screen.dart`, and `lib/screens/splash_screen.dart` form the authentication/bootstrapping boundary.
   - `lib/utils/auth.dart` is the dedicated auth utility, implying Firebase Authentication or similar identity management is abstracted there.
   - The splash screen likely decides whether to route into the authenticated area or back to login based on auth state.

5. **Main navigation and app shell**
   - `lib/screens/main_screen.dart` is the central post-login container.
   - `lib/screens/setting_screen.dart` is a separate app-level settings surface.
   - `lib/widgets/custom_appbar.dart` and `lib/widgets/main_board.dart` suggest the main screen is built from reusable header/dashboard components rather than a single monolithic page.

6. **Health data input subsystem**
   - `lib/screens/input_screen.dart` is the gateway for data entry.
   - Specialized input screens exist for each metric:
     - `blood_pressure_input.dart`
     - `blood_sugar_input.dart`
     - `heart_rate_input.dart`
     - `weight_input.dart`
   - Shared input UI is factored into `lib/widgets/input/`, including common form controls, date selection, and “input at once” / multi-submit actions.

7. **Health data results and visualization subsystem**
   - `lib/screens/result_screen.dart` is the gateway for viewing recorded measurements.
   - Metric-specific result screens mirror the input screens:
     - `blood_pressure_result.dart`
     - `blood_sugar_result.dart`
     - `heart_rate_result.dart`
     - `weight_result.dart`
   - `lib/screens/resultScreens/all_result.dart` likely combines multiple metrics into a unified summary view.
   - Visualization is handled by reusable widgets such as `common_chart_widget.dart`, `radar_chart.dart`, and result button/toggle controls.

8. **Data storage and cloud boundary**
   - `lib/utils/firestore.dart` is the key persistence layer, strongly suggesting **Cloud Firestore** is the central backend datastore.
   - The architecture likely follows this flow: **input screens write measurement documents to Firestore; result screens query Firestore for history, averages, and recent values**.
   - `android/app/google-services.json` confirms Firebase is configured on Android; the presence of `firebase_options.dart` indicates a multi-platform Firebase setup.

9. **Reusable UI component layer**
   - `lib/widgets/` contains the app’s shared presentation components:
     - `average_board.dart`, `recent_board.dart` for dashboard-style summaries
     - `custom_dialog.dart` for modal feedback/confirmation
     - `custom_appbar.dart` for consistent screen chrome
     - `widgets/input/*` and `widgets/result/*` for domain-specific controls and charts
   - This layer isolates styling and interaction patterns so the feature screens stay thin.

10. **Assets and branding**
   - `assets/fonts/` includes the Pretendard font family, so typography is intentionally branded and consistent across the app.
   - `assets/images/` exists, though no specific image files are shown in the tree.
   - The app uses standard Flutter asset packaging rather than a separate media pipeline.

11. **Platform integration**
   - Native folders contain only standard Flutter host code and launch scaffolding:
     - Android `MainActivity.kt`
     - iOS/macOS Swift app delegates
     - desktop runners for Linux/Windows/macOS
   - There is no sign of custom native business logic; native code is mainly the platform bridge for Flutter and Firebase.

12. **Testing and project maturity**
   - `test/widget_test.dart` is present, indicating at least the default Flutter test scaffold.
   - `analysis_options.yaml`, `pubspec.yaml`, and `pubspec.lock` show a conventional Flutter-managed build and dependency setup.

13. **What to draw in an architecture diagram**
   - A useful diagram would center on **Flutter UI** feeding into two cross-cutting services:
     - **Auth** via `utils/auth.dart`
     - **Data persistence** via `utils/firestore.dart`
   - Above that, show feature clusters:
     - authentication screens
     - health input screens
     - health result/analytics screens
     - settings/dashboard shell
   - External dependencies to place outside the app boundary: **Firebase Authentication**, **Cloud Firestore**, and the Flutter/Firebase platform runtimes.

Main entry points: [`lib/utils/firestore.dart`](https://github.com/wkkyu088/senior_health_care/blob/master/lib/utils/firestore.dart) (Firestore util), [`lib/screens/main_screen.dart`](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/main_screen.dart) (Main screen), [`lib/screens/result_screen.dart`](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/result_screen.dart) (Result hub), [`lib/main.dart`](https://github.com/wkkyu088/senior_health_care/blob/master/lib/main.dart) (main.dart)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["App Core"]
  node_main["main.dart<br/>entrypoint<br/>[main.dart]"]
  node_firebase_options["Firebase options<br/>config"]
  node_constants["Constants<br/>shared config<br/>[constants.dart]"]
end

subgraph group_auth["Access Layer"]
  node_splash_screen["Splash<br/>auth gate<br/>[splash_screen.dart]"]
  node_login_screen["Login<br/>auth screen<br/>[login_screen.dart]"]
  node_signup_screen["Sign up<br/>auth screen<br/>[singup_screen.dart]"]
  node_main_screen["Main screen<br/>app shell<br/>[main_screen.dart]"]
  node_setting_screen["Settings"]
end

subgraph group_input["Measurement Input"]
  node_input_screen["Input hub<br/>feature hub<br/>[input_screen.dart]"]
  node_bp_input["Blood pressure<br/>input screen"]
  node_bs_input["Blood sugar<br/>input screen"]
  node_hr_input["Heart rate<br/>input screen"]
  node_wt_input["Weight<br/>input screen<br/>[weight_input.dart]"]
end

subgraph group_results["Results & Analytics"]
  node_result_screen["Result hub<br/>feature hub<br/>[result_screen.dart]"]
  node_all_result["All results<br/>summary screen<br/>[all_result.dart]"]
  node_bp_result["Blood pressure<br/>result screen"]
  node_bs_result["Blood sugar<br/>result screen"]
  node_hr_result["Heart rate<br/>result screen"]
  node_wt_result["Weight<br/>result screen<br/>[weight_result.dart]"]
end

subgraph group_shared["Shared UI & Services"]
  node_auth_util["Auth util<br/>[auth.dart]"]
  node_firestore_util["Firestore util<br/>[firestore.dart]"]
  node_ui_widgets["Shared widgets<br/>ui kit<br/>[custom_appbar.dart]"]
  node_input_widgets["Input widgets<br/>ui kit"]
  node_result_widgets["Result widgets<br/>ui kit"]
end

subgraph group_platform["Platform Shells"]
  node_android_shell["Android<br/>platform runner<br/>[MainActivity.kt]"]
  node_ios_shell["iOS<br/>platform runner<br/>[AppDelegate.swift]"]
  node_desktop_shell["Desktop<br/>platform runner<br/>[main.cc]"]
  node_web_shell["Web<br/>platform runner<br/>[index.html]"]
end

node_main -->|"initializes"| node_firebase_options
node_main -->|"starts"| node_splash_screen
node_splash_screen -->|"checks session"| node_auth_util
node_splash_screen -->|"routes to"| node_login_screen
node_login_screen -->|"sign in"| node_auth_util
node_signup_screen -->|"register"| node_auth_util
node_login_screen -->|"navigates"| node_signup_screen
node_login_screen -->|"enters app"| node_main_screen
node_main_screen -->|"opens input"| node_input_screen
node_main_screen -->|"opens results"| node_result_screen
node_main_screen -->|"opens settings"| node_setting_screen
node_input_screen -->|"metric"| node_bp_input
node_input_screen -->|"metric"| node_bs_input
node_input_screen -->|"metric"| node_hr_input
node_input_screen -->|"metric"| node_wt_input
node_bp_input -->|"uses"| node_input_widgets
node_bs_input -->|"uses"| node_input_widgets
node_hr_input -->|"uses"| node_input_widgets
node_wt_input -->|"uses"| node_input_widgets
node_bp_input -->|"writes"| node_firestore_util
node_bs_input -->|"writes"| node_firestore_util
node_hr_input -->|"writes"| node_firestore_util
node_wt_input -->|"writes"| node_firestore_util
node_result_screen -->|"summary"| node_all_result
node_result_screen -->|"metric"| node_bp_result
node_result_screen -->|"metric"| node_bs_result
node_result_screen -->|"metric"| node_hr_result
node_result_screen -->|"metric"| node_wt_result
node_all_result -->|"uses"| node_result_widgets
node_bp_result -->|"uses"| node_result_widgets
node_bs_result -->|"uses"| node_result_widgets
node_hr_result -->|"uses"| node_result_widgets
node_wt_result -->|"uses"| node_result_widgets
node_bp_result -->|"reads"| node_firestore_util
node_bs_result -->|"reads"| node_firestore_util
node_hr_result -->|"reads"| node_firestore_util
node_wt_result -->|"reads"| node_firestore_util
node_main_screen -->|"uses"| node_ui_widgets
node_setting_screen -->|"uses"| node_ui_widgets
node_main_screen -->|"styles"| node_constants
node_android_shell -->|"hosts"| node_main
node_ios_shell -->|"hosts"| node_main
node_desktop_shell -->|"hosts"| node_main
node_web_shell -->|"hosts"| node_main

click node_main "https://github.com/wkkyu088/senior_health_care/blob/master/lib/main.dart"
click node_firebase_options "https://github.com/wkkyu088/senior_health_care/blob/master/lib/firebase_options.dart"
click node_constants "https://github.com/wkkyu088/senior_health_care/blob/master/lib/constants.dart"
click node_splash_screen "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/splash_screen.dart"
click node_login_screen "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/login_screen.dart"
click node_signup_screen "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/singup_screen.dart"
click node_main_screen "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/main_screen.dart"
click node_setting_screen "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/setting_screen.dart"
click node_input_screen "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/input_screen.dart"
click node_bp_input "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/inputScreens/blood_pressure_input.dart"
click node_bs_input "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/inputScreens/blood_sugar_input.dart"
click node_hr_input "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/inputScreens/heart_rate_input.dart"
click node_wt_input "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/inputScreens/weight_input.dart"
click node_result_screen "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/result_screen.dart"
click node_all_result "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/all_result.dart"
click node_bp_result "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/blood_pressure_result.dart"
click node_bs_result "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/blood_sugar_result.dart"
click node_hr_result "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/heart_rate_result.dart"
click node_wt_result "https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/weight_result.dart"
click node_auth_util "https://github.com/wkkyu088/senior_health_care/blob/master/lib/utils/auth.dart"
click node_firestore_util "https://github.com/wkkyu088/senior_health_care/blob/master/lib/utils/firestore.dart"
click node_ui_widgets "https://github.com/wkkyu088/senior_health_care/blob/master/lib/widgets/custom_appbar.dart"
click node_input_widgets "https://github.com/wkkyu088/senior_health_care/blob/master/lib/widgets/input/common_input_widget.dart"
click node_result_widgets "https://github.com/wkkyu088/senior_health_care/blob/master/lib/widgets/result/common_chart_widget.dart"
click node_android_shell "https://github.com/wkkyu088/senior_health_care/blob/master/android/app/src/main/kotlin/com/example/senior_health_care/MainActivity.kt"
click node_ios_shell "https://github.com/wkkyu088/senior_health_care/blob/master/ios/Runner/AppDelegate.swift"
click node_desktop_shell "https://github.com/wkkyu088/senior_health_care/blob/master/linux/main.cc"
click node_web_shell "https://github.com/wkkyu088/senior_health_care/blob/master/web/index.html"

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_firebase_options,node_constants toneBlue
class node_splash_screen,node_login_screen,node_signup_screen,node_main_screen,node_setting_screen toneAmber
class node_input_screen,node_bp_input,node_bs_input,node_hr_input,node_wt_input toneMint
class node_result_screen,node_all_result,node_bp_result,node_bs_result,node_hr_result,node_wt_result toneRose
class node_auth_util,node_firestore_util,node_ui_widgets,node_input_widgets,node_result_widgets toneIndigo
class node_android_shell,node_ios_shell,node_desktop_shell,node_web_shell toneTeal
```

## Components

### App Core

Startup, configuration, and shared application state

- [main.dart](https://github.com/wkkyu088/senior_health_care/blob/master/lib/main.dart): entrypoint · App entry and bootstrap · `lib/main.dart`
- [Firebase options](https://github.com/wkkyu088/senior_health_care/blob/master/lib/firebase_options.dart): config · FlutterFire setup values · `lib/firebase_options.dart`
- [Constants](https://github.com/wkkyu088/senior_health_care/blob/master/lib/constants.dart): shared config · App-wide constants and tokens · `lib/constants.dart`

### Access Layer

Authentication and app entry flow

- [Splash](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/splash_screen.dart): auth gate · Startup routing and auth check · `lib/screens/splash_screen.dart`
- [Login](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/login_screen.dart): auth screen · User sign-in UI · `lib/screens/login_screen.dart`
- [Sign up](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/singup_screen.dart): auth screen · Account creation UI · `lib/screens/singup_screen.dart`
- [Main screen](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/main_screen.dart): app shell · Post-login container and navigation · `lib/screens/main_screen.dart`
- [Settings](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/setting_screen.dart): settings screen · App-level preferences and options · `lib/screens/setting_screen.dart`

### Measurement Input

Screens and widgets for entering health metrics

- [Input hub](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/input_screen.dart): feature hub · Entry point for measurement forms · `lib/screens/input_screen.dart`
- [Blood pressure](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/inputScreens/blood_pressure_input.dart): input screen · Blood pressure entry flow · `lib/screens/inputScreens/blood_pressure_input.dart`
- [Blood sugar](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/inputScreens/blood_sugar_input.dart): input screen · Blood sugar entry flow · `lib/screens/inputScreens/blood_sugar_input.dart`
- [Heart rate](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/inputScreens/heart_rate_input.dart): input screen · Heart rate entry flow · `lib/screens/inputScreens/heart_rate_input.dart`
- [Weight](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/inputScreens/weight_input.dart): input screen · Weight entry flow · `lib/screens/inputScreens/weight_input.dart`

### Results & Analytics

Screens and widgets for viewing stored measurements

- [Result hub](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/result_screen.dart): feature hub · Entry point for measurement history views · `lib/screens/result_screen.dart`
- [All results](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/all_result.dart): summary screen · Combined metrics overview · `lib/screens/resultScreens/all_result.dart`
- [Blood pressure](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/blood_pressure_result.dart): result screen · Blood pressure history and charts · `lib/screens/resultScreens/blood_pressure_result.dart`
- [Blood sugar](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/blood_sugar_result.dart): result screen · Blood sugar history and charts · `lib/screens/resultScreens/blood_sugar_result.dart`
- [Heart rate](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/heart_rate_result.dart): result screen · Heart rate history and charts · `lib/screens/resultScreens/heart_rate_result.dart`
- [Weight](https://github.com/wkkyu088/senior_health_care/blob/master/lib/screens/resultScreens/weight_result.dart): result screen · Weight history and charts · `lib/screens/resultScreens/weight_result.dart`

### Shared UI & Services

Reusable widgets and persistence/auth helpers

- [Auth util](https://github.com/wkkyu088/senior_health_care/blob/master/lib/utils/auth.dart): service · Authentication abstraction · `lib/utils/auth.dart`
- [Firestore util](https://github.com/wkkyu088/senior_health_care/blob/master/lib/utils/firestore.dart): service · Cloud persistence and queries · `lib/utils/firestore.dart`
- [Shared widgets](https://github.com/wkkyu088/senior_health_care/blob/master/lib/widgets/custom_appbar.dart): ui kit · Reusable app chrome and dashboards · `lib/widgets/custom_appbar.dart`
- [Input widgets](https://github.com/wkkyu088/senior_health_care/blob/master/lib/widgets/input/common_input_widget.dart): ui kit · Shared input controls and actions · `lib/widgets/input/common_input_widget.dart`
- [Result widgets](https://github.com/wkkyu088/senior_health_care/blob/master/lib/widgets/result/common_chart_widget.dart): ui kit · Charts, toggles, and result controls · `lib/widgets/result/common_chart_widget.dart`

### Platform Shells

Native runners and Flutter host integration

- [Android](https://github.com/wkkyu088/senior_health_care/blob/master/android/app/src/main/kotlin/com/example/senior_health_care/MainActivity.kt): platform runner · Android host and Firebase config · `android/app/src/main/kotlin/com/example/senior_health_care/MainActivity.kt`
- [iOS](https://github.com/wkkyu088/senior_health_care/blob/master/ios/Runner/AppDelegate.swift): platform runner · iOS host integration · `ios/Runner/AppDelegate.swift`
- [Desktop](https://github.com/wkkyu088/senior_health_care/blob/master/linux/main.cc): platform runner · macOS, Linux, and Windows hosts · `linux/main.cc`
- [Web](https://github.com/wkkyu088/senior_health_care/blob/master/web/index.html): platform runner · Web host entry and manifest · `web/index.html`

## Connections

- main.dart → Firebase options: initializes · Startup loads FlutterFire config
- main.dart → Splash: starts · Entry point routes into auth gate
- Splash → Auth util: checks session · Determines signed-in state
- Splash → Login: routes to · Unauthenticated users go to login
- Login → Auth util: sign in · Uses auth helper for login
- Sign up → Auth util: register · Uses auth helper for account creation
- Login → Sign up: navigates · Moves between auth screens
- Login → Main screen: enters app · Successful auth opens main shell
- Main screen → Input hub: opens input · Primary navigation to measurement entry
- Main screen → Result hub: opens results · Primary navigation to history and summaries
- Main screen → Settings: opens settings · App settings surface
- Input hub → Blood pressure: metric · Blood pressure input flow
- Input hub → Blood sugar: metric · Blood sugar input flow
- Input hub → Heart rate: metric · Heart rate input flow
- Input hub → Weight: metric · Weight input flow
- Blood pressure → Input widgets: uses · Shared form controls and date selection
- Blood sugar → Input widgets: uses · Shared form controls and date selection
- Heart rate → Input widgets: uses · Shared form controls and date selection
- Weight → Input widgets: uses · Shared form controls and date selection
- Blood pressure → Firestore util: writes · Persists measurement records
- Blood sugar → Firestore util: writes · Persists measurement records
- Heart rate → Firestore util: writes · Persists measurement records
- Weight → Firestore util: writes · Persists measurement records
- Result hub → All results: summary · Unified overview of measurements
- Result hub → Blood pressure: metric · Blood pressure results flow
- Result hub → Blood sugar: metric · Blood sugar results flow
- Result hub → Heart rate: metric · Heart rate results flow
- Result hub → Weight: metric · Weight results flow
- All results → Result widgets: uses · Charts and toggle controls
- Blood pressure → Result widgets: uses · Charts and toggle controls
- Blood sugar → Result widgets: uses · Charts and toggle controls
- Heart rate → Result widgets: uses · Charts and toggle controls
- Weight → Result widgets: uses · Charts and toggle controls
- Blood pressure → Firestore util: reads · Queries history and aggregates
- Blood sugar → Firestore util: reads · Queries history and aggregates
- Heart rate → Firestore util: reads · Queries history and aggregates
- Weight → Firestore util: reads · Queries history and aggregates
- Main screen → Shared widgets: uses · Dashboard chrome and summary boards
- Settings → Shared widgets: uses · Shared modal and layout widgets
- Main screen → Constants: styles · Uses shared app constants
- Android → main.dart: hosts · Android Flutter entry host
- iOS → main.dart: hosts · iOS Flutter entry host
- Desktop → main.dart: hosts · Desktop Flutter entry host
- Web → main.dart: hosts · Web Flutter entry host
