# datpham0412/covid19-prediction-model architecture

> Architecture diagram of the GitHub repository datpham0412/covid19-prediction-model, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/datpham0412/covid19-prediction-model
- Repository: https://github.com/datpham0412/covid19-prediction-model

## Overview

##### Main components
- Data Ingestion & Migration – Represent the scripts that fetch data from external sources (scripts/fetch_data.py) and then migrate raw data into a usable form (scripts/migrate_data.py). This is where the project collects Covid‑19 case data and mobility data.
- Data Processing and Feature Engineering – Include the components for cleaning and processing the data (scripts/data_processing.py), performing exploratory data analysis (scripts/eda_visualization.py), engineering new features (scripts/feature_engineering.py), and splitting the data into training and testing sets (scripts/split_data.py).
- Model Training & Evaluation – Highlight the model lifecycle, with training (scripts/model_training.py) and evaluation (scripts/model_evaluation.py). Also note that serialized models (e.g., models/vietnam/linear_regression_model.pkl) are stored as artifacts.
- C++ Core Processing – Emphasize the components in the src folder (src/data_processor.cpp and src/main.cpp) that provide efficient data processing capabilities along with integration to SQLite (through the included SQLiteCpp library). This module, built via CMake (CMakeLists.txt) and linked with external libraries, underpins performance-critical operations.
- Visualization & Interpretation – Represent the interactive analysis and reporting layer using Jupyter Notebooks (notebooks/interpret_predictions.ipynb) which enable detailed data exploration and visual interpretation of model results.

##### Out relationships and data flow
- The prepared dataset is then used in the Model Training component, where the machine learning algorithm (built with Python libraries like scikit‑learn) learns the trends. Post-training, evaluations are carried out and results are stored.
- Additionally, show how the C++ core (compiled via CMake from src/) integrates with the system for efficient processing and SQLite database interactions. This might be represented as a side module that either feeds data to or works in tandem with the Python processing pipeline.

##### Architectural patterns and key design principles
- Separation of concerns – Different folders clearly separate data ingestion, processing, model training, and visualization.
- Modular design – Each script or module has a dedicated responsibility within the overall machine-learning pipeline.
- Hybrid technology stack – Python for high-level data science and visualization, C++ for performance-critical components, and SQLite for database management.
- Integration points – Explicit integration of SQLite through the SQLiteCpp library in C++ (reflected in both the “include” and “src” directories and CMake build configuration).

##### Relevant technologies and frameworks
- Python: Pandas, scikit‑learn, matplotlib, seaborn, dill, Joblib, and Jupyter Notebook.
- C++: Employed for performance, with Google Test for unit testing, and built using CMake.
- SQLite: Utilized via the SQLiteCpp library for handling data persistence.
- Cross-platform building: CMake to orchestrate builds across environments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Data Sources
    EX_DS["External Data Sources"]:::data_source

    %% Data Ingestion & Migration
    subgraph "Data Ingestion & Migration"
        D1["fetch_data.py"]:::python
        D2["migrate_data.py"]:::python
        D1 --> D2
    end

    %% Data Processing & Feature Engineering
    subgraph "Data Processing & Feature Engineering"
        PD1["data_processing.py"]:::python
        PD2["eda_visualization.py"]:::python
        PD3["feature_engineering.py"]:::python
        PD4["split_data.py"]:::python
        PD1 --> PD2
        PD2 --> PD3
        PD3 --> PD4
    end

    %% Model Training & Evaluation
    subgraph "Model Training & Evaluation"
        MT1["model_training.py"]:::python
        MT2["model_evaluation.py"]:::python
        MT3["linear_regression_model.pkl"]:::python
        MT1 --> MT2
        MT2 --> MT3
    end

    %% C++ Core Processing (Side Module)
    subgraph "C++ Core Processing"
        CP1["data_processor.cpp"]:::cpp
        CP2["main.cpp"]:::cpp
        CP3["CMakeLists.txt"]:::cpp
        CP1 --> CP2
        CP2 --> CP3
    end

    %% Visualization & Interpretation
    VIS["interpret_predictions.ipynb"]:::python

    %% Data Flow Connections
    EX_DS -->|"fetches"| D1
    D2 -->|"prepares"| PD1
    PD4 -->|"routes data"| MT1
    PD4 -->|"enhanced processing"| CP1
    CP3 -->|"optimized data"| MT1
    MT2 -->|"results to"| VIS

    %% Class Definitions
    classDef python fill:#bbf,stroke:#333,stroke-width:2px;
    classDef cpp fill:#f99,stroke:#333,stroke-width:2px;
    classDef data_source fill:#ffdead,stroke:#333,stroke-width:2px;

    %% Click Events
    click D1 "https://github.com/datpham0412/covid19-prediction-model/blob/main/scripts/fetch_data.py"
    click D2 "https://github.com/datpham0412/covid19-prediction-model/blob/main/scripts/migrate_data.py"
    click PD1 "https://github.com/datpham0412/covid19-prediction-model/blob/main/scripts/data_processing.py"
    click PD2 "https://github.com/datpham0412/covid19-prediction-model/blob/main/scripts/eda_visualization.py"
    click PD3 "https://github.com/datpham0412/covid19-prediction-model/blob/main/scripts/feature_engineering.py"
    click PD4 "https://github.com/datpham0412/covid19-prediction-model/blob/main/scripts/split_data.py"
    click MT1 "https://github.com/datpham0412/covid19-prediction-model/blob/main/scripts/model_training.py"
    click MT2 "https://github.com/datpham0412/covid19-prediction-model/blob/main/scripts/model_evaluation.py"
    click MT3 "https://github.com/datpham0412/covid19-prediction-model/blob/main/models/vietnam/linear_regression_model.pkl"
    click CP1 "https://github.com/datpham0412/covid19-prediction-model/blob/main/src/data_processor.cpp"
    click CP2 "https://github.com/datpham0412/covid19-prediction-model/blob/main/src/main.cpp"
    click CP3 "https://github.com/datpham0412/covid19-prediction-model/blob/main/CMakeLists.txt"
    click VIS "https://github.com/datpham0412/covid19-prediction-model/blob/main/notebooks/interpret_predictions.ipynb"
```
