Storywrangler
Navigation

Term Series

get /wikimedia/term-series

Per-date time series for a single n-gram term within one entity (country).

Returns counts, rank, and optionally top contributing Wikipedia articles for each date.

Fast path (~20-70ms): point lookups on precomputed sorted Parquet files for ~65K vocabulary terms. Slow fallback (~3-5s): daily partition scan for arbitrary terms not in the precomputed vocabulary. Set include_articles=false for sparkline-only responses (~20ms, no top_articles field).

Query Parameters

entity string required

Global entity ID, e.g. 'wikidata:Q30'

type string required

The n-gram term to look up, e.g. 'Trump'. Case-sensitive.

date

End date (YYYY-MM-DD). Defaults to latest available.

window integer

Number of days to look back from date. 0 = full history.

granularity string

Hive granularity: daily | weekly | monthly

n integer

N-gram size (1 = unigrams, 2 = bigrams)

include_articles boolean

Include top_articles in response (set false for sparkline-only, ~2x faster)

sparkline_dataset string

Registry dataset_id for the sparkline precomputed data (default: 'sparklines').

Response

type string

The n-gram term that was looked up (echoed back).

latest_available_date string

Most recent date with data for this entity (YYYY-MM-DD). Use this to default the date picker in the UI.

series array

Time series entries, one per date, sorted chronologically.

curl -X GET http://localhost:8000/wikimedia/term-series \