# kurasaiteja/whatsapp-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/kurasaiteja/whatsapp-analysis
- Repository: https://github.com/kurasaiteja/whatsapp-analysis

## Overview

##### Main Components
- Data Input Component: Represent the WhatsApp chat file (appreciate.txt) that serves as the primary input.
- Parsing/Preprocessing Module: This part reads and processes the raw WhatsApp chat transcript, preparing it for analysis. Consider differences between Android and iOS formats.
- Analysis Module: Use Pandas to clean, structure, and analyze the parsed data. This module is central to the project's computations.
- Visualization Module: Utilizes Plotly to create interactive graphs and charts based on the analyzed data.
- Notebook Interface: Three separate Jupyter notebooks are targeted (general, Android-specific, and iOS-specific). They serve both as user interfaces and as orchestrators that call and coordinate the other modules.

##### Interactions
- Data flows from the Input Component to the Parsing Module, where it is converted into a structured data format.
- Once processed, the data is passed to the Analysis Module (powered by Pandas) where metrics, aggregations, and other insights are computed.
- The processed and analyzed data is then supplied to the Visualization Module (using Plotly) to render interactive visualizations.
- Each Notebook (one for general use, one tailored to Android and one for iOS) coordinates these steps, allowing for a slight variation in handling platform-specific discrepancies in the input file format.

##### Architectural Patterns & Design Principles
- Clear data flow from raw input to processed output, ensuring that the separation of concerns is maintained between data ingestion, processing (parsing/analysis), and visualization.
- That while the notebooks act as the main driver, they essentially encapsulate a functional pipeline rather than a heavy web or multi-tier application.
- Importance of modularity: While the notebooks provide an interface, consider modular blocks for the parsing logic, analysis computations, and visualization routines, making it easier to update individual parts as the project evolves.

##### Relevant Technologies & Frameworks
- Python (as the core language).
- Jupyter Notebook: The user interface for running iterative analysis.
- Pandas: For data manipulation and analytics.
- Plotly: For creating interactive visualizations.
- Text File (or multiple versions if necessary): As the source for WhatsApp chat data.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Input
    Input["WhatsApp Chat: appreciate.txt"]:::input

    %% Jupyter Notebook Interfaces Subgraph
    subgraph "Jupyter Notebook Interfaces"
        NotebookGeneral["General Notebook"]:::notebook
        NotebookAndroid["Android Notebook"]:::notebook
        NotebookiOS["iOS Notebook"]:::notebook
    end

    %% Processing Pipeline
    Parsing["Parsing/Preprocessing Module"]:::process
    Analysis["Analysis Module (Pandas)"]:::process
    Visualization["Visualization Module (Plotly)"]:::visual

    %% Data Flow Connections
    Input -->|"raw_chat_data"| Parsing
    NotebookGeneral -->|"orchestrates"| Parsing
    NotebookAndroid -->|"orchestrates"| Parsing
    NotebookiOS -->|"orchestrates"| Parsing
    Parsing -->|"clean_data"| Analysis
    Analysis -->|"analyzed_data"| Visualization
    Visualization -->|"interactive_plots"| NotebookGeneral
    Visualization -->|"interactive_plots"| NotebookAndroid
    Visualization -->|"interactive_plots"| NotebookiOS

    %% Click Events
    click Input "https://github.com/kurasaiteja/whatsapp-analysis/blob/master/appreciate.txt"
    click NotebookGeneral "https://github.com/kurasaiteja/whatsapp-analysis/blob/master/Whatsapp_Group_Chat_Analysis.ipynb"
    click NotebookAndroid "https://github.com/kurasaiteja/whatsapp-analysis/blob/master/Whatsapp_Group_Chat_Analysis_for_Android.ipynb"
    click NotebookiOS "https://github.com/kurasaiteja/whatsapp-analysis/blob/master/Whatsapp_Group_Chat_Analysis_for_iOS.ipynb"

    %% Styles
    classDef input fill:#ffcc80,stroke:#bf360c,stroke-width:2px;
    classDef notebook fill:#b39ddb,stroke:#4a148c,stroke-width:2px;
    classDef process fill:#90caf9,stroke:#0d47a1,stroke-width:2px;
    classDef visual fill:#a5d6a7,stroke:#1b5e20,stroke-width:2px;
```
