api_check_batch: Create or update MS Bioscreen data entries?

Description Usage Arguments Value See Also

Description

api_check_batch fetches all the bioscreen data for the specified endpoint. api_check_batch then compares each entry in the inputed sufl data set with the corresponding entry in the bioscreen data set. For each entry in the inputed sufl data set, api_check_batch returns "create", "update", or "no action". When change is set to TRUE, api_check_batch will proceed to actually create and update entries. api_check_batch is similar to api_check except that it can take a sufl data set with multiple entries. When there is only one entry, use api_check for faster comparison. See ?api_check for more details.

Usage

1
2
3
4
5
api_check_batch(sufl_batch, endpoint, ignore_colnames = c("first_name",
  "last_name"), base_url = "https://msbioscreen-uat.herokuapp.com/api/v1",
  token = get_token(), verbose_b = TRUE, keep_na = FALSE,
  change = FALSE, destructive = FALSE, max_update = 200,
  max_delete = 200)

Arguments

sufl_batch

a data frame with any number of rows and column names that follow the current SUFL specification (1.0). At minimum, sufl_batch must contain the identifier columns "source_id" and "external_identifier". For attacks, treatments and visits data, sufl_batch must also contain the identifier columns "patient_source_id" and "patient_external_identifier".

endpoint

the data endpoint of interest. Possible values are "subjects", "attacks", "treatments", and "visits".

ignore_colnames

the names of the variables whose values should not be updated in the bioscreen. Set to NULL to allow any variable to be updated in the bioscreen if its value is different in the inputed sufl data set.

base_url

the API base URL.

token

HTTP authorization token. Default is to get environment variable 'MSBWAITER_TOKEN'.

verbose_b

print progress messages as function runs?

keep_na

when there is an NA value in the sufl data set that is not NA in the corresponding bioscreen data entry, should the value in the bioscreen be overwritten to NA? Default is set to FALSE so that non-missing values in the bioscreen are not overwritten to NA.

change

should the function proceed to actually create and update entries in the bioscreen? Default is set to FALSE.

destructive

if TRUE and change = TRUE, api_check_batch will delete any data in the bioscreen that is not found in sufl_batch but that has a source_id that is found sufl_batch.

max_update

the maximum number of entries that you expect will need to be updated. If there are more than max_update entries to update, api_check_batch will not proceed to create/update/delete entries in the bioscreen even if change is equal to TRUE. Set to NA for no restriction on max_update.

max_delete

the maximum number of entries that you expect will need to be deleted from the bioscreen when destructive = TRUE. If there are more than max_delete entries to delete, api_check_batch will not proceed to create/update/delete entries in the bioscreen even if destructive and change are equal to TRUE. Set to NA for no restriction on max_delete.

Value

api_check_batch returns a list of length 2. The first entry in the list is a vector the same length as the number of rows in sufl_batch where each entry of the vector is either create', 'update', or 'no action'. See ?api_check for more details. The second entry in the list is the number of entries that were found in the bioscreen but not in sufl_batch.

See Also

api_check, api_get_batch, api_create, api_update, to_json_non_array


UCSF-MSLAB/msbwaiter documentation built on May 9, 2019, 5:19 p.m.