# jeffwu0724/illumio-jeff-wu architecture

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

- Interactive diagram: https://gitdiagram.com/jeffwu0724/illumio-jeff-wu
- Repository: https://github.com/jeffwu0724/illumio-jeff-wu

## Overview

##### Main Components
- Input Files: Represent the two CSV input files – lookup_table.csv and sample_flow_log.csv.
- Lookup Table Loader: A component (or module) that reads the lookup_table.csv and builds a hashmap (or similar data structure) mapping port-protocol pairs to their respective tags.
- Flow Log Parser: A module that reads and parses sample_flow_log.csv. It validates each record (ensuring there are at least 14 fields) and extracts the required port and protocol information.
- Data Processor: The core processing part that uses the lookup hashmap to count the occurrences for each port/protocol combination and associated tag. This includes handling cases where no match is found – labeling them as “Untagged.”
- Report Generator: This module takes the computed counts and writes out two separate CSV files (port_protocol_com_count_report.csv and tag_count_report.csv) into the output directory.
- Main/Driver Class: The Main.java file that orchestrates the process, from reading inputs to processing and report generation.
- Unit Testing: Represent a testing module (e.g., MainTest.java) used to verify the correctness of the business logic.

- Next, indicate that the Data Processor sends data concurrently to the Report Generator, with one stream for port/protocol counts and another for tag counts.
- The Main/Driver class is at the center, coordinating these calls sequentially, so represent it as the central control component linking to all modules.

##### Architectural Patterns and Design Principles
- Separation of concerns by isolating file input, processing, and output generation.
- Use of a hashing mechanism to quickly map port/protocol pairs to tags, which is essential for performance.
- The design can be interpreted as following a pipeline model, where data flows from input through transformation (processing) to output, and can be represented as a series of modular steps.

##### Technologies, Frameworks, and Libraries
- Since it’s plain Java (no external frameworks beyond the JDK), mention standard Java I/O for file operations and collections (e.g., HashMap) for lookup.
- JUnit (or similar) for the testing component since there is an example unit test.

##### Essential Elements
- Input Files → Lookup Table Loader and Flow Log Parser
- Lookup Table Loader → Data Processor
- Flow Log Parser → Data Processor
- Data Processor → Report Generator → Output CSV Files

##### Extra Details
- If necessary, represent the interaction with the file system (e.g., the root folder and the output subdirectory).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Input Files"
        LT["lookup_table.csv"]:::blue
        FL["sample_flow_log.csv"]:::blue
    end

    MT["Main/Driver Class"]:::orange

    LTL["Lookup Table Loader"]:::green
    FLP["Flow Log Parser"]:::green
    DP["Data Processor"]:::green
    RG["Report Generator"]:::green

    subgraph "Output Files"
        OUT1["port_protocol_com_count_report.csv"]:::blue
        OUT2["tag_count_report.csv"]:::blue
    end

    UT["Unit Testing"]:::purple

    %% Connections
    MT -->|"orchestrates"| LTL
    MT -->|"orchestrates"| FLP
    LT -->|"provides lookup"| LTL
    FL -->|"provides flow"| FLP
    LTL -->|"supplies lookup map"| DP
    FLP -->|"supplies parsed data"| DP
    DP -->|"sends results"| RG
    RG -->|"writes report"| OUT1
    RG -->|"writes report"| OUT2
    MT -->|"triggers tests"| UT

    %% Click Events
    click LT "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/lookup_table.csv"
    click FL "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/sample_flow_log.csv"
    click MT "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/Main.java"
    click LTL "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/Main.java"
    click FLP "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/FlowLogProcessror.java"
    click DP "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/Main.java"
    click RG "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/Main.java"
    click OUT1 "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/output/port_protocol_com_count_report.csv"
    click OUT2 "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/output/tag_count_report.csv"
    click UT "https://github.com/jeffwu0724/illumio-jeff-wu/blob/master/src/test/java/MainTest.java"

    %% Styles
    classDef blue fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef green fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef orange fill:#ffcc99,stroke:#000,stroke-width:2px;
    classDef purple fill:#DDA0DD,stroke:#000,stroke-width:2px;
```
