Skip to main content

EconLens 🔎

Find precise, current real-world news examples for any IB Economics concept — ranked, explainable, and offline-first.

PyPI Python IB Economics BM25 MIT


The hardest marks on IB Economics Paper 1 (b) — the 15-mark Evaluate / Discuss / Examine questions — reward real-world examples (RWE). EconLens turns any syllabus concept into a ranked list of current news stories you can cite, with the date, source, and a link back to the original article.

$ econlens news inflation

🔎 Inflation  [macro/inflation]
   1. [13.6] US inflation rose at fastest pace in three years as energy costs surge
          2026-05-28 · The Guardian — Economics
          https://www.theguardian.com/business/2026/may/28/...
   2. [ 4.0] US PCE inflation rate hits three-year high …
   ...
   see also: monetary_policy, interest_rates, deflation

Why it's different

  • 🎯 Precise, not a keyword dump — each concept has a hand-tuned keyword set (must / boost / exclude), so "minimum wage" never returns "minimum balance".
  • 🔬 Explainable — classic Okapi BM25 ranking with title-field weighting. Run with --why to see exactly which keywords and how recent each result is. Fully deterministic: the same news yields the same ranking, every time.
  • 🕒 Recency-aware — RWE must be current, so fresher stories get a bounded, half-life recency bonus, and --since 30d trims the search to a window.
  • 🆓 Offline-first & free — pulls from key-less sources (economics RSS feeds + the free GDELT news API), fetched concurrently so the wait is the slowest single source, not their sum. An optional NewsAPI key adds coverage but is never required.
  • 🤖 Scriptable — --json emits structured results (status on stderr) so you can pipe EconLens into other tools.
  • 🧩 Data-driven — concepts live in a YAML ontology; contributors extend coverage by editing data, not code. The schema reserves a course field so other curricula (A-Level, AP) can be added later.
  • 🔒 Copyright-safe — only the headline, link, date, and source are stored; article bodies are never copied. Results always link to the original.

Quickstart

pip install econlens

Or from source:

git clone https://github.com/HarryXin0919/econlens.git
cd econlens
pip install -e .          # add .[dev] for tests

# list the concepts (35 across micro / macro / global / development)
econlens concepts
econlens concepts --unit macro

# find real-world examples for a concept
econlens news minimum_wage
econlens news tariffs --why            # show which keywords + how recent each match is
econlens news inflation --since 30d    # only stories from the last 30 days (also 2w, 3m, 1y)
econlens news inflation --no-gdelt     # RSS only (faster; skips the slower GDELT API)
econlens news tariffs --json           # structured output for piping into other tools

GDELT can take 10–20 s and feeds occasionally hiccup; EconLens fetches every source concurrently, with a per-source timeout and retries, so one slow source never sinks the search.

Concepts covered (v0.2)

35 core IB Economics concepts:

Unit Examples
Micro PED/PES, market failure, externalities, carbon/sugar tax, subsidies, minimum wage, price floors, monopoly, oligopoly, competition policy, labour markets
Macro inflation, deflation, interest rates, monetary & fiscal policy, government debt, unemployment, economic growth, supply-side policy
Global free trade, protectionism, tariffs, exchange rates, balance of payments
Development economic development, poverty & inequality, foreign aid

Add more by editing econlens/data/ontology.yaml — see CONTRIBUTING.md.

Optional: more sources via NewsAPI

The free GDELT + RSS sources need no setup. To also query NewsAPI (free tier: 100 requests/day, non-commercial), copy config.example.py to config_local.py and add your key, or set the NEWSAPI_KEY environment variable. config_local.py is git-ignored and never committed.

Roadmap

  • Phase 1 — concept ontology + multi-source fetch + BM25 ranking (econlens news)
  • v0.2 — recency-aware ranking, concurrent fetch, --since / --json
  • Phase 2 — syllabus-organised practice questions (econlens questions)
  • Phase 3 — spaced-repetition review (SM-2) (econlens review)
  • Phase 4 — optional Streamlit web UI

Design & contributing

The ranking model, ontology design, and source handling are documented in docs/DESIGN.md. To add concepts, keywords, or news sources, see CONTRIBUTING.md.

License

MIT — see LICENSE.

Metadata

Release files for econlens 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for econlens 0.2.1
File Size Uploaded Provenance Actions
econlens-0.2.1.tar.gz 25.9 kB With provenance Details for econlens-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for econlens 0.2.1
File Interpreter ABI Platform Actions
econlens-0.2.1-py3-none-any.whl Python 3 none any Details for econlens-0.2.1-py3-none-any.whl

Total release size: 48.9 kB

Release files / econlens-0.2.1.tar.gz

Download URL econlens-0.2.1.tar.gz
Size 25.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4d49362ffa09e320d520a464a88aa0396e09744a8416c94a7993c00116c5db8a
BLAKE2b-256 checksum
How to use checksums
510862dc95cfa1738074f3a59ab46ee25b0d850a9bd9b5a934c44cd839f37109
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Release files / econlens-0.2.1-py3-none-any.whl

Download URL econlens-0.2.1-py3-none-any.whl
Size 23.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8ee6cebfb26338fa9d98fddbef9e6e3e29441d53c524683f565f272d391eedf
BLAKE2b-256 checksum
How to use checksums
a5afea1381f6b2237da1b1d859bac5f919ea7e3f693627b767c229fc51d23049
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

Security for econlens 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for econlens-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 13, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page