Work with RIDL datasets (datasets)
Usage
dataset_create(metadata)
dataset_show(id)
dataset_update(id, metadata)
dataset_patch(id, metadata)
dataset_delete(id)
Arguments
- metadata
Metadata created by
dataset_metadata()
.- id
The id or name of the dataset.
Details
You must have the necessary permissions to create, edit, or delete datasets.
Note that several fields are required for dataset_create()
and dataset_update()
operations to succeed.
Consult dataset_metadata()
for the details.
For dataset_update()
/dataset_patch()
operations, it is recommended to
call dataset_show()
, make the desired changes to the result,
and then call dataset_update()
/dataset_patch()
with it.
The difference between the update and patch methods is that the patch will
perform an update of the provided parameters, while leaving all other
parameters unchanged, whereas the update methods deletes all parameters
not explicitly provided in the metadata
.
Examples
#-----
# test search in prod
Sys.unsetenv("USE_UAT")
# riddle::dataset_show(id = "unhcr-cbi-americas-quarterly-report")
#
# p <- riddle::dataset_show('rms_v4')
# list_of_ressources <- p[["resources"]][[1]]
# list_of_ressources
#-----
# Test create in UAT
Sys.setenv(USE_UAT=1)
m <- riddle::dataset_metadata(title = "Testing Riddle Interface",
name = "riddleapitest",
notes = "Making an API test",
owner_org = "americas", ## be careful- all lower case!!!
visibility = "public",
geographies = "UNSPECIFIED",
external_access_level = "open_access",
data_collector = "Motor Trend",
keywords = keywords[c("Environment", "Other")],
unit_of_measurement = "car",
data_collection_technique = "oth",
archived = "False")
# ## For the above to work - you need to make sure you have at least editor access
# to the corresponding container - i.e. owner_org = "exercise-container"
# p <- dataset_create(metadata = m)
# The return value is a representation of the dataset we just created in
# RIDL that you could inspect like any other R object.
# p
## Now deleting this!
# dataset_delete(id = p$id)
#-----
# Test create in prod
Sys.unsetenv("USE_UAT")
# m1 <- riddle::dataset_metadata(title = "Test",
# name = "Test",
# notes = "The data was extracted from kobo.",
# owner_org = "americas-regional-dataset",
# visibility = "public",
# geographies = "UNSPECIFIED",
# external_access_level = "open_access",
# data_collector = "UNHCR",
# keywords = keywords[c("Environment", "Other")],
# unit_of_measurement = "car",
# data_collection_technique = "oth",
# archived = "False")
# p <- riddle::dataset_create(metadata = m1)