Skip to main content
This document covers advancedmd_add_codes_to_visit, the AdvancedMD coding write-back tool exposed through the Agents Platform.

Authentication

Uses the existing AdvancedMD connector.

Safety

dry_run=true remains the default. Non-dry-run uses AdvancedMD’s proprietary Connect API charge-entry flow (@class="chargeentry", @action="updvisitwithcharges") modeled from Fleming’s lower-level AddCharge / UpdateChargeInVisit helpers. The exact method-level API docs are not public; AdvancedMD’s public developer pages confirm Connect APIs support CRUD-style PM workflows, and AdvancedMD product docs describe charge-entry / charge-detail workflows. The XML payload here follows Fleming’s existing implementation rather than guessing from public docs.

advancedmd_add_codes_to_visit

Writes approved CPT/ICD/modifier coding data to existing AdvancedMD visit charges. Important limitation: each non-dry-run charge must include external_charge_id. Public docs do not confirm safe creation semantics for brand-new charge IDs, so this tool updates known charges instead of inventing charge identifiers.

Provider profile & facility preservation

updvisitwithcharges rewrites the visit record and clears any attribute it is not given, and the billing provider/facility are @profile/@facility on the visit element (AMD API docs June 2025) — omitting them is what reset 58 charges to a blank provider. This write now reads the visit record from getchargedetaildataicd10, echoes those values back, refuses to run if the provider cannot be read, and re-reads it afterwards to confirm it survived. ADVANCEDMD_CHARGE_WRITE_ENABLED=false is the ops kill switch. Full background: AdvancedMD Unapply Payment — Provider profile & facility preservation.

Inputs

Required:
  • visit_id
  • patient_id when dry_run=false
  • charges: Array of validated charges.
    • external_charge_id is required per charge when dry_run=false.
Optional:
  • supervising_provider_id

Output

Human-readable text

The tool emits markdown for the feed: an ## AdvancedMD Dry Run / ## AdvancedMD Codes Applied summary table, a ## Charges table (external id, CPT, diagnosis, modifiers, POS, TOS, units, fee, note), an ## Applied Charge IDs table, and a ## Per-Charge Errors section on failures. The full payload and raw response stay in structuredContent.

Agent Instruction Guidance

Keep dry_run=true for first-pass coding suggestions. Only call with dry_run=false after biller approval, and only when the current visit summary gives you the target patient_id and existing AdvancedMD charge ids.