# arshnoor-singh-sohi/tickfit architecture

> Architecture diagram of the GitHub repository arshnoor-singh-sohi/tickfit, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arshnoor-singh-sohi/tickfit
- Repository: https://github.com/arshnoor-singh-sohi/tickfit

## Overview

##### Project Type and Purpose
- This is a Java-based, Maven-managed data-processing and recommendation system. It ingests raw HTML from various smartwatch vendor sites, parses and indexes the content, and then provides a smartwatch recommendation engine via a command-line interface (with some vestigial web UI components).

##### File-Structure and Architectural Patterns
- Top-level:
- pom.xml (Maven build & dependencies, notably Apache POI)
- src/main/java/org/example – major packages
- src/main/resources/static – optional web UI assets
- saved_pages & smartwatches_HTML – raw, crawler-fetched HTML
- text_pages – parser-generated plain-text files
- CSV/Excel files – final structured data for recommendations
- Packages reveal a layered design:
- WebCrawler – data ingestion
- Parser – transformation and validation
- InvertedIndex & PageRanking – indexing and ranking logic
- WordFrequencyAnalyzer – analysis services
- SmartwatchRecommendationSystem & SpellChecker – core recommendation
- test/testUI – CLI/Swing prototype UIs

##### Key Components
a. Data Ingestion Layer
- Components: UWCrawler, HTMLtoTextConverter, RegexValidatorApp
- Inputs: saved_pages/*, smartwatches_HTML/*
- Output: raw HTML files or initial text dumps
b. Data Processing Layer
- Components: HTMLParser, HTML_To_Text, RegexValidator, InvertedIndex
- Flow: raw HTML → cleaned text (text_pages) → inverted index data structures
c. Analysis & Ranking Layer
- Components: PageRanking, WebContentAnalyzer, WordFrequencyAnalyzer1-4
- Output: ranked lists or frequency models used by the engine
d. Recommendation Engine Layer
- Components: SmartwatchRecommendationSystem, ExcelReader, SpellChecker
- Uses: indexed data, CSV/Excel specs (apple_watches.csv, combined_watch_data.csv, etc.)
e. Presentation Layer
- CLI: console-based user prompts and output in SmartwatchRecommendationSystem
- (Optional) Web UI: Spring-style SearchController + index.html + search.js

##### Architectural Patterns & Principles
- Layered Architecture: clear separation of concerns (Ingestion → Processing → Analysis → Presentation)
- Pipeline Pattern: each module transforms data and hands off to next
- Dependency Injection (via Spring or manual wiring) implied by application.properties & SearchController
- External library integration: Apache POI for Excel, regex utilities, standard Java IO

##### Essential Elements to Capture
- Clear labels: component names, class/package pointers
- External data sources and libraries
- Build/configuration context (pom.xml, application.properties)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Sources
    VendorSites["External Vendor Sites"]:::external
    SavedPages["saved_pages/"]:::external
    SmartwatchesHTML["smartwatches_HTML/"]:::external

    subgraph "Data Ingestion Layer"
        direction TB
        UWCrawler["UWCrawler"]:::ingestion
        HTMLtoTextConverter["HTMLtoTextConverter"]:::ingestion
        RegexValidatorApp["RegexValidatorApp"]:::ingestion
    end

    VendorSites --> UWCrawler
    UWCrawler --> SavedPages
    VendorSites --> RegexValidatorApp
    VendorSites --> HTMLtoTextConverter
    SavedPages --> UWCrawler
    SmartwatchesHTML --> UWCrawler

    subgraph "Data Processing Layer"
        direction TB
        HTMLParser["HTMLParser"]:::processing
        HTML_To_Text["HTML_To_Text"]:::processing
        RegexValidator["RegexValidator"]:::processing
        InvertedIndex["InvertedIndex"]:::processing
        TextPages["text_pages/"]:::external
    end

    UWCrawler -->|HTML files| HTMLParser
    HTMLtoTextConverter -->|initial text| HTML_To_Text
    RegexValidatorApp -->|validated HTML| RegexValidator

    HTMLParser -->|cleaned HTML| RegexValidator
    HTML_To_Text -->|plain text| InvertedIndex
    RegexValidator -->|validated text| InvertedIndex
    InvertedIndex -->|index| TextPages

    subgraph "Analysis & Ranking Layer"
        direction TB
        PageRanking["PageRanking"]:::analysis
        WebContentAnalyzer["WebContentAnalyzer"]:::analysis
        WFA1["WordFrequencyAnalyzer1"]:::analysis
        WFA2["WordFrequencyAnalyzer2"]:::analysis
        WFA3["WordFrequencyAnalyzer3"]:::analysis
        WFA4["WordFrequencyAnalyzer4"]:::analysis
    end

    TextPages --> PageRanking
    TextPages --> WebContentAnalyzer
    TextPages --> WFA1
    TextPages --> WFA2
    TextPages --> WFA3
    TextPages --> WFA4

    subgraph "Recommendation Engine Layer"
        direction TB
        REngine["SmartwatchRecommendationSystem"]:::analysis
        RApp["SmartwatchRecommendationApp"]:::analysis
        SpellChecker["SpellChecker"]:::analysis
        CSVExcel["CSV/Excel Files"]:::external
    end

    PageRanking --> REngine
    WebContentAnalyzer --> REngine
    WFA1 --> REngine
    WFA2 --> REngine
    WFA3 --> REngine
    WFA4 --> REngine
    CSVExcel --> REngine
    RApp --> REngine
    SpellChecker --> REngine

    subgraph "Presentation Layer"
        direction TB
        CLI["CLI Terminal"]:::presentation
        SearchController["SearchController"]:::presentation
        IndexHTML["index.html"]:::presentation
        SearchJS["search.js"]:::presentation
    end

    REngine -->|recommendations| CLI
    REngine -->|HTTP search| SearchController
    SearchController --> IndexHTML
    SearchController --> SearchJS

    Pom["pom.xml"]:::external
    AppProps["application.properties"]:::external

    Pom --> UWCrawler
    AppProps --> SearchController

    %% Click Events
    click UWCrawler "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/WebCrawler/UWCrawler.java"
    click HTMLtoTextConverter "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/WebCrawler/HTMLtoTextConverter.java"
    click RegexValidatorApp "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/WebCrawler/RegexValidatorApp.java"
    click SavedPages "https://github.com/arshnoor-singh-sohi/tickfit/tree/main/saved_pages/"
    click SmartwatchesHTML "https://github.com/arshnoor-singh-sohi/tickfit/tree/main/smartwatches_HTML/"
    click HTMLParser "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/Parser/HTMLParser.java"
    click HTML_To_Text "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/Parser/HTML_To_Text.java"
    click RegexValidator "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/Parser/RegexValidator.java"
    click InvertedIndex "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/Parser/InvertedIndex.java"
    click TextPages "https://github.com/arshnoor-singh-sohi/tickfit/tree/main/text_pages/"
    click PageRanking "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/Parser/PageRanking.java"
    click WebContentAnalyzer "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/PageRanking/WebContentAnalyzer.java"
    click WFA1 "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/WordFrequencyAnalyzer/WordFrequencyAnalyzer1.java"
    click WFA2 "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/WordFrequencyAnalyzer/WordFrequencyAnalyzer2.java"
    click WFA3 "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/WordFrequencyAnalyzer/WordFrequencyAnalyzer3.java"
    click WFA4 "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/WordFrequencyAnalyzer/WordFrequencyAnalyzer4.java"
    click REngine "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/testUI/SmartwatchRecommendationSystem.java"
    click RApp "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/testUI/SmartwatchRecommendationApp.java"
    click SpellChecker "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/test/SpellChecker.java"
    click SearchController "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/java/org/example/WordFrequencyAnalyzer/SearchController.java"
    click IndexHTML "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/resources/static/index.html"
    click SearchJS "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/resources/static/search.js"
    click AppProps "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/src/main/resources/application.properties"
    click Pom "https://github.com/arshnoor-singh-sohi/tickfit/blob/main/pom.xml"

    %% Styles
    classDef ingestion fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef processing fill:#FFA500,stroke:#333,stroke-width:1px
    classDef analysis fill:#90EE90,stroke:#333,stroke-width:1px
    classDef presentation fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#F0F0F0,stroke:#333,stroke-width:1px
```
