# jayanta0123/cricketstats architecture

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

- Interactive diagram: https://gitdiagram.com/jayanta0123/cricketstats
- Repository: https://github.com/jayanta0123/cricketstats

## Overview

##### Project Type Analysis
This is a Java application focused on web scraping and data processing, specifically designed to demonstrate the advantages of multi-threading. The project has two main execution paths (single-threaded and multi-threaded) and handles cricket statistics from Cricbuzz.com.

##### Key Components

A. Data Source Layer:
- Cricbuzz.com Web Interface
- External Resource File (countries.txt)

B. Application Core:
- Single-Threaded Processor (SingleThreadedStats.java)
- Multi-Threaded Processor (MultiThreadedStats.java)
- Constants Manager (CricConstants.java)

C. Output Layer:
- File Writers for different cricket formats
- Test Statistics
- ODI Statistics
- T20 Statistics
- IPL Statistics
- Indian International Cricket Statistics

- [Data Source Layer]
- ↓
- [Processing Layer]
- ↓
- [Output Layer]

##### Specific Implementation Details

**[Cricbuzz.com] → [Data Fetcher]**
- ↓
**[countries.txt] → [Processor]**
- ↓
- [Thread Pool Manager]
- ↓
- [Stats Processors]
- ↓
- [File Writers]

##### Important Elements to Highlight

a) Threading Model:
- Thread pool in the multi-threaded version
- Parallel processing paths
- Demonstrate how data is aggregated before writing

b) Data Flow:
- How data is fetched from Cricbuzz.com
- Processing pipeline
- Output file generation process

##### Technical Details

- Java 8+ Runtime Environment
- Apache Commons Library dependency
- Maven build system
- Memory requirements (Xms768m, Xmx1G)

##### Additional Recommendations

- Processing capacity indicators (150 vs 10000 profiles)
- Error handling paths
- System requirements and constraints

##### Performance Aspects

A small sidebar showing:
- Single-threaded performance metrics
- Multi-threaded performance metrics
- Memory usage indicators
- Throughput capabilities

## Diagram (Mermaid)

```mermaid
graph TB
    %% Data Source Layer
    subgraph DataSources
        CB[Cricbuzz.com]:::external
        CF["countries.txt"]:::file
    end

    %% Processing Layer
    subgraph ProcessingCore
        DF[Data Fetcher]:::processor
        
        subgraph ThreadingModels
            ST["SingleThreadedStats"]:::processor
            MT["MultiThreadedStats"]:::processor
            TPM[Thread Pool Manager]:::processor
            CONST["CricConstants"]:::utility
        end
        
        subgraph DataProcessors
            TP1[Thread Processor 1]:::processor
            TP2[Thread Processor 2]:::processor
            TP3[Thread Processor 3]:::processor
        end
    end

    %% Output Layer
    subgraph OutputFiles
        TEST["Test Statistics"]:::output
        ODI["ODI Statistics"]:::output
        T20["T20 Statistics"]:::output
        IPL["IPL Statistics"]:::output
        INDIAN["Indian International Statistics"]:::output
    end

    %% Build System
    BUILD["Maven Build System"]:::build

    %% Connections
    CB --> DF
    CF --> DF
    DF --> ST
    DF --> MT
    MT --> TPM
    TPM --> TP1
    TPM --> TP2
    TPM --> TP3
    CONST -.-> ST
    CONST -.-> MT
    
    TP1 & TP2 & TP3 --> TEST
    TP1 & TP2 & TP3 --> ODI
    TP1 & TP2 & TP3 --> T20
    TP1 & TP2 & TP3 --> IPL
    TP1 & TP2 & TP3 --> INDIAN
    
    ST --> TEST
    ST --> ODI
    ST --> T20
    ST --> IPL
    ST --> INDIAN

    %% Styling
    classDef external fill:#a2d2ff
    classDef file fill:#bde0fe
    classDef processor fill:#a2d2ff
    classDef utility fill:#cdb4db
    classDef output fill:#ffafcc
    classDef build fill:#ffc8dd

    %% Click Events
    click CF "https://github.com/jayanta0123/CricketStats/blob/master/src/resources/countries.txt"
    click ST "https://github.com/jayanta0123/CricketStats/blob/master/src/com/stats/cric/SingleThreadedStats.java"
    click MT "https://github.com/jayanta0123/CricketStats/blob/master/src/com/stats/cric/multithread/MultiThreadedStats.java"
    click CONST "https://github.com/jayanta0123/CricketStats/blob/master/src/com/stats/cric/multithread/CricConstants.java"
    click TEST "https://github.com/jayanta0123/CricketStats/blob/master/cricbuzz_test_stats.txt"
    click ODI "https://github.com/jayanta0123/CricketStats/blob/master/cricbuzz_odi_stats.txt"
    click T20 "https://github.com/jayanta0123/CricketStats/blob/master/cricbuzz_t20_intl_stats.txt"
    click IPL "https://github.com/jayanta0123/CricketStats/blob/master/cricbuzz_IPL_stats.txt"
    click INDIAN "https://github.com/jayanta0123/CricketStats/blob/master/cb_indian_intl_cric_test_stats.txt"
    click BUILD "https://github.com/jayanta0123/CricketStats/blob/master/pom.xml"

    %% Legend
    subgraph Legend
        L1[External Service]:::external
        L2[File]:::file
        L3[Processor]:::processor
        L4[Utility]:::utility
        L5[Output]:::output
        L6[Build]:::build
    end
```
