Skip to contents

This function imports and validates preprocessed fisheries data from a MongoDB collection. It performs a series of validation checks to ensure data integrity, including checks on dates, fisher counts, boat numbers, catch weights, and IMEI numbers. The function then compiles the validated data and corresponding alert flags, which are subsequently uploaded back to MongoDB.

Usage

validate_landings(log_threshold = logger::DEBUG)

Arguments

log_threshold

Logging threshold level (default: logger::DEBUG)

Value

This function does not return a value. It processes the data and uploads the validated results to a MongoDB collection in the pipeline database.

Details

The function performs the following main operations:

  1. Pulls preprocessed landings data from the preprocessed MongoDB collection.

  2. Validates the data for consistency and accuracy, focusing on:

    • Date validation

    • Number of fishers

    • Number of boats

    • Catch weights and prices

    • IMEI numbers

  3. Generates a validated dataset that integrates the results of the validation checks.

  4. Creates alert flags to identify and track any data issues discovered during validation.

  5. Merges the validated data with additional metadata, such as survey details and landing site information.

  6. Uploads the validated dataset to the validated MongoDB collection.

Note

This function requires a configuration file to be present and readable by the 'read_config' function, which should provide MongoDB connection details and parameters for validation.

Examples

if (FALSE) { # \dontrun{
validate_landings()
} # }