diff --git a/R/add_context.R b/R/add_context.R index c473b4d..364e48a 100644 --- a/R/add_context.R +++ b/R/add_context.R @@ -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)) { diff --git a/R/check_dataset_name.R b/R/check_dataset_name.R index 2e4744f..4033888 100644 --- a/R/check_dataset_name.R +++ b/R/check_dataset_name.R @@ -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 diff --git a/R/check_res_id.R b/R/check_res_id.R index 5b8dc1f..4e1b8c2 100644 --- a/R/check_res_id.R +++ b/R/check_res_id.R @@ -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) { diff --git a/R/dump_download.R b/R/dump_download.R index 2058e2e..3e3a5f3 100644 --- a/R/dump_download.R +++ b/R/dump_download.R @@ -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( diff --git a/R/error_check.R b/R/error_check.R index cb670f8..46d6576 100644 --- a/R/error_check.R +++ b/R/error_check.R @@ -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) diff --git a/R/get_latest_resource_id.R b/R/get_latest_resource_id.R index 4bdabbe..d8b6e81 100644 --- a/R/get_latest_resource_id.R +++ b/R/get_latest_resource_id.R @@ -15,6 +15,8 @@ #' @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) diff --git a/R/parse_col_select.R b/R/parse_col_select.R index e45eed8..f2e76f3 100644 --- a/R/parse_col_select.R +++ b/R/parse_col_select.R @@ -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) diff --git a/R/parse_row_filters.R b/R/parse_row_filters.R index f099791..4144d3c 100644 --- a/R/parse_row_filters.R +++ b/R/parse_row_filters.R @@ -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)) { diff --git a/R/phs_GET.R b/R/phs_GET.R index 8a89c6c..d59a340 100644 --- a/R/phs_GET.R +++ b/R/phs_GET.R @@ -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) diff --git a/R/request_url.R b/R/request_url.R index d6a19ea..856c53b 100644 --- a/R/request_url.R +++ b/R/request_url.R @@ -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( diff --git a/R/suggest_dataset_name.R b/R/suggest_dataset_name.R index f59aab7..13d124a 100644 --- a/R/suggest_dataset_name.R +++ b/R/suggest_dataset_name.R @@ -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", "") diff --git a/R/use_dump_check.R b/R/use_dump_check.R index 15d9ba1..d053f27 100644 --- a/R/use_dump_check.R +++ b/R/use_dump_check.R @@ -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 diff --git a/man/check_dataset_name.Rd b/man/check_dataset_name.Rd deleted file mode 100644 index adf75d0..0000000 --- a/man/check_dataset_name.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/check_dataset_name.R -\name{check_dataset_name} -\alias{check_dataset_name} -\title{Throws an error if a dataset name is invalid} -\usage{ -check_dataset_name(dataset_name) -} -\arguments{ -\item{dataset_name}{a resource ID} -} -\description{ -Used to attempt to validate a dataset name before submitting it to the API -} diff --git a/man/check_res_id.Rd b/man/check_res_id.Rd deleted file mode 100644 index 2830d58..0000000 --- a/man/check_res_id.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/check_res_id.R -\name{check_res_id} -\alias{check_res_id} -\title{Check if a resource ID is valid} -\usage{ -check_res_id(res_id) -} -\arguments{ -\item{res_id}{a resource ID} -} -\value{ -TRUE / FALSE indicating the validity of the res_id -} -\description{ -Used to attempt to validate a res_id before submitting it to the API -} diff --git a/man/dump_download.Rd b/man/dump_download.Rd deleted file mode 100644 index 386260e..0000000 --- a/man/dump_download.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/dump_download.R -\name{dump_download} -\alias{dump_download} -\title{Use datastore dump to download whole files} -\usage{ -dump_download(res_id) -} -\arguments{ -\item{res_id}{a resource ID} -} -\value{ -dataframe containing resource records -} -\description{ -Use datastore dump to download whole files -} diff --git a/man/error_check.Rd b/man/error_check.Rd deleted file mode 100644 index 9a577b5..0000000 --- a/man/error_check.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/error_check.R -\name{error_check} -\alias{error_check} -\title{Throws errors found in the content of an \code{httr::GET} request} -\usage{ -error_check(content) -} -\arguments{ -\item{content}{object produced by \code{httr::content}} -} -\description{ -Throws errors found in the content of an \code{httr::GET} request -} diff --git a/man/get_latest_resource_id.Rd b/man/get_latest_resource_id.Rd deleted file mode 100644 index d79e6ae..0000000 --- a/man/get_latest_resource_id.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/get_latest_resource_id.R -\name{get_latest_resource_id} -\alias{get_latest_resource_id} -\title{get_latest_resource_id} -\usage{ -get_latest_resource_id(dataset_name) -} -\arguments{ -\item{dataset_name}{name of the dataset as found on -\href{https://www.opendata.nhs.scot/}{NHS Open Data platform}} -} -\value{ -a string with the resource id -} -\description{ -to be confident that the resource returned is the one intended -two conditions have to be met. It has to appear at the top of -of the resource list as shown on the open data platform. -The order they are returned via the api is the same -as they appear on the open data platform. It also -has to have the most recent date created -} -\details{ -There are only some datasets that this functionality -is relevant to, these are listed within applicable -datasets and are the datasets that keep historic -resources instead of over writing them. -} diff --git a/man/parse_col_select.Rd b/man/parse_col_select.Rd deleted file mode 100644 index f4148cc..0000000 --- a/man/parse_col_select.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/parse_col_select.R -\name{parse_col_select} -\alias{parse_col_select} -\title{Create fields query for GET} -\usage{ -parse_col_select(col_select) -} -\arguments{ -\item{col_select}{a character vector identifying the columns to select.} -} -\value{ -a character string -} -\description{ -Produces a comma separated list -} diff --git a/man/parse_row_filters.Rd b/man/parse_row_filters.Rd deleted file mode 100644 index eed28c1..0000000 --- a/man/parse_row_filters.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/parse_row_filters.R -\name{parse_row_filters} -\alias{parse_row_filters} -\title{Create JSON 'dict' from named list or vector} -\usage{ -parse_row_filters(row_filters) -} -\arguments{ -\item{row_filters}{list or named vectors matching fields to values} -} -\value{ -a json as a character string -} -\description{ -Formats a list or named vector into a valid query -} diff --git a/man/phs_GET.Rd b/man/phs_GET.Rd deleted file mode 100644 index 9b0df09..0000000 --- a/man/phs_GET.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/phs_GET.R -\name{phs_GET} -\alias{phs_GET} -\title{Send a GET request to the PHS CKAN API} -\usage{ -phs_GET(action, query, verbose = FALSE) -} -\arguments{ -\item{action}{The API endpoint you want to use, e.g., "package_show" / "datastore_search".} - -\item{query}{The query to pass to the endpoint defined by the action argument.} - -\item{verbose}{TRUE or FALSE. If TRUE, a success message will be printed to the console.} -} -\value{ -content of a httr::GET request -} -\description{ -Send a GET request to the PHS CKAN API -} diff --git a/man/request_url.Rd b/man/request_url.Rd deleted file mode 100644 index d629049..0000000 --- a/man/request_url.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/request_url.R -\name{request_url} -\alias{request_url} -\title{Produces a URL for a GET request to opendata.nhs.scot} -\usage{ -request_url(action, query) -} -\arguments{ -\item{action}{The API endpoint you want to use, e.g., "package_show" / "datastore_search".} - -\item{query}{The query to pass to the endpoint defined by the action argument.} -} -\value{ -a URL as a character string -} -\description{ -Produces a URL for a GET request to opendata.nhs.scot -} diff --git a/man/suggest_dataset_name.Rd b/man/suggest_dataset_name.Rd deleted file mode 100644 index ff47bbd..0000000 --- a/man/suggest_dataset_name.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/suggest_dataset_name.R -\name{suggest_dataset_name} -\alias{suggest_dataset_name} -\title{Throw an error with suggested dataset name, if possible.} -\usage{ -suggest_dataset_name(dataset_name) -} -\arguments{ -\item{dataset_name}{a string to be matched against valid dataset names} -} -\description{ -Throw an error with suggested dataset name, if possible. -} diff --git a/man/use_dump_check.Rd b/man/use_dump_check.Rd deleted file mode 100644 index cc20664..0000000 --- a/man/use_dump_check.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/use_dump_check.R -\name{use_dump_check} -\alias{use_dump_check} -\title{Determines if the datastore dump should be used} -\usage{ -use_dump_check(query, rows) -} -\arguments{ -\item{query}{a list of items to query} - -\item{rows}{the number of rows user is requesting} -} -\value{ -a logical value. TRUE indicates that the dump should be used -} -\description{ -Determines if the datastore dump should be used -}