Skip to content

Commit 720cedf

Browse files
author
Vambrocop
committed
Add nutrient meta data and R workflow patterns
1 parent dda9e73 commit 720cedf

5 files changed

Lines changed: 71 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@ skills/
187187
├── ml-yield-feature-schema.csv
188188
├── ml-yield-prediction-audit.md
189189
├── multi-objective-tradeoff-schema.csv
190+
├── nutrient-meta-dataset-schema.csv
190191
├── nutrient-meta-extraction-schema.csv
191192
├── nutrient-meta-reproducibility-ledger.csv
193+
├── nutrient-meta-r-workflow-blueprint.csv
192194
├── pareto-frontier-audit.md
193195
├── peco-framework.md
194196
├── policy-scenario-matrix.csv

‎skills/environment-life-review-forge/SKILL.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Use `templates/food-environment-bidirectional-audit.md` and `templates/food-envi
5959
Use `templates/food-waste-forecast-audit.md` and `templates/food-waste-geospatial-feature-schema.csv` for geospatial food-waste forecasting.
6060
Use `templates/dual-outcome-meta-audit.md` and `templates/nutrient-meta-extraction-schema.csv` for agroecosystem nutrient meta-analysis.
6161
Use `templates/nutrient-meta-reproducibility-ledger.csv` when a nutrient meta-analysis provides Zenodo/OSF/GitHub data and code.
62+
Use `templates/nutrient-meta-dataset-schema.csv` and `templates/nutrient-meta-r-workflow-blueprint.csv` when designing data tables and R scripts for nutrient meta-analysis.
6263
Use `templates/ml-yield-prediction-audit.md` and `templates/ml-yield-feature-schema.csv` for agricultural ML yield-prediction studies.
6364
Use `templates/scenario-model-audit.md` and `templates/policy-scenario-matrix.csv` for scenario-model evidence synthesis.
6465
Use `templates/pareto-frontier-audit.md` and `templates/multi-objective-tradeoff-schema.csv` for multiobjective optimization and land-use trade-off studies.

‎skills/environment-life-review-forge/references/agroecosystem-nutrient-meta-analysis.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ The reproducibility package exposes the data-engineering layer that the article
5050
- location maps, density plots, forest-style summaries, and moderator plots using `ggplot2`, `patchwork`, and `cowplot`.
5151

5252
Use `templates/nutrient-meta-reproducibility-ledger.csv` to audit similar repositories.
53+
Use `templates/nutrient-meta-dataset-schema.csv` as a field-level design pattern for yield/SOC treatment-control extraction tables.
54+
Use `templates/nutrient-meta-r-workflow-blueprint.csv` as a script-organization pattern for reproducible R analyses.
55+
56+
Reusable data/code design lessons:
57+
58+
- keep yield and SOC as separate tables when the outcome families have different sample sizes and time horizons;
59+
- preserve raw treatment and control values, then calculate `lnRR` in code;
60+
- include geography, climate, soil baseline, nutrient rate, crop, crop system, and duration before modeling;
61+
- create stable `Study_ID` and `Entry_ID` fields before multilevel models;
62+
- record any imputed or gap-filled covariates, especially MAT/MAP from WorldClim;
63+
- separate `metafor` synthesis from BRT moderator exploration;
64+
- treat BRT relative influence as exploratory variable ranking, not causal proof;
65+
- export summary tables and figures from code, not by hand.
5366

5467
## What To Extract
5568

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
field,required,outcome_scope,example_column_from_potassium_meta,description,unit_or_coding,audit_rule
2+
citation,yes,both,Citation,Short paper identifier such as first author and year,string,Must be stable enough to construct Study_ID
3+
title,yes,both,Title,Paper title,string,Use to disambiguate repeated first-author-year citations
4+
latitude,no,both,Lat,Study site latitude,decimal degrees,Required for geospatial mapping or climate gap filling
5+
longitude,no,both,Lon,Study site longitude,decimal degrees,Required for geospatial mapping or climate gap filling
6+
mean_annual_temperature,no,both,MAT,Mean annual temperature,degrees C,Flag whether observed or gap-filled
7+
mean_annual_precipitation,no,both,MAP,Mean annual precipitation,mm,Flag whether observed or gap-filled
8+
soil_clay,no,both,Clay,Soil clay content,percent,Moderator not an outcome
9+
baseline_soc,no,both,SOC,Baseline soil organic carbon,g/kg,Do not confuse baseline SOC with SOC outcome response
10+
total_nitrogen,no,both,TN,Soil total nitrogen,g/kg,Moderator
11+
total_phosphorus,no,both,TP,Soil total phosphorus,g/kg,Moderator
12+
total_potassium,no,both,TK,Soil total potassium,g/kg,Moderator
13+
available_nitrogen,no,both,AN,Soil available nitrogen,mg/kg,Moderator
14+
available_phosphorus,no,both,AP,Soil available phosphorus,mg/kg,Moderator
15+
available_potassium,no,both,AK,Soil available potassium,mg/kg,Important for baseline K limitation
16+
bulk_density,no,both,BD,Soil bulk density,g/cm3,Needed for SOC stock conversion if available
17+
soil_ph,no,both,pH,Soil pH,pH units,Moderator
18+
duration_years,yes,both,Duration,Experiment duration,years,Keep numeric and create time bins in code
19+
potassium_type,yes,both,potassium type,Fertilizer form or K source,string,Standardize spelling before subgrouping
20+
potassium_rate,no,both,potassium rate,K application rate,usually kg K ha-1 or reported unit,Record unit and conversion assumptions
21+
treatment,yes,both,treatment,Nutrient treatment background such as K NK NPK OK PK,categorical,Defines comparator context and co-applied inputs
22+
crop,yes,both,crop,Crop species or crop group,string,Can derive C3/C4 grouping if agronomically justified
23+
crop_system,no,both,crop system,Rotation monoculture or other system,categorical,Keep separate from crop species
24+
n_control,no,both,cksize,Control sample size or replication,count,Used in approximate weight calculation
25+
n_treatment,no,both,nsize,Treatment sample size or replication,count,Used in approximate weight calculation
26+
yield_control,conditional,yield,yield_control,Control yield value,reported yield unit,Preserve before lnRR conversion
27+
yield_treatment,conditional,yield,yield_treatment,Treatment yield value,reported yield unit,Preserve before lnRR conversion
28+
soc_control,conditional,soc,SOC_control,Control SOC value,reported SOC unit,Preserve before lnRR conversion
29+
soc_treatment,conditional,soc,SOC_treatment,Treatment SOC value,reported SOC unit,Preserve before lnRR conversion
30+
lnrr_yield,derived,yield,lnratio_yield,Log response ratio for yield,log(treatment/control),Calculate in code rather than hand entry
31+
lnrr_soc,derived,soc,lnratio_SOC,Log response ratio for SOC,log(treatment/control),Calculate in code rather than hand entry
32+
study_id,derived,both,Study_ID,Numeric or string study-level cluster ID,derived from citation or citation-title,Needed for multilevel random effects
33+
entry_id,derived,both,Entry_ID,Effect-level row ID,unique per row,Needed for nested random effects
34+
weight,derived,both,weight,Analysis weight from duration and replication,project-specific formula,Formula must be documented and sensitivity checked
35+
variance,derived,both,vi,Approximate sampling variance or inverse weight,positive numeric,Do not hide approximate variance assumptions
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
stage,script_section,example_from_potassium_r,why_it_matters,guardrail
2+
1,load_packages,"terra geodata metafor patchwork cowplot gbm broom tidyverse sf rnaturalearth purrr ggplot2 stringr",Makes runtime dependencies explicit,Record package versions or session info
3+
2,read_raw_data,"read.table for yield and SOC CSV files",Keeps outcome families separate,Do not merge yield and SOC before effect-size calculation
4+
3,compute_effect_metric,"lnratio_yield = log(yield_treatment/yield_control); lnratio_SOC = log(SOC_treatment/SOC_control)",Preserves transparent treatment-control transformation,Keep original treatment/control values
5+
4,derive_agronomic_groups,"C3/C4 crop grouping from crop names",Adds biologically interpretable moderator,Document grouping rule and exceptions
6+
5,gap_fill_environment,"WorldClim MAT/MAP via geodata and terra",Completes climate moderators,Flag observed versus imputed climate values
7+
6,assign_geography,"sf plus rnaturalearth country region and agricultural region assignment",Supports maps and regional subgrouping,Keep missing coordinates visible
8+
7,summarize_dataset,"TableS1 yield and SOC summary CSV outputs",Documents data coverage before modeling,Report n and missingness by key moderator
9+
8,map_and_density_plots,"study distribution maps and lnRR density plots",Shows spatial and effect-size coverage,Do not let polished figures hide sparse regions
10+
9,prepare_model_data,"time bins; numeric duration/sample sizes; weight; vi; Study_ID; Entry_ID",Creates model-ready structure,Document approximate weight and variance formula
11+
10,run_multilevel_meta_analysis,"metafor::rma.mv with random = ~ 1 | Study_ID/Entry_ID",Handles multiple effects per study,Use simpler fallback only with convergence note
12+
11,subgroup_models,"treatment potassium.type crop.system crop C34 time region",Tests interpretable moderator strata,Do not present subgroup estimates as causal mechanisms
13+
12,transform_outputs,"100 * (exp(estimate) - 1) for percent change",Makes lnRR interpretable,Keep lnRR and CI alongside percent change
14+
13,forest_summary_plots,"forest-style category plots for yield and SOC",Communicates pooled and subgroup effects,Show number of effects behind each estimate
15+
14,subgroup_significance,"QM tests from model objects",Checks moderator signal,Do not rely only on p-values without heterogeneity context
16+
15,brt_moderator_exploration,"gbm with n.trees 12000 shrinkage 0.005 interaction.depth 2",Ranks nonlinear moderator importance,Label BRT exploratory unless validation is strong
17+
16,brt_performance,"broom::glance on observed vs predicted",Reports R2-style fit summary,Performance is not out-of-sample causality
18+
17,variable_influence_tables,"relative influence grouped into Soil Fertilizer Climate Crop",Turns ML output into domain categories,Group definitions must be declared before interpretation
19+
18,moderator_relationship_plots,"metafor::rma with selected moderators and weighted points",Connects moderator plots back to meta-analysis,Separate significant and nonsignificant relationships
20+
19,export_artifacts,"write.csv and ggsave for tables and figures",Keeps outputs reproducible,No manual editing of final numerical outputs

0 commit comments

Comments
 (0)