{"action":"created","issue":{"url":"https://api.github.com/repos/USGS-R/sbtools/issues/158","labels_url":"https://api.github.com/repos/USGS-R/sbtools/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/USGS-R/sbtools/issues/158/comments","events_url":"https://api.github.com/repos/USGS-R/sbtools/issues/158/events","html_url":"https://github.com/USGS-R/sbtools/issues/158","id":127286856,"number":158,"title":"warning when searching without authentication and/or not getting results?","user":{"login":"aappling-usgs","id":12039957,"avatar_url":"https://avatars.githubusercontent.com/u/12039957?v=3","gravatar_id":"","url":"https://api.github.com/users/aappling-usgs","html_url":"https://github.com/aappling-usgs","followers_url":"https://api.github.com/users/aappling-usgs/followers","following_url":"https://api.github.com/users/aappling-usgs/following{/other_user}","gists_url":"https://api.github.com/users/aappling-usgs/gists{/gist_id}","starred_url":"https://api.github.com/users/aappling-usgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aappling-usgs/subscriptions","organizations_url":"https://api.github.com/users/aappling-usgs/orgs","repos_url":"https://api.github.com/users/aappling-usgs/repos","events_url":"https://api.github.com/users/aappling-usgs/events{/privacy}","received_events_url":"https://api.github.com/users/aappling-usgs/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-18T18:33:48Z","updated_at":"2016-01-18T21:11:09Z","closed_at":"2016-01-18T21:11:01Z","body":"A philosophical question: Can and should `sbtools` usefully steer users to more successful querying by noticing when authentication is missing and/or when 0 search results are returned, then providing a warning message suggesting authentication?\r\n\r\n(I raised this question as part of an earlier issue (#132) - moving it to its own issue here to make sure it gets some discussion.)\r\n\r\nExample: Running this search without authentication returns 0 items with no errors or warnings.\r\n```r\r\n> library(sbtools)\r\n> run_items <- query_item_identifier(scheme = 'mda_streams', type = 'metab_run', limit = 10000)\r\n> dim(run_items)\r\n[1] 0 0\r\n```\r\nWhereas running the search after authentication returns 14 items (provided your account has access to these items).\r\n```r\r\n> authenticate_sb()\r\n> run_items <- query_item_identifier(scheme = 'mda_streams', type = 'metab_run', limit = 10000)\r\n> dim(run_items)\r\n[1] 14  2\r\n```\r\nAlso, if you wait about an hour or more, your authentication silently expires. Within the same session as above, then, it's possible to go back to 0 items returned without warning:\r\n```r\r\n> Sys.time() # authenticated right now, but wait a while\r\n[1] \"2016-01-18 12:39:14 CST\"\r\n> Sys.time() # OK, been waiting a while\r\n[1] \"2016-01-18 13:53:40 CST\"\r\n> run_items <- query_item_identifier(scheme = 'mda_streams', type = 'metab_run', limit = 10000)\r\n> dim(run_items)\r\n[1] 0 0\r\n```\r\n\r\nThe current behavior is OK - many queries can and should be run without authentication. But suppose you're using `sbtools` and were recently authenticated in your R session. Then you run some query and are suddenly getting back fewer / no results - do you (1) brilliantly realize that your session has timed out and go fix that first, (2) not notice the change because this query was buried in a long script and returned no errors or warnings, or (3) notice and panic because SB seems to be malfunctioning and has precedent for malfunctioning at inconvenient times, and you really needed to get that report out today...? I argue that not every user will go straight to the correct response every time. \r\n\r\nWhen would response 1 be the correct one, and is there any way for us to know from the `sbtools` side? We'll never know for sure, but it seems most likely when (a) the user is not authenticated, (b) the session has expired, and/or (c) the query has returned 0 results. If we returned a warning message under these conditions, we might help some users through some frustrating and hard-to-replicate problems."},"comment":{"url":"https://api.github.com/repos/USGS-R/sbtools/issues/comments/172654755","html_url":"https://github.com/USGS-R/sbtools/issues/158#issuecomment-172654755","issue_url":"https://api.github.com/repos/USGS-R/sbtools/issues/158","id":172654755,"user":{"login":"aappling-usgs","id":12039957,"avatar_url":"https://avatars.githubusercontent.com/u/12039957?v=3","gravatar_id":"","url":"https://api.github.com/users/aappling-usgs","html_url":"https://github.com/aappling-usgs","followers_url":"https://api.github.com/users/aappling-usgs/followers","following_url":"https://api.github.com/users/aappling-usgs/following{/other_user}","gists_url":"https://api.github.com/users/aappling-usgs/gists{/gist_id}","starred_url":"https://api.github.com/users/aappling-usgs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aappling-usgs/subscriptions","organizations_url":"https://api.github.com/users/aappling-usgs/orgs","repos_url":"https://api.github.com/users/aappling-usgs/repos","events_url":"https://api.github.com/users/aappling-usgs/events{/privacy}","received_events_url":"https://api.github.com/users/aappling-usgs/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T21:11:09Z","updated_at":"2016-01-18T21:11:09Z","body":"I really like the solution you've put up, @lawinslow. There's still the possibility that a user will search without ever authenticating, but that's much less insidious and I'm now content to let that user fail without help."}}