# jacquewill/seo_hif_js architecture

> Architecture diagram of the GitHub repository jacquewill/seo_hif_js, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jacquewill/seo_hif_js
- Repository: https://github.com/jacquewill/seo_hif_js

## Overview

##### Frontend Layer
- Search_bing.html as the entry point
- It to the Bing Search API integration

##### Core Processing Components (Worker Architecture)
- Preprocessing Worker
- Embedding Worker
- Training Worker (Linear Regression)
- Prediction Worker
These should be connected in a pipeline fashion, showing data flow.

##### Data Processing Pipeline
a. User Input → Search Interface
b. Search Interface → Bing API
c. Search Results → Preprocessing Worker
d. Preprocessed Data → Embedding Worker
e. Embeddings → Training/Prediction Workers
f. Final Rankings → Search Interface

##### Storage/Data Components
- A data store component for implicit feedback collection
- Connection to testing_data (Hall.csv, Hall.json)
- A metrics collection component (connected to metrics.js)

- Blue: User-facing components (Search Interface)
- Green: Data processing workers
- Yellow: External services (Bing API)
- Purple: Data storage components
- Red: Critical data flow paths

Specific Implementation Details to Highlight:

##### Worker Architecture
- preprocessing_worker.js
- embedding_worker.js
- train_LR_worker.js
- predict_LR_worker.js

##### Feedback Loop
- User interactions are captured
- Data is fed back into the training process
- Rankings are updated based on implicit feedback

##### Development Components
- Performance monitoring
- API development interface
- Metrics collection

Important Relationships to Emphasize:
##### Integration with external search API

- Component types (Workers, Interface, Storage, API)
- Development vs Production components

Level of Detail:
- Version/state indicators for components under development

Additional Notes:
- Annotation for scalability points
- Areas where additional implicit feedback types can be integrated

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef interface fill:#3498db,stroke:#2980b9,color:white
    classDef worker fill:#2ecc71,stroke:#27ae60,color:white
    classDef api fill:#f1c40f,stroke:#f39c12,color:black
    classDef storage fill:#9b59b6,stroke:#8e44ad,color:white
    classDef dev fill:#e74c3c,stroke:#c0392b,color:white
    classDef flow fill:none,stroke:#95a5a6,color:black

    %% Main Components
    UI["Search Interface"]:::interface
    click UI "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/search_bing.html"
    BING["Bing API Integration"]:::api
    click BING "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/bing-search.js"
    
    %% Worker Pipeline
    subgraph Workers
        PRE["Preprocessing Worker"]:::worker
        EMB["Embedding Worker"]:::worker
        TRAIN["Training Worker"]:::worker
        PRED["Prediction Worker"]:::worker
        
        click PRE "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/preprocessing_worker.js"
        click EMB "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/embedding_worker.js"
        click TRAIN "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/train_LR_worker.js"
        click PRED "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/predict_LR_worker.js"
    end

    %% Storage Components
    subgraph Data
        STORE[("Feedback Storage")]:::storage
        TEST[("Testing Data")]:::storage
        click TEST "https://github.com/JacqueWill/SEO_HIF_JS/tree/main/testing_data/"
    end

    %% Development Tools
    subgraph Development
        METRIC["Metrics Collection"]:::dev
        PERF["Performance Monitor"]:::dev
        API_DEV["API Development"]:::dev
        HASH["Embedding Hash"]:::dev
        MAIN["Main Logic"]:::dev
        
        click METRIC "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/dev/metrics.js"
        click API_DEV "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/dev/api_dev.html"
        click PERF "https://github.com/JacqueWill/SEO_HIF_JS/tree/main/dev/Performance/"
        click HASH "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/dev/embedding_hash.js"
        click MAIN "https://github.com/JacqueWill/SEO_HIF_JS/blob/main/dev/main.js"
    end

    %% Data Flow
    UI --> BING
    BING --> PRE
    PRE --> EMB
    EMB --> TRAIN
    TRAIN --> PRED
    PRED --> UI
    
    %% Feedback Loop
    UI -.-> STORE
    STORE -.-> TRAIN
    
    %% Development Connections
    METRIC -.-> Workers
    PERF -.-> Workers
    API_DEV -.-> BING
    HASH -.-> EMB
    MAIN -.-> Workers

    %% Legend
    subgraph Legend
        L1["User Interface"]:::interface
        L2["Workers"]:::worker
        L3["External API"]:::api
        L4[("Storage")]:::storage
        L5["Development"]:::dev
        L6["Data Flow"]:::flow
    end
```
