Agentic LLM Approach to Automated LOINC Code Assignment for Internal Laboratory Tests
摘要
Standardized coding of laboratory data is essential for clinical interoperability, secondary data use, and multi-institutional research. Logical Observation Identifiers Names and Codes (LOINC®) provide a global standard for laboratory observations, but manual and automated mapping remain challenging due to heterogeneous local test descriptions, language differences, and evolving terminologies. We propose an agentic approach for automated LOINC coding that leverages a locally deployed large language model (LLM) interacting iteratively with the official LOINC Search API through a query-refinement loop. The method was evaluated on 151 frequently used laboratory tests extracted from German language routine clinical data. Performance was benchmarked against a retrieval augmented generation (RAG) baseline using multiple embedding models. The proposed approach consistently outperformed the RAG baseline, achieving a Top-1 accuracy of up to \(85.4\%\) and a Top-5 accuracy of up to \(98.0\%\) . The high Top-5 performance enables efficient expert-in-the-loop validation workflows. The agentic method demonstrated greater robustness to incomplete laboratory metadata and maintained competitive runtime while operating entirely locally. Agentic, API-driven LLM workflows offer a practical and transparent solution for automated LOINC coding in clinical settings. The approach supports interoperability, minimizes dependence on proprietary services, and is well suited for integration into routine hospital environments.