# yashpurbhe123/forecasting_system architecture

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

- Interactive diagram: https://gitdiagram.com/yashpurbhe123/forecasting_system
- Repository: https://github.com/yashpurbhe123/forecasting_system

## Overview

##### Project type and purpose
- This is a full-stack, Python-based demand-forecasting application delivered via a Streamlit dashboard with voice-controlled input.
- Its purpose is to ingest hyperlocal grocery sales data, filter noise, train time-series models, and provide real-time month-ahead demand forecasts.

##### File-structure analysis
- Top level:
- Forecasting.py – Core model-training and prediction module
- month_forecasting.ipynb – Exploratory notebook for prototyping
- hyperlocal_demand_forecasting_with_grocery_items.xlsx – Primary dataset
- pages/ directory: four Streamlit page scripts
- Past_Data.py – Data-ingestion and raw‐data display
- Past_Data_visualization.py – Charts and trend-analysis UI
- Future_Prediction.py – Forecast UI, voice input hook
- (Excel file duplicated for demonstration)
- No separate “backend” vs. “frontend” folder, but pages/ serves as the UI layer and Forecasting.py as the service layer.

##### README insights
- Real-time, granular forecasts at area/store level
- Voice-activated dashboard: speech-to-text → forecast
- Tech stack: Python, pandas, scikit-learn/Prophet or TensorFlow, Plotly, Streamlit

a. Main components
- Data Storage: Excel (.xlsx) or a database if scaled
- Data-Ingestion & Preprocessing module (pandas, noise filtering)
- Model Module (Forecasting.py using Prophet/TensorFlow)
- Voice-Control Interface (speech-to-text library)
- Streamlit UI Layer (pages/*.py)
- Visualization Engine (Plotly)
- Prototyping Notebook (for offline experimentation)

b. Relationships and interactions
1. User speaks into Voice Interface → speech-to-text
2. Parsed “product + month” request sent to Streamlit UI
3. UI invokes Forecasting module
4. Forecasting loads/preprocesses data → runs model → returns forecast
5. UI renders results via Plotly charts
6. For historical views, UI calls Data-Ingestion module → visualization

c. Architectural patterns & design principles
- Modular Monolith: clear separation between UI pages and model logic
- MVC-like flow: UI (View) → Forecasting.py (Controller) → Data/Model (Model)
- Reusable preprocessing and model code for both notebook and production
- Single-page application split into multiple logical pages for maintainability

d. Key technologies & libraries
- Python & Streamlit (UI hosting)
- pandas for ETL
- scikit-learn/Prophet or TensorFlow for forecasting
- speech_recognition (or similar) for voice input
- Plotly for interactive charts

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User["User"]:::external

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        VoiceInterface["Voice-Control Interface"]:::ui
        PastDataUI["Historical Data UI (Past_Data.py)"]:::ui
        VisualizationUI["Visualization Engine (Past_Data_visualization.py)"]:::ui
        ForecastUI["Forecast Interface (Future_Prediction.py)"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        Preprocessor["Data-Ingestion & Preprocessing\n(Forecasting.py)"]:::compute
        ModelModule["Forecasting Model Module\n(Forecasting.py)"]:::compute
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Dataset["Primary Dataset\n(hyperlocal_demand_forecasting_with_grocery_items.xlsx)"]:::data
        DemoDataset["Demo Dataset Copy\n(pages/hyperlocal_demand_forecasting_with_grocery_items.xlsx)"]:::data
    end

    %% Development/Experimentation
    subgraph "Development / Experimentation"
        direction TB
        Notebook["Prototyping Notebook\n(month_forecasting.ipynb)"]:::dev
        README["Project README\n(README.md)"]:::dev
    end

    %% Data Flow
    User -->|"speaks request"| VoiceInterface
    VoiceInterface -->|"speech-to-text"| ForecastUI
    ForecastUI -->|"forecast request"| Preprocessor
    Preprocessor -->|"clean timeseries"| ModelModule
    ModelModule -->|"forecast results"| ForecastUI
    ForecastUI -->|"render charts"| VisualizationUI

    PastDataUI -->|"load historical data"| Preprocessor
    Preprocessor -->|"timeseries data"| VisualizationUI

    VisualizationUI --> User
    ForecastUI --> User
    PastDataUI --> User

    %% Data Store Access
    Preprocessor -->|"read"| Dataset
    Preprocessor -->|"read demo"| DemoDataset
    Notebook --> Dataset
    Notebook --> Preprocessor
    Notebook --> ModelModule
    Notebook --> VisualizationUI
    README -.-> Notebook

    %% Click Events
    click Dataset "https://github.com/yashpurbhe123/forecasting_system/blob/main/hyperlocal_demand_forecasting_with_grocery_items.xlsx"
    click DemoDataset "https://github.com/yashpurbhe123/forecasting_system/blob/main/pages/hyperlocal_demand_forecasting_with_grocery_items.xlsx"
    click Preprocessor "https://github.com/yashpurbhe123/forecasting_system/blob/main/Forecasting.py"
    click ModelModule "https://github.com/yashpurbhe123/forecasting_system/blob/main/Forecasting.py"
    click PastDataUI "https://github.com/yashpurbhe123/forecasting_system/blob/main/pages/Past_Data.py"
    click VisualizationUI "https://github.com/yashpurbhe123/forecasting_system/blob/main/pages/Past_Data_visualization.py"
    click ForecastUI "https://github.com/yashpurbhe123/forecasting_system/blob/main/pages/Future_Prediction.py"
    click Notebook "https://github.com/yashpurbhe123/forecasting_system/blob/main/jupyter file/month_forecasting.ipynb"
    click README "https://github.com/yashpurbhe123/forecasting_system/blob/main/README.md"

    %% Styles
    classDef data fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef compute fill:#90EE90,stroke:#000,stroke-width:1px
    classDef ui fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef dev fill:#E0E0E0,stroke:#000,stroke-width:1px
```
