get_country_ranking
Retrieve top and bottom country rankings for a UNESCO UIS indicator. Uses dense ranking to show tied countries at the same rank for a specific year.
Instructions
Rank countries (not regions) by their value for a UNESCO UIS indicator.
Returns the top-N and bottom-N countries for a given indicator in a specific year. Uses dense ranking (tied countries share the same rank).
Year handling:
strict_year=True (default): year must be provided explicitly.
strict_year=False and year omitted: uses the year with the most country coverage.
Args: indicator_code: The indicator code (e.g. "LR.AG15T99"). year: Optional. The year to rank countries for. If omitted, the year with the most data points is used only when strict_year=False. top_n: Number of top-ranked countries to return (default 10, max 200). bottom_n: Number of bottom-ranked countries to return (default 10, max 200). strict_year: If True, require an explicit year to avoid implicit year selection.
Returns: A dictionary with: - "indicator_code", "indicator_name": Indicator identity. - "year_used": The year the ranking is based on. - "total_countries_with_data": Countries with non-null values that year. - "top": [{rank, code, name, value}, ...] — highest-value countries. - "bottom": [{rank, code, name, value}, ...] — lowest-value countries. - "note": Context (e.g. year selection rationale, overlap explanation).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| indicator_code | Yes | ||
| year | No | ||
| top_n | No | ||
| bottom_n | No | ||
| strict_year | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||