Skip to main content
advancedmd_get_ehr_document downloads a document filed on a patient’s AdvancedMD EHR chart, such as a form staff uploaded against a visit, and stores it in the task. It returns a file_url that a file-reading tool takes by its task variable reference. Find the document with the catalog operations advancedmd_op_ehr_list_documents, or advancedmd_op_ehr_list_encounters, where a type 9 child of an encounter is a document filed on that visit.

Authentication and enablement

Uses the workspace’s AdvancedMD connection (office code, username, password are bound from it and hidden from the model). Off by default: enable it on the agent.

Inputs

Output

metadata is AdvancedMD’s record as sent, without the file content. When AdvancedMD holds no content for the document, file_url is empty and nothing is stored.

Limits and side effects

  • Reads AdvancedMD’s ehr-api files/documents/{id}. Read-only against AdvancedMD.
  • Stores the file in the task’s files, like an upload. Files over 25 MB are refused.
  • The file name is the document’s AdvancedMD name plus its extension (AdvancedMD’s fileExtension, else the type sniffed from the content).

Errors

  • document_id must be a numeric AdvancedMD EHR document id — the id has no digits.
  • file storage is not available, so the document cannot be stored — the surface running the tool has no file storage; AdvancedMD is not called.
  • AdvancedMD EHR documents call failed (HTTP …) — AdvancedMD’s own status, for example an unknown document.
  • could not store document … — the content was over 25 MB or could not be written.
  • An AdvancedMD-not-connected result when the workspace has no AdvancedMD connection.