-
Notifications
You must be signed in to change notification settings - Fork 9
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
updated endpoint list #37
Conversation
Hey Russ, a few questions on this:
get_endpoints <- function() {
unique(fieldsdf$endpoint)
}
|
You're right on the singular/plural functions, they aren't needed any longer. Nice catch. We can dry out get_endpoints(), but could we put a sort() around it? Or is that covered by the arrange in fieldsdf.R? I like having the ones nested under patent traveling together! The tests were included to get the builds back to working. I'm guessing the failing tests are keeping it off r-universe. Still having plural endpoints wasn't intentional. |
Looks like we do need to_plural() to handle groups in the code I just pushed. In fieldsdf now the group on an unnested field is an empty string (""). Previously the group matched the endpoint when they were plural and unnested. Now the API throws an error if an unnested field is fully qualified, e.g. Error: Invalid field: patents.patent_date The alternative is to have an empty string as a group mean unnested fields but that doesn't seem ideal. Using the actual returned entity seems less wrong though I don't like that users need to know the ipc endpoint's returned entity is ipcr and wipo returns wipo (the rest are the plural of the de-nested endpoint). I was wrong about getting the tests to pass. They'll need changes to search-pv that I was planning to do in a later PR. I was trying to keep this one to the specifics of the endpoint changes in the code. I think I got rid of all the plural endpoints now, except for the vignettes. |
Hey Russ, sorry not sure I'm following. What's wrong with this version of the code: get_fields <- function(endpoint, groups = NULL) {
browser()
# validate_endpoint(endpoint)
if (is.null(groups)) {
fieldsdf[fieldsdf$endpoint == endpoint, "field"]
} else {
# groups <- replace(groups, groups == to_plural(endpoint), "")
# validate_groups(endpoint, groups = groups)
fieldsdf[fieldsdf$endpoint == endpoint & fieldsdf$group %in% groups, "field"]
}
} |
With the change in fieldsdf.R, top level/unnested attributes don't have a group filled in in fieldsdf, it's an empty string now. They can't be requested with a group as the nested fields are. In the example code the group of "assignees" works since there is a group of assignees in the data frame for the patent endpoint but there isn't a group of patents for the patent endpoints.
|
Probably the better fix would be to put to_plural() in fieldsdf.R and populate the group with to_plural(endpoint) for unnested attributes and use the original code in get_fields(). Should we do that here or in a separate PR? patentsview/data-raw/fieldsdf.R Line 95 in e1ca36b
Only problem with that is it negates my best PR 😃 |
Or I could let go of to_plural() and change fieldsdf.R since the plural entity is in openapi.json!
|
Thanks! |
Endpoints are now singular and some are nested under patent/ and one is nested under publication