Skip to contents

Retrieves boat/device data from Pelagic Data Systems API, processes and cleans the data, maps country information from Airtable, and syncs the results back to Airtable. This function handles the complete workflow for maintaining up-to-date device information.

Usage

ingest_pelagic_boats(conf = NULL)

Arguments

conf

List. Configuration parameters (defaults to read_config()). Must contain pds (username, password, customer_id) and airtable (token, frame base_id) configuration.

Value

List containing the authentication response and sync results.

Details

The function performs the following steps:

  1. Authenticates with Pelagic Data Systems API

  2. Retrieves boat data with device and vessel characteristics

  3. Cleans and standardizes the data format

  4. Maps customer names to standardized country names, and each country to its timezone

  5. Retrieves country IDs from Airtable Countries table

  6. Syncs the processed data to the pds_devices Airtable table

Country mapping includes: Egypt, Timor-Leste, Mozambique, Zanzibar, Kenya, Malaysia, Malawi, Tanzania, Bangladesh, and India.

device_timezone comes from the country, not from the timezone PDS holds for each tracker: PDS has reset trackers in the field to America/Los_Angeles, a value the Airtable field does not accept.

Examples

if (FALSE) { # \dontrun{
# Using default configuration
result <- ingest_pelagic_boats()

# Using custom configuration
custom_config <- read_config("custom_conf.yml")
result <- ingest_pelagic_boats(custom_config)
} # }