Skip to content

ORACLIN

Reinforced medical diagnosis reasoning using ICD-10 as a diagnosis scaffold.

Core trick

An LLM agent walks the 70,000-code ICD-10-CM tree step by step, with RL rewards penalizing wrong branch choices.

Tags

Description

Reinforced medical diagnosis reasoning using ICD-10 as a diagnosis scaffold.
gtcha2/ORACLIN★ 00 forksPythonMITCreated Mar 7, 2026 · last push Mar 8, 2026

README excerpt

# ORACLIN

**Oracle-guided Clinical Coding with Reinforcement Learning**

ORACLIN is an agentic ICD-10-CM coding system that uses LLMs to traverse the medical coding hierarchy and select diagnosis codes from clinical notes. It treats each coding session as a **Markov Decision Process** (MDP) where an LLM agent navigates a tree of 70,000+ ICD-10-CM codes, and an RL reward signal penalizes wrong turns and reinforces correct ones.

The system is built on [**OpenEnv**](https://github.com/facebookresearch/openenv) (Meta's environment interface for RL) which provides the standard `reset()` / `step(action)` contract that connects the ICD-10 traversal environment to any training framework — TRL, GRPO, SFT, or custom policies — without coupling the environment logic to the training loop.

---

## How It Works

A clinical note enters the system. The agent starts at ROOT and performs **breadth-first selection**: at each node it sees the candidate children, picks which branches are clinically relevant, and descends. The traversal also follows **lateral links** (codeFirst, codeAlso, useAdditionalCode) and resolves **7th character extensions** (e.g. `T36.1X5D` for subsequent encounters). When no more relevant children exist, the leaf codes become the final diagnosis codes.

```
Clinical Note
     │
     ▼
   ROOT
   ├── A00-B99  Infectious diseases
   │   └── A40  Streptococcal sepsis
   │       └── A40.0  Sepsis due to group A streptococcus  ← finalized
   ├── I00-I99  Circulatory system

Team