Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Retrieval-Augmented Generation (Rag) For Automating Agricultural Block Annotations: AI-Driven Processing of Structured Text and Boundary Data for Descriptive Comment Generation
Jönköping University, School of Engineering, JTH, Department of Computer Science and Informatics.
Jönköping University, School of Engineering, JTH, Department of Computer Science and Informatics.
2025 (English)Independent thesis Basic level (degree of Bachelor), 10 credits / 15 HE creditsStudent thesisAlternative title
Retrieval-Augmented Generation (RAG) för automatisering av jordbruksblockannoteringar : AI-driven bearbetning av strukturerad text och gränsdata för generering av beskrivande kommentarer (Swedish)
Abstract [en]

Manual annotation of agricultural block boundary modifications is a time-consuming task often prone to inconsistency and administrative inefficiency. This thesis investigates how retrieval-augmented generation (RAG) can be used to automate the generation of internal annotations (noteringar) based on structured spatial and administrative data from Jordbruksverket’s Basen system. The purpose was to evaluate whether AI-generated comments could align with human-written annotations in both tone and content, and whether such a system could reduce the burden of manual documentation in public administration workflows. 

A microservice architecture was developed, integrating PostgreSQL, FastAPI, and RAGnar—a retrieval system used to dynamically query historical block data. Structured prompts were constructed using fields such as status, granskorsak, area_difference, and direction_change, and passed into a locally hosted LLaMA 3 language model to generate descriptive annotations. Evaluation was per- formed using BERTScore to measure semantic similarity between the AI-generated and human written annotations across 1,974 matched pairs. Results showed an average BERTScore F1 of 0.6594, indicating moderate semantic overlap. A deeper qualitative comparison revealed that the system performed well in routine cases involving spatial changes and area updates, while struggling with annotations requiring legal reasoning, policy references, or context not captured in structured metadata.

The findings suggest that while the method does not fully replace expert judgment, it can support case officers by generating draft annotations that follow institutional tone and format. This contributes to increased standardization, improved traceability, and potential time savings in annotation workflows. The approach may also be applicable in other domains that rely on structured spatial data and formaldocumentation, such as urban planning and environmental regulation.

Abstract [sv]

Manuell annotering av ändringar av jordbruksblockgränser är en tidskrävande uppgift som ofta är benägen att vara inkonsekvent och administrativt ineffektiv. Denna avhandling undersöker hur retrieval-augmented generation (RAG) kan användas för att automatisera genereringen av interna annoteringar baserade på strukturerad rumslig och administrativ data från Jordbruksverkets Basen-system. Syftet var att utvärdera om AI-genererade kommentarer kunde överensstämma med människoskrivna annoteringar både i ton och innehåll, och om ett sådant system kunde minska bördan av manuell dokumentation i offentliga förvaltningsarbetsflöden.

En mikrotjänstarkitektur utvecklades, som integrerade PostgreSQL, FastAPI och RAGnar – ett hämtningssystem som används för att dynamiskt fråga historisk blockdata. Strukturerade prompter konstruerades med hjälp av fält som status, granskorsak, area_difference och direction_change, och skickades till en lokalt hostad LLaMA 3-språkmodell för att generera beskrivande annoteringar. Utvärderingen utfördes med BERTScore för att mäta semantisk likhet mellan de AI-genererade och människoskrivna annoteringarna över 1 974 matchade par. Resultaten visade en genomsnittlig BERTScore F1 på 0,6594, vilket indikerar måttlig semantisk överlappning. En djupare kvalitativ jämförelse visade att systemet presterade bra i rutinmässiga fall som involverade rumsliga förändringar och områdesuppdateringar, samtidigt som det kämpade med anteckningar som krävde juridiska resonemang, policyreferenser eller kontext som inte fångades i strukturerad metadata.

Resultaten tyder på att även om metoden inte helt ersätter expertbedömningar, kan den stödja handläggare genom att generera utkast till anteckningar som följer institutionell ton och format. Detta bidrar till ökad standardisering, förbättrad spårbarhet och potentiella tidsbesparingar i anteckningsarbetsflöden. Metoden kan också vara tillämplig inom andra områden som förlitar sig på strukturerad rumslig data och formell dokumentation, såsom stadsplanering och miljöreglering.

Place, publisher, year, edition, pages
2025. , p. 53
Keywords [en]
Retrieval-Augmented Generation, RAG, Jordbruksverket, agricultural automation, AI, LLaMA 3, text generation
Keywords [sv]
Retrieval-Augmented Generation, RAG, Jordbruksverket, jordbruksautomation, AI, LLaMA 3, textgenerering
National Category
Computer Sciences
Identifiers
URN: urn:nbn:se:hj:diva-69165OAI: oai:DiVA.org:hj-69165DiVA, id: diva2:1979703
External cooperation
Jordbruksverket
Subject / course
JTH, Computer Engineering
Presentation
2025-05-26, E1418, Jönköping, 08:17 (English)
Supervisors
Examiners
Available from: 2025-07-28 Created: 2025-06-30 Last updated: 2025-10-13Bibliographically approved

Open Access in DiVA

fulltext(1739 kB)142 downloads
File information
File name FULLTEXT01.pdfFile size 1739 kBChecksum SHA-512
9480c26c3cd20800a5a74b12f28ddfd0652bd9610a04229e7d24b85176af3d54c94b1a9cb50b0556f065aa3d669366f9a048f2468fc69d04e4020854fa05f92d
Type fulltextMimetype application/pdf

By organisation
JTH, Department of Computer Science and Informatics
Computer Sciences

Search outside of DiVA

GoogleGoogle Scholar
Total: 146 downloads
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 581 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf