bcdata icon indicating copy to clipboard operation
bcdata copied to clipboard

Update catalogue

Open boshek opened this issue 1 year ago • 2 comments

Testing #342

boshek avatar Jul 09 '24 23:07 boshek

So... this is passing now with a couple of (rather big) caveats:

  1. I've skipped tests for which there is no available data in tests/test-get-data.R.
  2. The new catalogue requires a new API key, which I can't get since I don't have an IDIR. Right now I've disabled the BCDC_KEY environment variable in the R CMD check action so the tests that access private records are skipped. We could continue this way or @stephhazlitt could get a key from the new catalogue and we can add that to the repo secrets. Or we could ask the catalogue team for a different key for CI purposes.

ateucher avatar Aug 16 '24 22:08 ateucher

@ateucher I'll chat with the catalogue team next week re: best path for the API key.

stephhazlitt avatar Aug 17 '24 02:08 stephhazlitt

Currently failing with search facets. A simplified example:

Current catalogue (returns populated License ID facets):

httr::GET("https://catalogue.data.gov.bc.ca/api/3/action/package_search?facet.field=%5B%22license_id%22%5D&rows=0") |> 
  httr::content(as = "text")
#> [1] "{\"help\": \"https://catalogue.data.gov.bc.ca/api/3/action/help_show?name=package_search\", \"success\": true, \"result\": {\"count\": 3252, \"sort\": \"score desc, metadata_modified desc\", \"facets\": {\"license_id\": {\"24\": 61, \"25\": 1, \"21\": 70, \"22\": 1420, \"49\": 5, \"47\": 2, \"44\": 13, \"45\": 2, \"42\": 18, \"50\": 5, \"53\": 2, \"43\": 3, \"2\": 1637, \"48\": 12, \"52\": 1}}, \"results\": [], \"search_facets\": {\"license_id\": {\"items\": [{\"count\": 70, \"display_name\": \"Statistics Canada Open Licence\", \"name\": \"21\"}, {\"count\": 2, \"display_name\": \"Open Licence - University of Northern British Columbia\", \"name\": \"53\"}, {\"count\": 12, \"display_name\": \"Open Government Licence \\u2013 TransLink\", \"name\": \"48\"}, {\"count\": 13, \"display_name\": \"Open Government Licence \\u2013 Municipality of North Cowichan\", \"name\": \"44\"}, {\"count\": 5, \"display_name\": \"Open Government Licence - SkilledTradesBC\", \"name\": \"50\"}, {\"count\": 3, \"display_name\": \"Open Government Licence - Destination BC\", \"name\": \"43\"}, {\"count\": 61, \"display_name\": \"Open Government Licence - Canada\", \"name\": \"24\"}, {\"count\": 1637, \"display_name\": \"Open Government Licence - British Columbia\", \"name\": \"2\"}, {\"count\": 2, \"display_name\": \"Open Government Licence - BC Assessment\", \"name\": \"47\"}, {\"count\": 5, \"display_name\": \"Open Data Licence for ICBC Information\", \"name\": \"49\"}, {\"count\": 1, \"display_name\": \"Open Data Licence - Office of the Registrar of Lobbyists for British Columbia\", \"name\": \"52\"}, {\"count\": 2, \"display_name\": \"Open Data Commons - Public Domain Dedication and Licence\", \"name\": \"45\"}, {\"count\": 1, \"display_name\": \"King's Printer Licence - British Columbia\", \"name\": \"25\"}, {\"count\": 18, \"display_name\": \"Elections BC Open Data Licence\", \"name\": \"42\"}, {\"count\": 1420, \"display_name\": \"Access Only\", \"name\": \"22\"}], \"title\": \"license_id\"}}}}"

"toyger" test catalogue: (returns empty)

httr::GET("https://toyger.data.gov.bc.ca/api/3/action/package_search?facet.field=%5B%22license_id%22%5D&rows=0") |> 
  httr::content(as = "text")
#> [1] "{\"help\": \"https://toyger.data.gov.bc.ca/api/3/action/help_show?name=package_search\", \"success\": true, \"result\": {\"count\": 0, \"facets\": {\"license_id\": {}}, \"results\": [], \"sort\": \"score desc, metadata_modified desc\", \"search_facets\": {\"license_id\": {\"title\": \"license_id\", \"items\": []}}}}"

Created on 2024-12-04 with reprex v2.1.1

ateucher avatar Dec 05 '24 01:12 ateucher