Skip to contents

Read and write telemetry data in the SpeedGoat database from R.

Query individuals, devices, deployments, captures, events and GPS positions, and create, update or delete them. Authentication is automatic — the first call that needs credentials starts the login flow, so there is no key to configure.

# What is in this project?
devices <- telem_read_devices()
elk <- telem_read_individuals(species_id = 4)

# Reads return every matching record. Page deliberately if you would rather:
first_page <- telem_read_devices(pages = list(size = 100))

# Creates take a data frame, one row per record.
telem_create_devices(
  data.frame(serial_number = c("A-001", "A-002"), state = "In-Hand")
)

Every create checks your data against the fields the endpoint actually accepts before sending anything, and reports every problem at once rather than stopping at the first. telem_fields() is that list, and telem_validate() runs the check on its own if you want it earlier:

telem_fields("devices")
telem_validate(my_devices, "devices")

The values the API accepts for its enumerated fields are functions too, so a value can be checked against the list rather than guessed at:

What you are allowed to do

The API decides from your role, not from which package you installed:

Operation Requires
read, create, update membership of the project
delete the Admin role, and membership of the project

A caller without the Admin role gets a 403 from a delete rather than a deletion.

Discovering what an endpoint accepts

spdgt.auth::api_discover() asks the API to describe itself, rather than sending you to the source:

spdgt.auth::api_discover("telemetry")              # every endpoint and its actions
spdgt.auth::api_discover("telemetry", "/events")   # the filters this one takes

Discovery is built from the API’s OpenAPI annotations, which have drifted from the validation rules that run — so for the fields a write accepts, prefer telem_fields().

Reporting problems

Report them at https://support.spdgt.com, with what you called, what came back, and the output of sessionInfo().

This package’s source repository is private, so a GitHub issues link would send you somewhere you cannot reach. Support is the route that works for everyone who can install the package.