Skip to content

Nagyhoho1234/precagri

Repository files navigation

Precision Agriculture: A Comprehensive Guide / Precíziós mezőgazdaság: Átfogó útmutató

Bilingual (EN/HU) AI-powered interactive learning platform for precision agriculture

License: MIT Languages: EN/HU Python 3.11+ React 19 DOI

AI-Generated Content Disclosure

Both the textbook content (20 chapters, ~278K words) and the majority of this application's source code were generated with the assistance of large language models (LLMs). The text has been through two full automated lector passes (~5,000 corrections) but has not been independently peer-reviewed. This material should be treated as an educational technology demonstration, not as an authoritative precision agriculture reference.


Overview

An interactive learning platform built around a 20-chapter bilingual university textbook on precision agriculture. The book covers everything from soil sensing and satellite imagery to AI/ML, livestock monitoring, and the economics of PA adoption — with a dedicated chapter on Hungarian precision agriculture.

Students can read the book in English or Hungarian, ask questions about specific passages, take self-assessment quizzes, study with spaced-repetition flashcards, and explore chapter dependencies — all with a bilingual interface.

Key Numbers

Metric Count
Chapters 20 (EN) + 20 (HU)
Appendices 5 (preface, exercises, glossary, data sources, software guide)
Total words ~278,000 (152K EN + 126K HU)
Estimated pages 275 (EN PDF) + 288 (HU PDF)
Quiz questions 1,002 EN + 1,009 HU (4 types each)
RAG chunks 648 EN + 627 HU
Concept graph 81 concepts with prerequisites
Lector corrections ~5,000 (2 passes via LLM)
Source books 8 reference books + 13 lecture note folders

Features

Feature Description
Book Reader 20-chapter textbook with markdown rendering, LaTeX equations, tables
EN/HU Toggle Full bilingual support — chapters, quizzes, UI strings, sidebar
AI Chat RAG-powered Q&A grounded in textbook content (both languages)
Text Selection Highlight any passage and ask questions about it
Quiz System 2,000+ pre-generated questions, local grading, PDF export
Flashcards SM-2 spaced repetition with 4-level quality rating
Concept Map Interactive SVG dependency graph across all 20 chapters
Full-Text Search Semantic search across all chapters with highlighted excerpts
Cross-References Clickable chapter links in text
3-Level TOC Sidebar with Part / Chapter / Section navigation
Dark Mode Light/dark theme toggle
Mobile Layout Responsive design for phone/tablet
Green Theme Agriculture-themed color scheme

Book Structure (20 Chapters, 6 Parts)

Part I: Foundations

  1. Why Precision Agriculture?
  2. The Agricultural Landscape
  3. The Data Revolution in Farming

Part II: Sensing and Measurement

  1. Satellite and Aerial Remote Sensing
  2. Hyperspectral and Multispectral Imaging
  3. Proximal and In-Field Sensors
  4. Positioning and Navigation

Part III: Soil and Water

  1. Understanding Soil Variability
  2. Water Management and Irrigation
  3. Nutrient Management

Part IV: Crop Management

  1. Variable Rate Technology
  2. Crop Health Monitoring and Protection
  3. Yield Monitoring and Mapping

Part V: Data and Intelligence

  1. Data Pipelines and Management
  2. Artificial Intelligence and Machine Learning in Agriculture
  3. Decision Support Systems

Part VI: Broader Context

  1. Economics of Precision Agriculture
  2. Precision Livestock and Beyond
  3. The Future of Precision Agriculture
  4. Precision Agriculture in Hungary — Case Studies and Perspectives

Appendices

  • A: Practical Exercises (20 exercises, one per chapter)
  • B: Glossary (150+ terms with Hungarian translations)
  • C: Data Sources (satellite, weather, soil, crop — incl. Hungarian portals)
  • D: Software Guide (GIS, remote sensing, crop modeling, farm management tools)

Tech Stack

Layer Technology
Frontend React 19, Vite, TailwindCSS, KaTeX
Backend FastAPI, Python 3.11+
Vector DB ChromaDB (local, persistent)
Embeddings sentence-transformers (all-MiniLM-L6-v2, local)
LLM Configurable (for chat/summaries)
Lector LLM-based automated review
PDF Pandoc + XeLaTeX

Quick Start

1. Clone

git clone https://github.com/Nagyhoho1234/precagri.git
cd precagri

2. Backend

cd precagri-tutor
pip install -r requirements.txt

# Set up environment
echo "GEMINI_API_KEY=your-key-here" > .env

# Start backend
python -m uvicorn backend.main:app --host 0.0.0.0 --port 8000

3. Frontend

cd precagri-tutor/frontend
npm install
npm run dev
# Opens at http://localhost:5173

4. (Optional) Ingest RAG

python scripts/ingest_chapters.py --lang en
python scripts/ingest_chapters.py --lang hu

5. (Optional) Generate PDF

python scripts/build_book.py
# Or directly:
pandoc full_book_clean.md -o full_book_en.pdf --pdf-engine=xelatex \
  -V geometry:a4paper,margin=2.5cm -V fontsize=11pt --toc

Source Materials

The textbook was synthesized from 8 reference books:

Book Authors Year Focus
Precision Agriculture Basics Shannon, Clay, Kitchen 2018 Foundational PA textbook
PA for Sustainability Oliver, Bishop 2013 Geostatistics, economics, soil
AI & Data Sciences for PA Fiaz, Nadeem et al. 2026 AI/ML applications
Hyperspectral Imaging for PA Zhao, Wang 2023-24 Spectral methods, UAV
Precision Agriculture (ECPA) Stafford, Werner 2003 118 European research papers
PA Technology for Crop Farming Zhang 2016 Sensors, VRT, machinery
Advances in PLF Berckmans et al. 2022 Precision livestock farming
Precíziós MG helyzetkép Vértesy (MATE) 2023 Hungarian PA economics

Plus 13 folders of Hungarian university lecture materials (water management, soil mapping, remote sensing, irrigation).


Project Structure

precagri/
├── chapters_en/          # 20 English chapters + preface + 4 appendices
├── chapters_hu/          # 20 Hungarian chapters + preface + 4 appendices
├── precagri-tutor/       # Full-stack web application
│   ├── backend/          # FastAPI + RAG + agents + student tracking
│   ├── frontend/         # React 19 + Vite + TailwindCSS
│   └── data/             # ChromaDB, question banks, chunks
├── books/                # Source material (PDFs + converted markdown)
├── scripts/              # Build, translate, ingest, lector, question gen
├── lector_fixes/         # Lector results and claims verification
├── full_book_en.pdf      # Printable English PDF (275 pages)
├── full_book_hu.pdf      # Printable Hungarian PDF (288 pages)
├── CLAUDE.md             # Project rules for AI assistants
└── README.md             # This file

Quality Assurance

  • Two full lector passes via LLM (~5,000 corrections across EN + HU)
  • Fact-checking: 76 quotes, dates, and claims verified against web sources
  • 3 factual errors corrected (Landsat OLI bands, NDVI attribution date, AFBF date)
  • 1 misattribution flagged (Socrates quote — uncertain provenance noted in text)
  • Hungarian translation: domain-specific terminology glossary (312 terms), multi-pass review
  • Known limitation: AI-generated content may contain errors not caught by automated review

License

MIT License


Acknowledgments

Built with the assistance of large language models. Source materials include works by Shannon et al., Oliver & Bishop, Stafford & Werner, Zhang, Fiaz et al., Berckmans et al., and Vértesy (MATE Press). Hungarian lecture materials from the University of Debrecen and MATE Gödöllő.