Import Locations
Import locations using the OpenDataBio R client
3 minute read
The Opendatabio-R package was created to allow users to interact with an OpenDataBio server, to both obtain (GET) data or to import (POST) data into the database. This tutorial is a basic example of how to import data.
odb_config()
function. The most important parameters for
this function are base_url
, which should point to the API url for your OpenDataBio server, and
token
, which is the access token used to authenticate your user.token
is mandatory to import data.library(opendatabio)
base_url="https://opendb.inpa.gov.br/api"
token ="GZ1iXcmRvIFQ"
#create a config object
cfg = odb_config(base_url=base_url, token = token)
#test connection
odb_test(cfg)
Check the API Quick-Reference for a full list of POST endpoints and link to details.
All import functions have the same signature: the first argument is a data.frame
with data to be imported, and the second parameter is a configuration object generated by odb_config
.
When writing an import request, check the POST API docs in order to understand which columns can be declared in the data.frame
.
All import functions return a job id
, which can be used to check if the job is still running, if it ended with success or if it encountered an error. This job id can be used in the functions odb_get_jobs()
, odb_get_affected_ids()
and odb_get_log()
, to find details about the job, which (if any) were the IDs of the successfully imported objects, and the full log of the job. You may also see the log in your user jobs list in the web interface.
For Individuals, Vouchers and Identifications you may use incomplete dates.
The date format used in OpenDataBio is YYY-MM-DD (year - month - day), so a valid entry would be 2018-05-28
.
Particularly in historical data, the exact day (or month) may not be known, so you can substitute this fields with NA: ‘1979-05-NA’ means “an unknown day, in May 1979”, and ‘1979-NA-NA’ means “unknown day and month, 1979”. You may not add a date for which you have only the day, but can if you have only the month if is actually meaningful in some way.
Import locations using the OpenDataBio R client
Import Taxons using the OpenDataBio R client
Import Persons using the OpenDataBio R client
Import Traits using the OpenDataBio R client
Import Individuals & Vouchers using the OpenDataBio R client
Import Measurements using the OpenDataBio R client