-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add changes introduced by Russ re: minimal working API client using n…
…ew API version
- Loading branch information
Showing
20 changed files
with
690 additions
and
1,303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
#' Fields data frame | ||
#' | ||
#' A data frame containing the names of retrievable and queryable fields for | ||
#' each of the 7 API endpoints. A yes/no flag (\code{can_query}) indicates | ||
#' each of the 13 API endpoints. A yes/no flag (\code{can_query}) indicates | ||
#' which fields can be included in the user's query. You can also find this | ||
#' data on the API's online documentation for each endpoint as well (e.g., | ||
#' the \href{https://patentsview.org/apis/api-endpoints/patents}{patents | ||
#' endpoint field list table}) | ||
#' | ||
#' @format A data frame with 992 rows and 7 variables: | ||
#' @format A data frame with 130 rows and 8 variables: | ||
#' \describe{ | ||
#' \item{endpoint}{The endpoint that this field record is for} | ||
#' \item{field}{The name of the field} | ||
#' \item{data_type}{The field's data type (string, date, float, integer, | ||
#' \item{data_type}{The field's input data type (string, date, float, integer, | ||
#' fulltext)} | ||
#' \item{can_query}{An indicator for whether the field can be included in | ||
#' the user query for the given endpoint} | ||
#' \item{group}{The group the field belongs to} | ||
#' \item{common_name}{The field's common name} | ||
#' \item{description}{A description of the field} | ||
#' \item{plain_name}{field without dot parent structure} | ||
#' \item{cast_as}{data type we want the return to be cast as} | ||
#' } | ||
"fieldsdf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
# I tried having this filename as helper-queries.R but the ubuntu-20.04 job failed | ||
# while the other three jobs worked. Serveral tests use get_test_query() | ||
# Feels a bit awkward... | ||
|
||
query_for_endpoint <- c( | ||
"application_citations" = '{"patent_number": "10966293"}', # still searchable by pn | ||
"assignees" = '{"_text_phrase":{"name_last": "Clinton"}}', | ||
"cpc_groups" = '{"cpc_group_id": "A01B"}', | ||
"cpc_subgroups" = '{"cpc_subgroup_id": "A01B1/00"}', | ||
"cpc_subsections" = '{"cpc_subsection_id": "A01"}', | ||
"inventors" = '{"_text_phrase":{"name_last":"Clinton"}}', | ||
"locations" = NA, | ||
"nber_categories" = '{"nber_category_id": "1"}', | ||
"nber_subcategories" = '{"nber_subcategory_id": "11"}', | ||
"patents" = '{"patent_number":"5116621"}', # still searchable by pn | ||
"patent_citations" = '{"patent_number":"5116621"}', # still searchable by pn | ||
"uspc_mainclasses" = '{"uspc_mainclass_id":"30"}', | ||
"uspc_subclasses" = '{"uspc_subclass_id": "100/1"}' | ||
) | ||
|
||
#' Get Test Query | ||
#' | ||
#' In the new version of the api, only three of the endpoints are searchable | ||
#' by patent number. This function provides a sample query for each | ||
#' endpoint, except for locations, which isn't on the test server yet | ||
#' | ||
#' @param endpoint The web service resource you want a test query for. \code{endpoint} | ||
#' must be one of the following: "patents", "inventors", "assignees", | ||
#' "locations", "cpc_groups", "cpc_subgroups", "cpc_subsections", "uspc_mainclasses", | ||
#' "uspc_subclasses","nber_categories", "nber_subcategories", "application_citations", | ||
#' or "patent_citations" | ||
#' | ||
#' @return a test query for the specified endpoint. | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' | ||
#' get_test_query("patents") | ||
#' } | ||
#' | ||
#' @export | ||
get_test_query <- function(endpoint) { | ||
ifelse(endpoint %in% names(query_for_endpoint), query_for_endpoint[[endpoint]], NA) | ||
} |
Oops, something went wrong.