TemploApi class
TemploApiClient.Rd
API client to consume TEMPLO's API
Value
TRUE or FALSE
TRUE or FALSE
record with the data being sent plus the unique identifier generated by the remote database
a dataframe with the sought information.
a dataframe with the sought information.
a dataframe with the sought information.
a dataframe with the sought information.
TRUE if successfully completed. Error message otherwise.
Public fields
base_url
string containing the base url of the querying API (without the end_point) part
headers
list of HTTP headers
token
string to authenticate against the API
Active bindings
base_url
string containing the base url of the querying API (without the end_point) part
Methods
Method add_species()
Add a dataframe of unique species to the database through the API. One insertion is done per species. Species failing to be inserted for whatever reason will be reported to the stdout, along with each error. Those sucesfully inserted will be listed. In case either none or all were inserted, the final output will report it so.
Method add_tagged_individuals()
Add a dataframe of tagged_individuals to the database through the API. One insertion is done per individual, irrespective of how many rows such individual may have due to its associated sensors. Individuals failing to be inserted for whatever reason will be reported to the stdout, along with each error. Those sucesfully inserted will be listed. In case either none or all were inserted, the final output will report it so.
Usage
TemploApiClient$add_tagged_individuals(
df,
individual_prefix,
tag_prefix,
sensor_prefix,
tagged_individual_prefix,
field_names = c("individual_data", "tag_data", "sensors_data",
"tagged_individual_data"),
end_point = "tagged_individuals/"
)
Arguments
df
dataframe with pontetial multiple-row individuals (if multiple sensors); one row otherwise.
individual_prefix
string identifying what columns belong to the individual dataset
tag_prefix
string identifying what columns belong to the tag dataset
sensor_prefix
string identifying what columns belong to the sensor dataset
tagged_individual_prefix
string identifying what columns belong to the tagged_individual dataset
field_names
a character vector containing what the names of the datasets to be sent to the API should be
end_point
string with the name of the end point being queried.
Method add_single_record_and_fetch_id()
General method to add a single record to the database through the API
Method get_tagged_individuals()
Get all tagged individuals from the database. This operation may take a few seconds and makes two API calls: one to get the tagged_individual data and another one to get the sensor types. The final result is a merge between both retrieved datasets.
Method get_environmental_readings()
Get environmental data from the API that were emitted by receptors