# mohamedgamil27/egx30-data-pipeline architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedgamil27/egx30-data-pipeline
- Repository: https://github.com/mohamedgamil27/egx30-data-pipeline

## Overview

This repository is a daily Egyptian market-data collection pipeline. Users run three independent collectors: an EGX30 index summary from African Markets, listed-company and sector rows from African Markets, and an all-stock screener snapshot from TradingView. Each collector fetches and parses its source, then writes dated CSV and JSON output. Shared HTTP, validation, and atomic-output helpers support those flows. The README also describes an experimental, manual-only official EGX path in the EGX30 collector. Some connections are documented only at the pipeline level; unsampled behavior is not inferred.

Main entry points: [`src/collect_egx30.py`](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_egx30.py) (EGX30 collector), [`src/collect_listed_companies.py`](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_listed_companies.py) (Listed-company collector), [`src/collect_tradingview_egypt_stocks.py`](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_tradingview_egypt_stocks.py) (TradingView collector), [`src/common/output.py`](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/common/output.py) (Atomic output)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection"]
  node_egx_collector["EGX30 collector<br/>[collect_egx30.py]"]
  node_companies_collector["Listed-company collector"]
  node_tv_collector["TradingView collector"]
  node_official_egx["Official EGX experiment<br/>[collect_egx30.py]"]
end

subgraph group_parsing["Source parsing"]
  node_african_egx["African Markets EGX parser"]
  node_african_companies["Companies parser"]
  node_tradingview_parser["TradingView parser"]
end

subgraph group_shared["Shared runtime"]
  node_http["HTTP fetch<br/>[http.py]"]
  node_validation["Value validation<br/>[validation.py]"]
  node_output["Atomic output<br/>[output.py]"]
end

subgraph group_outputs["Daily outputs"]
  node_daily_data["Dated CSV and JSON"]
end

node_user(("Operator"))
node_african_source["African Markets"]
node_tv_source["TradingView"]
node_official_source["Official EGX"]

node_user -->|"runs"| node_egx_collector
node_user -->|"runs"| node_companies_collector
node_user -->|"runs"| node_tv_collector
node_egx_collector -->|"fetches through"| node_http
node_companies_collector -->|"fetches through"| node_http
node_tv_collector -->|"fetches through"| node_http
node_egx_collector -->|"parses with"| node_african_egx
node_companies_collector -->|"parses with"| node_african_companies
node_tv_collector -->|"parses with"| node_tradingview_parser
node_african_egx -->|"uses"| node_validation
node_african_companies -->|"uses"| node_validation
node_tradingview_parser -->|"uses"| node_validation
node_egx_collector -->|"writes through"| node_output
node_companies_collector -->|"writes through"| node_output
node_tv_collector -->|"writes through"| node_output
node_output -->|"writes"| node_daily_data
node_egx_collector -->|"collects from"| node_african_source
node_companies_collector -->|"collects from"| node_african_source
node_tv_collector -->|"collects from"| node_tv_source
node_user -.->|"manually dispatches"| node_official_egx
node_official_egx -.->|"experimental collection"| node_official_source

click node_egx_collector "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_egx30.py"
click node_companies_collector "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_listed_companies.py"
click node_tv_collector "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_tradingview_egypt_stocks.py"
click node_official_egx "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_egx30.py"
click node_african_egx "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/parsers/african_markets_egx.py"
click node_african_companies "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/parsers/african_markets_companies.py"
click node_tradingview_parser "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/parsers/tradingview_egypt.py"
click node_http "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/common/http.py"
click node_validation "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/common/validation.py"
click node_output "https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/common/output.py"
click node_daily_data "https://github.com/mohamedgamil27/egx30-data-pipeline/tree/main/data"

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_egx_collector,node_companies_collector,node_tv_collector,node_official_egx,node_tv_source toneBlue
class node_african_egx,node_african_companies,node_tradingview_parser toneAmber
class node_http,node_validation,node_output toneMint
class node_daily_data toneRose
class node_user,node_african_source,node_official_source toneIndigo
```

## Components

### Collection

- [EGX30 collector](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_egx30.py): `src/collect_egx30.py`
- [Listed-company collector](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_listed_companies.py): `src/collect_listed_companies.py`
- [TradingView collector](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_tradingview_egypt_stocks.py): `src/collect_tradingview_egypt_stocks.py`
- [Official EGX experiment](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/collect_egx30.py): `src/collect_egx30.py`

### Source parsing

- [African Markets EGX parser](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/parsers/african_markets_egx.py): `src/parsers/african_markets_egx.py`
- [Companies parser](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/parsers/african_markets_companies.py): `src/parsers/african_markets_companies.py`
- [TradingView parser](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/parsers/tradingview_egypt.py): `src/parsers/tradingview_egypt.py`

### Shared runtime

- [HTTP fetch](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/common/http.py): `src/common/http.py`
- [Value validation](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/common/validation.py): `src/common/validation.py`
- [Atomic output](https://github.com/mohamedgamil27/egx30-data-pipeline/blob/main/src/common/output.py): `src/common/output.py`

### Daily outputs

- [Dated CSV and JSON](https://github.com/mohamedgamil27/egx30-data-pipeline/tree/main/data): `data`

### Other components

- **Operator**
- **African Markets**
- **TradingView**
- **Official EGX**

## Connections

- Operator → EGX30 collector: runs (evidence: `README.md`)
- Operator → Listed-company collector: runs (evidence: `README.md`)
- Operator → TradingView collector: runs (evidence: `README.md`)
- EGX30 collector → HTTP fetch: fetches through (evidence: `src/collect_egx30.py`)
- Listed-company collector → HTTP fetch: fetches through (evidence: `src/collect_listed_companies.py`)
- TradingView collector → HTTP fetch: fetches through (evidence: `src/collect_tradingview_egypt_stocks.py`)
- EGX30 collector → African Markets EGX parser: parses with (evidence: `src/collect_egx30.py`)
- Listed-company collector → Companies parser: parses with (evidence: `src/collect_listed_companies.py`)
- TradingView collector → TradingView parser: parses with (evidence: `src/collect_tradingview_egypt_stocks.py`)
- African Markets EGX parser → Value validation: uses (evidence: `src/parsers/african_markets_egx.py`)
- Companies parser → Value validation: uses (evidence: `src/parsers/african_markets_companies.py`)
- TradingView parser → Value validation: uses (evidence: `src/parsers/tradingview_egypt.py`)
- EGX30 collector → Atomic output: writes through (evidence: `src/collect_egx30.py`)
- Listed-company collector → Atomic output: writes through (evidence: `src/collect_listed_companies.py`)
- TradingView collector → Atomic output: writes through (evidence: `src/collect_tradingview_egypt_stocks.py`)
- Atomic output → Dated CSV and JSON: writes (evidence: `src/common/output.py`)
- EGX30 collector → African Markets: collects from (evidence: `README.md`)
- Listed-company collector → African Markets: collects from (evidence: `README.md`)
- TradingView collector → TradingView: collects from (evidence: `README.md`)
- Operator → Official EGX experiment: manually dispatches (evidence: `README.md`)
- Official EGX experiment → Official EGX: experimental collection (evidence: `README.md`)
