# kanishk1420/streetsense-road-damage-detection architecture

> Architecture diagram of the GitHub repository kanishk1420/streetsense-road-damage-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kanishk1420/streetsense-road-damage-detection
- Repository: https://github.com/kanishk1420/streetsense-road-damage-detection

## Overview

##### Project type and purpose
- This is a cross-platform Flutter mobile application (“StreetSense”) whose sole purpose is to capture road-surface images, send them to a cloud-based AI detection API (Roboflow), and present damage detection results (potholes, cracks) plus risk metrics to the user.

##### File structure
- Top-level directories:
- android/ – native Android embedding & Gradle build files
- ios/ – native iOS embedding & Xcode project files
- windows/ – native Windows embedding & CMake runner
- lib/ – Dart application code
- test/ – widget tests
- Under lib/:
- main.dart – app entry point
- screens/ – UI pages: camera_screen.dart, display_picture_screen.dart, damage_analysis_screen.dart
- widgets/ – reusable UI components (e.g., camera_preview.dart)
- Config & assets: pubspec.yaml, analysis_options.yaml, AndroidManifest.xml, Info.plist, assets under each platform.

##### README for additional insights
- Four logical modules described:
1. App Entry
2. Camera Module
3. Image Analysis Module
4. Damage Analysis & Display Module
- Workflow: app start → capture/select image → preprocess → call Roboflow API → receive detection → render results & metrics → optional contact form.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        MainEntry["App Entry\n(main.dart)"]:::ui
        CameraScreen["CameraScreen (UI)"]:::ui
        CameraPreview["CameraPreview (Widget)"]:::ui
        DisplayPictureScreen["DisplayPictureScreen (UI)"]:::ui
        DamageAnalysisScreen["DamageAnalysisScreen (UI)"]:::ui
    end

    %% Service Layer
    subgraph "Service Layer"
        direction TB
        ImageProcessingService["ImageProcessingService"]:::service
        HTTPClient["HTTP Client"]:::service
        BusinessLogic["Business Logic\n(Response Parser)"]:::service
    end

    %% Plugin Interfaces
    subgraph "Plugin Interfaces"
        direction TB
        CameraPlugin["Camera Plugin"]:::plugin
        ImagePickerPlugin["ImagePicker Plugin"]:::plugin
        SensorsPlugin["SensorsPlus Plugin"]:::plugin
        PathProviderPlugin["PathProvider Plugin"]:::plugin
    end

    %% External Services
    subgraph "External Services"
        direction TB
        RoboflowAPI["Roboflow Detection API"]:::external
        ContactFormService["Contact Form Service"]:::external
    end

    %% Mobile App Flow
    MainEntry -->|"launches"| CameraScreen
    CameraScreen -->|"uses"| CameraPlugin
    CameraScreen -->|"embeds"| CameraPreview
    CameraScreen -->|"onCapture"| DisplayPictureScreen
    DisplayPictureScreen -->|"hands off image"| ImageProcessingService
    ImageProcessingService -->|"encodes/compresses"| HTTPClient
    HTTPClient -->|"POST image"| RoboflowAPI
    RoboflowAPI -->|"returns JSON"| HTTPClient
    HTTPClient -->|"forwards data"| BusinessLogic
    BusinessLogic -->|"provides models to"| DamageAnalysisScreen
    DamageAnalysisScreen -->|"render overlays & charts"| DamageAnalysisScreen
    DamageAnalysisScreen -->|"optional submit"| ContactFormService

    %% Plugin usage
    DisplayPictureScreen -->|"may use"| ImagePickerPlugin
    ImageProcessingService -->|"may use"| PathProviderPlugin
    CameraPlugin -->|"may use"| SensorsPlugin

    %% Click Events
    click MainEntry "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/lib/main.dart"
    click CameraScreen "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/lib/screens/camera_screen.dart"
    click CameraPreview "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/lib/widgets/camera_preview.dart"
    click DisplayPictureScreen "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/lib/screens/display_picture_screen.dart"
    click DamageAnalysisScreen "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/lib/screens/damage_analysis_screen.dart"

    %% Native Embedding Clicks
    click AndroidMainActivity "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/android/app/src/main/kotlin/com/StreetSense/streetsense/MainActivity.kt"
    click AndroidManifest "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/android/app/src/main/AndroidManifest.xml"
    click iOSAppDelegate "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/ios/Runner/AppDelegate.swift"
    click iOSInfoPlist "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/ios/Runner/Info.plist"
    click WindowsMain "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/windows/runner/main.cpp"
    click WindowsWindow "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/windows/runner/flutter_window.cpp"

    %% Shared Config
    click Pubspec "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/pubspec.yaml"
    click AnalysisOptions "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/analysis_options.yaml"
    click Readme "https://github.com/kanishk1420/streetsense-road-damage-detection/blob/main/README.md"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#0366d6,stroke-width:1px
    classDef service fill:#d4edda,stroke:#28a745,stroke-width:1px
    classDef plugin fill:#fff3cd,stroke:#d39e00,stroke-width:1px
    classDef external fill:#e2d4f0,stroke:#6f42c1,stroke-width:1px
```
