search_codes
Resolve dimension values to numeric codes ONS NOMIS fetch_data needs. Search concepts like geography or sex, and use a type code for geography areas.
Instructions
Resolve dimension values to the numeric codes fetch_data needs.
Codes are opaque integers (Bristol, City of is 1778384919 in TYPE424) and cannot be guessed or derived from ONS GSS codes. Always come here first.
Geography needs two steps. Searching geography without a type_code returns the list of geography types for the dataset, because the top of the geography codelist holds only a handful of country nodes and a search there matches nothing and returns success. Pick a type, then search within it:
search_codes('NM_1_1', 'geography') -> type list
search_codes('NM_1_1', 'geography', 'bristol', 'TYPE424')
-> value 1778384919, geog_code E06000023Non-geography dimensions are searched directly, no type_code needed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| concept | Yes | Dimension name exactly as listed by get_dataset_dimensions, e.g. 'geography', 'sex', 'item', 'c2021_sexor_6'. | |
| pattern | No | Text to match, case-insensitive, e.g. 'bristol'. Wildcards are added automatically. Use '*' to list everything. | * |
| type_code | No | Geography type such as 'TYPE424'. Required to search geography areas. Omit to list the available geography types first. | |
| dataset_id | Yes | Dataset id, e.g. NM_1_1 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||