Skip to content

wb_search() does not find existing indicators #49

Description

@morrisseyj

wb_search() yields no results for existing indicators ids.

"SH.DTH.COMM.FE.ZS" is a valid id with a working endpoint. See here: https://api.worldbank.org/v2/country/all/indicator/SH.DTH.COMM.FE.ZS?source=14

Yet:

wb_search("SH.DTH.COMM.FE.ZS")
# A tibble: 0 × 3
# ℹ 3 variables: indicator_id <chr>, indicator <chr>, indicator_desc <chr>
Warning message:
In wb_search("SH.DTH.COMM.FE.ZS") :
  no matches were found for the search term SH.DTH.COMM.FE.ZS. Returning an empty data frame.

Notably this works in wb_data():

wb_data("SH.DTH.COMM.FE.ZS") %>% 
  filter(!is.na(SH.DTH.COMM.FE.ZS))
# A tibble: 732 × 9
   iso2c iso3c country      date SH.DTH.COMM.FE.ZS unit  obs_status footnote last_updated
   <chr> <chr> <chr>       <dbl>             <dbl> <chr> <chr>      <chr>    <date>      
 1 AF    AFG   Afghanistan  2000             62.4  NA    NA         NA       2025-03-05  
 2 AF    AFG   Afghanistan  2010             50.3  NA    NA         NA       2025-03-05  
 3 AF    AFG   Afghanistan  2015             42.0  NA    NA         NA       2025-03-05  
 4 AF    AFG   Afghanistan  2019             34.1  NA    NA         NA       2025-03-05  
 5 AO    AGO   Angola       2000             75.4  NA    NA         NA       2025-03-05  
 6 AO    AGO   Angola       2010             68.5  NA    NA         NA       2025-03-05  
 7 AO    AGO   Angola       2015             63.5  NA    NA         NA       2025-03-05  
 8 AO    AGO   Angola       2019             61.6  NA    NA         NA       2025-03-05  
 9 AL    ALB   Albania      2000              8.25 NA    NA         NA       2025-03-05  
10 AL    ALB   Albania      2010              3.14 NA    NA         NA       2025-03-05  
# ℹ 722 more rows
# ℹ Use `print(n = ...)` to see more rows

There also appears to be a problem with the description search as this also yields an empty dataframe:

wb_search("Cause of death, by communicable diseases and maternal, prenatal and nutrition conditions, female")

Expected behavior is that wb_search() searches through all the existing indicators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions