Commands

The Commands API is designed to offer a user-friendly interface for creating, updating, or deleting commands through REST endpoints. Commands can exclusively be added to encounter, review, or data import notes. It is important to note that encounter and review notes must be unlocked and should not be deleted.

Schema Fields

There are a number of available field types that each command can implement.

ApproximateDateField

A field to turn a string into an approximate date.

AutocompleteField

A field that provides autocomplete suggestions

These suggestions can be retrieved using the autocomplete endpoint described below.

CheckboxField

A field for collecting a boolean value with a checkbox.

ChoiceField

A field for collecting a value from a predefined list of options.

DateField

A field for collecting a date value.

IntegerField

A field for collecting an integer value.

MultiLineTextField

A text field that can handle multi-line input.

MultipleChoiceField

A field for collecting multiple values from a predefined list of options.

TextField

A single-line text field.

Available Commands

Every command is associated with a unique schema_key, which should be used when creating the respective command. To retrieve the schema fields for a command, utilize the fields endpoint.

Assess

schema_key:assess

Schema

{
    "schema": "assess",
    "fields": [
        {
            "name": "condition",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "background",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        },
        {
            "name": "status",
            "type": "ChoiceField",
            "required": false,
            "choices": [
                {
                    "value": "improved",
                    "text": "Improved"
                },
                {
                    "value": "stable",
                    "text": "Unchanged"
                },
                {
                    "value": "deteriorated",
                    "text": "Deteriorated"
                }
            ]
        },
        {
            "name": "narrative",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "condition": {
        "text": "Bitten by orca, initial encounter (W56.21XA)",
        "value": 359
    },
    "background": "background for condition",
    "status": "stable",
    "narrative": "today's assessment"
}

Diagnose

schema_key:diagnose

Schema

{
    "schema": "diagnose",
    "fields": [
        {
            "name": "diagnose",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "background",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        },
        {
            "name": "approximate_date_of_onset",
            "type": "ApproximateDateField",
            "required": false,
            "choices": null
        },
        {
            "name": "today_assessment",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "diagnose": {
        "text": "Bitten by orca, initial encounter (W5621XA)",
        "extra": {
            "coding": [
                {
                    "code": "W5621XA",
                    "display": "Bitten by orca, initial encounter",
                    "system": "ICD-10"
                },
                {
                    "code": 404684003,
                    "display": "Bitten by orca, initial encounter",
                    "system": "http://snomed.info/sct"
                }
            ]
        },
        "value": "W5621XA"
    },
    "approximate_date_of_onset": {
        "input": "1d",
        "date": "2024-06-17"
    },
    "background": "bitten by orca",
    "today_assessment": "bitten by orca"
}

Goal

schema_key:goal

Schema

{
    "schema": "goal",
    "fields": [
        {
            "name": "goal_statement",
            "type": "MultiLineTextField",
            "required": true,
            "choices": null
        },
        {
            "name": "start_date",
            "type": "DateField",
            "required": false,
            "choices": null
        },
        {
            "name": "due_date",
            "type": "DateField",
            "required": false,
            "choices": null
        },
        {
            "name": "achievement_status",
            "type": "ChoiceField",
            "required": false,
            "choices": [
                {
                    "value": "in-progress",
                    "text": "In Progress"
                },
                {
                    "value": "improving",
                    "text": "Improving"
                },
                {
                    "value": "worsening",
                    "text": "Worsening"
                },
                {
                    "value": "no-change",
                    "text": "No Change"
                },
                {
                    "value": "achieved",
                    "text": "Achieved"
                },
                {
                    "value": "sustaining",
                    "text": "Sustaining"
                },
                {
                    "value": "not-achieved",
                    "text": "Not Achieved"
                },
                {
                    "value": "no-progress",
                    "text": "No Progress"
                },
                {
                    "value": "not-attainable",
                    "text": "Not Attainable"
                }
            ]
        },
        {
            "name": "priority",
            "type": "ChoiceField",
            "required": false,
            "choices": [
                {
                    "value": "high-priority",
                    "text": "High Priority"
                },
                {
                    "value": "medium-priority",
                    "text": "Medium Priority"
                },
                {
                    "value": "low-priority",
                    "text": "Low Priority"
                }
            ]
        },
        {
            "name": "progress",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "goal_statement": "This is a goal.",
    "start_date": "2024-05-01",
    "due_date": "2024-07-01",
    "achievement_status": "achieved",
    "priority": "high-priority",
    "progress": "the goal was achieved."
}

History Of Present Illness

schema_key:hpi

Schema

{
"schema": "hpi",
"fields": [
        {
            "name": "narrative",
            "type": "MultiLineTextField",
            "required": true,
            "choices": null
        }
    ]
}

Example Payload

{
    "narrative": "This is a HPI command narrative"
}

Instruct

schema_key:instruct

Schema

{
    "schema": "instruct",
    "fields": [
        {
            "name": "instruct",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "narrative",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
     "instruct": {
         "text": "Basic nutrition education",
         "extra": {
             "coding": [
                 {
                     "code": 61310001,
                     "display": "Basic nutrition education",
                     "system": "http://snomed.info/sct"
                 }
             ],
             "score": 231,
             "search_term": "a"
         },
         "value": 61310001
     },
     "narrative": "test narrative"
 }

Lab Order

schema_key:labOrder

Schema

{
    "schema": "labOrder",
    "fields": [
        {
            "name": "lab_partner",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "tests",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "ordering_provider",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "diagnosis",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "fasting_status",
            "type": "CheckboxField",
            "required": false,
            "choices": null
        },
        {
            "name": "comment",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "schemaKey": "labOrder",
    "noteKey": "9c8e96ee-1e1f-42db-9024-7748244919c3",
    "values": {
        "lab_partner": {
            "text": "Generic Lab",
            "extra": {
                "electronic_ordering_enabled": false
            },
            "value": "Generic Lab"
        },
        "tests": [
            {
                "text": "HEIGHT",
                "value": "19689"
            }
        ],
        "ordering_provider": {
            "text": "Steven Magee MD",
            "value": 3
        },
        "diagnosis": [
            {
                "text": "Ophiasis",
                "value": "L632"
            }
        ],
        "fasting_status": true,
        "comment": "a comment"
    }
}

Medication Statement

schema_key:medicationStatement

Schema

{
    "schema": "medicationStatement",
    "fields": [
        {
            "name": "medication",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "sig",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "medication": {
        "text": "lancets",
        "value": 221185,
        "extra": {
            "coding": [
                {
                    "code": 221185,
                    "display": "lancets",
                    "system": "http://www.fdbhealth.com/"
                }
            ]
        }
    },
    "sig": "take one daily 3"
}

Perform

schema_key:perform

Schema

{
    "schema": "perform",
    "fields": [
        {
            "name": "perform",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "notes",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "perform": {
        "text": "Established patient office visit, level three (CPT: 99213)",
        "extra": {
            "coding": [
                {
                    "code": "99213",
                    "display": "Established patient office visit, level three",
                    "system": "http://www.ama-assn.org/go/cpt"
                }
            ]
        },
        "value": "99213"
    },
    "notes": "notes for the command"
}

Plan

schema_key:plan

Schema

{
    "schema": "plan",
    "fields": [
        {
            "name": "narrative",
            "type": "MultiLineTextField",
            "required": true,
            "choices": null
        }
    ]
}

Example Payload

{
    "narrative": "This is a Plan command narrative"
}

Prescribe

schema_key:prescribe

Schema

{
    "schema": "prescribe",
    "fields": [
        {
            "name": "prescribe",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "indications",
            "type": "AutocompleteField",
            "required": false,
            "choices": null
        },
        {
            "name": "sig",
            "type": "MultiLineTextField",
            "required": true,
            "choices": null
        },
        {
            "name": "days_supply",
            "type": "IntegerField",
            "required": false,
            "choices": null
        },
        {
            "name": "quantity_to_dispense",
            "type": "DecimalField",
            "required": true,
            "choices": null
        },
        {
            "name": "type_to_dispense",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "refills",
            "type": "IntegerField",
            "required": true,
            "choices": null
        },
        {
            "name": "substitutions",
            "type": "ChoiceField",
            "required": true,
            "choices": [
                {
                    "value": "allowed",
                    "text": "Allowed"
                },
                {
                    "value": "not_allowed",
                    "text": "Not Allowed"
                }
            ]
        },
        {
            "name": "pharmacy",
            "type": "AutocompleteField",
            "required": false,
            "choices": null
        },
        {
            "name": "prescriber",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "note_to_pharmacist",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "prescribe": {
        "text": "Comfort Lancets",
        "extra": {
            "coding": [
                {
                    "code": 453535,
                    "display": "Comfort Lancets",
                    "system": "http://www.fdbhealth.com/"
                }
            ],
            "clinical_quantities": [
                {
                    "erx_quantity": "100.0000000",
                    "representative_ndc": "08214065711",
                    "clinical_quantity_description": "100 each box",
                    "erx_ncpdp_script_quantity_qualifier_code": "C120263",
                    "erx_ncpdp_script_quantity_qualifier_description": "Lancet"
                }
            ]
        },
        "value": 453535
    },
    "indications": [
        {
            "text": "Bitten by orca, initial encounter (W56.21XA)",
            "value": 45
        }
    ],
    "sig": "take one daily",
    "days_supply": "1",
    "quantity_to_dispense": "1",
    "type_to_dispense": {
        "text": "100 each box",
        "value": "08214065711|100|C120263",
        "extra": {
            "erx_quantity": "100.0000000",
            "representative_ndc": "08214065711",
            "clinical_quantity_description": "100 each box",
            "erx_ncpdp_script_quantity_qualifier_code": "C120263",
            "erx_ncpdp_script_quantity_qualifier_description": "Lancet"
        }
    },
    "substitutions": "not_allowed",
    "pharmacy": {
        "text": "CVS Health #68631, 1 Cvs Drive, Phoenix, AZ, 85001, 655.5 mi",
        "disabled": false,
        "description": "Phone: (401) 834-4059 Fax: (401) 834-4059",
        "annotations": [
            "Retail"
        ],
        "extra": {
            "address": "1 Cvs Drive, Phoenix, AZ, 85001",
            "name": "CVS Health #68631",
            "ncpdp_id": "0068631",
            "phone_number": "4018344059",
            "fax_number": "4018344059",
            "service_level": "New~Refill~Change~Cancel~ControlledSubstance",
            "specialty_type": "Retail"
        },
        "value": "0068631"
    },
    "prescriber": {
        "text": "Erik McDonald",
        "value": 6
    },
    "note_to_pharmacist": "this is a note to pharmacist"
}

Questionnaire

schema_key:questionnaire

The command features a dynamic schema that adapts according to the selected questionnaire.

Schema

Without a questionnaire selected:

{
    "schema": "questionnaire",
    "fields": [
        {
            "name": "questionnaire",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "result",
            "type": "TextField",
            "required": false,
            "choices": null
        }
    ]
}

Once a questionnaire is selected, the schema dynamically adjusts and can be refreshed by utilizing the fields endpoint.

{
    "schema": "questionnaire",
    "fields": [
        {
            "name": "questionnaire",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "result",
            "type": "TextField",
            "required": false,
            "choices": null
        },
        {
            "name": "question-29",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        },
        {
            "name": "question-30",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        },
        {
            "name": "question-31",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "questionnaire": {
        "text": "Care Plan",
        "disabled": false,
        "description": null,
        "annotations": null,
        "extra": {
            "name": "Care Plan",
            "prologue": "",
            "pk": 1,
            "carry_forward_on_init": false,
            "questions": [
                {
                    "pk": 29,
                    "name": "question-29",
                    "label": "My health coach is",
                    "type": "TXT",
                    "coding": {
                        "system": "SNOMED",
                        "code": "91689009"
                    },
                    "options": [
                        {
                            "pk": 70,
                            "label": "coach",
                            "code": "91689009",
                            "value": ""
                        }
                    ]
                },
                {
                    "pk": 30,
                    "name": "question-30",
                    "label": "My top health concerns are",
                    "type": "TXT",
                    "coding": {
                        "system": "SNOMED",
                        "code": "91689010"
                    },
                    "options": [
                        {
                            "pk": 71,
                            "label": "concerns",
                            "code": "91689010",
                            "value": ""
                        }
                    ]
                },
                {
                    "pk": 31,
                    "name": "question-31",
                    "label": "The main things about my health I want to improve are",
                    "type": "TXT",
                    "coding": {
                        "system": "SNOMED",
                        "code": "91689011"
                    },
                    "options": [
                        {
                            "pk": 72,
                            "label": "goals",
                            "code": "91689011",
                            "value": ""
                        }
                    ]
                },
                {
                    "pk": 32,
                    "name": "question-32",
                    "label": "The main obstacles I face are",
                    "type": "MULT",
                    "coding": {
                        "system": "SNOMED",
                        "code": "91689012"
                    },
                    "options": [
                        {
                            "pk": 73,
                            "label": "Money is tough",
                            "code": "91689012-1",
                            "value": ""
                        },
                        {
                            "pk": 74,
                            "label": "Time is short",
                            "code": "91689012-2",
                            "value": ""
                        },
                        {
                            "pk": 75,
                            "label": "Transportation is difficult",
                            "code": "91689012-3",
                            "value": ""
                        },
                        {
                            "pk": 76,
                            "label": "Support is hard to find",
                            "code": "91689012-4",
                            "value": ""
                        },
                        {
                            "pk": 77,
                            "label": "Motivation is missing",
                            "code": "91689012-5",
                            "value": ""
                        }
                    ]
                },
                {
                    "pk": 33,
                    "name": "question-33",
                    "label": "Other challenges I feel are",
                    "type": "TXT",
                    "coding": {
                        "system": "SNOMED",
                        "code": "91689013"
                    },
                    "options": [
                        {
                            "pk": 78,
                            "label": "challenges",
                            "code": "91689013",
                            "value": ""
                        }
                    ]
                }
            ]
        },
        "value": 1
    },
    "question-29": "Health coach",
    "question-30": "Top health concerns",
    "question-31": "main things to improve",
    "question-32": [
        {
            "text": "Money is tough",
            "value": 73,
            "comment": "",
            "selected": false
        },
        {
            "text": "Time is short",
            "value": 74,
            "comment": "",
            "selected": false
        },
        {
            "text": "Transportation is difficult",
            "value": 75,
            "comment": "",
            "selected": true
        },
        {
            "text": "Support is hard to find",
            "value": 76,
            "comment": "",
            "selected": false
        },
        {
            "text": "Motivation is missing",
            "value": 77,
            "comment": "Motivation comment",
            "selected": true
        }
    ],
    "question-33": "Other challenges"
}

Reason For Visit

schema_key:reasonForVisit

Schema

{
    "schema": "reasonForVisit",
    "fields": [
        {
            "name": "coding",
            "type": "AutocompleteField",
            "required": false,
            "choices": null
        },
        {
            "name": "comment",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Types of Reason For Visit

Structured

Utilize a structured format

Use the comment property to add more context to the structured reason.

Free Text

Create a simple free text reason using the comment property

Both types can be created using comment property

For the structured Reason For Visit, it is necessary to update it further with the coding property. See the documentation at https://docs.canvasmedical.com/documentation/reason-for-visit-setting-codings to learn how to create a structured reason for visit.

Example Payload

{
    "coding": {
        "text": "Homoiothermia",
        "value": "129007"
    },
    "comment": "Cold"
}

Stop Medication

schema_key:stopMedication

Schema

{
    "schema": "stopMedication",
    "fields": [
        {
            "name": "medication",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "rationale",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "medication": {
        "text": "lancets",
        "value": 38
    },
    "rationale": "not needed"
}

Update Goal

schema_key:updateGoal

Schema

{
    "schema": "updateGoal",
    "fields": [
        {
            "name": "goal_statement",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "due_date",
            "type": "DateField",
            "required": false,
            "choices": null
        },
        {
            "name": "achievement_status",
            "type": "ChoiceField",
            "required": false,
            "choices": [
                {
                    "value": "in-progress",
                    "text": "In Progress"
                },
                {
                    "value": "improving",
                    "text": "Improving"
                },
                {
                    "value": "worsening",
                    "text": "Worsening"
                },
                {
                    "value": "no-change",
                    "text": "No Change"
                },
                {
                    "value": "achieved",
                    "text": "Achieved"
                },
                {
                    "value": "sustaining",
                    "text": "Sustaining"
                },
                {
                    "value": "not-achieved",
                    "text": "Not Achieved"
                },
                {
                    "value": "no-progress",
                    "text": "No Progress"
                },
                {
                    "value": "not-attainable",
                    "text": "Not Attainable"
                }
            ]
        },
        {
            "name": "priority",
            "type": "ChoiceField",
            "required": false,
            "choices": [
                {
                    "value": "high-priority",
                    "text": "High Priority"
                },
                {
                    "value": "medium-priority",
                    "text": "Medium Priority"
                },
                {
                    "value": "low-priority",
                    "text": "Low Priority"
                }
            ]
        },
        {
            "name": "progress",
            "type": "MultiLineTextField",
            "required": false,
            "choices": null
        }
    ]
}

Example Payload

{
    "goal_statement": {
        "text": "This is a goal",
        "value": 1
    },
    "due_date": "2024-08-01",
    "achievement_status": "no-progress",
    "priority": "low-priority",
    "progress": "update goal."
}

Educational Material

schema_key:educationalMaterial

Schema

{
    "schema": "educationalMaterial",
    "fields": [
        {
            "name": "title",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        },
        {
            "name": "language",
            "type": "AutocompleteField",
            "required": true,
            "choices": null
        }
    ]
}

Example Payload

{
    "schemaKey": "educationalMaterial",
    "noteKey": "<note_key>",
    "values": {
        "title": {
            "value": "hw202906",
            "text": "Varicocele Repair Surgery"
        },
        "language": {
            "value": "en-us",
            "text": "English"
        }
    }
}

Basic Usage

Warning

Trailing slash is required for POST, PUT, PATCH and DELETE operations

GET /core/api/v1/commands/{command_uuid}

Retrieves the information about a specific command

Example request:

GET /core/api/v1/commands/23f9f649-7cbb-4111-ac21-72e5f16319ed HTTP/1.1
Host: example.com
Accept: application/json

Example response:

HTTP/1.1 200 OK

{
  "uuid": "23f9f649-7cbb-4111-ac21-72e5f16319ed",
  "state": "committed",
  "created_at": "2024-01-04T12:28:28.563080Z",
  "updated_at": "2024-01-04T12:30:55.326076Z",
  "schema_key": "plan",
  "patient_key": "06693bde986c4b3c90049315c14d8250",
  "note_key": "acb56588-da8f-40ea-b5b7-dd222193cd24",
  "originated_by": "4150cd20de8a470aa570a852859ac87e",
  "edited_by": [
      "4150cd20de8a470aa570a852859ac87e"
  ],
  "committed_by": "4150cd20de8a470aa570a852859ac87e",
  "entered_in_error_by": null,
  "data": {
      "narrative": "test"
  }
}
Query Parameters:
  • command_uuid (string) – The command UUID

Request Headers:
Response JSON Object:
  • uuid (string) – Command UUID

  • state (string) – State of the command (staged, committed or entered_in_error).

  • created_at (string) – Date when the command was created

  • updated_at (string) – Date when the command was last updated

  • schema_key (string) – Type of the command (plan, hpi, etc.)

  • patient_key (string) – Patient that the command is associated to

  • note_key (string) – Note where the command was inserted in

  • originated_by (string) – Key of the user who created the command

  • edited_by (string) – Key of the user who edited the command

  • committed_by (string) – Key of the user who committed the command

  • entered_in_error_by (string) – Key of the user who entered in error the command

  • data (dict) – Command’s field values

Status Codes:
GET /core/api/v1/commands

Retrieves all commands that fits the query params

Example request:

Filter committed commands for a specific patient that were created before 2024-01-05

GET /core/api/v1/commands?patient_key=06693bde986c4b3c90049315c14d8250&state=committed&created_at__lte=2024-01-05 HTTP/1.1
Host: example.com
Accept: application/json

Example response:

HTTP/1.1 200 OK

{
      "count": 1,
      "next": null,
      "previous": null,
      "results": [
          {
              "uuid": "23f9f649-7cbb-4111-ac21-72e5f16319ed",
              "state": "committed",
              "created_at": "2024-01-04T12:28:28.563080Z",
              "updated_at": "2024-01-04T12:30:55.326076Z",
              "schema_key": "plan",
              "patient_key": "06693bde986c4b3c90049315c14d8250",
              "note_key": "acb56588-da8f-40ea-b5b7-dd222193cd24",
              "originated_by": "4150cd20de8a470aa570a852859ac87e",
              "edited_by": [
                  "4150cd20de8a470aa570a852859ac87e"
              ],
              "committed_by": "4150cd20de8a470aa570a852859ac87e",
              "entered_in_error_by": null,
              "data": {
                  "narrative": "test"
              }
          }
      ]
}
Query Parameters:
  • patient_key (string) – Key of the patient

  • note_key (string) – Key of the note

  • originator_key (string) – Key of the user who created the command

  • committer_key (string) – Key of the user who committed the command

  • schema_key (string) – Type of the command (plan, hpi, etc.)

  • state (string) – State of the command (staged, committed or entered_in_error)

  • created_at (string) – Date when the command was created (allows filtering before or after by adding __lt(e) or __gt(e))

  • updated_at (string) – Date when the command was last updated (allows filtering before or after by adding __lt(e) or __gt(e))

Request Headers:
Response JSON Array of Objects:
  • uuid (string) – Command UUID

  • state (string) – State of the command (staged, committed or entered_in_error)

  • created_at (string) – Date when the command was created

  • updated_at (string) – Date when the command was last updated

  • schema_key (string) – Type of the command (plan, hpi, etc.)

  • patient_key (string) – Patient that the command is associated to

  • note_key (string) – Note where the command was inserted in

  • originated_by (string) – Key of the user who created the command

  • edited_by (string) – Key of the user who edited the command

  • committed_by (string) – Key of the user who committed the command

  • entered_in_error_by (string) – Key of the user who entered in error the command

  • data (dict) – Command’s field values

Status Codes:
GET /core/api/v1/commands/{command_uuid}

Retrieves the information about a specific command

Example request:

GET /core/api/v1/commands/23f9f649-7cbb-4111-ac21-72e5f16319ed HTTP/1.1
Host: example.com
Accept: application/json

Example response:

HTTP/1.1 200 OK

{
  "uuid": "23f9f649-7cbb-4111-ac21-72e5f16319ed",
  "state": "committed",
  "created_at": "2024-01-04T12:28:28.563080Z",
  "updated_at": "2024-01-04T12:30:55.326076Z",
  "schema_key": "plan",
  "patient_key": "06693bde986c4b3c90049315c14d8250",
  "note_key": "acb56588-da8f-40ea-b5b7-dd222193cd24",
  "originated_by": "4150cd20de8a470aa570a852859ac87e",
  "edited_by": [
      "4150cd20de8a470aa570a852859ac87e"
  ],
  "committed_by": "4150cd20de8a470aa570a852859ac87e",
  "entered_in_error_by": null,
  "data": {
      "narrative": "test"
  }
}
Query Parameters:
  • command_uuid (string) – The command UUID

Request Headers:
Response JSON Object:
  • uuid (string) – Command UUID

  • state (string) – State of the command (staged, committed or entered_in_error).

  • created_at (string) – Date when the command was created

  • updated_at (string) – Date when the command was last updated

  • schema_key (string) – Type of the command (plan, hpi, etc.)

  • patient_key (string) – Patient that the command is associated to

  • note_key (string) – Note where the command was inserted in

  • originated_by (string) – Key of the user who created the command

  • edited_by (string) – Key of the user who edited the command

  • committed_by (string) – Key of the user who committed the command

  • entered_in_error_by (string) – Key of the user who entered in error the command

  • data (dict) – Command’s field values

Status Codes:
GET /core/api/v1/commands/{command_uuid}/fields/

Retrieves all command’s fields.

Example request:

Get a plan command’s schema fields

GET /core/api/v1/commands/8839374a-f0a0-4502-a379-4b3942aba024/fields/ HTTP/1.1
Host: example.com
Accept: application/json

Example response:

HTTP/1.1 200 OK

{
      "schema": "plan"
      "fields": [
          {
             "name": "narrative",
             "type": "MultiLineTextField,
             "required": true,
             "choices": []
          }
      ]
}
Query Parameters:
  • command_uuid (string) – The command UUID

Request Headers:
Response JSON Object:
  • schema (string) – Command schema key

  • fields (array<dict>) – Command schema available fields

Status Codes:
GET /core/api/v1/commands/{command_uuid}/fields/{field_name}/autocomplete/

Retrieve response options for a specific field of a particular command. Utilize this information to enhance the understanding of available choices or autocomplete suggestions.

Example request:

Get aspirin medications for a medication statement command

GET /core/api/v1/commands/affa8dc3-96b4-4b7a-8fc2-d9d5cfa0db77/fields/medication/autocomplete/?search_term=aspirin' HTTP/1.1
Host: example.com
Accept: application/json

Example response:

HTTP/1.1 200 OK

[
    {
        "text": "aspirin 500 mg tablet",
        "value": "{"text\": \"aspirin 500 mg tablet\", \"disabled\": false, \"description\": null, \"annotations\": null, \"extra\": {\"coding\": [{\"code\": 216092, \"display\": \"aspirin 500 mg tablet\", \"system\": \"http://www.fdbhealth.com/\"}, {\"code\": \"198471\", \"display\": \"aspirin 500 mg tablet\", \"system\": \"http://www.nlm.nih.gov/research/umls/rxnorm\"}]}, \"value\": 216092}"
    },
    {
        "text": "aspirin 325 mg tablet",
        "value": "{\"text\": \"aspirin 325 mg tablet\", \"disabled\": false, \"description\": null, \"annotations\": null, \"extra\": {\"coding\": [{\"code\": 172480, \"display\": \"aspirin 325 mg tablet\", \"system\": \"http://www.fdbhealth.com/\"}, {\"code\": \"212033\", \"display\": \"aspirin 325 mg tablet\", \"system\": \"http://www.nlm.nih.gov/research/umls/rxnorm\"}]}, \"value\": 172480}"
    }
]
Query Parameters:
  • command_uuid (string) – The command UUID

  • field_name (string) – The field name

  • search_term (string) – The term to use in the search

Request Headers:
Response JSON Array of Objects:
  • text (string) – Display text of the option

  • value (jsonstring) – Value used to update the field

Status Codes:
POST /core/api/v1/commands/

Create a command

Example request:

POST /core/api/v1/commands/ HTTP/1.1
Host: example.com
Content-Type: application/json

{ "schemaKey": "plan", "noteKey": "45b819e7-9ee0-4e2e-82a4-a90f74864f84", "values":{ "narrative": "test via api"}}

Example response:

HTTP/1.1 201 CREATED

{
  "uuid": "c532af8b-ed51-4c99-be23-9849a219a71d",
  "state": "staged",
  "created_at": "2024-01-16T12:14:30.787243Z",
  "updated_at": "2024-01-16T12:14:30.835402Z",
  "schema_key": "plan",
  "patient_key": "2371271908f6491294d940c7d320e30c",
  "note_key": "45b819e7-9ee0-4e2e-82a4-a90f74864f84",
  "originated_by": "4150cd20de8a470aa570a852859ac87e",
  "edited_by": [
      "4150cd20de8a470aa570a852859ac87e"
  ],
  "committed_by": null,
  "entered_in_error_by": null,
  "data": {
      "narrative": "test via api"
  }
}
Request JSON Object:
  • schemaKey (string) – Type of the command (plan, hpi, etc.)

  • noteKey (string) – Key of the note where to create the command

  • values (dict) – optional values to created a command with pre-filled values.

Request Headers:
Response JSON Object:
  • uuid (string) – Command UUID

  • state (string) – State of the command (staged, committed or entered_in_error).

  • created_at (string) – Date when the command was created

  • updated_at (string) – Date when the command was last updated

  • schema_key (string) – Type of the command (plan, hpi, etc.)

  • patient_key (string) – Patient that the command is associated to

  • note_key (string) – Note where the command was inserted in

  • originated_by (string) – Key of the user who created the command

  • edited_by (string) – Key of the user who edited the command

  • committed_by (string) – Key of the user who committed the command

  • entered_in_error_by (string) – Key of the user who entered in error the command

  • data (dict) – Command’s field values

Status Codes:
PATCH /core/api/v1/commands/{command_uuid}/

Update a command data values. The state will automatically change upon committing or entering an error. The committed_by field will automatically update upon committing the command The entered_in_error_by field will automatically update when marking the command as entered in error. The edited_by field will automatically update when the command is modified.

Example request:

PATCH /core/api/v1/commands/c532af8b-ed51-4c99-be23-9849a219a71d/ HTTP/1.1
Host: example.com
Content-Type: application/json

{ "values":{ "narrative": "update this value via API"}}

Example response:

HTTP/1.1 200 OK

{
  "uuid": "c532af8b-ed51-4c99-be23-9849a219a71d",
  "state": "staged",
  "created_at": "2024-01-16T12:14:30.787243Z",
  "updated_at": "2024-01-16T12:14:30.835402Z",
  "schema_key": "plan",
  "patient_key": "2371271908f6491294d940c7d320e30c",
  "note_key": "45b819e7-9ee0-4e2e-82a4-a90f74864f84",
  "originated_by": "4150cd20de8a470aa570a852859ac87e",
  "edited_by": [
      "4150cd20de8a470aa570a852859ac87e"
  ],
  "committed_by": null,
  "entered_in_error_by": null,
  "data": {
      "narrative": "update this value via API"
  }
}
Query Parameters:
  • command_uuid (string) – The command UUID

Request JSON Object:
  • values (dict) – values to update the command with

Request Headers:
Response JSON Object:
  • uuid (string) – Command UUID

  • state (string) – State of the command (staged, committed or entered_in_error).

  • created_at (string) – Date when the command was created

  • updated_at (string) – Date when the command was last updated

  • schema_key (string) – Type of the command (plan, hpi, etc.)

  • patient_key (string) – Patient that the command is associated to

  • note_key (string) – Note where the command was inserted in

  • originated_by (string) – Key of the user who created the command

  • edited_by (string) – Key of the user who edited the command

  • committed_by (string) – Key of the user who committed the command

  • entered_in_error_by (string) – Key of the user who entered in error the command

  • data (dict) – Command’s field values

Status Codes:
DELETE /core/api/v1/commands/{command_uuid}/

Deletes a staged command.

Example request:

DELETE /core/api/v1/commands/c532af8b-ed51-4c99-be23-9849a219a71d/ HTTP/1.1
Host: example.com
Accept: application/json

Example response:

HTTP/1.1 200 OK
Query Parameters:
  • command_uuid (string) – The command UUID

Request Headers:
Status Codes:
POST /core/api/v1/commands/{command_uuid}/commit/

Commit a staged command.

Example request:

POST /core/api/v1/commands/2af6d2b5-1547-4051-b3b5-583f1f4956c6/commit/ HTTP/1.1
Host: example.com
Content-Type: application/json

Example response:

HTTP/1.1 200 OK

{
    "uuid": "2af6d2b5-1547-4051-b3b5-583f1f4956c6",
    "state": "committed",
    "created_at": "2024-01-20T09:59:25.918682Z",
    "updated_at": "2024-01-20T10:00:27.813827Z",
    "schema_key": "plan",
    "patient_key": "3b44f1387e604f86bef4b6ef56a821bd",
    "note_key": "b0a8a25c-f0bd-44a3-ae8b-31eb3e3fafea",
    "originated_by": "4150cd20de8a470aa570a852859ac87e",
    "edited_by": [
        "4150cd20de8a470aa570a852859ac87e"
    ],
    "committed_by": "4150cd20de8a470aa570a852859ac87e",
    "entered_in_error_by": null,
    "data": {
        "narrative": "this is the narrative"
    }
}
Query Parameters:
  • command_uuid (string) – The command UUID

Request Headers:
Response JSON Object:
  • uuid (string) – Command UUID

  • state (string) – State of the command (staged, committed or entered_in_error).

  • created_at (string) – Date when the command was created

  • updated_at (string) – Date when the command was last updated

  • schema_key (string) – Type of the command (plan, hpi, etc.)

  • patient_key (string) – Patient that the command is associated to

  • note_key (string) – Note where the command was inserted in

  • originated_by (string) – Key of the user who created the command

  • edited_by (string) – Key of the user who edited the command

  • committed_by (string) – Key of the user who committed the command

  • entered_in_error_by (string) – Key of the user who entered in error the command

  • data (dict) – Command’s field values

Status Codes:
POST /core/api/v1/commands/{command_uuid}/enter-in-error/

Mark a committed command as entered in error

Example request:

POST /core/api/v1/commands/2af6d2b5-1547-4051-b3b5-583f1f4956c6/enter-in-error/ HTTP/1.1
Host: example.com
Content-Type: application/json

Example response:

HTTP/1.1 200 OK

{
    "uuid": "2af6d2b5-1547-4051-b3b5-583f1f4956c6",
    "state": "entered_in_error",
    "created_at": "2024-01-20T09:59:25.918682Z",
    "updated_at": "2024-01-20T11:00:27.813827Z",
    "schema_key": "plan",
    "patient_key": "3b44f1387e604f86bef4b6ef56a821bd",
    "note_key": "b0a8a25c-f0bd-44a3-ae8b-31eb3e3fafea",
    "originated_by": "4150cd20de8a470aa570a852859ac87e",
    "edited_by": [
        "4150cd20de8a470aa570a852859ac87e"
    ],
    "committed_by": "4150cd20de8a470aa570a852859ac87e",
    "entered_in_error_by": "4150cd20de8a470aa570a852859ac87e",
    "data": {
        "narrative": "this is the narrative"
    }
}
Query Parameters:
  • command_uuid (string) – The command UUID

Request Headers:
Response JSON Object:
  • uuid (string) – Command UUID

  • state (string) – State of the command (staged, committed or entered_in_error).

  • created_at (string) – Date when the command was created

  • updated_at (string) – Date when the command was last updated

  • schema_key (string) – Type of the command (plan, hpi, etc.)

  • patient_key (string) – Patient that the command is associated to

  • note_key (string) – Note where the command was inserted in

  • originated_by (string) – Key of the user who created the command

  • edited_by (string) – Key of the user who edited the command

  • committed_by (string) – Key of the user who committed the command

  • entered_in_error_by (string) – Key of the user who entered in error the command

  • data (dict) – Command’s field values

Status Codes: