Closed stephhazlitt closed 1 year ago
Also not that bcdc_search()
does not warn or error when group
is passed as an argument, but instead seems to use the argument as search terms. This feels fragile, as sometimes it can appear to work, as records are returned but they are not strictly from the supplied group
.
e.g.
bcdata::bcdc_search(group = "Connectivity in BC")
#> List of B.C. Data Catalogue Records
#> Number of records: 59
#> Showing the top 50 results. You can assign the output of bcdc_search,
#> to an object and subset with `[` to see other results in the set.
#>
#> Titles:
#> 1: BC Network Connectivity (multiple, wms, kml)
#> ID: ee60bfce-e9ce-449b-ba8f-3491553ede35
#> Name: bc-network-connectivity
#> 2: Internet Connectivity in Relation to B.C. Health Geographies Map
#> (other)
#> ID: fe8f959a-6a61-4bda-856f-4c4939150e9c
#> Name: internet-connectivity-in-relation-to-b-c-health-geographies-map
#> 3: Connectivity Infrastructure Projects (csv)
#> ID: ee53f7aa-d5dc-4897-b0c6-635dfe2f7e5e
#> Name: connectivity-infrastructure-projects
#> 4: Elk Connectivity Corridors Merritt TSA (multiple)
#> ID: 4079f9fc-727e-4837-81d9-8ea2eefbb57d
#> Name: elk-connectivity-corridors-merritt-tsa
#> 5: BC Highways without Cell Service (kmz, pdf)
#> ID: ae1470d6-d730-49e5-9fab-16215c0b6e72
#> Name: bc-highways-without-cell-service
#> 6: Project Zones (kmz)
#> ID: 8fbfc57f-4381-4a10-a4e8-0f335c6fe39a
#> Name: project-zones
#> 7: BC Indigenous Business Listings (csv, html, wms, kml, multiple)
#> ID: bdc81d33-1ab5-4882-9764-8701e8971bb7
#> Name: bc-indigenous-business-listings
#> 8: BC Hexagonal Grid (wms, kml, multiple)
#> ID: a3badeec-feed-41d9-b33d-5ae41c19f27d
#> Name: bc-hexagonal-grid
#> 9: BC Ideas Exchange - Economic Development Success Stories (csv)
#> ID: e04840a4-77fe-4175-a029-8ae195a32a9a
#> Name: bc-ideas-exchange-economic-development-success-stories
#> 10: Welcome BC Settlement Service Providers - Interactive Web Map Data
#> (xls, csv)
#> ID: 5d544eb3-cb2c-4204-bd8d-452341e52c8b
#> Name: welcome-bc-settlement-service-providers-interactive-web-map-data
#> 11: Landsat Web Map Service (xml, kml, wms)
#> ID: ac0a7aa9-f56d-45b1-bd17-8554843de6a5
#> Name: landsat-web-map-service
#> 12: Imagery Spot 15m Web Map Service (xml, kml, wms)
#> ID: bcad8f9e-274b-4a29-9e06-d05def3a50c2
#> Name: imagery-spot-15m-web-map-service
#> 13: Forest Ecosystem Networks for the Chilcotin Forest District
#> (oracle_sde)
#> ID: e55ea13e-7503-4109-ae46-9c1a113eaed8
#> Name: forest-ecosystem-networks-for-the-chilcotin-forest-district
#> 14: Well Directional Survey (multiple, wms, kml)
#> ID: 22165318-4e70-4702-8888-4a27a19855ff
#> Name: well-directional-survey
#> 15: Pseudo Households - Underserved (kmz)
#> ID: f7b14bb2-6c95-448d-81d7-b78003e1e847
#> Name: pseudo-households-underserved
#> 16: Hexagonal Grid - Underserved Households (kmz)
#> ID: ea9f2e67-f0e6-4fc4-a5b8-b6507e85d750
#> Name: hex-underserved-households
#> 17: Community Investment Opportunities Tool (other)
#> ID: 9b7317c9-4392-4423-a191-999ecd660eee
#> Name: community-investment-opportunities-tool
#> 18: Community Census Subdivisions (oracle_sde, wms, kml)
#> ID: fcdb4f20-247f-459e-a3c6-7e286fb622a2
#> Name: community-census-subdivisions
#> 19: Metadata for Supportive Housing - E01 (json)
#> ID: 28d17abd-e38f-4a15-bbb5-c10f6908a57e
#> Name: metadata-for-supportive-housing---e01
#> 20: Historic City of Vancouver Fire Insurance Map (wms)
#> ID: 1dbc0b94-54c3-4d6b-a55f-340673a5056f
#> Name: historic-city-of-vancouver-fire-insurance-map
#> 21: Orthophoto Web Map Service (wms)
#> ID: 3fa96b60-0260-45b7-b231-3ce4610852c0
#> Name: orthophoto-web-map-service
#> 22: Freshwater Atlas Coastlines (multiple, html, pdf, wms, kml)
#> ID: 87b1d6a7-d4d1-4c25-a879-233becdbffed
#> Name: freshwater-atlas-coastlines
#> 23: Freshwater Atlas Stream Network (multiple, html, pdf, wms, kml,
#> fgdb)
#> ID: 92344413-8035-4c08-b996-65a9b3f62fca
#> Name: freshwater-atlas-stream-network
#> 24: Freshwater Atlas Edge Type Codes (multiple, html, pdf)
#> ID: 509cbf74-7ee7-44d3-a88d-4e088ea67325
#> Name: freshwater-atlas-edge-type-codes
#> 25: Freshwater Atlas Waterbody Type Codes (multiple, html, pdf)
#> ID: ade4f36a-1fd4-4583-8253-2b2a1bbe34ff
#> Name: freshwater-atlas-waterbody-type-codes
#> 26: Freshwater Atlas Watershed Type Codes (multiple, html, pdf)
#> ID: f7efa3ea-bf1c-4c4f-bb33-ba841aa076c0
#> Name: freshwater-atlas-watershed-type-codes
#> 27: Freshwater Atlas 20K-50K Stream Cross Reference Table (multiple,
#> html, pdf)
#> ID: c819aef2-2cb3-43ee-a41b-77debdecd81e
#> Name: freshwater-atlas-20k-50k-stream-cross-reference-table
#> 28: Freshwater Atlas 20K-50K Waterbody Cross Reference Table (multiple,
#> html, pdf)
#> ID: a5965764-a3d0-48aa-97e7-10f873cb5e78
#> Name: freshwater-atlas-20k-50k-waterbody-cross-reference-table
#> 29: Freshwater Atlas Watershed Boundaries (multiple, html, pdf, wms,
#> kml, fgdb)
#> ID: ab758580-809d-4e11-bb2c-df02ac5465c9
#> Name: freshwater-atlas-watershed-boundaries
#> 30: Freshwater Atlas Linear Boundaries (multiple, html, pdf, wms, kml,
#> fgdb)
#> ID: 2af1388e-d5f7-46dc-a6e2-f85415ddbd1c
#> Name: freshwater-atlas-linear-boundaries
#> 31: Freshwater Atlas Watersheds (multiple, html, pdf, wms, kml, fgdb)
#> ID: 3ee497c4-57d7-47f8-b030-2e0c03f8462a
#> Name: freshwater-atlas-watersheds
#> 32: Freshwater Atlas Watershed Groups (multiple, html, pdf, wms, kml)
#> ID: 51f20b1a-ab75-42de-809d-bf415a0f9c62
#> Name: freshwater-atlas-watershed-groups
#> 33: Freshwater Atlas Rivers (multiple, fgdb, pdf, wms, kml)
#> ID: f7dac054-efbf-402f-ab62-6fc4b32a619e
#> Name: freshwater-atlas-rivers
#> 34: Freshwater Atlas Stream Directions (multiple, html, pdf, wms, kml)
#> ID: d7165359-52ef-41d0-b762-c53e3468ff3f
#> Name: freshwater-atlas-stream-directions
#> 35: Freshwater Atlas Named Watersheds (multiple, html, pdf, wms, kml)
#> ID: ea63ea04-eab0-4b83-8729-f8a93ac688a1
#> Name: freshwater-atlas-named-watersheds
#> 36: Freshwater Atlas Glaciers (multiple, html, pdf, wms, kml)
#> ID: 8f2aee65-9f4c-4f72-b54c-0937dbf3e6f7
#> Name: freshwater-atlas-glaciers
#> 37: Freshwater Atlas Manmade Waterbodies (multiple, html, pdf, wms,
#> kml)
#> ID: 055fd71e-b771-4d47-a863-8a54f91a954c
#> Name: freshwater-atlas-manmade-waterbodies
#> 38: Freshwater Atlas Obstructions (multiple, html, pdf, wms, kml)
#> ID: 64797286-3ca5-4202-9064-a7f790321e9e
#> Name: freshwater-atlas-obstructions
#> 39: Freshwater Atlas Named Point Features (multiple, html, pdf, wms,
#> kml)
#> ID: db43a358-273c-4c2e-8a5c-cc28eaaffaa7
#> Name: freshwater-atlas-named-point-features
#> 40: Freshwater Atlas Wetlands (multiple, html, pdf, wms, kml)
#> ID: 93b413d8-1840-4770-9629-641d74bd1cc6
#> Name: freshwater-atlas-wetlands
#> 41: Freshwater Atlas Bays and Channels (multiple, html, pdf, wms, kml)
#> ID: 60fb779b-e0b0-4026-9ecc-40579d63a724
#> Name: freshwater-atlas-bays-and-channels
#> 42: Freshwater Atlas Assessment Watersheds (multiple, html, pdf, wms,
#> kml)
#> ID: 97d8ef37-b8d2-4c3b-b772-6b25c1db13d0
#> Name: freshwater-atlas-assessment-watersheds
#> 43: Freshwater Atlas Lakes (multiple, html, pdf, wms, kml)
#> ID: cb1e3aba-d3fe-4de1-a2d4-b8b6650fb1f6
#> Name: freshwater-atlas-lakes
#> 44: Freshwater Atlas Islands (multiple, html, pdf, wms, kml)
#> ID: 4483aeea-df26-4b83-a565-934c769e74de
#> Name: freshwater-atlas-islands
#> 45: Draft Viewlines with Direction for the Cariboo Region (shp)
#> ID: e20e8358-d73a-41d5-b417-7a292ae6ce24
#> Name: draft-viewlines-with-direction-for-the-cariboo-region
#> 46: Customs Ports of Entry (multiple, wms, kml)
#> ID: 4fac3ad6-8749-4741-ac98-527b23e4b0b2
#> Name: customs-ports-of-entry
#> 47: Metadata for Child Welfare Program - E05 (json)
#> ID: f47ca736-4ab3-4a79-9f86-b20cd9afced1
#> Name: metadata-for-child-welfare-program---e05
#> 48: Streams with Water Allocation Notations (oracle_sde, wms, kml)
#> ID: 687fdbd1-771d-4624-a28c-7c1ff07309fa
#> Name: streams-with-water-allocation-notations
#> 49: Streams with Water Allocation Restrictions (multiple)
#> ID: 961b0fac-0b7e-4fce-9359-7dce3f4cfb4e
#> Name: streams-with-water-allocation-restrictions
#> 50: TransLink - Major Road Network (geojson, shp, kml)
#> ID: c157824e-593e-48dd-a34f-ce8ecd534b3f
#> Name: translink-major-road-network
#>
#> Access a single record by calling `bcdc_get_record(ID)` with the ID
#> from the desired record.
Created on 2023-03-05 with reprex v2.0.2
I feel like the simplest solution would be to add groups
to the function as a facet and process it like the rest of the facets?
Also not that bcdc_search() does not warn or error when group is passed as an argument, but instead seems to use the argument as search terms.
This is because it's passed in with the ...
. To guard against this we could make sure that none of the terms in ...
have names?
E.g.,:
f <- function(...) {
dots_list <- list(...)
if (length(names(dots_list)) > 0) {
stop("search terms passed to ... should not be named")
}
dots_list
}
f("foo")
#> [[1]]
#> [1] "foo"
f(group = "foo")
#> Error in f(group = "foo"): search terms passed to ... should not be named
Created on 2023-03-08 with reprex v2.0.2
bcdc_search() takes all the catalogue facets except
group
as valid arguments, with users callingbcdc_search_facets()
to find the possible values. Users can leveragebcdc_list_group_records()
to retrieve records bygroup
, but it might be confusing for users that the facetgroup
is included in the returned data frame frombcdc_search_facets()
?Possible solutions?
bcdc_search()
to acknowledge this different API forgroup
and point users tobcdc_list_group_records()
group
rows before returning the data frame frombcdc_search_facets()
? Users can still getgroup
info frombcdc_list_groups()
Created on 2023-03-05 with reprex v2.0.2