# mitp7/surely_insured architecture

> Architecture diagram of the GitHub repository mitp7/surely_insured, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mitp7/surely_insured
- Repository: https://github.com/mitp7/surely_insured

## Overview

##### Main Components

A. Frontend (React Application):
- Landing Page Component
- Home Component
- Component (with Google Maps integration)
- Search Bar Component
- Data Display Component
- Navigation Component
- API Service Layer

B. Backend (Flask Server):
- Server Module
- Data Analysis Services:
- Hazards Analysis
- Idling Analysis
- Service Center Analysis
- Maps Integration Module

C. External Services:
- Google Maps Platform:
- Maps JavaScript API
- Geocoding API
- Geotab Ignition Datasets:
- Hazardous Driving Areas
- Idling Areas
- Service Center Metrics

##### Component Relationships and Data Flow

- Frontend → Backend: HTTP/REST API calls
- Backend → External Services: API calls to Google Services
- Backend → Geotab Datasets: Data retrieval and processing
- Frontend Components → Frontend API Service Layer: Internal data flow

##### Specific Implementation Details

A. Frontend Layer:

- React Frontend     |

- Components    |   |
- Landing     |   |
- Home        |   |
- Map         |   |
- DataDisplay |   |

- API Service   |   |

B. Backend Layer:

- Flask Backend      |

- Data Analysis    |  |
- Hazards        |  |
- Idling         |  |
- Service        |  |

- Maps Integration |  |

##### Special Notes

- Data analysis pipeline as it's core to the application
- Google Maps integration points
- How the frontend components interact with the map and data display
- Where data processing and calculations occur

Remember to maintain clarity while showing the complexity of the system, especially the interaction between the mapping services, data analysis, and user interface components.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        App["App"]
        Landing["Landing Page"]
        Home["Home"]
        MapComp["Map Component"]
        Search["Search Bar"]
        DataDisplay["Data Display"]
        Nav["Navigation"]
        APIService["API Service Layer"]
        MapContainer["Map Container"]
        MapSearch["Map & Search Integration"]

        App --> Landing
        App --> Home
        App --> Nav
        Home --> MapSearch
        MapSearch --> MapComp
        MapSearch --> Search
        MapComp --> MapContainer
        MapContainer --> DataDisplay
        APIService --> MapComp
        APIService --> DataDisplay
    end

    subgraph Backend
        Server["Server Module"]
        HazardsAnalysis["Hazards Analysis"]
        IdlingAnalysis["Idling Analysis"]
        ServiceAnalysis["Service Center Analysis"]
        MapsIntegration["Maps Integration"]

        Server --> HazardsAnalysis
        Server --> IdlingAnalysis
        Server --> ServiceAnalysis
        Server --> MapsIntegration
    end

    subgraph "External Services"
        GMaps[("Google Maps Platform")]
        GeoTab[("Geotab Datasets")]
    end

    APIService --> Server
    MapsIntegration --> GMaps
    HazardsAnalysis --> GeoTab
    IdlingAnalysis --> GeoTab
    ServiceAnalysis --> GeoTab

    %% Click Events
    click App "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/App.js"
    click Landing "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/Landing/Landing.js"
    click Home "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/Home/Home.js"
    click MapComp "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/Map/Map/Map.js"
    click Search "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/Map/SearchBar/SearchBar.js"
    click DataDisplay "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/DataDisplay/DataDisplay.js"
    click Nav "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/Navbar/Navbar.js"
    click APIService "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/api/index.js"
    click Server "https://github.com/mitp7/Surely_Insured/blob/master/backend/server.py"
    click HazardsAnalysis "https://github.com/mitp7/Surely_Insured/blob/master/backend/data_analysis_hazards.py"
    click IdlingAnalysis "https://github.com/mitp7/Surely_Insured/blob/master/backend/data_analysis_idling.py"
    click ServiceAnalysis "https://github.com/mitp7/Surely_Insured/blob/master/backend/data_analysis_service.py"
    click MapsIntegration "https://github.com/mitp7/Surely_Insured/blob/master/backend/maps.py"
    click MapContainer "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/Map/Map/MapContainer.js"
    click MapSearch "https://github.com/mitp7/Surely_Insured/blob/master/client/my-app/src/Map/MapAndSearchBar.js"

    classDef frontend fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:2px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef database fill:#FFA500,stroke:#333,stroke-width:2px

    class App,Landing,Home,MapComp,Search,DataDisplay,Nav,APIService,MapContainer,MapSearch frontend
    class Server,HazardsAnalysis,IdlingAnalysis,ServiceAnalysis,MapsIntegration backend
    class GMaps,GeoTab external
```
