> ## Documentation Index
> Fetch the complete documentation index at: https://agents.nanonets.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Coding Diagnosis

> `coding_diagnosis` extracts the ICD-10-CM diagnosis codes that belong on the claim from the encounter documentation.

`coding_diagnosis` extracts the ICD-10-CM diagnosis codes that belong on the claim from the encounter documentation. It is part of the **Nanonets Coding Engine** tool group.

The full senior-auditor reasoning prompt (ported from Fleming `ProcessVisitForDiagnosisCoding`) — including the two-condition test, uncertainty/historical exclusions, same-family deduplication, active-medication rescue, and ordering tiers — is baked into the tool.

## Inputs

* `encounter_context` (required): the documentation to code from. May wrap the target encounter in `<current_encounter>` tags and include nearby encounters as context.
* `practice_specific_icd_rules` (optional): practice/organization rules. Only ICD-10-relevant rules are applied; CPT/modifier/billing rules are ignored by the prompt.

## Output

```json theme={null}
{
  "tool_name": "coding_diagnosis",
  "icd10_codes": [{ "code": "F33.1", "description": "MDD recurrent moderate", "confidence": "High", "reasoning": "..." }],
  "code_list": ["F33.1"],
  "sud_diagnosis_codes": [],
  "notes": "Step 1: ...",
  "completed_at": "2026-06-01T00:00:00Z"
}
```

`code_list` is a flat, claim-ordered list of the returned codes for convenience.

## Human-readable text

In the task feed the tool renders a `## Diagnosis` ICD-10 table (code, description, confidence, reasoning), plus SUD codes and notes when present. The full result struct stays in `structuredContent`.

## SUD codes (follow-up)

`sud_diagnosis_codes` is always an empty array for now. The baked Fleming diagnosis prompt returns only `icd10_codes` and `notes`; dedicated substance-use-disorder (SUD) extraction is a documented follow-up and would require expanding the prompt.

## Notes

* LLM tool. Billed per call. `default_enabled` is false.
