Overview
Implement comprehensive World Reference Base for Soil Resources (WRB) soil classification system to replace the current basic soil texture preferences. This will provide scientifically accurate soil classification data for plant species in the agroforestry platform.
Background
The WRB is the international standard for soil classification, endorsed by the International Union of Soil Sciences (IUSS). It provides a two-tiered system:
- 32 Reference Soil Groups (RSGs) - primary classification level
- 202 qualifiers - additional descriptors (principal and supplementary)
Scope
1. Data Models
- Replace current
SoilPreference model with new WRB-specific models
- Create
WRBReferenceGroup model for the 32 RSGs with categories and codes
- Create
WRBQualifier model for the 202 qualifiers (principal/supplementary)
- Create appropriate through models following existing patterns (
SpeciesWRBReferenceGroup, SpeciesWRBQualifier)
- Update
SpeciesProperties model to use new WRB relationships
2. Data Structure
Reference Soil Groups organized by categories:
- Thick organic layers (1 RSG): Histosol
- Strong human influence (2 RSGs): Anthrosol, Technosol
- Root growth limitations (5 RSGs): Cryosol, Leptosol, Solonetz, Vertisol, Solonchak
- Fe/Al chemistry (8 RSGs): Gleysol, Andosol, Podzol, Plinthosol, Planosol, Stagnosol, Nitisol, Ferralsol
- Organic matter accumulation (4 RSGs): Chernozem, Kastanozem, Phaeozem, Umbrisol
- Salt/substance accumulation (3 RSGs): Durisol, Gypsisol, Calcisol
- Clay-enriched subsoil (5 RSGs): Retisol, Acrisol, Lixisol, Alisol, Luvisol
- Little profile differentiation (4 RSGs): Cambisol, Fluvisol, Arenosol, Regosol
3. Database Migrations
- Migration to remove old
SoilPreference model and relationships
- Migration to create new WRB models
- Data migration with fixtures for all 32 RSGs and 202 qualifiers
- Update existing species data relationships
4. Admin Interface
- Admin classes for
WRBReferenceGroup and WRBQualifier management
- Inline admin for species-WRB relationships
- Filtering and search capabilities in admin
- Bulk import/export functionality for WRB data
5. API Integration
- Update existing API endpoints to use WRB data instead of soil preferences
- Maintain backward compatibility where possible
- Add filtering by WRB categories and codes
- Update serializers and viewsets consistently
6. Fixtures and Initial Data
- Complete fixture with all 32 Reference Soil Groups including:
- Official WRB codes (e.g., 'LV' for Luvisol)
- English names (non-translatable as per WRB standard)
- Category classifications
- Descriptions
- Complete fixture with all 202 qualifiers including:
- Qualifier codes and names
- Principal vs supplementary classification
- Descriptions
7. Testing
- Unit tests for new models and relationships
- Migration tests to ensure data integrity
- API tests for updated endpoints
- Admin tests for management interface
Implementation Notes
- Follow existing patterns from
ClimateZone, HumanUse, and other categorized properties
- Use
CategorizedPlantPropertyBase and CategorizedSpeciesPropertyThroughBase
- Maintain confidence scoring and source tracking for AI-enriched data
- Ensure natural key lookups and proper slugification
- Update enrichment chains to use WRB terminology
Acceptance Criteria
Breaking Changes
This implementation will replace the current soil preference system, requiring:
- Database schema changes
- API response format changes
- Admin interface updates
- Potential data loss of existing soil texture preferences (acceptable per requirements)
Overview
Implement comprehensive World Reference Base for Soil Resources (WRB) soil classification system to replace the current basic soil texture preferences. This will provide scientifically accurate soil classification data for plant species in the agroforestry platform.
Background
The WRB is the international standard for soil classification, endorsed by the International Union of Soil Sciences (IUSS). It provides a two-tiered system:
Scope
1. Data Models
SoilPreferencemodel with new WRB-specific modelsWRBReferenceGroupmodel for the 32 RSGs with categories and codesWRBQualifiermodel for the 202 qualifiers (principal/supplementary)SpeciesWRBReferenceGroup,SpeciesWRBQualifier)SpeciesPropertiesmodel to use new WRB relationships2. Data Structure
Reference Soil Groups organized by categories:
3. Database Migrations
SoilPreferencemodel and relationships4. Admin Interface
WRBReferenceGroupandWRBQualifiermanagement5. API Integration
6. Fixtures and Initial Data
7. Testing
Implementation Notes
ClimateZone,HumanUse, and other categorized propertiesCategorizedPlantPropertyBaseandCategorizedSpeciesPropertyThroughBaseAcceptance Criteria
Breaking Changes
This implementation will replace the current soil preference system, requiring: