# sapai5/avevaeco-tech architecture

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

- Interactive diagram: https://gitdiagram.com/sapai5/avevaeco-tech
- Repository: https://github.com/sapai5/avevaeco-tech

## Overview

##### Main System Components

A. Frontend Layer (Blue)
- Next.js Web Application
- Components (group the various React components)
- Analysis Components (AnalysisSummary, LiveAnalysisSummary, StaticAnalysisSummary)
- Visualization Components (Various charts: MineralChart, PerformanceChart, PHPredictionChart)
- Data Input Components (CSVUpload, FileUpload, PredictionUpload)
- Monitoring Components (LiveDataTable, LiveRevenueCard)

B. API Layer (Green)
- REST Endpoints
- /api/analyze
- /api/predict
- /api/predict-ph

C. Backend Services (Yellow)
- Machine Learning Services
- ARIMA Model Prediction Service
- Time Series Prediction Service
- Batch Prediction Service
- Single Point Prediction Service

D. Data Layer (Purple)
- Model Storage
- Time Series Models (my_dir/time_series)
- Model Checkpoints
- Input Data
- CSV Data Storage
- Real-time Data Processing

##### Interaction Flows
- User interaction flow from frontend to API
- API calls to ML services
- Data flow between ML services and storage
- Response flow back to frontend

##### Technical Stack Indicators
- Next.js
- Python
- Machine Learning frameworks
- Docker

##### Microservices Architecture
- Separate services for different prediction types
- Containerized deployment (note Dockerfile)

##### Real-time Processing Pipeline
- Live data analysis flow
- Batch processing flow

##### Model Management
- Multiple model versions
- Model checkpoint storage
- Training pipeline

##### Data Flow
- Input data validation
- Processing pipeline
- Results storage and presentation

- Rectangles for services
- Hexagons for API endpoints
- Rounded rectangles for UI components

Remember to include:
- System boundaries
- External service integrations
- Scaling considerations
- Error handling paths
- Monitoring points

This will provide a comprehensive view of the system while maintaining clarity and showing the sophisticated nature of the ML-powered application.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#e1f5fe,stroke:#01579b
    classDef api fill:#e8f5e9,stroke:#1b5e20
    classDef backend fill:#fff3e0,stroke:#e65100
    classDef data fill:#f3e5f5,stroke:#4a148c
    classDef container fill:#eceff1,stroke:#263238

    %% Frontend Layer
    subgraph Frontend
        UI["Next.js Web Application"]
        
        subgraph Components
            AC["Analysis Components"]
            VC["Visualization Components"]
            DI["Data Input Components"]
            MC["Monitoring Components"]
        end

        subgraph AnalysisComps
            AS["AnalysisSummary"]
            LAS["LiveAnalysisSummary"]
            SAS["StaticAnalysisSummary"]
        end

        subgraph VisualizationComps
            MIN["MineralChart"]
            PERF["PerformanceChart"]
            PHP["PHPredictionChart"]
        end

        subgraph InputComps
            CSV["CSVUpload"]
            FU["FileUpload"]
            PU["PredictionUpload"]
        end

        subgraph MonitoringComps
            LDT["LiveDataTable"]
            LRC["LiveRevenueCard"]
        end
    end

    %% API Layer
    subgraph APILayer
        ANA["/api/analyze"]
        PRED["/api/predict"]
        PHPR["/api/predict-ph"]
    end

    %% Backend Services
    subgraph MLServices
        ARIMA["ARIMA Model Service"]
        TS["Time Series Prediction"]
        BP["Batch Prediction"]
        SP["Single Point Prediction"]
    end

    %% Data Layer
    subgraph DataLayer
        TSM[("Time Series Models")]
        MC1[("Model Checkpoints")]
        CSV1[("CSV Storage")]
    end

    %% Relationships
    Components --> AnalysisComps
    Components --> VisualizationComps
    Components --> InputComps
    Components --> MonitoringComps
    
    AnalysisComps --> APILayer
    VisualizationComps --> APILayer
    InputComps --> APILayer
    
    APILayer --> MLServices
    MLServices --> DataLayer
    DataLayer --> MLServices
    MLServices --> APILayer
    APILayer --> Components

    %% Click Events
    click AS "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/AnalysisSummary.tsx"
    click LAS "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/LiveAnalysisSummary.tsx"
    click SAS "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/StaticAnalysisSummary.tsx"
    click MIN "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/MineralChart.tsx"
    click PERF "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/PerformanceChart.tsx"
    click PHP "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/PHPredictionChart.tsx"
    click CSV "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/CSVUpload.tsx"
    click FU "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/FileUpload.tsx"
    click PU "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/PredictionUpload.tsx"
    click LDT "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/LiveDataTable.tsx"
    click LRC "https://github.com/sapai5/AVEVAeco-tech/blob/main//components/LiveRevenueCard.tsx"
    click ANA "https://github.com/sapai5/AVEVAeco-tech/blob/main//app/api/analyze/route.ts"
    click PRED "https://github.com/sapai5/AVEVAeco-tech/blob/main//app/api/predict/route.ts"
    click PHPR "https://github.com/sapai5/AVEVAeco-tech/blob/main//app/api/predict-ph/route.ts"
    click ARIMA "https://github.com/sapai5/AVEVAeco-tech/blob/main//ARIMAmodelPrediction.py"
    click BP "https://github.com/sapai5/AVEVAeco-tech/blob/main//batchPrediction.py"
    click SP "https://github.com/sapai5/AVEVAeco-tech/blob/main//singlePointPredict.py"
    click TSM "https://github.com/sapai5/AVEVAeco-tech/tree/main//my_dir/time_series/"
    
    %% Style Applications
    class UI,Components,AnalysisComps,VisualizationComps,InputComps,MonitoringComps,AS,LAS,SAS,MIN,PERF,PHP,CSV,FU,PU,LDT,LRC frontend
    class ANA,PRED,PHPR api
    class ARIMA,TS,BP,SP backend
    class TSM,MC1,CSV1 data
```
