Logo Lanfrica

temeawoke/Telegram_Medical_Analytics_API

Domain:

healthcare

Record type:

software
Creator:
tem
Host:
An end-to-end data product that scrapes public Telegram channels for Ethiopian medical-related content, extracts and enriches product data using object detection (YOLO), transforms it via dbt, and serves it through an analytical API. # Telegram Medical Analytics API This project extracts and transforms Telegram messages and media from Ethiopian medical-related Telegram channels using dbt and Python. It supports analytics and ML use cases like object detection and sentiment analysis. --- ## βœ… Features - Scrape raw Telegram messages and images - Store unprocessed JSON files in a data lake - Load raw data into PostgreSQL (raw schema) - Transform data using dbt into a clean star schema: - `dim_channels` - `dim_dates` - `fct_messages` - Built-in dbt tests and documentation --- ## πŸ“ Project Structure ``` telegram-medical-analytics-api/ β”œβ”€β”€ data/ β”‚ └── raw/ β”‚ β”œβ”€β”€ telegram_messages/ β”‚ β”‚ └── YYYY-MM-DD/ β”‚ β”‚ └── channel_name.json β”‚ └── images/ β”‚ └── channel_msgid.jpg β”œβ”€β”€ telegram_scraping_task1.ipynb β”œβ”€β”€ load_json_to_postgres.py β”œβ”€β”€ telegram_dbt/ β”‚ β”œβ”€β”€ models/ β”‚ β”‚ β”œβ”€β”€ staging/ β”‚ β”‚ β”‚ └── stg_telegram_messages.sql β”‚ β”‚ β”œβ”€β”€ marts/ β”‚ β”‚ β”‚ β”œβ”€β”€ dim/ β”‚ β”‚ β”‚ β”‚ └── dim_channels.sql β”‚ β”‚ β”‚ β”‚ └── dim_dates.sql β”‚ β”‚ β”‚ └── fct/ β”‚ β”‚ β”‚ └── fct_messages.sql β”‚ β”‚ └── schema.yml β”œβ”€β”€ .env β”œβ”€β”€ .gitignore └── README.md ``` --- ## πŸ› οΈ Setup Instructions ### 1. Virtual Environment ```bash python -m venv env env\Scripts\activate # Windows ``` ### 2. Install Python Requirements ```bash pip install -r requirements.txt ``` ### 3. Install dbt ```bash pip install dbt-postgres ``` ### 4. Create `.env` ```env TELEGRAM_API_ID=23786461 TELEGRAM_API_HASH=a442d356a70cb78b21df5af9a84dffb7 DB_NAME=medical_data DB_USER=admin DB_PASSWORD=secret DB_HOST=localhost DB_PORT=5432 ``` --- ## πŸ§ͺ Run Scripts ### Load Raw JSON into PostgreSQL ```bash python load_json_to_postgres.py ``` ### dbt Workflow ```bash cd telegram_dbt dbt run dbt test dbt docs generate dbt docs serve ``` --- ## βœ… Tests in dbt - `unique` and `not_null` on message IDs and timestamps - Custom test: no future-dated messages --- ## πŸ“¬ Contact For suggestions or …

Languages

Licenses