bcgov / bcdata

An R package for searching & retrieving data from the B.C. Data Catalogue
https://bcgov.github.io/bcdata
Apache License 2.0
82 stars 13 forks source link

Add warning when using record name in lieu of ID #52

Closed stephhazlitt closed 5 years ago

stephhazlitt commented 5 years ago

You can get a record with both the record id (bcdc_get_record("76b1b7a3-2112-4444-857a-afccf7b20da8") and the record name (bcdc_get_record("bc-airports"). Users should get a warning in the console if they use the name -- while fine interactively, this is a more fragile approach in scripts as record names can change (with no redirects). Record IDs do not change.

ateucher commented 5 years ago

Definitely agree. Probably a message over a warning (and probably just once per session).

ateucher commented 5 years ago

Actually @stephhazlitt and @boshek - should this be in bcdc_get_data rather than bcdc_get_record? The latter is more likely to be scripted and thus vulnerable to changing names. Or both?

ateucher commented 5 years ago

Another thought - a warning might actually be better since it shows up after the output, a message is printed first so could easily be missed.

stephhazlitt commented 5 years ago

I think bcdc_get_data() for v0.1.0—and maybe also/eventually in bcdc_get_record() for those that may do list gymnastics with the output of bcdc_get_record as a feeder to getting the data?

ateucher commented 5 years ago

It's easy enough to put it in both right now while I'm working on it...

stephhazlitt commented 5 years ago

Warnings are the new messages 😆

Another thought - a warning might actually be better since it shows up after the output, a message is printed first so could easily be missed.

ateucher commented 5 years ago

Ok, weedy question. One warning per session regardless of the function? Or once per function per session? I.e., if call bcdc_get_record with a name and get a warning, should you also get a warning if you call bcdc_get_data with a name in the same session?

ateucher commented 5 years ago

I ask because there is also bcdc_query_geodata, bcdc_preview, and bcdc_describe_feature

ateucher commented 5 years ago

I'm going to go with just once for now - much simpler to implement.