# suhaibpalli/ibm-ai architecture

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

- Interactive diagram: https://gitdiagram.com/suhaibpalli/ibm-ai
- Repository: https://github.com/suhaibpalli/ibm-ai

## Overview

##### Project type and purpose
- The project is a data analysis project (more specifically, a data science/analytics project) using Jupyter Notebooks.
- Its main goal is to perform Market Basket Analysis through the Apriori algorithm, processing a retail transaction dataset sourced from an Excel file (via Kaggle).
- Deliverables include insights and possibly an output file (association_rules_insights.xlsx) with the discovered association rules.

##### File structure
- The top-level files include multiple phases of the project documented as PDF reports (AI_Phase1.pdf, AI_Phase2.pdf) and a few Jupyter Notebook files representing different stages (AI_Phase3.ipynb, AI_Phase4.ipynb, AI_Phase5.ipynb). This indicates an iterative process where the analysis was developed in phases.
- There are Excel files – one for the raw dataset (Assignment-1_Data.xlsx) and one likely used for output or further insights (association_rules_insights.xlsx).
- The README file provides extensive instructions on running the project.

##### README for additional insights
- The README explains the dataset structure (fields like Itemname, Quantity, Price, etc.) and clearly describes the usage steps – from launching Jupyter Notebook to executing the code.
- It lists the dependencies (pandas, numpy, matplotlib, mlxtend, mpld3) which hints at data manipulation, computation, and visualization components.

a. Main components of the system:
- Data Source:
- Raw Data in Excel (Assignment-1_Data.xlsx)
- (Optional) Association Rules output (association_rules_insights.xlsx)
- Data Processing and Analysis Layer:
- Jupyter Notebook environment (with notebooks: AI_Phase3.ipynb, AI_Phase4.ipynb, AI_Phase5.ipynb)
- Data ingestion & preprocessing using Python libraries (pandas, numpy)
- Apriori algorithm execution for Market Basket Analysis (mlxtend)
- Data visualization (matplotlib, mpld3)
- Documentation and Reporting:
- PDF reports (AI_Phase1.pdf and AI_Phase2.pdf) summarizing project phases and results.
- README.md for project and usage guidance

b. Relationships and interactions:
- The raw data (from Excel) is the input to the Jupyter notebooks.
- The notebooks work sequentially through multiple phases, indicating an iterative analysis process, where each phase might refine or extend previous analysis.
- The Apriori algorithm (and any associated helper functions) processes the data to extract association rules.
- Visualizations and insights are produced, with some of the results being saved to Excel (e.g., association_rules_insights.xlsx) or documented in PDF files.
- The dependencies (Python packages) support these interactions by handling data manipulation, algorithm execution, and visual output.

c. Important architectural patterns/design principles:
- Iterative/Incremental Development: Demonstrated by the phase-wise notebooks and reports.
- Modular & Layered Design: Separation of data ingestion, data processing (core analysis logic), and data presentation/documentation.
- Reusability & Extensibility: Use of Jupyter Notebooks facilitates exploratory analysis with room for iterative improvement.
- Dependency Management: Clearly stated external libraries.

d. Relevant technologies and frameworks:
- Technologies: Jupyter Notebook as the primary development and execution environment.
- Libraries: pandas, numpy (data manipulation); mlxtend (for Apriori algorithm); matplotlib, mpld3 (for plotting/visualization).

- Out how data is initially loaded (Excel file) and how it moves through the system.
- Role of each Notebook file, highlighting which one (AI_Phase5.ipynb) is the entry/primary notebook.
- External dependencies (pandas, numpy, etc.) as annotations that underpin the processing components.
- Detail any intermediate steps in the analysis (data cleaning, rule generation, visualization).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    subgraph "Input Layer"
        DS["Raw Data (Excel)"]:::dataSource
    end

    %% Processing Layer
    subgraph "Processing Layer"
        phase3["AI_Phase3.ipynb"]:::processing
        phase4["AI_Phase4.ipynb"]:::processing
        phase5["AI_Phase5.ipynb"]:::processing
        algo["Apriori Algorithm (mlxtend)"]:::processing
        extDep["Dependencies: pandas, numpy, matplotlib, mpld3"]:::note
    end

    %% Output Layer
    subgraph "Output Layer"
        output["Excel Output (association_rules_insights.xlsx)"]:::output
        subgraph "Reporting and Documentation"
            doc1["Phase Report (AI_Phase1.pdf)"]:::documentation
            doc2["Phase Report (AI_Phase2.pdf)"]:::documentation
            readme["README (README.md)"]:::documentation
        end
    end

    %% Data Flow Connections
    DS -->|"loads"| phase3
    phase3 -->|"processes"| phase4
    phase4 -->|"refines"| phase5
    extDep --- phase3
    phase5 -->|"executes"| algo
    algo -->|"generates"| output
    algo -->|"documents"| doc1
    algo -->|"documents"| doc2
    algo -->|"documents"| readme

    %% Legend
    subgraph "Legend"
        L1["Data Source (Excel Files)"]:::dataSource
        L2["Processing (Jupyter Notebooks & Algorithms)"]:::processing
        L3["Output (Excel Result)"]:::output
        L4["Documentation (PDF/README)"]:::documentation
        L5["Note: External Dependencies"]:::note
    end

    %% Click Events for Component Mapping
    click DS "https://github.com/suhaibpalli/ibm-ai/blob/main/Assignment-1_Data.xlsx"
    click phase3 "https://github.com/suhaibpalli/ibm-ai/blob/main/AI_Phase3.ipynb"
    click phase4 "https://github.com/suhaibpalli/ibm-ai/blob/main/AI_Phase4.ipynb"
    click phase5 "https://github.com/suhaibpalli/ibm-ai/blob/main/AI_Phase5.ipynb"
    click output "https://github.com/suhaibpalli/ibm-ai/blob/main/association_rules_insights.xlsx"
    click doc1 "https://github.com/suhaibpalli/ibm-ai/blob/main/AI_Phase1.pdf"
    click doc2 "https://github.com/suhaibpalli/ibm-ai/blob/main/AI_Phase2.pdf"
    click readme "https://github.com/suhaibpalli/ibm-ai/blob/main/README.md"

    %% Styles
    classDef dataSource fill:#ffe6e6,stroke:#333,stroke-width:2px;
    classDef processing fill:#e6f5ff,stroke:#333,stroke-width:2px;
    classDef output fill:#e6ffe6,stroke:#333,stroke-width:2px;
    classDef documentation fill:#fff0e6,stroke:#333,stroke-width:2px;
    classDef note fill:#f2f2f2,stroke:#666,stroke-dasharray: 3,3,stroke-width:1px;
```
