# 2233-prajyesh/lead-conversion-predection architecture

> Architecture diagram of the GitHub repository 2233-prajyesh/lead-conversion-predection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/2233-prajyesh/lead-conversion-predection
- Repository: https://github.com/2233-prajyesh/lead-conversion-predection

## Overview

##### Main Components
- Data Input Sources: Represent the three sample data files (SampleData.csv, SampleData.xlsx, synthetic_lead_data.csv). These files are where raw lead data comes from.
- Data Ingestion & Preprocessing Module: This component (implemented in leadconver.py) is responsible for reading the data, cleaning it (handling missing values, duplicates, normalizing column names), and preparing it for analysis.
- Exploratory Data Analysis (EDA) Module: This part handles visualization tasks such as generating histograms, correlation heatmaps, boxplots, and conversion rate graphics. Indicate that Seaborn & Matplotlib are the libraries powering these visualizations.
- Rule-Based Prediction Engine: This module encapsulates the logic that predicts lead conversion. According to the README and model logic, it checks conditions (lead score > 50, email opened = Yes, total time spent > 100 seconds) to produce predictions.
- Performance Evaluation Module: This component computes accuracy by comparing model predictions with the actual conversion data. It outputs performance metrics and can present sample predictions in a tabular format.

##### Establish Relationships and Data Flows
- From Data Ingestion, create two major output flows:
- One goes into the EDA Module (for visualization and insights gathering).
- The other flows into the Rule-Based Prediction Engine.

##### Important Architectural Patterns and Technologies
- That the application uses a sequential data processing pipeline where each module feeds into the next.
- That the design uses a modular approach by separating various concerns (ingestion, cleaning, EDA, prediction, evaluation) even though it is implemented in a single Python file. This separation can help guide future refactoring into separate modules if needed.
- Specific libraries (Pandas, Seaborn, Matplotlib) next to the appropriate modules, which helps recognize the technology stack.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Input Sources"
        DS1["SampleData.csv"]:::data
        DS2["SampleData.xlsx"]:::data
        DS3["synthetic_lead_data.csv"]:::data
    end

    DIP["Data Ingestion & Preprocessing (leadconver.py)\n(Data Cleaning, Normalization)"]:::process
    EDA["Exploratory Data Analysis\n(Visualization: Seaborn, Matplotlib)"]:::analytics
    PRED["Rule-Based Prediction Engine\n(Logic: score>50, emailOpened=Yes, timeSpent>100)"]:::process
    PERF["Performance Evaluation\n(Accuracy, Comparison with Actual)"]:::analytics

    DS1 --> DIP
    DS2 --> DIP
    DS3 --> DIP

    DIP -->|"feedsDataIntoEDA"| EDA
    DIP -->|"feedsDataIntoPrediction"| PRED
    PRED -->|"outputsTo"| PERF
    EDA -.->|"feedbackLoop"| DIP

    click DS1 "https://github.com/2233-prajyesh/lead-conversion-predection/blob/main/SampleData.csv"
    click DS2 "https://github.com/2233-prajyesh/lead-conversion-predection/blob/main/SampleData.xlsx"
    click DS3 "https://github.com/2233-prajyesh/lead-conversion-predection/blob/main/synthetic_lead_data.csv"
    click DIP "https://github.com/2233-prajyesh/lead-conversion-predection/blob/main/leadconver.py"
    click EDA "https://github.com/2233-prajyesh/lead-conversion-predection/blob/main/leadconver.py"
    click PRED "https://github.com/2233-prajyesh/lead-conversion-predection/blob/main/leadconver.py"
    click PERF "https://github.com/2233-prajyesh/lead-conversion-predection/blob/main/leadconver.py"

    classDef data fill:#fffae6,stroke:#f0ad4e,stroke-width:2px;
    classDef process fill:#d9edf7,stroke:#31708f,stroke-width:2px;
    classDef analytics fill:#dff0d8,stroke:#3c763d,stroke-width:2px;
```
