# otimtony/cs523-final-project-big-data architecture

> Architecture diagram of the GitHub repository otimtony/cs523-final-project-big-data, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/otimtony/cs523-final-project-big-data
- Repository: https://github.com/otimtony/cs523-final-project-big-data

## Overview

This repository is a real-time Wikimedia edit analytics pipeline. Its main workflow streams recent-change events into Kafka, processes them into namespace counts and user anomaly flags, stores raw events in HBase, and serves dashboard views from HBase. A separate enrichment job joins stored analytics with namespace labels and writes Hive tables. The README documents HDFS/Parquet outputs, though the sampled streaming processor excerpt does not show those writes; those links are therefore based on the README. The dashboard frontend and Hive schema are also documented but not sampled.

Main entry points: [`bonus/spark_sql_join.py`](https://github.com/otimtony/cs523-final-project-big-data/blob/main/bonus/spark_sql_join.py) (SQL enrichment), [`streaming_processor.py`](https://github.com/otimtony/cs523-final-project-big-data/blob/main/streaming_processor.py) (Stream processor), [`dashboard/server.js`](https://github.com/otimtony/cs523-final-project-big-data/blob/main/dashboard/server.js) (Dashboard API), [`dashboard/public/index.html`](https://github.com/otimtony/cs523-final-project-big-data/blob/main/dashboard/public/index.html) (Dashboard UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Event Ingestion"]
  node_producer["Event producer"]
  node_kafka["Kafka topic"]
end

subgraph group_analytics["Stream Analytics"]
  node_processor["Stream processor"]
  node_window_counts["Namespace counts"]
  node_user_counts["User counts"]
  node_anomalies["Anomaly flags"]
end

subgraph group_storage["Persistence"]
  node_hbase_writer["Raw event writer<br/>[hbase_writer.js]"]
  node_hbase[("HBase tables")]
  node_hdfs[("HDFS Parquet")]
  node_hive[("Hive warehouse")]
  node_hive_schema["Hive schema<br/>[hive_schema.sql]"]
end

subgraph group_presentation["Dashboard and Enrichment"]
  node_dashboard_api["Dashboard API<br/>[server.js]"]
  node_dashboard_ui["Dashboard UI<br/>[index.html]"]
  node_namespace_labels["Namespace labels"]
  node_enrichment["SQL enrichment<br/>[spark_sql_join.py]"]
end

node_wikimedia(("Wikimedia stream"))
node_dashboard_user(("Dashboard user"))

node_wikimedia -->|"streams events"| node_producer
node_producer -->|"publishes events"| node_kafka
node_kafka -->|"streams records"| node_processor
node_kafka -->|"consumes events"| node_hbase_writer
node_processor -->|"groups namespace"| node_window_counts
node_processor -->|"groups users"| node_user_counts
node_user_counts -->|"flags over five"| node_anomalies
node_hbase_writer -->|"writes raw rows"| node_hbase
node_processor -->|"writes Parquet"| node_hdfs
node_hdfs -->|"stores analytics"| node_hive
node_hive_schema -->|"defines tables"| node_hive
node_dashboard_user -->|"views dashboard"| node_dashboard_ui
node_dashboard_ui -->|"requests data"| node_dashboard_api
node_dashboard_api -->|"reads REST tables"| node_hbase
node_dashboard_api -->|"serves files"| node_dashboard_ui
node_enrichment -->|"reads Parquet"| node_hdfs
node_enrichment -->|"reads reference"| node_namespace_labels
node_enrichment -->|"writes result tables"| node_hive
node_enrichment -->|"loads labels from"| node_hdfs
node_enrichment -->|"reads anomalies"| node_hive

click node_producer "https://github.com/otimtony/cs523-final-project-big-data/blob/main/wikimedia_producer.py"
click node_processor "https://github.com/otimtony/cs523-final-project-big-data/blob/main/streaming_processor.py"
click node_window_counts "https://github.com/otimtony/cs523-final-project-big-data/blob/main/streaming_processor.py"
click node_user_counts "https://github.com/otimtony/cs523-final-project-big-data/blob/main/streaming_processor.py"
click node_anomalies "https://github.com/otimtony/cs523-final-project-big-data/blob/main/streaming_processor.py"
click node_hbase_writer "https://github.com/otimtony/cs523-final-project-big-data/blob/main/storage/hbase_writer.js"
click node_hive_schema "https://github.com/otimtony/cs523-final-project-big-data/blob/main/storage/hive_schema.sql"
click node_dashboard_api "https://github.com/otimtony/cs523-final-project-big-data/blob/main/dashboard/server.js"
click node_dashboard_ui "https://github.com/otimtony/cs523-final-project-big-data/blob/main/dashboard/public/index.html"
click node_namespace_labels "https://github.com/otimtony/cs523-final-project-big-data/blob/main/bonus/namespace_labels.csv"
click node_enrichment "https://github.com/otimtony/cs523-final-project-big-data/blob/main/bonus/spark_sql_join.py"

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_producer,node_kafka,node_dashboard_user toneBlue
class node_processor,node_window_counts,node_user_counts,node_anomalies toneAmber
class node_hbase_writer,node_hbase,node_hdfs,node_hive,node_hive_schema toneMint
class node_dashboard_api,node_dashboard_ui,node_namespace_labels,node_enrichment toneRose
class node_wikimedia toneIndigo
```

## Components

### Event Ingestion

- [Event producer](https://github.com/otimtony/cs523-final-project-big-data/blob/main/wikimedia_producer.py): `wikimedia_producer.py`
- **Kafka topic**

### Stream Analytics

- [Stream processor](https://github.com/otimtony/cs523-final-project-big-data/blob/main/streaming_processor.py): `streaming_processor.py`
- [Namespace counts](https://github.com/otimtony/cs523-final-project-big-data/blob/main/streaming_processor.py): `streaming_processor.py`
- [User counts](https://github.com/otimtony/cs523-final-project-big-data/blob/main/streaming_processor.py): `streaming_processor.py`
- [Anomaly flags](https://github.com/otimtony/cs523-final-project-big-data/blob/main/streaming_processor.py): `streaming_processor.py`

### Persistence

- [Raw event writer](https://github.com/otimtony/cs523-final-project-big-data/blob/main/storage/hbase_writer.js): `storage/hbase_writer.js`
- **HBase tables**
- **HDFS Parquet**
- **Hive warehouse**
- [Hive schema](https://github.com/otimtony/cs523-final-project-big-data/blob/main/storage/hive_schema.sql): `storage/hive_schema.sql`

### Dashboard and Enrichment

- [Dashboard API](https://github.com/otimtony/cs523-final-project-big-data/blob/main/dashboard/server.js): `dashboard/server.js`
- [Dashboard UI](https://github.com/otimtony/cs523-final-project-big-data/blob/main/dashboard/public/index.html): `dashboard/public/index.html`
- [Namespace labels](https://github.com/otimtony/cs523-final-project-big-data/blob/main/bonus/namespace_labels.csv): `bonus/namespace_labels.csv`
- [SQL enrichment](https://github.com/otimtony/cs523-final-project-big-data/blob/main/bonus/spark_sql_join.py): `bonus/spark_sql_join.py`

### Other components

- **Wikimedia stream**
- **Dashboard user**

## Connections

- Wikimedia stream → Event producer: streams events (evidence: `wikimedia_producer.py`)
- Event producer → Kafka topic: publishes events (evidence: `wikimedia_producer.py`)
- Kafka topic → Stream processor: streams records (evidence: `streaming_processor.py`)
- Kafka topic → Raw event writer: consumes events (evidence: `storage/hbase_writer.js`)
- Stream processor → Namespace counts: groups namespace (evidence: `streaming_processor.py`)
- Stream processor → User counts: groups users (evidence: `streaming_processor.py`)
- User counts → Anomaly flags: flags over five (evidence: `streaming_processor.py`)
- Raw event writer → HBase tables: writes raw rows (evidence: `storage/hbase_writer.js`)
- Stream processor → HDFS Parquet: writes Parquet (evidence: `README.md`)
- HDFS Parquet → Hive warehouse: stores analytics (evidence: `README.md`)
- Hive schema → Hive warehouse: defines tables (evidence: `README.md`)
- Dashboard user → Dashboard UI: views dashboard (evidence: `README.md`)
- Dashboard UI → Dashboard API: requests data (evidence: `README.md`)
- Dashboard API → HBase tables: reads REST tables (evidence: `dashboard/server.js`)
- Dashboard API → Dashboard UI: serves files (evidence: `dashboard/server.js`)
- SQL enrichment → HDFS Parquet: reads Parquet (evidence: `bonus/spark_sql_join.py`)
- SQL enrichment → Namespace labels: reads reference (evidence: `bonus/spark_sql_join.py`)
- SQL enrichment → Hive warehouse: writes result tables (evidence: `bonus/spark_sql_join.py`)
- SQL enrichment → HDFS Parquet: loads labels from (evidence: `bonus/spark_sql_join.py`)
- SQL enrichment → Hive warehouse: reads anomalies (evidence: `bonus/spark_sql_join.py`)
