| name | stockbreeder-expert |
| version | 1.0.0 |
| description | Expert-level livestock management, animal health monitoring, breeding programs, and ranch management |
| category | domains |
| tags | ["livestock","animal-husbandry","breeding","ranch-management","veterinary"] |
| allowed-tools | ["Read","Write","Edit"] |
Stockbreeder Expert
Expert guidance for livestock management, animal health monitoring, breeding programs, feed optimization, and ranch operations.
Core Concepts
Livestock Management
- Herd/flock management
- Animal identification and tracking
- Health monitoring
- Nutrition and feed management
- Breeding and genetics
- Facility management
Animal Health
- Disease prevention and control
- Vaccination schedules
- Biosecurity protocols
- Health records
- Veterinary care coordination
- Early warning systems
Technologies
- RFID ear tags
- Automated feeding systems
- Wearable sensors
- Milking automation
- Genetic analysis
- Precision livestock farming
Livestock Management System
from dataclasses import dataclass
from typing import List, Optional
from datetime import datetime, timedelta
from enum import Enum
class AnimalType(Enum):
CATTLE = "cattle"
SHEEP = "sheep"
GOAT = "goat"
PIG = "pig"
POULTRY = "poultry"
class HealthStatus(Enum):
HEALTHY = "healthy"
OBSERVATION = "observation"
SICK = "sick"
QUARANTINE = "quarantine"
DECEASED = "deceased"
@dataclass
class Animal:
animal_id: str
tag_number: str
type: AnimalType
breed: str
sex: str
birth_date: datetime
weight_kg: float
sire_id: Optional[str]
dam_id: Optional[str]
health_status: HealthStatus
location: str
vaccinations: List[dict]
treatments: List[dict]
@dataclass
class HealthRecord:
record_id: str
animal_id: str
date: datetime
:
diagnosis: []
treatment: []
veterinarian_id: []
notes:
follow_up_date: [datetime]
:
():
.db = db
():
animal = Animal(**animal_data)
animal.tag_number:
animal.tag_number = .generate_tag_number(animal.)
health_record = HealthRecord(
record_id=generate_id(),
animal_id=animal.animal_id,
date=datetime.now(),
=,
diagnosis=,
treatment=,
veterinarian_id=,
notes=,
follow_up_date=
)
.db.save_animal(animal)
.db.save_health_record(health_record)
animal
():
animal = .db.get_animal(animal_id)
sensor_data = .get_sensor_data(animal_id)
health_indicators = {
: sensor_data.get(),
: sensor_data.get(),
: sensor_data.get(),
: .analyze_feeding_pattern(animal_id),
: .calculate_weight_trend(animal_id)
}
alerts = []
health_indicators[] > :
alerts.append({
: ,
: ,
:
})
health_indicators[] < :
alerts.append({
: ,
: ,
:
})
{
: animal_id,
: animal.tag_number,
: health_indicators,
: alerts,
: .calculate_health_score(health_indicators)
}
():
animals = .db.get_herd_animals(herd_id)
vaccination_schedule = []
animal animals:
last_vaccinations = .db.get_vaccinations(animal.animal_id)
required_vaccines = .get_required_vaccines(animal)
vaccine required_vaccines:
last_admin = (
(v v last_vaccinations v[] == vaccine[]),
)
last_admin .is_vaccine_due(last_admin, vaccine):
vaccination_schedule.append({
: animal.animal_id,
: animal.tag_number,
: vaccine[],
: .calculate_vaccine_due_date(last_admin, vaccine),
: vaccine[]
})
vaccination_schedule.sort(key= x: (x[], x[]))
vaccination_schedule
Breeding Management
class BreedingManagement:
"""Breeding program management"""
def select_breeding_pairs(self, herd_id, breeding_goals):
"""Select optimal breeding pairs"""
eligible_males = self.db.get_breeding_males(herd_id)
eligible_females = self.db.get_breeding_females(herd_id)
breeding_recommendations = []
for female in eligible_females:
scores = []
for male in eligible_males:
if self.are_related(male, female, max_generations=3):
continue
score = self.calculate_breeding_value(
male,
female,
breeding_goals
)
scores.append({
'male_id': male.animal_id,
'male_tag': male.tag_number,
'score': score,
'expected_traits': self.predict_offspring_traits(male, female)
})
if scores:
best_match = max(scores, key=lambda x: x['score'])
breeding_recommendations.append({
'female_id': female.animal_id,
'female_tag': female.tag_number,
'recommended_male': best_match,
: .calculate_optimal_breeding_date(female)
})
breeding_recommendations
():
score =
goals:
score += (male.genetics[] + female.genetics[]) *
goals:
score += (male.genetics[] + female.genetics[]) *
goals:
score += (male.genetics[] + female.genetics[]) *
goals:
score += (male.fertility_score + female.fertility_score) *
score
():
animal = .db.get_animal(animal_id)
breeding_record = .db.get_last_breeding(animal_id)
breeding_record:
{: }
pregnancy_check = .db.get_latest_pregnancy_check(animal_id)
pregnancy_check pregnancy_check[]:
gestation_period = .get_gestation_period(animal.)
due_date = breeding_record[] + timedelta(days=gestation_period)
days_pregnant = (datetime.now() - breeding_record[]).days
checkup_schedule = .generate_pregnancy_checkups(
breeding_record[],
due_date
)
{
: ,
: breeding_record[],
: due_date,
: days_pregnant,
: (due_date - datetime.now()).days,
: checkup_schedule
}
{: , : }
Feed Management
class FeedManagement:
"""Feed optimization and management"""
def calculate_feed_requirements(self, animal_id):
"""Calculate nutritional requirements"""
animal = self.db.get_animal(animal_id)
requirements = {
'dry_matter_kg': self.calculate_dm_requirement(animal),
'crude_protein_kg': self.calculate_protein_requirement(animal),
'energy_mcal': self.calculate_energy_requirement(animal),
'minerals': self.calculate_mineral_requirements(animal)
}
return requirements
def optimize_feed_ration(self, herd_id):
"""Optimize feed ration for herd"""
animals = self.db.get_herd_animals(herd_id)
available_feeds = self.db.get_available_feeds()
groups = self.group_animals_by_requirements(animals)
ration_plans = []
for group in groups:
avg_requirements = self.calculate_group_requirements(group['animals'])
optimal_ration = self.solve_ration_optimization(
avg_requirements,
available_feeds
)
ration_plans.append({
: group[],
: (group[]),
: optimal_ration,
: (
ingredient[] * ingredient[]
ingredient optimal_ration
),
:
})
ration_plans
():
feeding_data = .db.get_feeding_data(animal_id, days=)
analysis = {
: np.mean([d[] d feeding_data]),
: (feeding_data) / ,
: np.std([d[] d feeding_data]),
: np.mean([d[] d feeding_data])
}
analysis[] < expected_intake * :
analysis[] =
analysis
Herd Analytics
class HerdAnalytics:
"""Herd performance analytics"""
def analyze_herd_performance(self, herd_id):
"""Comprehensive herd performance analysis"""
animals = self.db.get_herd_animals(herd_id)
metrics = {
'total_animals': len(animals),
'avg_weight': np.mean([a.weight_kg for a in animals]),
'avg_age_months': np.mean([
(datetime.now() - a.birth_date).days / 30
for a in animals
]),
'health_status_distribution': self.get_health_distribution(animals),
'mortality_rate': self.calculate_mortality_rate(herd_id),
'reproduction_rate': self.calculate_reproduction_rate(herd_id),
'avg_daily_gain': self.calculate_avg_daily_gain(herd_id),
'feed_conversion_ratio': self.calculate_fcr(herd_id)
}
metrics['production_value'] = self.calculate_production_value(herd_id)
metrics['feed_cost'] = self.calculate_total_feed_cost(herd_id)
metrics['veterinary_cost'] = self.calculate_vet_costs(herd_id)
metrics['profit_per_animal'] = (
metrics['production_value'] -
metrics['feed_cost'] -
metrics['veterinary_cost']
) / metrics[]
metrics
():
animal = .db.get_animal(animal_id)
historical_production = .db.get_production_history(animal_id, days=)
forecast = .production_model.forecast(
historical_production,
periods=days_ahead
)
{
: animal_id,
: days_ahead,
: forecast.tolist(),
: (forecast),
: .calculate_confidence_interval(forecast)
}
Best Practices
- Use individual animal identification
- Maintain detailed health records
- Implement biosecurity protocols
- Monitor animal welfare continuously
- Practice selective breeding
- Optimize feed efficiency
- Schedule regular veterinary checkups
- Use data for decision-making
- Maintain proper facilities
- Follow animal welfare standards
- Track financial performance
- Implement early disease detection
Anti-Patterns
❌ Poor record keeping
❌ No biosecurity measures
❌ Reactive health management
❌ Inbreeding
❌ Over or underfeeding
❌ Ignoring animal behavior
❌ Manual data collection only
Resources