# melodyduplaix/spamsmsduplaixherry architecture

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

- Interactive diagram: https://gitdiagram.com/melodyduplaix/spamsmsduplaixherry
- Repository: https://github.com/melodyduplaix/spamsmsduplaixherry

## Overview

Key Components to Include in the System Design:

##### Data Layer
- Different data sources: BD1.txt, DataSmsSpamNH.csv, telegram_spam_dataset.csv

##### Data Processing Pipeline
- Data Analysis (Analyse/AnalyseDataSet.py)
- Feature Extraction (Automatisation/ExtractFeaturesVectorize.py)
- Dataset Management (Automatisation/DataSetManagement.py)

##### Model Training Layer
- Model training process:
- Model Creation (Automatisation/CreateBayesModel.py)
- Model Evaluation (Automatisation/EvaluateModelsFeatures.py)
- Model Storage (Models/ directory)

##### Application Layer
- Both Streamlit applications:
- Original App (AppStreamlit/app.py)
- New App (NewAppStreamlit/app.py)

- [Raw Data] → [Processing] → [Training] → [Model Storage] → [Web Application]

##### Specific Elements
- Vectorization process
- Feature extraction
- Model serialization/deserialization
- Evaluation metrics flow

Relationships to Highlight:

##### Data Flow
- How processed data feeds into model training
- Model deployment to the Streamlit application

##### Component Interaction
- Bidirectional communication between model storage and applications
- Feedback loops in model evaluation

Technical Details to Include:

##### Technologies
- Scikit-learn for ML implementation
- Joblib for model serialization
- Pandas for data handling
- Streamlit for web interface

##### Key Processes
- Feature vectorization
- Naive Bayes classification
- Model evaluation metrics

Level of Detail:

##### High-Level Components
- Keep main components clearly separated
- Primary data and process flows

##### Sub-Components
- Major processing steps
- File interactions

Special Considerations:

##### Automation Pipeline
- Automated nature of model creation and evaluation
- How different features and parameters can be tested

##### Multiple Applications
- Clearly distinguish between the two Streamlit applications
- Shared resources between them

- Symbols for data storage, processing units, and applications

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Layer
    subgraph DataLayer["Data Layer"]
        RawData[("Raw Data Storage")]:::storage
        BD1["BD1.txt"]:::file
        DataSmsSpam["DataSmsSpamNH.csv"]:::file
        TelegramSpam["telegram_spam_dataset.csv"]:::file
        
        RawData --> BD1
        RawData --> DataSmsSpam
        RawData --> TelegramSpam
    end

    %% Processing Layer
    subgraph ProcessingLayer["Data Processing Pipeline"]
        Analysis["Data Analysis"]:::process
        FeatureExtraction["Feature Extraction"]:::process
        DatasetMgmt["Dataset Management"]:::process
        
        Analysis --> FeatureExtraction
        FeatureExtraction --> DatasetMgmt
    end

    %% Model Training Layer
    subgraph TrainingLayer["Model Training Layer"]
        ModelCreation["Model Creation"]:::training
        ModelEval["Model Evaluation"]:::training
        ModelStorage[("Model Storage")]:::storage
        
        ModelCreation --> ModelEval
        ModelEval --> ModelStorage
        
        BasicModel["BasicBayesModel.joblib"]:::file
        BayesModel["BayesienModel.joblib"]:::file
        
        ModelStorage --> BasicModel
        ModelStorage --> BayesModel
    end

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        OriginalApp["Original Streamlit App"]:::app
        NewApp["New Streamlit App"]:::app
        AppModel["Application Model"]:::file
    end

    %% Notebooks
    subgraph NotebookLayer["Training Notebooks"]
        BaseTraining["Base Training"]:::notebook
        AdvFeatures["Advanced Features"]:::notebook
        ModelEvalNotebook["Model Evaluation"]:::notebook
    end

    %% Connections between layers
    DataLayer --> ProcessingLayer
    ProcessingLayer --> TrainingLayer
    TrainingLayer --> AppLayer
    NotebookLayer --> TrainingLayer

    %% Click events
    click RawData "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/tree/main/DataSetBrut/"
    click BD1 "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/DataSetBrut/BD1.txt"
    click DataSmsSpam "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/DataSetBrut/DataSmsSpamNH.csv"
    click TelegramSpam "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/DataSetBrut/telegram_spam_dataset.csv"
    click Analysis "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/Analyse/AnalyseDataSet.py"
    click FeatureExtraction "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/Automatisation/ExtractFeaturesVectorize.py"
    click DatasetMgmt "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/Automatisation/DataSetManagement.py"
    click ModelCreation "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/Automatisation/CreateBayesModel.py"
    click ModelEval "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/Automatisation/EvaluateModelsFeatures.py"
    click ModelStorage "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/tree/main/Models/"
    click BasicModel "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/Models/BasicBayesModel.joblib"
    click BayesModel "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/Models/BayesienModel.joblib"
    click OriginalApp "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/AppStreamlit/app.py"
    click NewApp "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/NewAppStreamlit/app.py"
    click AppModel "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/AppStreamlit/BayesienModel.joblib"
    click BaseTraining "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/ModelTraining/bayesnaif.ipynb"
    click AdvFeatures "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/ModelTraining/bayesnaifwithotherfeatures.ipynb"
    click ModelEvalNotebook "https://github.com/MelodyDuplaix/SpamSmsDuplaixHerry/blob/main/ModelTraining/algoEvalNewDataset.ipynb"

    %% Styling
    classDef storage fill:#3498db,stroke:#2980b9,color:white
    classDef process fill:#2ecc71,stroke:#27ae60,color:white
    classDef training fill:#f1c40f,stroke:#f39c12,color:black
    classDef app fill:#9b59b6,stroke:#8e44ad,color:white
    classDef file fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef notebook fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        Storage[("Storage")]:::storage
        Process["Processing"]:::process
        Training["Training"]:::training
        Application["Application"]:::app
        File["File"]:::file
        Notebook["Notebook"]:::notebook
    end
```
