Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

row_filters doesn't work in an odd scenario #15

Open
Moohan opened this issue Aug 4, 2023 · 0 comments
Open

row_filters doesn't work in an odd scenario #15

Moohan opened this issue Aug 4, 2023 · 0 comments
Labels
CKAN issue Issue with CKAN instance rather than code

Comments

@Moohan
Copy link
Member

Moohan commented Aug 4, 2023

I'm trying to extract HB pops using this code:

all <- get_resource(
  res_id = "27a72cc8-d6d8-430c-8b4f-3109a9ceadb1",
  row_filters = list("Sex" = "All"),
  col_select = c("Year", "HB", "AllAges", "Sex")
)

However it just returns an empty tibble i.e. the request was successful, it just didn't return any data.

Weirdly the row_filters works fine for "Male" (or "Female")

male <- get_resource(
  res_id = "27a72cc8-d6d8-430c-8b4f-3109a9ceadb1",
  row_filters = list("Sex" = "Male"),
  col_select = c("Year", "HB", "AllAges", "Sex")
)

I can also return all the data and then filter in which case Sex == "All" works.

all_after <- get_resource(
  res_id = "27a72cc8-d6d8-430c-8b4f-3109a9ceadb1",
  col_select = c("Year", "HB", "AllAges", "Sex")
) |>
  dplyr::filter(Sex == "All")

I'm wondering if this is possibly an issue with CKAN / the data as phsopendata seems to be generating the correct API query in both cases.
All - https://www.opendata.nhs.scot/api/3/action/datastore_search?id=27a72cc8-d6d8-430c-8b4f-3109a9ceadb1&limit=99999&q={\"Sex\":\"All\"}&fields=Year,HB,AllAges,Sex
Male - https://www.opendata.nhs.scot/api/3/action/datastore_search?id=27a72cc8-d6d8-430c-8b4f-3109a9ceadb1&limit=99999&q={\"Sex\":\"Male\"}&fields=Year,HB,AllAges,Sex

@csillasch csillasch added the CKAN issue Issue with CKAN instance rather than code label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CKAN issue Issue with CKAN instance rather than code
Projects
None yet
Development

No branches or pull requests

2 participants