Skip to contents

This function merges fishing trip tracking data with landing records by matching IMEI numbers and landing dates. It only merges records where there is exactly one trip and one landing per day for a given IMEI to ensure accurate matching.

Usage

merge_trips(log_threshold = logger::DEBUG)

Arguments

log_threshold

Logging level threshold. Defaults to logger::DEBUG.

Value

None (invisible). Results are written directly to MongoDB.

Details

The function performs the following steps:

  1. Pulls preprocessed landing data from MongoDB

  2. Retrieves deployed device metadata

  3. Fetches trip tracking data from PDS (Pelagic Data Systems)

  4. Validates IMEI numbers

  5. Identifies unique trips per day

  6. Merges landing records with tracking data

  7. Uploads merged results back to MongoDB

Data Requirements

  • MongoDB connection with preprocessed landing data

  • Valid PDS API credentials in configuration

  • Deployed device metadata with IMEI numbers

Warning

This function assumes that trips ending on the same day as landings correspond to each other. This assumption may not hold if multiple trips occur on the same day.

Examples

if (FALSE) { # \dontrun{
merge_trips()
merge_trips(log_threshold = logger::INFO)
} # }