Skip to content

Commit

Permalink
Merge branch 'api-redesign-contribute' of github.com:mustberuss/paten…
Browse files Browse the repository at this point in the history
…tsview into api-redesign-contribute
  • Loading branch information
mustberuss committed Aug 22, 2022
2 parents 0a2042f + 897bf5a commit 5c56a80
Show file tree
Hide file tree
Showing 11 changed files with 228 additions and 498 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
# Run sequentially so that we don't run into rate limit errors that our
# code would normally work around via retry logic
max-parallel: 1
fail-fast: false
matrix:
config:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Suggests:
rmarkdown,
testthat,
tidyr
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
25 changes: 10 additions & 15 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
#' Fields data frame
#'
#' A data frame containing the names of retrievable and queryable fields for
#' 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})
#' A data frame containing the names of retrievable fields for each of the
#' endpoints. You can 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 130 rows and 8 variables:
#' @format A data frame with the following columns:
#' \describe{
#' \item{endpoint}{The endpoint that this field record is for}
#' \item{field}{The name of the field}
#' \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{field}{The complete name of the field, including the parent group if
#' applicable}
#' \item{data_type}{The field's input data type}
#' \item{group}{The group the field belongs to}
#' \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}
#' \item{common_name}{The field name without the parent group structure}
#' }
"fieldsdf"
Binary file modified R/sysdata.rda
Binary file not shown.
22 changes: 12 additions & 10 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,27 @@ validate_pv_data <- function(data) {

#' @noRd
to_singular <- function(plural) {
# assignees is an exception, singular isn't assigne

if (endsWith(plural, "ies")) {
singular <- sub("ies$", "y", plural)
} else if (endsWith(plural, "es") && !endsWith(plural, "ees")) {
singular <- sub("es$", "", plural)
if (endsWith(plural, "ees")) {
sub("ees$", "ee", plural)
} else if (endsWith(plural, "ies")) {
sub("ies$", "y", plural)
} else if (endsWith(plural, "es")) {
sub("es$", "", plural)
} else if (endsWith(plural, "s")) {
sub("s$", "", plural)
} else {
singular <- sub("s$", "", plural)
plural
}
}


#' @noRd
to_plural <- function(singular) {
if (endsWith(singular, "y")) {
plural <- sub("y$", "ies", singular)
sub("y$", "ies", singular)
} else if (endsWith(singular, "s")) {
plural <- paste0(singular, "es")
paste0(singular, "es")
} else {
plural <- paste0(singular, "s")
paste0(singular, "s")
}
}
283 changes: 0 additions & 283 deletions data-raw/definition_extract.R

This file was deleted.

Loading

0 comments on commit 5c56a80

Please sign in to comment.