Export Processed Fisheries Data to MongoDB
export_data.Rd
Processes validated survey data to generate summary metrics and exports them to MongoDB collections. The function calculates three main types of metrics:
Monthly CPUE and RPUE metrics by landing site
Gear-specific metrics by landing site and habitat
Taxa proportions by landing site
Usage
export_data(log_threshold = logger::DEBUG)
Arguments
- log_threshold
The logging level threshold for the logger package (e.g., DEBUG, INFO) See
logger::log_levels
for available options.
Value
None (invisible). The function performs its operations for side effects:
Processes survey data into summary metrics
Uploads results to MongoDB collections
Generates logs of the process
Details
The function performs the following operations:
Filters out landing sites with >75% missing CPUE data
Calculates monthly median CPUE and RPUE values
Processes gear-specific metrics, excluding gears with spaces in names and "other" category
Computes taxa proportions, grouping taxa with <5% representation as "Others"
Uploads processed data to specified MongoDB collections
The metrics calculated include:
CPUE (Catch Per Unit Effort)
RPUE (Revenue Per Unit Effort)
Catch proportions by taxa
Exported collections:
Monthly metrics: Time series of CPUE and RPUE by landing site
Gear metrics: CPUE and RPUE by gear type, habitat, and landing site
Taxa proportions: Percentage contribution of each taxa to total catch by landing site
See also
get_validated_surveys()
for details on the input data formatmdb_collection_push()
for details on the MongoDB upload processexpand_taxa()
for details on taxa classification
Examples
if (FALSE) { # \dontrun{
# Export data with default debug logging
export_data()
# Export with info-level logging only
export_data(logger::INFO)
} # }