# sobdurated/com6064-pipeline architecture

> Architecture diagram of the GitHub repository sobdurated/com6064-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sobdurated/com6064-pipeline
- Repository: https://github.com/sobdurated/com6064-pipeline

## Overview

This is a Turkish social-post data-processing pipeline, runnable locally or through a dashboard-facing server. Its principal workflow fetches posts, preprocesses text, runs transformer and LLM sentiment analysis, then supports geospatial output and province-level aggregation. The runner dynamically executes the steps in order and shares a MongoDB context. The graph preserves documented stages and server capabilities; some step internals and their database interactions were not shown, so uncertain links are omitted or marked unverified.

Main entry points: [`pipeline.py`](https://github.com/sobdurated/com6064-pipeline/blob/main/pipeline.py) (Pipeline Runner), [`preprocess.py`](https://github.com/sobdurated/com6064-pipeline/blob/main/preprocess.py) (Text Preprocessing), [`server.py`](https://github.com/sobdurated/com6064-pipeline/blob/main/server.py) (Run and Log Server), [`sentiment_analysis.py`](https://github.com/sobdurated/com6064-pipeline/blob/main/sentiment_analysis.py) (Transformer Sentiment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Pipeline Control"]
  node_server["Run and Log Server<br/>[server.py]"]
  node_runner["Pipeline Runner<br/>[pipeline.py]"]
end

subgraph group_collection["Collection and Preparation"]
  node_fetch["Post Fetch<br/>[fetch.py]"]
  node_preprocess["Text Preprocessing<br/>[preprocess.py]"]
  node_cleaner["Turkish Text Cleaner<br/>[preprocess.py]"]
end

subgraph group_analysis["Sentiment Analysis"]
  node_transformer["Transformer Sentiment"]
  node_llm["LLM Sentiment"]
end

subgraph group_results["Geospatial and Aggregation"]
  node_geospatial["Geospatial Output<br/>[geospatial.py]"]
  node_aggregation["Sentiment Aggregation"]
end

node_dashboard(("Dashboard Client"))
node_mongo[("MongoDB")]
node_serper["Serper Search API"]
node_ngrok["ngrok Tunnel"]

node_dashboard -->|"triggers runs"| node_server
node_server -->|"launches subprocess"| node_runner
node_runner -->|"executes"| node_fetch
node_runner -->|"executes"| node_preprocess
node_runner -->|"executes"| node_transformer
node_runner -->|"executes"| node_llm
node_runner -->|"executes"| node_geospatial
node_runner -->|"executes"| node_aggregation
node_fetch -->|"queries"| node_serper
node_fetch -->|"passes output"| node_preprocess
node_preprocess -->|"cleans text"| node_cleaner
node_preprocess -->|"reads and writes posts"| node_mongo
node_preprocess -->|"passes output"| node_transformer
node_transformer -->|"passes output"| node_llm
node_transformer -->|"updates sentiment"| node_mongo
node_llm -->|"passes output"| node_geospatial
node_llm -.->|"uses post records"| node_mongo
node_geospatial -->|"updates and reads posts"| node_mongo
node_geospatial -->|"passes output"| node_aggregation
node_aggregation -->|"reads posts, upserts aggregates"| node_mongo
node_server -->|"streams run status and logs"| node_dashboard
node_server -->|"optionally exposes"| node_ngrok

click node_server "https://github.com/sobdurated/com6064-pipeline/blob/main/server.py"
click node_runner "https://github.com/sobdurated/com6064-pipeline/blob/main/pipeline.py"
click node_fetch "https://github.com/sobdurated/com6064-pipeline/blob/main/fetch.py"
click node_preprocess "https://github.com/sobdurated/com6064-pipeline/blob/main/preprocess.py"
click node_cleaner "https://github.com/sobdurated/com6064-pipeline/blob/main/preprocess.py"
click node_transformer "https://github.com/sobdurated/com6064-pipeline/blob/main/sentiment_analysis.py"
click node_llm "https://github.com/sobdurated/com6064-pipeline/blob/main/sentiment_analysis_llm.py"
click node_geospatial "https://github.com/sobdurated/com6064-pipeline/blob/main/geospatial.py"
click node_aggregation "https://github.com/sobdurated/com6064-pipeline/blob/main/sentiment_aggregation.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_server,node_runner,node_dashboard toneBlue
class node_fetch,node_preprocess,node_cleaner,node_mongo toneAmber
class node_transformer,node_llm,node_serper toneMint
class node_geospatial,node_aggregation toneRose
class node_ngrok toneIndigo
```

## Components

### Pipeline Control

- [Run and Log Server](https://github.com/sobdurated/com6064-pipeline/blob/main/server.py): `server.py`
- [Pipeline Runner](https://github.com/sobdurated/com6064-pipeline/blob/main/pipeline.py): `pipeline.py`

### Collection and Preparation

- [Post Fetch](https://github.com/sobdurated/com6064-pipeline/blob/main/fetch.py): `fetch.py`
- [Text Preprocessing](https://github.com/sobdurated/com6064-pipeline/blob/main/preprocess.py): `preprocess.py`
- [Turkish Text Cleaner](https://github.com/sobdurated/com6064-pipeline/blob/main/preprocess.py): `preprocess.py`

### Sentiment Analysis

- [Transformer Sentiment](https://github.com/sobdurated/com6064-pipeline/blob/main/sentiment_analysis.py): `sentiment_analysis.py`
- [LLM Sentiment](https://github.com/sobdurated/com6064-pipeline/blob/main/sentiment_analysis_llm.py): `sentiment_analysis_llm.py`

### Geospatial and Aggregation

- [Geospatial Output](https://github.com/sobdurated/com6064-pipeline/blob/main/geospatial.py): `geospatial.py`
- [Sentiment Aggregation](https://github.com/sobdurated/com6064-pipeline/blob/main/sentiment_aggregation.py): `sentiment_aggregation.py`

### Other components

- **Dashboard Client**
- **MongoDB**
- **Serper Search API**
- **ngrok Tunnel**

## Connections

- Dashboard Client → Run and Log Server: triggers runs (evidence: `server.py`)
- Run and Log Server → Pipeline Runner: launches subprocess (evidence: `server.py`)
- Pipeline Runner → Post Fetch: executes (evidence: `pipeline.py`)
- Pipeline Runner → Text Preprocessing: executes (evidence: `pipeline.py`)
- Pipeline Runner → Transformer Sentiment: executes (evidence: `pipeline.py`)
- Pipeline Runner → LLM Sentiment: executes (evidence: `pipeline.py`)
- Pipeline Runner → Geospatial Output: executes (evidence: `pipeline.py`)
- Pipeline Runner → Sentiment Aggregation: executes (evidence: `pipeline.py`)
- Post Fetch → Serper Search API: queries (evidence: `fetch.py`)
- Post Fetch → Text Preprocessing: passes output
- Text Preprocessing → Turkish Text Cleaner: cleans text (evidence: `preprocess.py`)
- Text Preprocessing → MongoDB: reads and writes posts (evidence: `preprocess.py`)
- Text Preprocessing → Transformer Sentiment: passes output
- Transformer Sentiment → LLM Sentiment: passes output
- Transformer Sentiment → MongoDB: updates sentiment (evidence: `sentiment_analysis.py`)
- LLM Sentiment → Geospatial Output: passes output
- LLM Sentiment → MongoDB: uses post records
- Geospatial Output → MongoDB: updates and reads posts (evidence: `geospatial.py`)
- Geospatial Output → Sentiment Aggregation: passes output
- Sentiment Aggregation → MongoDB: reads posts, upserts aggregates (evidence: `sentiment_aggregation.py`)
- Run and Log Server → Dashboard Client: streams run status and logs (evidence: `server.py`)
- Run and Log Server → ngrok Tunnel: optionally exposes (evidence: `server.py`)
