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

Remove Rd help pages for internal functions #50

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions R/add_context.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#' @keywords internal
#' @noRd
add_context <- function(data, id, name, created_date, modified_date) {
# Catch if the resource has never been modified
if (is.null(modified_date)) {
Expand Down
3 changes: 2 additions & 1 deletion R/check_dataset_name.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#' Used to attempt to validate a dataset name before submitting it to the API
#'
#' @param dataset_name a resource ID
#'
#' @keywords internal
#' @noRd
check_dataset_name <- function(dataset_name) {
# Starts and ends in a lowercase letter or number
# Has only lowercase alphanum or hyphens inbetween
Expand Down
2 changes: 2 additions & 0 deletions R/check_res_id.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#' @param res_id a resource ID
#'
#' @return TRUE / FALSE indicating the validity of the res_id
#' @keywords internal
#' @noRd
check_res_id <- function(res_id) {
# check res_id is single value
if (length(res_id) > 1) {
Expand All @@ -31,7 +33,7 @@
if (!grepl(res_id_regex, res_id)) {
cli::cli_abort(c(
"Argument {.var res_id} is in an invalid format.",
i = "You can find a resource's ID in the URL of it's page on {.url www.opendata.nhs.scot}."

Check warning on line 36 in R/check_res_id.R

View workflow job for this annotation

GitHub Actions / lint

file=R/check_res_id.R,line=36,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 97 characters.
))
}
}
3 changes: 2 additions & 1 deletion R/dump_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#'
#' @param res_id a resource ID
#' @return dataframe containing resource records
#'
#' @keywords internal
#' @noRd
dump_download <- function(res_id) {
# fetch the data
content <- suppressMessages(
Expand Down
3 changes: 2 additions & 1 deletion R/error_check.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#' Throws errors found in the content of an `httr::GET` request
#'
#' @param content object produced by `httr::content`
#'
#' @keywords internal
#' @noRd
error_check <- function(content) {
# if content is not a list,
# stop for content (a string describing an error)
Expand Down
2 changes: 2 additions & 0 deletions R/get_latest_resource_id.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
#' @inheritParams get_dataset
#'
#' @return a string with the resource id
#' @keywords internal
#' @noRd
get_latest_resource_id <- function(dataset_name) {
# send the api request
query <- list("id" = dataset_name)
content <- phs_GET("package_show", query)

# retrieve the resource id's from returned contect
all_ids <- purrr::map_chr(content$result$resources, ~ .x$id)

Check warning on line 26 in R/get_latest_resource_id.R

View workflow job for this annotation

GitHub Actions / lint

file=R/get_latest_resource_id.R,line=26,col=3,[object_usage_linter] local variable 'all_ids' assigned but may not be used


# add the id, created date and last_modified to a dataframe
Expand Down
2 changes: 2 additions & 0 deletions R/parse_col_select.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#'
#' @param col_select a character vector identifying the columns to select.
#' @return a character string
#' @keywords internal
#' @noRd
parse_col_select <- function(col_select) {
if (is.null(col_select)) {
return(NULL)
Expand Down
2 changes: 2 additions & 0 deletions R/parse_row_filters.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#' @description Formats a list or named vector into a valid query
#' @param row_filters list or named vectors matching fields to values
#' @return a json as a character string
#' @keywords internal
#' @noRd
parse_row_filters <- function(row_filters) {
# exit function if no filters
if (is.null(row_filters)) {
Expand Down
2 changes: 2 additions & 0 deletions R/phs_GET.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#' @inheritParams request_url
#' @param verbose TRUE or FALSE. If TRUE, a success message will be printed to the console.
#' @return content of a httr::GET request
#' @keywords internal
#' @noRd
phs_GET <- function(action, query, verbose = FALSE) {
# define URL
url <- request_url(action, query)
Expand Down
3 changes: 2 additions & 1 deletion R/request_url.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#' @param action The API endpoint you want to use, e.g., "package_show" / "datastore_search".
#' @param query The query to pass to the endpoint defined by the action argument.
#' @return a URL as a character string
#'
#' @keywords internal
#' @noRd
request_url <- function(action, query) {
# check action is valid
valid_actions <- c(
Expand Down
3 changes: 2 additions & 1 deletion R/suggest_dataset_name.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#'
#'
#' @param dataset_name a string to be matched against valid dataset names
#'
#' @keywords internal
#' @noRd
suggest_dataset_name <- function(dataset_name) {
content <- phs_GET("package_list", "")

Expand Down
3 changes: 2 additions & 1 deletion R/use_dump_check.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#' @param query a list of items to query
#' @param rows the number of rows user is requesting
#' @return a logical value. TRUE indicates that the dump should be used
#'
#' @keywords internal
#' @noRd
use_dump_check <- function(query, rows) {
# if row input is > 99999 or NULL
# or all queries (inc. rows) are null
Expand Down
14 changes: 0 additions & 14 deletions man/check_dataset_name.Rd

This file was deleted.

17 changes: 0 additions & 17 deletions man/check_res_id.Rd

This file was deleted.

17 changes: 0 additions & 17 deletions man/dump_download.Rd

This file was deleted.

14 changes: 0 additions & 14 deletions man/error_check.Rd

This file was deleted.

29 changes: 0 additions & 29 deletions man/get_latest_resource_id.Rd

This file was deleted.

17 changes: 0 additions & 17 deletions man/parse_col_select.Rd

This file was deleted.

17 changes: 0 additions & 17 deletions man/parse_row_filters.Rd

This file was deleted.

21 changes: 0 additions & 21 deletions man/phs_GET.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/request_url.Rd

This file was deleted.

14 changes: 0 additions & 14 deletions man/suggest_dataset_name.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/use_dump_check.Rd

This file was deleted.

Loading