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

Refactor Betydb functions to support new API #82

Merged
merged 14 commits into from
Feb 7, 2017

Conversation

infotroph
Copy link
Contributor

@infotroph infotroph commented Feb 1, 2017

As seen in #77:

  • Remove betydb_GET2 if redundant
    • Done. Note that this means betydb_GET now returns a dataframe for multi-item queries and a (possibly nested) list for the detail view on a single ID.
  • target API by version
    • I implemented this in betydb_GET (which handles the JSON), not betydb_http (which returns a single text string and only cares about API version for include strings)
  • make generic functions for table queries (Merge BETYdb table queries into a single generic function #26) and single records
    • add betydb_query()
    • add betydb_record()
    • make other query functions use betydb_query under the hood
  • Update documentation
    • I think this is mostly done; feedback, please.
  • Allow unchecked data (Add option to retrieve 'unchecked' data from BETYdb #52). Already works in betydb_query, need to document and make work in singular functions.

@infotroph
Copy link
Contributor Author

Not sure how I managed a merge conflict in an autogenerated file, but should be fixed now

@infotroph
Copy link
Contributor Author

@dlebauer As currently written, I'm defaulting to the v0 API so anyone relying on previous versions can keep their old behavior, but that means regex searches always need to set api_version="beta" or they fail quietly. Switch default to api_version="beta"? Set options("betydb_api_version")?

@dlebauer
Copy link
Collaborator

dlebauer commented Feb 3, 2017

If you can pass API version, URL, and key in options() that would make the code easier to read. I've never written a function that used this approach but it would be nice if it wasn't necessary to explicitly pass these with each function call.

An alternative would be to create a list of connection parameters and pass that instead of having separate arguments.

The options approach seems more elegant but the list approach seems easier to implement and maintain (mostly because it is more straightforward). What do you think?

@sckott any guidance wrt best practices/ ropensci convention?

@infotroph
Copy link
Contributor Author

Without presuming anything on ropensci convention, I'll note I'm usually suspicious of options as 'basically globals by another name', but then again this likely is a global preference -- the user probably wants all queries in any one session to go to the same API on the same server.

How about betydb_foo(..., api_version=getOption("bety_api_version", "v0"), betyurl=getOption("bety_url", "https://www.betydb.org"), and so on? Then the defaults are sane and visible to everyone, and options are respected if set but we don't clutter up the options list for users who don't set them.

@dlebauer
Copy link
Collaborator

dlebauer commented Feb 3, 2017

That seems sensible, but is this preferable to passing a list connection = list(url, key, version) ?

@infotroph
Copy link
Contributor Author

Probably equal, unless one's more in the ropensci spirit.

@sckott
Copy link
Contributor

sckott commented Feb 3, 2017

at a meeting reply soon

@dlebauer
Copy link
Collaborator

dlebauer commented Feb 6, 2017

@infotroph the failed build is due to the function ncbi_byname (emitting a warning that is treated as error in the build) and is also causing the master branch to fail

WARNING
Undocumented arguments in documentation object 'ncbi_byname'

@dlebauer
Copy link
Collaborator

dlebauer commented Feb 7, 2017

@infotroph I think this looks good.

@sckott could you merge this? I'd like to use it in a workshop Friday, and I'd prefer to use install_github('ropensci/traits') than install_github('infotroph/traits@betydb_refactor') ... if possible.

@sckott
Copy link
Contributor

sckott commented Feb 7, 2017

looks good, seems like there may be stuff at top of issue #82 (comment) that isn't done yet, open any new issues if needed

@sckott sckott closed this Feb 7, 2017
@sckott sckott reopened this Feb 7, 2017
@sckott sckott merged commit 5af13de into ropensci:master Feb 7, 2017
@infotroph
Copy link
Contributor Author

Thanks! For the record, here are issues for the checkboxes not ticked at merge time:

@infotroph infotroph deleted the betydb_refactor branch February 8, 2017 14:43
@sckott
Copy link
Contributor

sckott commented Feb 10, 2017

thank

@infotroph infotroph mentioned this pull request Feb 24, 2017
5 tasks
@sckott sckott added this to the v0.3 milestone Mar 21, 2017
dlebauer added a commit to dlebauer/traits that referenced this pull request Mar 16, 2018
added (Chris Black) (@infotroph) to author list based on contributions to the betydb interface (especially ropensci#94, ropensci#88, ropensci#82)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants