# harshchi19/smartsure-innov8 architecture

> Architecture diagram of the GitHub repository harshchi19/smartsure-innov8, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/harshchi19/smartsure-innov8
- Repository: https://github.com/harshchi19/smartsure-innov8

## Overview

##### Main System Components

a) Frontend Layer:
- Main Application Interface (Streamlit-based)
- Multiple Pages/Modules:
- Customer Support Interface
- Fitness Score Calculator
- Base Plan Recommendations
- Custom Plan Generator
- Business Dashboard

b) AI/ML Service Layer:
- Mistral & Hugging Face API Integration
- ML Model Services:
- Random Forest (Fitness Score)
- KNN (Base Plan Recommendations)
- Neural Network (Custom Plan Generator)

c) Data Layer:
- File-based Storage:
- CSV files (various datasets)
- Excel files (coordinates, descriptive statistics)
- SQL Database (noted in resources/database.sql)

**[Frontend Layer (Streamlit UI)]**
- ↕
**[AI/ML Services Layer]**
- ↕
**[Data Layer]**

##### Component Relationships

Key interactions:

- User Input → Frontend → AI Services
- AI Services → Data Layer (for training/inference)
- Data Layer → AI Services → Frontend (for results)

b) API Interactions:
- External API calls to Mistral/Hugging Face
- Internal API routes between components

##### Specific Elements

a) Frontend Components:
**[Main App (main.py)]**
- ↓
**[Feature Modules]**
- AI Customer Support
- Fitness Calculator
- Plan Recommendations
- Custom Plan Generator
- Business Dashboard

b) AI/ML Services:
**[ML Model Services]**
- Random Forest (fitness_score_page.py)
- KNN (choose_base_plans_page.py)
- Neural Network (make_your_own_plan_page.py)

c) Data Storage:
**[Data Sources]**
- CSV Files
- Excel Files
- SQL Database

##### Technical Details to Highlight

- Streamlit framework for UI
- Python-based backend services
- ML model implementations
- Data processing pipelines
- External API integrations

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef ai fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef metrics fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Frontend Layer
    subgraph Frontend
        MainApp["Main Application Interface"]:::frontend
        CustSupport["Customer Support Interface"]:::frontend
        FitnessCalc["Fitness Score Calculator"]:::frontend
        BasePlanRec["Base Plan Recommendations"]:::frontend
        CustomPlan["Custom Plan Generator"]:::frontend
        BizDash["Business Dashboard"]:::frontend
        
        MainApp --> CustSupport
        MainApp --> FitnessCalc
        MainApp --> BasePlanRec
        MainApp --> CustomPlan
        MainApp --> BizDash

        subgraph DashboardModules
            CovAnalysis["Covariance Analysis"]:::frontend
            RegAnalysis["Regression Analysis"]:::frontend
            StatAnalysis["Statistical Analysis"]:::frontend
            BizLoc["Business Locations"]:::frontend
            
            BizDash --> CovAnalysis
            BizDash --> RegAnalysis
            BizDash --> StatAnalysis
            BizDash --> BizLoc
        end
    end

    %% AI/ML Service Layer
    subgraph AIServices
        RF["Random Forest Model"]:::ai
        KNN["KNN Model"]:::ai
        NN["Neural Network Model"]:::ai
        
        MistralAPI["Mistral API"]:::external
        HFAPI["HuggingFace API"]:::external
    end

    %% Data Layer
    subgraph DataStorage
        SQL["SQL Database"]:::data
        BasePlansCSV["Base Plans CSV"]:::data
        FitnessCSV["Fitness Data CSV"]:::data
        AdvRegCSV["Advanced Regression CSV"]:::data
        DataXLSX["Data XLSX"]:::data
        StatsXLSX["Descriptive Statistics XLSX"]:::data
    end

    %% Metrics
    subgraph Metrics
        M1["Query Resolution: 95%"]:::metrics
        M2["Health Risk Prediction: 92%"]:::metrics
        M3["Plan Matching: 88%"]:::metrics
        M4["Pricing Accuracy: 95%"]:::metrics
    end

    %% Relationships
    CustSupport <--> MistralAPI
    CustSupport <--> HFAPI
    FitnessCalc <--> RF
    BasePlanRec <--> KNN
    CustomPlan <--> NN

    RF --> FitnessCSV
    KNN --> BasePlansCSV
    NN --> SQL

    BizDash --> AdvRegCSV
    BizDash --> DataXLSX
    BizDash --> StatsXLSX

    %% Click Events
    click MainApp "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/main.py"
    click CustSupport "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/ai_assistant_page.py"
    click FitnessCalc "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/fitness_score_page.py"
    click BasePlanRec "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/choose_base_plans_page.py"
    click CustomPlan "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/make_your_own_plan_page.py"
    click BizDash "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/Bussiness_Dashboard/Home.py"
    click CovAnalysis "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/Bussiness_Dashboard/pages/🏷 CO-VARIANCE.py"
    click RegAnalysis "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/Bussiness_Dashboard/pages/🏷REGRESSION ANALYSIS.py"
    click StatAnalysis "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/Bussiness_Dashboard/pages/🏷DESCRIPTIVE STATISTICS.py"
    click BizLoc "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/Bussiness_Dashboard/pages/🏷BUSINESS LOCATIONS.py"
    click SQL "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/resources/database.sql"
    click BasePlansCSV "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/base_plans.csv"
    click FitnessCSV "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/fitness_claim_dataset.csv"
    click AdvRegCSV "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/Bussiness_Dashboard/advanced_regression.csv"
    click DataXLSX "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/Bussiness_Dashboard/data.xlsx"
    click StatsXLSX "https://github.com/harshchi19/Smartsure-INNOV8/blob/master/Bussiness_Dashboard/descriptive_statistics.xlsx"
```
