Datasets:
Upload folder using huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
- tabular-regression
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
tags:
|
| 9 |
+
- agriculture
|
| 10 |
+
- africa
|
| 11 |
+
- synthetic-data
|
| 12 |
+
- sub-saharan-africa
|
| 13 |
+
- livestock
|
| 14 |
+
- animal-health
|
| 15 |
+
size_categories:
|
| 16 |
+
- 10K<n<100K
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
# Livestock Health and Productivity - Sub-Saharan Africa
|
| 20 |
+
|
| 21 |
+
Synthetic dataset capturing livestock health, productivity, and management practices across smallholder farms in Sub-Saharan Africa. Covers cattle, goats, sheep, poultry, pigs, and donkeys with production and health metrics.
|
| 22 |
+
|
| 23 |
+
## Dataset Statistics
|
| 24 |
+
|
| 25 |
+
| Scenario | Records |
|
| 26 |
+
|----------|---------|
|
| 27 |
+
| Low Burden | 4,000 |
|
| 28 |
+
| Moderate Burden | 5,000 |
|
| 29 |
+
| High Burden | 6,000 |
|
| 30 |
+
| **Total** | **15,000** |
|
| 31 |
+
|
| 32 |
+
**Key Metrics:**
|
| 33 |
+
- 10 countries with diverse livestock systems
|
| 34 |
+
- Years: 2018-2025
|
| 35 |
+
- 52 columns covering health, productivity, and economics
|
| 36 |
+
- Cattle mortality: 8-15% in smallholder systems
|
| 37 |
+
- Milk yields: 2-5L/day vs 15-25L potential
|
| 38 |
+
|
| 39 |
+
## Column Descriptions
|
| 40 |
+
|
| 41 |
+
| Column | Description |
|
| 42 |
+
|--------|-------------|
|
| 43 |
+
| `record_id` | Unique record identifier |
|
| 44 |
+
| `livestock_id` | Unique livestock record identifier |
|
| 45 |
+
| `country` | Country name |
|
| 46 |
+
| `year` | Year of record |
|
| 47 |
+
| `farm_size_ha` | Farm size in hectares |
|
| 48 |
+
| `production_system` | Production system type |
|
| 49 |
+
| `primary_species` | Primary livestock species |
|
| 50 |
+
| `herd_size` | Herd/flock size |
|
| 51 |
+
| `breed_type` | Breed type (local/crossbreed/exotic) |
|
| 52 |
+
| `feed_source` | Primary feed source |
|
| 53 |
+
| `water_access` | Water access quality |
|
| 54 |
+
| `housing_type` | Housing type |
|
| 55 |
+
| `mortality_rate_pct` | Mortality rate percentage |
|
| 56 |
+
| `animals_died` | Number of animals died |
|
| 57 |
+
| `disease_outbreak` | Disease outbreak occurred (boolean) |
|
| 58 |
+
| `primary_disease` | Primary disease type |
|
| 59 |
+
| `disease_severity` | Disease severity level |
|
| 60 |
+
| `vaccination_coverage_pct` | Vaccination coverage (%) |
|
| 61 |
+
| `animals_vaccinated` | Number vaccinated |
|
| 62 |
+
| `deworming_frequency` | Deworming frequency |
|
| 63 |
+
| `tick_control` | Tick control practiced (boolean) |
|
| 64 |
+
| `veterinary_access` | Veterinary access (boolean) |
|
| 65 |
+
| `vet_visits_per_year` | Veterinary visits per year |
|
| 66 |
+
| `health_insurance` | Health insurance (boolean) |
|
| 67 |
+
| `milk_yield_l_day` | Milk yield (L/day) |
|
| 68 |
+
| `lactation_length_days` | Lactation length (days) |
|
| 69 |
+
| `annual_milk_l` | Annual milk production (L) |
|
| 70 |
+
| `weight_gain_kg_day` | Weight gain (kg/day) |
|
| 71 |
+
| `live_weight_kg` | Live weight (kg) |
|
| 72 |
+
| `reproductive_rate` | Reproductive rate |
|
| 73 |
+
| `reproductive_health` | Reproductive health status (boolean) |
|
| 74 |
+
| `fertility_issues` | Fertility issues (boolean) |
|
| 75 |
+
| `body_condition_score` | Body condition score (1-5) |
|
| 76 |
+
| `nutrition_status` | Nutrition status |
|
| 77 |
+
| `supplementation` | Feed supplementation (boolean) |
|
| 78 |
+
| `mineral_supplement` | Mineral supplement (boolean) |
|
| 79 |
+
| `forage_quality` | Forage quality |
|
| 80 |
+
| `breeding_method` | Breeding method |
|
| 81 |
+
| `record_keeping` | Record keeping (boolean) |
|
| 82 |
+
| `market_access` | Market access level |
|
| 83 |
+
| `price_per_head_usd` | Price per head (USD) |
|
| 84 |
+
| `annual_revenue_usd` | Annual revenue (USD) |
|
| 85 |
+
| `feed_cost_usd` | Feed cost (USD) |
|
| 86 |
+
| `health_cost_usd` | Health cost (USD) |
|
| 87 |
+
| `labor_cost_usd` | Labor cost (USD) |
|
| 88 |
+
| `total_cost_usd` | Total cost (USD) |
|
| 89 |
+
| `net_income_usd` | Net income (USD) |
|
| 90 |
+
| `productivity_index` | Productivity index (0-100) |
|
| 91 |
+
| `health_index` | Health index (0-100) |
|
| 92 |
+
| `mortality_category` | Mortality category |
|
| 93 |
+
| `intervention_priority` | Intervention priority level |
|
| 94 |
+
| `scenario` | Burden scenario |
|
| 95 |
+
|
| 96 |
+
## Usage Example
|
| 97 |
+
|
| 98 |
+
```python
|
| 99 |
+
import pandas as pd
|
| 100 |
+
|
| 101 |
+
# Load the dataset
|
| 102 |
+
df = pd.read_csv('livestock_health_productivity_africa_moderate_burden.csv')
|
| 103 |
+
|
| 104 |
+
# Mortality by species
|
| 105 |
+
mortality = df.groupby('primary_species')['mortality_rate_pct'].mean()
|
| 106 |
+
print(f"Mortality by species:\n{mortality}")
|
| 107 |
+
|
| 108 |
+
# Milk yield by production system
|
| 109 |
+
milk = df[df['primary_species'] == 'cattle'].groupby('production_system')['milk_yield_l_day'].mean()
|
| 110 |
+
print(milk)
|
| 111 |
+
|
| 112 |
+
# Economic analysis by breed type
|
| 113 |
+
economics = df.groupby('breed_type')[['net_income_usd', 'productivity_index']].mean()
|
| 114 |
+
print(economics)
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
## Research Sources
|
| 118 |
+
|
| 119 |
+
- FAO 2024: Cattle mortality 8-15% in smallholder systems
|
| 120 |
+
- ILRI 2023: Milk yields 2-5L/day vs 15-25L potential
|
| 121 |
+
- World Bank 2023: Poultry mortality 15-30% in traditional systems
|
| 122 |
+
- AU-IBAR 2023: Disease prevalence 20-40% for endemic diseases
|
| 123 |
+
- GALVmed 2023: Vaccination coverage 10-30% for priority diseases
|
| 124 |
+
|
| 125 |
+
**Author:** Electric Sheep Africa
|
generate_dataset.py
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Livestock Health and Productivity - Sub-Saharan Africa
|
| 3 |
+
========================================================
|
| 4 |
+
Based on research:
|
| 5 |
+
- FAO 2024: Cattle mortality 8-15% in smallholder systems
|
| 6 |
+
- ILRI 2023: Milk yields 2-5L/day vs 15-25L potential
|
| 7 |
+
- World Bank 2023: Poultry mortality 15-30% in traditional systems
|
| 8 |
+
- AU-IBAR 2023: Disease prevalence 20-40% for endemic diseases
|
| 9 |
+
- GALVmed 2023: Vaccination coverage 10-30% for priority diseases
|
| 10 |
+
|
| 11 |
+
PARAMETER EVIDENCE TABLE
|
| 12 |
+
─────────────────────────────────────────────────────────────────────────
|
| 13 |
+
Parameter │ Value Used │ Source │ Year
|
| 14 |
+
───────────────────────┼──────────────────┼───────────────────────────┼──────
|
| 15 |
+
Cattle mortality │ 8-15% │ FAO 2024 │ 2024
|
| 16 |
+
Milk yields │ 2-5L/day │ ILRI 2023 │ 2023
|
| 17 |
+
Poultry mortality │ 15-30% │ World Bank 2023 │ 2023
|
| 18 |
+
Disease prevalence │ 20-40% │ AU-IBAR 2023 │ 2023
|
| 19 |
+
Vaccination coverage │ 10-30% │ GALVmed 2023 │ 2023
|
| 20 |
+
Goat mortality │ 10-20% │ FAO 2024 │ 2024
|
| 21 |
+
|
| 22 |
+
Author: Electric Sheep Africa
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
import numpy as np
|
| 26 |
+
import pandas as pd
|
| 27 |
+
import argparse
|
| 28 |
+
import os
|
| 29 |
+
|
| 30 |
+
np.random.default_rng(42)
|
| 31 |
+
|
| 32 |
+
COUNTRIES = ['Kenya', 'Uganda', 'Nigeria', 'Ghana', 'Tanzania', 'Ethiopia', 'Malawi', 'Zambia', 'Mali', 'Burkina Faso']
|
| 33 |
+
SPECIES = ['cattle', 'goats', 'sheep', 'poultry', 'pigs', 'donkeys']
|
| 34 |
+
PRODUCTION_SYSTEMS = ['extensive', 'semi_intensive', 'intensive', 'pastoral', 'agropastoral']
|
| 35 |
+
BREED_TYPES = ['local', 'crossbreed', 'exotic']
|
| 36 |
+
FEED_SOURCES = ['grazing', 'crop_residues', 'concentrates', 'fodder_crops', 'mixed']
|
| 37 |
+
HEALTH_ISSUES = ['tick_borne', 'respiratory', 'digestive', 'parasitic', 'metabolic', 'reproductive']
|
| 38 |
+
YEARS = list(range(2018, 2026))
|
| 39 |
+
|
| 40 |
+
SPECIES_BASE_MORTALITY = {
|
| 41 |
+
'cattle': 0.12, 'goats': 0.15, 'sheep': 0.14, 'poultry': 0.22, 'pigs': 0.18, 'donkeys': 0.08
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
SPECIES_BASE_PRODUCTIVITY = {
|
| 45 |
+
'cattle': {'milk_l_day': 3.5, 'weight_gain_kg_day': 0.4, 'calving_rate': 0.55},
|
| 46 |
+
'goats': {'milk_l_day': 0.8, 'weight_gain_kg_day': 0.06, 'kidding_rate': 1.2},
|
| 47 |
+
'sheep': {'milk_l_day': 0.5, 'weight_gain_kg_day': 0.08, 'lambing_rate': 1.1},
|
| 48 |
+
'poultry': {'eggs_year': 80, 'weight_gain_kg_week': 0.15},
|
| 49 |
+
'pigs': {'litter_size': 8, 'weight_gain_kg_day': 0.35},
|
| 50 |
+
'donkeys': {'work_hours_day': 4, 'weight_gain_kg_day': 0.1}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
DISEASE_PREVALENCE = {
|
| 54 |
+
'tick_borne': 0.23, 'respiratory': 0.17, 'digestive': 0.14,
|
| 55 |
+
'parasitic': 0.28, 'metabolic': 0.07, 'reproductive': 0.11
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
def sc(p, rng):
|
| 59 |
+
a = np.array(list(p.values()))
|
| 60 |
+
return rng.choice(list(p.keys()), p=a/a.sum())
|
| 61 |
+
|
| 62 |
+
def gen(n=5000, seed=42):
|
| 63 |
+
rng = np.random.default_rng(seed)
|
| 64 |
+
recs = []
|
| 65 |
+
|
| 66 |
+
for i in range(n):
|
| 67 |
+
country = rng.choice(COUNTRIES)
|
| 68 |
+
year = rng.choice(YEARS)
|
| 69 |
+
|
| 70 |
+
record_id = f"LVS-{country[:3].upper()}-{year}-{i+1:05d}"
|
| 71 |
+
|
| 72 |
+
farm_size = rng.lognormal(0.2, 0.6)
|
| 73 |
+
farm_size = np.clip(farm_size, 0.2, 30.0)
|
| 74 |
+
|
| 75 |
+
production_system = sc({
|
| 76 |
+
'extensive': 0.35, 'semi_intensive': 0.25, 'intensive': 0.10,
|
| 77 |
+
'pastoral': 0.15, 'agropastoral': 0.15
|
| 78 |
+
}, rng)
|
| 79 |
+
|
| 80 |
+
primary_species = rng.choice(SPECIES, p=[0.30, 0.25, 0.15, 0.20, 0.07, 0.03])
|
| 81 |
+
|
| 82 |
+
herd_size_base = {'cattle': 8, 'goats': 15, 'sheep': 12, 'poultry': 35, 'pigs': 6, 'donkeys': 2}[primary_species]
|
| 83 |
+
herd_size = int(rng.lognormal(np.log(herd_size_base), 0.8))
|
| 84 |
+
herd_size = np.clip(herd_size, 1, {'cattle': 100, 'goats': 200, 'sheep': 150, 'poultry': 500, 'pigs': 50, 'donkeys': 10}[primary_species])
|
| 85 |
+
|
| 86 |
+
breed_type = sc({
|
| 87 |
+
'local': 0.60, 'crossbreed': 0.30, 'exotic': 0.10
|
| 88 |
+
}, rng)
|
| 89 |
+
|
| 90 |
+
feed_source = sc({
|
| 91 |
+
'grazing': 0.45, 'crop_residues': 0.20, 'concentrates': 0.10,
|
| 92 |
+
'fodder_crops': 0.10, 'mixed': 0.15
|
| 93 |
+
}, rng)
|
| 94 |
+
|
| 95 |
+
if production_system in ['pastoral', 'extensive']:
|
| 96 |
+
feed_source = 'grazing'
|
| 97 |
+
elif production_system == 'intensive':
|
| 98 |
+
feed_source = rng.choice(['concentrates', 'mixed'], p=[0.5, 0.5])
|
| 99 |
+
|
| 100 |
+
water_access = rng.choice(['adequate', 'seasonal', 'limited', 'poor'], p=[0.35, 0.30, 0.25, 0.10])
|
| 101 |
+
|
| 102 |
+
housing_type = rng.choice(['none', 'simple_shelter', 'improved_shelter', 'modern'], p=[0.35, 0.35, 0.20, 0.10])
|
| 103 |
+
|
| 104 |
+
base_mortality = SPECIES_BASE_MORTALITY[primary_species]
|
| 105 |
+
mortality_modifier = 1.0
|
| 106 |
+
mortality_modifier *= 0.7 if production_system == 'intensive' else 1.2 if production_system in ['pastoral', 'extensive'] else 1.0
|
| 107 |
+
mortality_modifier *= 0.8 if breed_type == 'local' else 1.1 if breed_type == 'exotic' else 1.0
|
| 108 |
+
mortality_modifier *= 0.9 if housing_type in ['improved_shelter', 'modern'] else 1.1 if housing_type == 'none' else 1.0
|
| 109 |
+
|
| 110 |
+
mortality_rate = base_mortality * mortality_modifier * rng.uniform(0.8, 1.2)
|
| 111 |
+
mortality_rate = np.clip(mortality_rate, 0.03, 0.45)
|
| 112 |
+
|
| 113 |
+
animals_died = int(herd_size * mortality_rate)
|
| 114 |
+
|
| 115 |
+
disease_outbreak = rng.random() < 0.20
|
| 116 |
+
|
| 117 |
+
primary_disease = None
|
| 118 |
+
if disease_outbreak:
|
| 119 |
+
primary_disease = rng.choice(list(DISEASE_PREVALENCE.keys()),
|
| 120 |
+
p=list(DISEASE_PREVALENCE.values()))
|
| 121 |
+
|
| 122 |
+
disease_severity = rng.choice(['mild', 'moderate', 'severe'], p=[0.40, 0.40, 0.20]) if disease_outbreak else 'none'
|
| 123 |
+
|
| 124 |
+
vaccination_coverage = rng.lognormal(np.log(0.20), 0.8)
|
| 125 |
+
vaccination_coverage = np.clip(vaccination_coverage, 0.02, 0.60)
|
| 126 |
+
|
| 127 |
+
animals_vaccinated = int(herd_size * vaccination_coverage)
|
| 128 |
+
|
| 129 |
+
deworming_frequency = rng.choice(['never', 'yearly', 'biannual', 'quarterly'], p=[0.30, 0.35, 0.25, 0.10])
|
| 130 |
+
|
| 131 |
+
tick_control = rng.random() < 0.45
|
| 132 |
+
|
| 133 |
+
veterinary_access = rng.random() < 0.35
|
| 134 |
+
|
| 135 |
+
vet_visits_year = rng.integers(0, 6) if veterinary_access else 0
|
| 136 |
+
|
| 137 |
+
health_insurance = rng.random() < 0.05
|
| 138 |
+
|
| 139 |
+
base_prod = SPECIES_BASE_PRODUCTIVITY[primary_species]
|
| 140 |
+
|
| 141 |
+
prod_modifier = 1.0
|
| 142 |
+
prod_modifier *= 1.3 if breed_type == 'exotic' else 1.1 if breed_type == 'crossbreed' else 1.0
|
| 143 |
+
prod_modifier *= 0.85 if disease_outbreak else 1.0
|
| 144 |
+
prod_modifier *= 0.9 if water_access in ['limited', 'poor'] else 1.0
|
| 145 |
+
prod_modifier *= 1.15 if production_system == 'intensive' else 0.9 if production_system == 'pastoral' else 1.0
|
| 146 |
+
prod_modifier *= 1.1 if feed_source in ['concentrates', 'mixed'] else 0.95 if feed_source == 'grazing' else 1.0
|
| 147 |
+
|
| 148 |
+
if primary_species == 'cattle':
|
| 149 |
+
milk_yield_l_day = base_prod['milk_l_day'] * prod_modifier * rng.uniform(0.8, 1.2)
|
| 150 |
+
milk_yield_l_day = np.clip(milk_yield_l_day, 0.5, 20)
|
| 151 |
+
lactation_length_days = int(rng.normal(250, 40))
|
| 152 |
+
annual_milk_l = milk_yield_l_day * lactation_length_days
|
| 153 |
+
weight_gain_kg_day = base_prod['weight_gain_kg_day'] * prod_modifier * rng.uniform(0.7, 1.3)
|
| 154 |
+
calving_rate = base_prod['calving_rate'] * prod_modifier * rng.uniform(0.8, 1.1)
|
| 155 |
+
calving_rate = np.clip(calving_rate, 0.3, 0.9)
|
| 156 |
+
live_weight_kg = rng.normal(320, 60) if breed_type == 'local' else rng.normal(400, 70)
|
| 157 |
+
elif primary_species == 'goats':
|
| 158 |
+
milk_yield_l_day = base_prod['milk_l_day'] * prod_modifier * rng.uniform(0.7, 1.3)
|
| 159 |
+
weight_gain_kg_day = base_prod['weight_gain_kg_day'] * prod_modifier
|
| 160 |
+
kidding_rate = base_prod['kidding_rate'] * prod_modifier
|
| 161 |
+
annual_milk_l = milk_yield_l_day * 180
|
| 162 |
+
calving_rate = kidding_rate
|
| 163 |
+
lactation_length_days = 180
|
| 164 |
+
live_weight_kg = rng.normal(28, 8)
|
| 165 |
+
elif primary_species == 'sheep':
|
| 166 |
+
milk_yield_l_day = base_prod['milk_l_day']
|
| 167 |
+
weight_gain_kg_day = base_prod['weight_gain_kg_day'] * prod_modifier
|
| 168 |
+
annual_milk_l = 0
|
| 169 |
+
lambing_rate = base_prod['lambing_rate']
|
| 170 |
+
calving_rate = lambing_rate
|
| 171 |
+
lactation_length_days = 0
|
| 172 |
+
live_weight_kg = rng.normal(32, 7)
|
| 173 |
+
elif primary_species == 'poultry':
|
| 174 |
+
eggs_per_year = int(base_prod['eggs_year'] * prod_modifier * rng.uniform(0.7, 1.3))
|
| 175 |
+
weight_gain_kg_week = base_prod['weight_gain_kg_week'] * prod_modifier
|
| 176 |
+
weight_gain_kg_day = weight_gain_kg_week / 7
|
| 177 |
+
milk_yield_l_day = 0
|
| 178 |
+
annual_milk_l = 0
|
| 179 |
+
calving_rate = 0
|
| 180 |
+
lactation_length_days = 0
|
| 181 |
+
live_weight_kg = rng.normal(1.8, 0.5)
|
| 182 |
+
elif primary_species == 'pigs':
|
| 183 |
+
litter_size = int(base_prod['litter_size'] * prod_modifier * rng.uniform(0.8, 1.2))
|
| 184 |
+
weight_gain_kg_day = base_prod['weight_gain_kg_day'] * prod_modifier
|
| 185 |
+
litters_per_year = rng.uniform(1.8, 2.3)
|
| 186 |
+
milk_yield_l_day = 0
|
| 187 |
+
annual_milk_l = 0
|
| 188 |
+
calving_rate = litter_size
|
| 189 |
+
lactation_length_days = 0
|
| 190 |
+
live_weight_kg = rng.normal(80, 20)
|
| 191 |
+
else:
|
| 192 |
+
milk_yield_l_day = 0
|
| 193 |
+
annual_milk_l = 0
|
| 194 |
+
calving_rate = 0
|
| 195 |
+
lactation_length_days = 0
|
| 196 |
+
weight_gain_kg_day = base_prod['weight_gain_kg_day']
|
| 197 |
+
live_weight_kg = rng.normal(140, 25)
|
| 198 |
+
|
| 199 |
+
reproductive_health = rng.random() < 0.75
|
| 200 |
+
fertility_issues = not reproductive_health and rng.random() < 0.25
|
| 201 |
+
|
| 202 |
+
body_condition_score = rng.integers(1, 6)
|
| 203 |
+
|
| 204 |
+
nutrition_status = 'adequate' if body_condition_score >= 3 else 'poor'
|
| 205 |
+
|
| 206 |
+
supplementation = rng.random() < 0.30
|
| 207 |
+
|
| 208 |
+
mineral_supplement = rng.random() < 0.20
|
| 209 |
+
|
| 210 |
+
forage_quality = rng.choice(['poor', 'moderate', 'good'], p=[0.30, 0.45, 0.25])
|
| 211 |
+
|
| 212 |
+
breeding_method = rng.choice(['natural', 'artificial_insemination', 'both'], p=[0.75, 0.10, 0.15])
|
| 213 |
+
|
| 214 |
+
record_keeping = rng.random() < 0.20
|
| 215 |
+
|
| 216 |
+
market_access = rng.choice(['farm_gate', 'local_market', 'regional', 'export'], p=[0.40, 0.35, 0.20, 0.05])
|
| 217 |
+
|
| 218 |
+
price_per_head = live_weight_kg * rng.lognormal(np.log(2.5), 0.3)
|
| 219 |
+
|
| 220 |
+
annual_revenue = herd_size * price_per_head * 0.3
|
| 221 |
+
|
| 222 |
+
feed_cost = herd_size * rng.uniform(20, 80) if feed_source in ['concentrates', 'mixed'] else herd_size * rng.uniform(5, 20)
|
| 223 |
+
health_cost = animals_vaccinated * 2 + vet_visits_year * 25
|
| 224 |
+
labor_cost = herd_size * rng.uniform(5, 15)
|
| 225 |
+
|
| 226 |
+
total_cost = feed_cost + health_cost + labor_cost
|
| 227 |
+
|
| 228 |
+
net_income = annual_revenue - total_cost
|
| 229 |
+
|
| 230 |
+
productivity_index = 50 + (body_condition_score - 2) * 10 + (10 if reproductive_health else -5)
|
| 231 |
+
productivity_index = np.clip(productivity_index, 10, 100)
|
| 232 |
+
|
| 233 |
+
health_index = 100 - mortality_rate * 200 - (15 if disease_outbreak else 0) + vaccination_coverage * 50
|
| 234 |
+
health_index = np.clip(health_index, 10, 100)
|
| 235 |
+
|
| 236 |
+
recs.append({
|
| 237 |
+
'record_id': i + 1,
|
| 238 |
+
'livestock_id': record_id,
|
| 239 |
+
'country': country,
|
| 240 |
+
'year': year,
|
| 241 |
+
'farm_size_ha': round(farm_size, 2),
|
| 242 |
+
'production_system': production_system,
|
| 243 |
+
'primary_species': primary_species,
|
| 244 |
+
'herd_size': herd_size,
|
| 245 |
+
'breed_type': breed_type,
|
| 246 |
+
'feed_source': feed_source,
|
| 247 |
+
'water_access': water_access,
|
| 248 |
+
'housing_type': housing_type,
|
| 249 |
+
'mortality_rate_pct': round(mortality_rate * 100, 1),
|
| 250 |
+
'animals_died': animals_died,
|
| 251 |
+
'disease_outbreak': disease_outbreak,
|
| 252 |
+
'primary_disease': primary_disease if primary_disease else 'none',
|
| 253 |
+
'disease_severity': disease_severity,
|
| 254 |
+
'vaccination_coverage_pct': round(vaccination_coverage * 100, 1),
|
| 255 |
+
'animals_vaccinated': animals_vaccinated,
|
| 256 |
+
'deworming_frequency': deworming_frequency,
|
| 257 |
+
'tick_control': tick_control,
|
| 258 |
+
'veterinary_access': veterinary_access,
|
| 259 |
+
'vet_visits_per_year': vet_visits_year,
|
| 260 |
+
'health_insurance': health_insurance,
|
| 261 |
+
'milk_yield_l_day': round(milk_yield_l_day, 2) if milk_yield_l_day > 0 else 0,
|
| 262 |
+
'lactation_length_days': lactation_length_days if lactation_length_days > 0 else 0,
|
| 263 |
+
'annual_milk_l': round(annual_milk_l, 0) if annual_milk_l > 0 else 0,
|
| 264 |
+
'weight_gain_kg_day': round(weight_gain_kg_day, 3) if primary_species in ['cattle', 'goats', 'sheep', 'pigs'] else 0,
|
| 265 |
+
'live_weight_kg': round(live_weight_kg, 1),
|
| 266 |
+
'reproductive_rate': round(calving_rate, 2) if calving_rate > 0 else 0,
|
| 267 |
+
'reproductive_health': reproductive_health,
|
| 268 |
+
'fertility_issues': fertility_issues,
|
| 269 |
+
'body_condition_score': body_condition_score,
|
| 270 |
+
'nutrition_status': nutrition_status,
|
| 271 |
+
'supplementation': supplementation,
|
| 272 |
+
'mineral_supplement': mineral_supplement,
|
| 273 |
+
'forage_quality': forage_quality,
|
| 274 |
+
'breeding_method': breeding_method,
|
| 275 |
+
'record_keeping': record_keeping,
|
| 276 |
+
'market_access': market_access,
|
| 277 |
+
'price_per_head_usd': round(price_per_head, 2),
|
| 278 |
+
'annual_revenue_usd': round(annual_revenue, 2),
|
| 279 |
+
'feed_cost_usd': round(feed_cost, 2),
|
| 280 |
+
'health_cost_usd': round(health_cost, 2),
|
| 281 |
+
'labor_cost_usd': round(labor_cost, 2),
|
| 282 |
+
'total_cost_usd': round(total_cost, 2),
|
| 283 |
+
'net_income_usd': round(net_income, 2),
|
| 284 |
+
'productivity_index': round(productivity_index, 1),
|
| 285 |
+
'health_index': round(health_index, 1),
|
| 286 |
+
'mortality_category': 'low' if mortality_rate < 0.10 else 'moderate' if mortality_rate < 0.20 else 'high',
|
| 287 |
+
'intervention_priority': 'high' if mortality_rate > 0.20 or disease_outbreak else 'moderate' if mortality_rate > 0.12 else 'low'
|
| 288 |
+
})
|
| 289 |
+
|
| 290 |
+
return pd.DataFrame(recs)
|
| 291 |
+
|
| 292 |
+
if __name__ == "__main__":
|
| 293 |
+
p = argparse.ArgumentParser()
|
| 294 |
+
p.add_argument('--n', type=int, default=5000)
|
| 295 |
+
p.add_argument('--output', type=str, default='.')
|
| 296 |
+
a = p.parse_args()
|
| 297 |
+
|
| 298 |
+
for sn, m, s in [('low_burden', 0.8, 42), ('moderate_burden', 1.0, 43), ('high_burden', 1.2, 44)]:
|
| 299 |
+
d = gen(int(a.n * m), s)
|
| 300 |
+
d['scenario'] = sn
|
| 301 |
+
d.to_csv(os.path.join(a.output, f'livestock_health_productivity_africa_{sn}.csv'), index=False)
|
| 302 |
+
print(f"Saved: livestock_health_productivity_africa_{sn}.csv, n={len(d)}")
|
livestock_health_productivity_africa_high_burden.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
livestock_health_productivity_africa_low_burden.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
livestock_health_productivity_africa_moderate_burden.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|