Skip to content

Add new food-habits data pipeline in data-raw/food-habits (ingestion, estimators, exports)#97

Merged
EOGrady21 merged 16 commits intoMarEcosystemApproaches:mainfrom
inSileco:main
Apr 8, 2026
Merged

Add new food-habits data pipeline in data-raw/food-habits (ingestion, estimators, exports)#97
EOGrady21 merged 16 commits intoMarEcosystemApproaches:mainfrom
inSileco:main

Conversation

@david-beauchesne
Copy link
Copy Markdown
Contributor

Summary

This PR introduces a new implementation for food-habits data products in data-raw/food-habits/.

The implementation is intentionally isolated to data-raw/food-habits/ and does not modify existing package runtime code.

What was implemented

1) Processing workflow

Updated data-raw/food-habits/food-habits.R as the orchestration script.
It handles input loading, standardization, filtering/grouping configuration, estimation workflows, and export/save of outputs.

2) Utilities and shared helpers

Added data-raw/food-habits/food-habits-utils.R with:

  • input-path resolution and loading helpers
  • data standardization and joins (predator/prey code/name mapping)
  • filtering and optional code-grouping logic
  • plot export utilities

3) Mean-diet estimator

Added data-raw/food-habits/food-habits-estimate-mean-diet.R with:

  • stratified estimator using predator-length and survey-stratum aggregation
  • optional label-column enrichment
  • optional prey exclusion list
  • optional custom length/strata weights
  • configurable denominator mode for predator counts

4) Dominant prey summaries

Added data-raw/food-habits/food-habits-estimate-dominant-prey.R:

  • built from estimate_mean_diet()
  • supports top-N and threshold filters

5) Predator contribution summaries

Added data-raw/food-habits/food-habits-estimate-predator-contribution.R:

  • summarizes predator contribution to focal prey
  • supports top-N predator filtering and contribution thresholds

Outputs produced by workflow

The pipeline produces:

  • food_habits_full
  • food_habits_stomach
  • food_habits_species
  • food_habits_mean_diet_stratified
  • food_habits_dominant_prey_timeseries
  • food_habits_prey_predation

Outputs are saved in data-raw/food-habits/*.rda and exported with usethis::use_data(...).

Examples and figures

If run_examples <- TRUE in the processing script, figures are automatically exported.

@jamiectam jamiectam requested a review from EOGrady21 March 24, 2026 13:52
@EOGrady21
Copy link
Copy Markdown
Collaborator

@david-beauchesne
This pull request cannot be merged due to unresolved conflicts. I do not have permission to write to the head branch

Conflicts should be resolved on inSileco:main, I don't anticipate they are anything major but I Cannot see the details unfortunately

@KevCaz
Copy link
Copy Markdown
Contributor

KevCaz commented Apr 8, 2026

@EOGrady21 conflicts should be resolved now. Let me know if you need something else.

@EOGrady21 EOGrady21 merged commit 95578b9 into MarEcosystemApproaches:main Apr 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants