What to build
A new exported function list_country_shapes() that reads inst/wb_shapes_registry.yaml (Inf-2) and returns a tibble of available countries and admin levels. Parallel in design to the existing list_hex_vars().
Offline-capable — no network call. The deployer calls this at the start of 01-shapes.qmd to discover what ISO-3 codes and admin levels are queryable via get_country_shapes().
Signature and return value
Returns a tibble with one row per (country × admin level):
| Column |
Type |
Notes |
iso3 |
character |
ISO-3 country code |
country_name |
character |
English country name |
admin_level |
integer |
0, 1, or 2 |
level_name |
character |
Human-readable label, e.g. "Province", "District" |
available |
logical |
TRUE if present in parquet |
last_updated |
Date |
Date of last ETL run for this country |
Usage in template
# Browse all available countries
list_country_shapes()
# Filter to a specific country
list_country_shapes() |>
dplyr::filter(iso3 == "RWA")
# Find all countries with admin2 coverage
list_country_shapes() |>
dplyr::filter(admin_level == 2, available)
Implementation notes
- Reads bundled YAML via internal
read_shapes_registry()
- No network dependency
@family data-input (same family group as list_hex_vars())
- Roxygen examples must pass
devtools::check() without network access
Acceptance criteria
Blocked by
#146 (Inf-2) — requires the registry YAML to be present.
What to build
A new exported function
list_country_shapes()that readsinst/wb_shapes_registry.yaml(Inf-2) and returns a tibble of available countries and admin levels. Parallel in design to the existinglist_hex_vars().Offline-capable — no network call. The deployer calls this at the start of
01-shapes.qmdto discover what ISO-3 codes and admin levels are queryable viaget_country_shapes().Signature and return value
Returns a tibble with one row per (country × admin level):
iso3country_nameadmin_levellevel_nameavailablelast_updatedUsage in template
Implementation notes
read_shapes_registry()@family data-input(same family group aslist_hex_vars())devtools::check()without network accessAcceptance criteria
list_country_shapes()is exported and documenteddevtools::check()examples pass headlesslyBlocked by
#146 (Inf-2) — requires the registry YAML to be present.