CoolFace
Datasetpublic

food-ai-nexus/organic-milk-spores-us-farms

Bacterial Spore Levels in Organic Bulk Tank Milk (US Farms) is a longitudinal tabular dataset linking bacterial spore counts in bulk tank raw milk to farm management characteristics and meteorological conditions across 102 certified organic dairy farms in 11 US states. With this dataset, researchers can train machine learning models to identify farm-level and environmental predictors of bacterial spore contamination in organic bulk tank milk, and study the interplay between farm practices… See the full description on the dataset page: https://huggingface.co/datasets/food-ai-nexus/organic-milk-spores-us-farms.

sourceHugging Facecc-by-4.0updated 6mo agoView on Hugging Face
0likes15downloads
Dataset Card

Bacterial Spore Levels in Organic Bulk Tank Milk (US Farms) is a longitudinal tabular dataset linking bacterial spore counts in bulk tank raw milk to farm management characteristics and meteorological conditions across 102 certified organic dairy farms in 11 US states.

With this dataset, researchers can train machine learning models to identify farm-level and environmental predictors of bacterial spore contamination in organic bulk tank milk, and study the interplay between farm practices, weather, and microbial quality.

Content

  • —The dataset contains 2,657 bulk tank raw milk test records from 102 certified organic dairy farms across 11 US states (California, Colorado, Iowa, Idaho, Minnesota, New York, Oregon, Pennsylvania, Vermont, Washington, Wisconsin).
  • —Farms were sampled bimonthly between May 2021 and August 2022 (up to 6 sampling rounds per farm, labeled A–H).
  • —It spans 102 columns covering the microbial test outcome, farm survey variables (housing, bedding, milking practices, feed, staffing), and meteorological variables for the day of sampling and the 3 preceding days.
  • —Farms varied widely in herd size (24–4,000 lactating cows), milking system (conventional parlor, stall/barn, or robotic), and geographic region.
  • —The dataset was used to train gradient-boosted tree and random forest models predicting bacterial spore levels. See the associated publication for full modeling details.

Data Fields

The dataset contains 102 columns organized into five groups: identifiers, microbial outcome, farm survey variables, holding/parlor/towel cleaning indicators, and meteorological variables.

Identifiers

ColumnDescription
FarmIDAnonymous farm identifier (R1–R102)
SampleTimeDate of sample collection (YYYY-MM-DD)
SamplingSampling round identifier (A–H, bimonthly)
LocFarm location (US state abbreviation: CA, CO, IA, ID, MN, NY, OR, PA, VT, WA, WI)

Microbial Outcome

ColumnDescription
TestType of microbiological test performed (SPC = standard plate count, BAB = butyric acid bacteria, MSC = mesophilic spore count)
ConcMicrobial concentration (cfu/mL or spores/mL; left-censored values imputed as half the detection limit)
SPCvarFarm-level standard deviation of log₁₀(SPC) across all sampling rounds; used as a predictor of within-farm variability

Farm Characteristics

ColumnDescription
CertYearNumber of years the farm has been certified organic
CowNumNumber of milking cows on the day of survey (one missing value imputed as cross-farm mean)
HouseStyleHousing style for lactating cows ("Free stalls", "Tie stalls or stanchions", "Bedded pack", "Other")
StockDenStocking density — ratio of cows to available stalls (0 for bedded pack, pasture, and dry lot farms)
BedBedding material ("Sawdust", "Straw", "Manure solids", "OtherInorg", "Organic and inorganic blend", "Other organic")
BedAddBedding additive used ("No bed additives", "Limestone", "Other")
BedAddFreqFrequency of adding or topping up bedding ("< 1x per day", "1x per day", ">= 2x per day")
StallCleanFreqFrequency of stall cleaning ("< 1x/day", "1x per day", "2x per day", ">= 3x per day")
PastureTimeHours per day lactating cows spend on pasture at time of survey
ClosedHerdWhether the farm maintains a closed herd ("Yes", "No")
FeedPurchaseWhether the farm purchases feed ("Yes", "No")
DryMatPercentPercentage of dry matter intake currently from pasture ("< 40%", "40-70%", "> 70%")

Staffing

ColumnDescription
PplNumPerWkNumber of different people milking cows throughout a week
PplNumPerShiftNumber of people milking cows in one milking shift
NonFamEmpNumNumber of non-family employees who milk cows (0 if none)
FullEmpNumNumber of full-time employees who milk cows (0 if none)
PartEmpNumNumber of part-time employees who milk cows (0 if none)

Milking Practices

ColumnDescription
MilkFreqAverage number of milkings per cow per day (numeric; 2.75 = midpoint of the original "2.7–2.8" robotic range)
CowMilkLocLocation where cows are milked ("Parlor", "Stall/barn", "Robot")
ParlorWhether cows are milked in a parlor ("Yes", "No")
GloveWhether gloves are worn during milking ("Yes", "No", "Sometimes")
GloveFreqFrequency of glove changes per milking shift ("1", "1-2", ">3", "unknown")
PreDipTypeType of pre-dip used ("Iodine based", "Hydrogen peroxide based", "No predip", "Other")
PostDipTypeType of post-dip used ("Iodine based", "Hydrogen peroxide based", "No PostDip", "Other")
UdderStiUdder stimulation method prior to milking ("Forestripping", "None", "Other")
ClipFlameWhether lactating cow udders are clipped and/or flamed ("Yes", "No")
CowMilkLocLocation where cows are milked ("Parlor", "Stall/barn", "Robot")
CowParlorCleanWhether cows are present when the parlor or milking area is cleaned ("Yes", "No")
CowWaitMilkWhether cows wait in a holding area before milking ("Yes", "No")
CowHoldCleanWhether cows are present during holding area cleaning ("Yes", "No", "No holding area")
TeatEndScoreWhether teat end scoring is routinely performed on the farm ("Yes", "No")
UdderHygScoreWhether udder hygiene is routinely scored on the farm ("Yes", "No")
TowelTypeType of towel used to clean teats ("Paper", "Laundered", "Moistened wipes", "Robot brush")
CowTowelWipeNumber of cows wiped with one individual towel ("0-1", "> 1")

Feed Types (Binary Indicators)

Each column indicates whether the farm feeds the specified feed type ("Yes" / "No").

ColumnDescription
CornSilageFarm feeds corn silage
HaylageFarm feeds haylage
CornMealFarm feeds corn meal
DryHayFarm feeds dry hay
BaleageFarm feeds baleage
GrassSilageFarm feeds grass silage
EarlageFarm feeds earlage
SnaplageFarm feeds snaplage
BioFeedAddWhether biological feed additives are used ("None", "Other")

Holding Area Cleaning Methods (Boolean Indicators)

Derived by splitting the free-text holding area cleaning response. TRUE if the method was mentioned.

ColumnDescription
HoldHoseHolding area cleaned by hosing
HoldManScrapHolding area cleaned by manual scraping
HoldFluSysHolding area cleaned by flush system
HoldScrBruHolding area cleaned by scrub brush

Parlor Cleaning Methods (Boolean Indicators)

Derived by splitting the free-text parlor cleaning response. TRUE if the method was mentioned.

ColumnDescription
ParlorHoseParlor cleaned by hosing
ParlorManScrapParlor cleaned by manual scraping
ParlorFluSysParlor cleaned by flush/automated system
ParlorDeterParlor cleaned with detergent
ParlorScrBruParlor cleaned with scrub brush
ParlorRobotParlor cleaned by robot

Towel Cleaning Protocol (Boolean Indicators)

Derived by splitting the free-text towel cleaning protocol response. TRUE if the method was mentioned.

ColumnDescription
TowelChloDeterTowels washed with chlorinated detergent
TowelDeterTowels washed with detergent
TowelBleacTowels washed with bleach
TowelMacDryTowels machine dried
TowelLaundryTowels sent to laundry service
TowelVinegarTowels washed with vinegar
TowelWashMacTowels washed in a washing machine

Meteorological Variables

Weather data were obtained from Visual Crossing for each farm location. Four time windows are provided: the day of sampling (_0d, no suffix), 1 day prior (_1d), 2 days prior (_2d), and 3 days prior (_3d). The columns below are repeated for each suffix.

Column (base name)DescriptionUnits
tempmaxMaximum daily temperature°F
tempminMinimum daily temperature°F
tempMean daily temperature°F
humidityMean relative humidity%
precipTotal precipitationinches
precipcoverPercentage of day with measurable precipitation%
windgustMaximum wind gust speed (0 if missing)mph
windspeedMean wind speedmph
solarradiationMean solar radiationW/m²

Uses

The dataset was originally used to train gradient-boosted tree (XGBoost) and random forest models predicting bacterial spore levels in organic bulk tank milk from farm characteristics and meteorological variables. It can also be used for research in organic dairy food safety, agricultural microbiology, farm management optimization, and longitudinal mixed-effects modeling.

Use the "Use this dataset" button at the top of the page to load the dataset into your preferred library. To load and prepare the data:

python
import pandas as pd
from datasets import load_dataset

ds = load_dataset("food-ai-nexus/organic-milk-spores-us-farms")
df = ds["train"].to_pandas()

License

This dataset is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0). It is intended for research and educational use. Please cite the associated publication when using this dataset.

Reference

bibtex
@article{qian2025organic,
  title={A Machine--Learning Approach Reveals That Bacterial Spore Levels in Organic Bulk Tank Milk are Dependent on Farm Characteristics and Meteorological Factors},
  author={Qian, C. and Wiedmann, M. and Martin, N.H.},
  journal={Journal of Food Protection},
  volume={88},
  pages={100477},
  year={2025},
  doi={10.1016/j.jfp.2024.100477}
}