Skip to content
Proyek

Mohith-akash/Global-News-Intel-Platform

Lihat di GitHub

Tentang

Geopolitical news platform on GDELT: 30M+ events, about 100K added daily. Polars, Dagster and Great Expectations load MotherDuck hourly, dbt builds tested marts weekly; AI chat answers with RAG and SQL. Free-tier infrastructure plus a few dollars a month of LLM credits.

Data dan analisis

Cara angka ini diukur

Yang dapat Anda lakukan

  • Dashboard (updated hourly) - Metrics, trending news, sentiment, geographic distribution
  • Emotion analytics - GKG tone, WordNet Affect emotions per 1,000 words, trending topics, mood index
  • AI chat - Two modes: RAG (keyword and vector search in one query batch) and a SQL mode that routes questions to tested query templates; Cerebras writes the answer, cached for an hour
  • LLM headline repair - Cerebras batch job fixes slug-derived headlines (casing, keyword stuffing) with hallucination guards

Pertumbuhan bintang terukur

dalam 24 jam
0
dalam 7 hari
0
dalam 15 hari
0
dalam 1 bulan
Mengumpulkan riwayat

Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.

README.md

Asli

Global News Intelligence Platform

Pipeline

Serverless ELT pipeline that ingests, processes, and visualizes about 100,000 global news events a day from the GDELT Project, with an AI chat interface for natural-language queries.

Live dashboard: https://global-news-intel-platform.streamlit.app/

Metric Value
Cumulative events processed 30M+
Daily ingestion 100K+ events
Live operation Since December 2025, scheduled hourly runs
Unique visitors 9,000+ since launch (Streamlit Cloud analytics), no promotion
Coverage 200+ countries, 100+ languages
Typical query latency < 1 second
Monthly cost $0 infrastructure, a few dollars of LLM credits

GDELT monitors news media from nearly every country in 100+ languages, identifying the people, locations, themes, and emotions driving global society.

Architecture

              ┌──────────────┐          ┌──────────────┐
              │ GDELT Events │          │  GDELT GKG   │
              └──────┬───────┘          └──────┬───────┘
                     │                         │
                     └────────────┬────────────┘
                                  ▼
┌─────────────────────────────────────────────────────────────────────────┐
│  INGESTION (hourly; each run re-pulls 24h of 15-min files, dedup by ID)  │
│  GitHub Actions → Dagster → Polars → Great Expectations (GX) checks      │
└─────────────────────────────────────────────────────────────────────────┘
                                  │
                                  ▼
┌─────────────────────────────────────────────────────────────────────────┐
│  TRANSFORMATION                                                          │
│  dbt Core: staging (stg_events) → marts (fct_daily, dim_actors, etc.)    │
└─────────────────────────────────────────────────────────────────────────┘
                                  │
                                  ▼
┌─────────────────────────────────────────────────────────────────────────┐
│  STORAGE & AI                                                            │
│  MotherDuck (DWH) ← Voyage AI (embeddings) → Cerebras LLM (RAG/SQL)      │
│  └── gkg_emotions: tone, WordNet Affect emotions, topics                 │
└─────────────────────────────────────────────────────────────────────────┘
                                  │
                                  ▼
┌─────────────────────────────────────────────────────────────────────────┐
│  PRESENTATION                                                            │
│  Streamlit: Overview | Feed | Emotions | Ask AI | About                  │
└─────────────────────────────────────────────────────────────────────────┘

Data flow

  1. Extract: GDELT Events API + GKG feed, parsed with Polars
  2. Validate: Great Expectations suite (required columns, null keys, value ranges, batch size) before anything is written
  3. Load: inserts into MotherDuck (serverless DuckDB) that skip rows already stored; the check runs inside the warehouse, and a failed load fails the run
  4. Transform: dbt builds staging views (deduplicated events, cleaned GKG) and five mart tables, then runs 30+ tests and a source freshness check, weekly in GitHub Actions
  5. Emotions: GKG tone, topics and 11 emotions from GCAM's WordNet Affect dictionary (words per 1,000), shown for a rolling 24h window
  6. Embed: Voyage AI generates 1024-dim vectors every 12 hours
  7. Serve: Streamlit dashboard with dual-mode AI chat (SQL + RAG)

Cost engineering

The pipeline started on a Snowflake trial. When the trial ended, the warehouse moved to MotherDuck and the slowest processing stage was rewritten from Pandas to Polars (91s down to 6s on 116K rows), bringing the infrastructure cost to $0 on free tiers, without giving up SQL compatibility, orchestration, testing, or vector search. MotherDuck's native array_cosine_similarity() also removed the need for a separate vector database. The one running cost is LLM credits: the headline job and the AI chat use a few dollars of Cerebras credits a month.

Other decisions that changed along the way: the LLM provider went from Gemini to Groq to Cerebras (fast inference, pay-as-you-go credits; currently GPT-OSS 120B after Cerebras archived Llama 3.1). LLM calls first went through LlamaIndex. They now go straight to the API, because the wrapper sent no output limit and a reasoning model bills its hidden reasoning as output tokens. The SQL chat also started with the LLM writing the query (LlamaIndex NLSQLTableQueryEngine). It got GDELT's conventions wrong (dates as YYYY-MM-DD instead of YYYYMMDD, the wrong year, 2-letter instead of 3-letter country codes), so questions are now routed to tested query templates and the LLM only writes the answer from the results.

The emotions tab had its own correction: the first GCAM mapping read Roget's Thesaurus categories (c9.) and GKG theme counts (c18.) as emotions, so "fear" dominated every day. Checked against GDELT's GCAM codebook, it now reads the WordNet Affect dictionary (c15.*) and divides by each article's word count.

Features

Feature Description
Dashboard (updated hourly) Metrics, trending news, sentiment, geographic distribution
Emotion analytics GKG tone, WordNet Affect emotions per 1,000 words, trending topics, mood index
AI chat Two modes: RAG (keyword and vector search in one query batch) and a SQL mode that routes questions to tested query templates; Cerebras writes the answer, cached for an hour
LLM headline repair Cerebras batch job fixes slug-derived headlines (casing, keyword stuffing) with hallucination guards
Hourly updates GitHub Actions cron → Dagster job
Data quality gates Great Expectations suite on every ingestion run, before load
Trend analysis 30-day time series, intensity tracking, actor monitoring

Screenshots

Home: KPIs and trending news

Dashboard Home

Emotions: GKG mood analysis

Emotions Tab

AI chat: natural-language queries

AI Chat

RAG chat: semantic analysis of world events

RAG Chat

Tech stack

Layer Tool Role
Processing Polars DataFrame processing (replaced Pandas in the hot path)
Transformation dbt Core Staging/marts models, schema tests, weekly build in GitHub Actions
Validation Great Expectations (GX Core) Expectation suite run at ingestion
Orchestration Dagster Asset-based pipeline definitions
Scheduling GitHub Actions hourly ingestion, 12-hour embeddings, health monitor
Warehouse MotherDuck (DuckDB) Serverless OLAP storage + native vector search
LLM Cerebras (GPT-OSS 120B) Chat answers and headline repair, direct API calls with an output cap
Embeddings Voyage AI 1024-dim vectors for semantic search
Frontend Streamlit + Plotly Dashboard and charts

Quick start

Requires Python 3.10+, a free MotherDuck account, and a free Cerebras API key.

git clone https://github.com/Mohith-akash/Global-News-Intel-Platform.git
cd Global-News-Intel-Platform

python -m venv venv
source venv/bin/activate        # Windows: .\venv\Scripts\activate
pip install -r requirements.txt

Create a .env file in the project root:

MOTHERDUCK_TOKEN=your_motherduck_token
CEREBRAS_API_KEY=your_cerebras_api_key
VOYAGE_API_KEY=your_voyage_api_key   # optional: enables RAG mode

Run the dashboard:

streamlit run app.py

Run the pipeline manually:

# Ingestion (normally triggered hourly), needs the ETL extras
pip install -r requirements-etl.txt
python -m dagster job execute -f etl/pipeline_polars.py -j gdelt_ingestion_job

# Embedding generation (normally every 12 hours)
python -m dagster job execute -f etl/embedding_job.py -j gdelt_embedding_job

# dbt models + tests (MOTHERDUCK_TOKEN must be set)
cd dbt && dbt build --profiles-dir .

Project structure

gdelt_project/
├── app.py                    # Streamlit dashboard entry point
├── src/
│   ├── config.py             # Configuration constants
│   ├── database.py           # Query worker calls, circuit breaker
│   ├── queries.py            # Dashboard queries (one cached batch)
│   ├── sql_templates.py      # SQL chat templates (bound parameters)
│   ├── ai_engine.py          # Cerebras client (direct API, capped output)
│   ├── rag_engine.py         # RAG engine (Voyage AI + vector search)
│   ├── data_processing.py    # Headline extraction
│   ├── utils.py              # Question parsing, country names, severity scale
│   └── styles.py             # Loads assets/style.css
├── etl/
│   ├── pipeline_polars.py    # Polars ingestion + validation (Dagster)
│   ├── embedding_job.py      # 12-hour embedding generation
│   └── headline_polish_job.py# 12-hour LLM headline repair (Cerebras)
├── dbt/
│   ├── dbt_project.yml
│   ├── profiles.yml          # MotherDuck connection
│   └── models/
│       ├── staging/          # stg_events, stg_gkg_emotions
│       └── marts/            # fct_daily_events, dim_actors, dim_countries, ...
├── components/               # Streamlit tabs; ui.py holds the shared card/metric/chart helpers
├── md_worker.py              # Subprocess that runs MotherDuck queries
├── scripts/                  # One-off maintenance (fix_gkg_emotions.py)
├── tests/                    # pytest: snapshots, chat SQL, worker errors, ingest
└── .github/workflows/
    ├── gdelt_ingest.yml          # hourly ingestion
    ├── gdelt_embeddings_12hr.yml # 12-hour embedding job
    ├── dbt_build.yml             # weekly dbt build + tests
    ├── tests.yml                 # pytest on push
    └── health_monitor.yml        # Uptime checks, outage issue alerts

License

MIT license, see LICENSE.

Data sourced from the GDELT Project. Built by Mohith Akash · LinkedIn

Jelajahi proyek terkait

Memuat…