# ankushd919/user-login-behavior-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/ankushd919/user-login-behavior-analyzer
- Repository: https://github.com/ankushd919/user-login-behavior-analyzer

## Overview

##### Project type and purpose
- From the README we see this is a data‐analysis and predictive modeling application focused on user login logs. It ingests raw log files, processes them to extract time‐based features, generates visualizations (heatmaps), and trains/runs a predictive model. A Streamlit UI provides end‐user interaction.

##### (minimal) file structure
- requirements.txt (Python dependencies)
- data_ingestion.py or similar scripts for raw log parsing
- analysis.py (heatmap generation)
- model_training.py (build/persist Scikit-learn model)
- app.py or streamlit_app.py (Streamlit UI)
- directories: /data (raw and processed CSV/Parquet), /models (saved model artifacts), /notebooks (exploratory work), /visuals (static charts).

##### README for additional insights
- Features: timestamp parsing, hourly heatmaps, predictive model.
- Tools: Python, Pandas, Matplotlib, Scikit-learn, Streamlit.

a. Main components
- Raw Log Ingestion
- Data Processing/ETL (Pandas)
- Visualization Engine (Matplotlib)
- Model Training & Prediction (Scikit-learn)
- Model & Data Storage (local files or lightweight DB)
- UI Layer (Streamlit)
- (Optional) Scheduler or CLI for batch jobs

b. Relationships & data flows
1. Raw logs → Ingestion module → processed data files
2. Processed data → Analysis module → heatmap images
3. Processed data → Model training module → trained model artifact
4. UI Layer loads processed data + model → presents heatmaps + predictions
5. User inputs (date range, user filter) → UI Layer → triggers on-the-fly re-analysis or model inference

c. Architectural patterns & principles
- Pipeline pattern: a clear end-to-end ETL → analysis → modeling → serving flow.
- Separation of concerns: distinct modules for parsing, analysis, training, UI.
- Modular, script-based design fits a small analytics tool.

d. Relevant technologies
- Python runtime for all components
- Pandas for data transformation
- Matplotlib (or Seaborn) for charting
- Scikit-learn for modeling
- Streamlit for interactive UI
- (Optional) SQLite or file-based storage for intermediate datasets and model artifacts

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Data Ingestion and ETL"
        direction TB
        RL["Raw Log Files"]:::data
        LI["Log Ingestor (data_ingestion.py)"]:::processing
        ETL["ETL Processor (analysis.py)"]:::processing
        RL --> LI --> ETL
        ETL --> DS["Processed Data (CSV/Parquet)"]:::storage
    end

    subgraph "Batch Jobs Scheduler"
        SCH["Scheduler/CLI"]:::scheduler
        SCH --> LI
        SCH --> MT
    end

    subgraph "Processing Consumers"
        direction TB
        HG["Heatmap Generator (analysis.py)"]:::processing
        MT["Model Trainer (model_training.py)"]:::processing
        DS --> HG --> VS["Visualizations (PNG/SVG)"]:::storage
        DS --> MT --> MS["Model Artifact (pickle)"]:::storage
    end

    subgraph "Interactive UI"
        UI["Streamlit UI (app.py)"]:::ui
        UI --> DS
        UI --> MS
        UI --> VS
        UI --> ETL
        UI --> MT
    end

    classDef data fill:#D6EAF8,stroke:#2980B9;
    classDef processing fill:#D5F5E3,stroke:#27AE60;
    classDef storage fill:#FCF3CF,stroke:#F1C40F;
    classDef ui fill:#FADBD8,stroke:#E74C3C;
    classDef scheduler fill:#E8DAEF,stroke:#8E44AD;
```
