The purpose of this project is to organize information about the Danish agricultural sector and make it universally accessible and useful.
cd backend
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt
uvicorn src.main:app --reload
cd frontend
npm install
npm start
Visit:
- Frontend: http://localhost:3000
- API Documentation: http://localhost:8000/docs
├── src/ │ ├── sources/ # Data source implementations │ │ ├── base.py # Base source class │ │ ├── parsers/ # API/WFS sources │ │ └── static/ # Static file sources │ ├── main.py # FastAPI application │ └── config.py # Configuration
frontend/ └── src/ ├── components/ # React components ├── api/ # Backend API client ├── hooks/ # Custom React hooks └── types/ # TypeScript definitions
Data should have one or more of the following attributes to be useful:
- CVR number (company registration number)
- CHR number (herd registration number)
- geospatial coordinates (point or polygon)
- enhedsnummer (CVR individual identifier)
- bfe number (cadaster number)
- Agricultural Fields (WFS)
- Updates: Weekly (Mondays 2 AM UTC)
- Content: Field boundaries, crop types
All static sources are updated through manual pull requests:
- Animal Welfare: Inspection reports and focus areas
- Biogas: Production data and methane leakage reports
- Fertilizer: Nitrogen data and climate calculations
- Herd Data: CHR (Central Husbandry Register)
- Pesticides: Usage statistics (2021-2023)
- Pig Movements: International transport (2017-2024)
- Subsidies: Support schemes and project grants
- Visa: Agricultural visa statistics
- Wetlands: Areas and carbon content
- Python 3.9+
- Node.js 16+
- GDAL library
- Git
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes
- Run tests:
# Backend cd backend pytest # Frontend cd frontend npm test
- Submit a pull request
-
Choose the appropriate directory:
backend/src/sources/parsers/
for API/WFS sourcesbackend/src/sources/static/
for static files
-
Create a new parser class:
from ..base import Source class YourSource(Source): async def fetch(self) -> pd.DataFrame: # Implement data fetching pass
-
Add configuration in
backend/src/config.py
-
Update frontend types in
frontend/src/types/
-
Add visualization in
frontend/src/components/
- WFS Sources: Automatic weekly updates (Mondays 2 AM UTC)
- Static Sources: Manual updates via pull requests
- Deployment: Automatic to Google Cloud Run
GOOGLE_CLOUD_PROJECT=your-project-id
GCS_BUCKET=your-bucket-name
REACT_APP_API_URL=http://localhost:8000
Common issues and solutions:
-
GDAL Installation
# Ubuntu/Debian sudo apt-get install gdal-bin libgdal-dev # macOS brew install gdal
-
API Connection Issues
- Verify backend is running
- Check CORS settings
- Confirm environment variables
This work is licensed under a Creative Commons Attribution 4.0 International License (CC-BY).
- Danish Agricultural Agency
- Danish Environmental Protection Agency
- Danish Energy Agency
- SIRI