> ## 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.

# AdvancedMD Get Patient Notes By Visit

> AdvancedMD EHR patient-notes tool exposed through the Agents Platform.

This document covers `advancedmd_get_patient_notes_by_visit`, the AdvancedMD EHR patient-notes tool exposed through the Agents Platform.

## Authentication

Uses the existing AdvancedMD connector (`office_code`, `username`, `password`).

## `advancedmd_get_patient_notes_by_visit`

Fetches AdvancedMD EHR patient notes for a visit using the `getehrnotesbyvisit` XML API (the same shape as Fleming's `GetEHRNotesByVisit`).

This tool is read-only.

### Inputs

Required:

* `visit_id`: AdvancedMD visit ID.

### Output

```json theme={null}
{
  "success": true,
  "visit_id": "vst123",
  "notes": [
    {
      "id": "note123",
      "patient_id": "pat123",
      "template_id": "tmpl123",
      "username": "Provider Name",
      "note_datetime": "5/1/2026 9:30:00 AM",
      "comments": "",
      "pages": [
        {
          "page_name": "Assessment",
          "fields": [{ "name": "Diagnosis", "value": "F33.1 Major depressive disorder" }]
        }
      ]
    }
  ]
}
```

Common failure reasons:

* `advancedmd_not_connected`
* visit notes unavailable

## Human-readable text

The tool emits markdown for the feed: a `## Patient Notes` summary table and a `## Notes` table (note id, datetime, template, page/field counts, and a short field preview). Full note pages and field values stay in `structuredContent`.

## Agent Instruction Guidance

Run after `advancedmd_get_visit_summary` and deterministic skip checks. Feed the returned notes into `coding_diagnosis`, then `coding_cpt_generation`, `coding_charge_reviewer`, and `coding_format_validation`.
