# whitedevilshri/intelligent-log-analyzer architecture

> Architecture diagram of the GitHub repository whitedevilshri/intelligent-log-analyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/whitedevilshri/intelligent-log-analyzer
- Repository: https://github.com/whitedevilshri/intelligent-log-analyzer

## Overview

The product ingests structured logs, groups stored events into traces, classifies traces with the R1 masked TF-IDF/Isolation Forest model, and exposes diagnostic root-cause evidence and operational views through FastAPI. The graph includes documented history, statistics, and prediction capabilities. Arrows are limited to calls shown in excerpts or relationships documented in the README; unsampled route internals are not inferred.

Main entry points: [`python-backend/app/main.py`](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/main.py) (FastAPI application), [`python-backend/app/db/database.py`](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/db/database.py) (PostgreSQL), [`python-backend/app/api/routes/predictions.py`](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/predictions.py) (Prediction endpoint), [`python-backend/app/api/routes/ingestion.py`](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/ingestion.py) (Ingestion endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Log ingestion"]
  node_java_reader["CSV reader and batcher<br/>[App.java]"]
  node_block_extract["Block ID extractor"]
  node_client["FastAPI batch client<br/>[FastApiClient.java]"]
  node_record_schema["Ingestion schemas<br/>[ingestion.py]"]
end

subgraph group_analysis["Trace analysis"]
  node_trace_builder["Trace construction<br/>[trace_builder.py]"]
  node_detector["Anomaly detector"]
  node_features["Masked TF-IDF preprocessing"]
  node_artifacts["R1 model artifacts<br/>[model.joblib]"]
  node_correlator["Root-cause correlation"]
end

subgraph group_api["REST API"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_ingestion_route["Ingestion endpoint<br/>[ingestion.py]"]
  node_traces_route["Trace build and labeling<br/>[traces.py]"]
  node_pred_route["Prediction endpoint<br/>[predictions.py]"]
  node_history_route["Prediction history<br/>[history.py]"]
  node_stats_route["Dashboard statistics<br/>[stats.py]"]
  node_root_route["Root-cause endpoint<br/>[root_cause.py]"]
end

subgraph group_storage["Persistence"]
  node_ingestion_store["Event and block storage<br/>[ingestion_store.py]"]
  node_postgres[("PostgreSQL<br/>[database.py]")]
  node_history_data[("Prediction and trace history<br/>[schema.sql]")]
end

node_operator(("Log operator"))
node_csv["Structured log CSV"]

node_operator -->|"provides logs"| node_csv
node_java_reader -->|"reads"| node_csv
node_java_reader -->|"extracts IDs"| node_block_extract
node_java_reader -->|"sends batches"| node_client
node_client -->|"posts batches"| node_ingestion_route
node_api_app -->|"registers route"| node_ingestion_route
node_api_app -->|"registers route"| node_traces_route
node_api_app -->|"registers route"| node_pred_route
node_api_app -->|"registers route"| node_history_route
node_api_app -->|"registers route"| node_stats_route
node_api_app -->|"registers route"| node_root_route
node_ingestion_route -->|"validates payload"| node_record_schema
node_ingestion_route -->|"stores batch"| node_ingestion_store
node_ingestion_store -->|"writes and reads"| node_postgres
node_traces_route -->|"loads records"| node_ingestion_store
node_traces_route -->|"builds traces"| node_trace_builder
node_trace_builder -->|"uses records"| node_record_schema
node_pred_route -->|"classifies traces"| node_detector
node_detector -->|"preprocesses text"| node_features
node_detector -->|"loads model"| node_artifacts
node_pred_route -.->|"stores results"| node_postgres
node_history_route -->|"reads history"| node_postgres
node_stats_route -->|"queries statistics"| node_postgres
node_root_route -->|"requests evidence"| node_correlator
node_correlator -->|"reads event associations"| node_postgres
node_pred_route -.->|"records predictions"| node_history_data

click node_java_reader "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/App.java"
click node_block_extract "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/BlockIdExtractor.java"
click node_client "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/FastApiClient.java"
click node_api_app "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/main.py"
click node_ingestion_route "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/ingestion.py"
click node_record_schema "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/schemas/ingestion.py"
click node_ingestion_store "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/services/ingestion_store.py"
click node_postgres "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/db/database.py"
click node_traces_route "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/traces.py"
click node_trace_builder "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/services/trace_builder.py"
click node_pred_route "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/predictions.py"
click node_detector "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/services/anomaly_detector.py"
click node_features "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/ml/features/build_masked_tfidf.py"
click node_artifacts "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/data/processed/model_results/isolation_forest_masked/model.joblib"
click node_history_route "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/history.py"
click node_stats_route "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/stats.py"
click node_root_route "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/root_cause.py"
click node_correlator "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/services/root_cause_correlator.py"
click node_history_data "https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/db/schema.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_java_reader,node_block_extract,node_client,node_record_schema toneBlue
class node_trace_builder,node_detector,node_features,node_artifacts,node_correlator toneAmber
class node_api_app,node_ingestion_route,node_traces_route,node_pred_route,node_history_route,node_stats_route,node_root_route toneMint
class node_ingestion_store,node_postgres,node_history_data toneRose
class node_operator,node_csv toneIndigo
```

## Components

### Log ingestion

- [CSV reader and batcher](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/App.java): `ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/App.java`
- [Block ID extractor](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/BlockIdExtractor.java): `ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/BlockIdExtractor.java`
- [FastAPI batch client](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/FastApiClient.java): `ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/FastApiClient.java`
- [Ingestion schemas](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/schemas/ingestion.py): `python-backend/app/schemas/ingestion.py`

### Trace analysis

- [Trace construction](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/services/trace_builder.py): `python-backend/app/services/trace_builder.py`
- [Anomaly detector](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/services/anomaly_detector.py): `python-backend/app/services/anomaly_detector.py`
- [Masked TF-IDF preprocessing](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/ml/features/build_masked_tfidf.py): `python-backend/ml/features/build_masked_tfidf.py`
- [R1 model artifacts](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/data/processed/model_results/isolation_forest_masked/model.joblib): `data/processed/model_results/isolation_forest_masked/model.joblib`
- [Root-cause correlation](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/services/root_cause_correlator.py): `python-backend/app/services/root_cause_correlator.py`

### REST API

- [FastAPI application](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/main.py): `python-backend/app/main.py`
- [Ingestion endpoint](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/ingestion.py): `python-backend/app/api/routes/ingestion.py`
- [Trace build and labeling](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/traces.py): `python-backend/app/api/routes/traces.py`
- [Prediction endpoint](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/predictions.py): `python-backend/app/api/routes/predictions.py`
- [Prediction history](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/history.py): `python-backend/app/api/routes/history.py`
- [Dashboard statistics](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/stats.py): `python-backend/app/api/routes/stats.py`
- [Root-cause endpoint](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/api/routes/root_cause.py): `python-backend/app/api/routes/root_cause.py`

### Persistence

- [Event and block storage](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/services/ingestion_store.py): `python-backend/app/services/ingestion_store.py`
- [PostgreSQL](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/db/database.py): `python-backend/app/db/database.py`
- [Prediction and trace history](https://github.com/whitedevilshri/intelligent-log-analyzer/blob/main/python-backend/app/db/schema.sql): `python-backend/app/db/schema.sql`

### Other components

- **Log operator**
- **Structured log CSV**

## Connections

- Log operator → Structured log CSV: provides logs (evidence: `README.md`)
- CSV reader and batcher → Structured log CSV: reads (evidence: `ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/App.java`)
- CSV reader and batcher → Block ID extractor: extracts IDs (evidence: `ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/App.java`)
- CSV reader and batcher → FastAPI batch client: sends batches (evidence: `ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/App.java`)
- FastAPI batch client → Ingestion endpoint: posts batches (evidence: `ingestion-java/src/main/java/com/intelligentloganalyzer/ingestion/FastApiClient.java`)
- FastAPI application → Ingestion endpoint: registers route (evidence: `python-backend/app/main.py`)
- FastAPI application → Trace build and labeling: registers route (evidence: `python-backend/app/main.py`)
- FastAPI application → Prediction endpoint: registers route (evidence: `python-backend/app/main.py`)
- FastAPI application → Prediction history: registers route (evidence: `python-backend/app/main.py`)
- FastAPI application → Dashboard statistics: registers route (evidence: `python-backend/app/main.py`)
- FastAPI application → Root-cause endpoint: registers route (evidence: `python-backend/app/main.py`)
- Ingestion endpoint → Ingestion schemas: validates payload (evidence: `python-backend/app/api/routes/ingestion.py`)
- Ingestion endpoint → Event and block storage: stores batch (evidence: `python-backend/app/api/routes/ingestion.py`)
- Event and block storage → PostgreSQL: writes and reads (evidence: `python-backend/app/services/ingestion_store.py`)
- Trace build and labeling → Event and block storage: loads records (evidence: `python-backend/app/api/routes/traces.py`)
- Trace build and labeling → Trace construction: builds traces (evidence: `python-backend/app/api/routes/traces.py`)
- Trace construction → Ingestion schemas: uses records (evidence: `python-backend/app/services/trace_builder.py`)
- Prediction endpoint → Anomaly detector: classifies traces (evidence: `python-backend/app/api/routes/predictions.py`)
- Anomaly detector → Masked TF-IDF preprocessing: preprocesses text (evidence: `python-backend/app/services/anomaly_detector.py`)
- Anomaly detector → R1 model artifacts: loads model (evidence: `python-backend/app/services/anomaly_detector.py`)
- Prediction endpoint → PostgreSQL: stores results (evidence: `python-backend/app/api/routes/predictions.py`)
- Prediction history → PostgreSQL: reads history (evidence: `python-backend/app/api/routes/history.py`)
- Dashboard statistics → PostgreSQL: queries statistics (evidence: `python-backend/app/api/routes/stats.py`)
- Root-cause endpoint → Root-cause correlation: requests evidence (evidence: `python-backend/app/api/routes/root_cause.py`)
- Root-cause correlation → PostgreSQL: reads event associations (evidence: `python-backend/app/services/root_cause_correlator.py`)
- Prediction endpoint → Prediction and trace history: records predictions
