# aaliyahussain27/smartflame architecture

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

- Interactive diagram: https://gitdiagram.com/aaliyahussain27/smartflame
- Repository: https://github.com/aaliyahussain27/smartflame

## Overview

SmartFlame is an Android emergency fire-reporting app. Its principal workflow guides a bystander from triggering an alert through GPS location resolution, nearest-station dispatch, photo proof, OTP verification, and final confirmation. The README documents a shared EmergencyViewModel and EmergencyFlowState for that flow. The source excerpts contain no application code, so screen-to-screen links reflect the documented flow; implementation-level calls and data wiring cannot be verified.

Main entry points: [`app/src/main/java/com/example/firesafe/ui/screens/AlertSentScreen.kt`](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/AlertSentScreen.kt) (Alert Sent), [`app/src/main/java/com/example/firesafe/ui/screens/LocationDetectingScreen.kt`](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/LocationDetectingScreen.kt) (Location Detecting), [`app/src/main/java/com/example/firesafe/ui/screens/PhotoProofScreen.kt`](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/PhotoProofScreen.kt) (Photo Proof), [`app/src/main/java/com/example/firesafe/ui/screens/PhoneVerificationScreen.kt`](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/PhoneVerificationScreen.kt) (Phone Verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reporting["Emergency Reporting"]
  node_home["Home<br/>[HomeScreen.kt]"]
  node_location_screen["Location Detecting"]
  node_alert_sent["Alert Sent<br/>[AlertSentScreen.kt]"]
  node_photo_proof["Photo Proof"]
  node_phone_verification["Phone Verification"]
  node_final_confirmation["Final Confirmation"]
  node_help["Help<br/>[HelpScreen.kt]"]
  node_history["History<br/>[HistoryScreen.kt]"]
end

subgraph group_dispatch["Location and Dispatch"]
  node_stations["Stations<br/>[StationsScreen.kt]"]
  node_gps["GPS Location"]
  node_location_repo["Location Repository"]
  node_station_repo["Station Repository"]
  node_alert_repo["Alert Repository<br/>[AlertRepository.kt]"]
  node_otp_repo["OTP Repository<br/>[OtpRepository.kt]"]
end

subgraph group_appstate["App Coordination"]
  node_main_activity["Main Activity<br/>[MainActivity.kt]"]
  node_navigation["Navigation<br/>[Navigation.kt]"]
  node_emergency_vm["Emergency ViewModel"]
  node_flow_state["Emergency Flow State"]
end

node_user(("Bystander"))
node_camera["CameraX"]
node_otp_service["OTP Service"]

node_user -->|"triggers"| node_home
node_home -->|"starts flow"| node_location_screen
node_location_screen -->|"resolves location"| node_alert_sent
node_alert_sent -->|"continues report"| node_photo_proof
node_photo_proof -->|"continues report"| node_phone_verification
node_phone_verification -->|"verifies reporter"| node_final_confirmation
node_location_screen -->|"detects location"| node_gps
node_alert_sent -->|"shows nearest station"| node_station_repo
node_alert_sent -.->|"dispatches alert"| node_alert_repo
node_photo_proof -->|"captures proof"| node_camera
node_phone_verification -->|"requests verification"| node_otp_repo
node_otp_repo -.->|"sends OTP"| node_otp_service
node_stations -.->|"looks up stations"| node_station_repo
node_main_activity -.->|"starts navigation"| node_navigation
node_navigation -->|"shares state"| node_emergency_vm
node_emergency_vm -->|"tracks flow"| node_flow_state

click node_home "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/HomeScreen.kt"
click node_location_screen "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/LocationDetectingScreen.kt"
click node_alert_sent "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/AlertSentScreen.kt"
click node_photo_proof "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/PhotoProofScreen.kt"
click node_phone_verification "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/PhoneVerificationScreen.kt"
click node_final_confirmation "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/FinalConfirmationScreen.kt"
click node_help "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/HelpScreen.kt"
click node_history "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/HistoryScreen.kt"
click node_stations "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/StationsScreen.kt"
click node_gps "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/impl/GPSLocationRepository.kt"
click node_location_repo "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/LocationRepository.kt"
click node_station_repo "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/FireStationRepository.kt"
click node_alert_repo "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/AlertRepository.kt"
click node_otp_repo "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/OtpRepository.kt"
click node_main_activity "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/MainActivity.kt"
click node_navigation "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/Navigation.kt"
click node_emergency_vm "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/viewmodel/EmergencyViewModel.kt"
click node_flow_state "https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/viewmodel/EmergencyFlowState.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_home,node_location_screen,node_alert_sent,node_photo_proof,node_phone_verification,node_final_confirmation,node_help,node_history toneBlue
class node_stations,node_gps,node_location_repo,node_station_repo,node_alert_repo,node_otp_repo toneAmber
class node_main_activity,node_navigation,node_emergency_vm,node_flow_state toneMint
class node_user,node_camera,node_otp_service toneIndigo
```

## Components

### Emergency Reporting

- [Home](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/HomeScreen.kt): `app/src/main/java/com/example/firesafe/ui/screens/HomeScreen.kt`
- [Location Detecting](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/LocationDetectingScreen.kt): `app/src/main/java/com/example/firesafe/ui/screens/LocationDetectingScreen.kt`
- [Alert Sent](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/AlertSentScreen.kt): `app/src/main/java/com/example/firesafe/ui/screens/AlertSentScreen.kt`
- [Photo Proof](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/PhotoProofScreen.kt): `app/src/main/java/com/example/firesafe/ui/screens/PhotoProofScreen.kt`
- [Phone Verification](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/PhoneVerificationScreen.kt): `app/src/main/java/com/example/firesafe/ui/screens/PhoneVerificationScreen.kt`
- [Final Confirmation](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/FinalConfirmationScreen.kt): `app/src/main/java/com/example/firesafe/ui/screens/FinalConfirmationScreen.kt`
- [Help](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/HelpScreen.kt): `app/src/main/java/com/example/firesafe/ui/screens/HelpScreen.kt`
- [History](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/HistoryScreen.kt): `app/src/main/java/com/example/firesafe/ui/screens/HistoryScreen.kt`

### Location and Dispatch

- [Stations](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/ui/screens/StationsScreen.kt): `app/src/main/java/com/example/firesafe/ui/screens/StationsScreen.kt`
- [GPS Location](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/impl/GPSLocationRepository.kt): `app/src/main/java/com/example/firesafe/data/repository/impl/GPSLocationRepository.kt`
- [Location Repository](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/LocationRepository.kt): `app/src/main/java/com/example/firesafe/data/repository/LocationRepository.kt`
- [Station Repository](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/FireStationRepository.kt): `app/src/main/java/com/example/firesafe/data/repository/FireStationRepository.kt`
- [Alert Repository](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/AlertRepository.kt): `app/src/main/java/com/example/firesafe/data/repository/AlertRepository.kt`
- [OTP Repository](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/data/repository/OtpRepository.kt): `app/src/main/java/com/example/firesafe/data/repository/OtpRepository.kt`

### App Coordination

- [Main Activity](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/MainActivity.kt): `app/src/main/java/com/example/firesafe/MainActivity.kt`
- [Navigation](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/Navigation.kt): `app/src/main/java/com/example/firesafe/Navigation.kt`
- [Emergency ViewModel](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/viewmodel/EmergencyViewModel.kt): `app/src/main/java/com/example/firesafe/viewmodel/EmergencyViewModel.kt`
- [Emergency Flow State](https://github.com/aaliyahussain27/smartflame/blob/main/app/src/main/java/com/example/firesafe/viewmodel/EmergencyFlowState.kt): `app/src/main/java/com/example/firesafe/viewmodel/EmergencyFlowState.kt`

### Other components

- **Bystander**
- **CameraX**
- **OTP Service**

## Connections

- Bystander → Home: triggers (evidence: `README.md`)
- Home → Location Detecting: starts flow (evidence: `README.md`)
- Location Detecting → Alert Sent: resolves location (evidence: `README.md`)
- Alert Sent → Photo Proof: continues report (evidence: `README.md`)
- Photo Proof → Phone Verification: continues report (evidence: `README.md`)
- Phone Verification → Final Confirmation: verifies reporter (evidence: `README.md`)
- Location Detecting → GPS Location: detects location (evidence: `README.md`)
- Alert Sent → Station Repository: shows nearest station (evidence: `README.md`)
- Alert Sent → Alert Repository: dispatches alert
- Photo Proof → CameraX: captures proof (evidence: `README.md`)
- Phone Verification → OTP Repository: requests verification (evidence: `README.md`)
- OTP Repository → OTP Service: sends OTP
- Stations → Station Repository: looks up stations
- Main Activity → Navigation: starts navigation
- Navigation → Emergency ViewModel: shares state (evidence: `README.md`)
- Emergency ViewModel → Emergency Flow State: tracks flow (evidence: `README.md`)
