Commands

The commands module lets you create and update commands within a specific note in Canvas. Commands are the building blocks of many end-user workflows in Canvas, including nearly all clinical workflows for documentation, like HPIs and questionnaires, as well as orders like prescriptions, labs, and referrals. Each Command class can be instantiated in your plugin and used to build a new command instance within a specific note or update an existing instance. The commands are then displayed in real time within the end user’s workflow.

Common objectives that can be met by using Command classes include dynamic note templates, clinical decision support, order set composition, care gap closure, and care coordination automation.

Common Attributes #

Parameters #

All commands share the following init kwarg parameters:

NameTypeRequiredDescription
note_uuidstringtrue if creating a new commandThe externally exposable id of the note in which to insert the command.
command_uuidstringtrue if updating an existing commandThe externally exposable id of the command which is being referenced.

All parameters can be set upon initialization, and also updated on the class instance.

Methods #

All commands have the following methods:

originate #

Returns an Effect that originates a new command in the note body.

edit #

Returns an Effect that edits an existing command with the values set on the command class instance.

delete #

Returns an Effect that deletes an existing, non-committed command from the note body.

commit #

Returns an Effect that commits an existing, non-committed command to the note body.

enter_in_error #

Returns an effect that enter-in-errors an existing, committed command in the note body.

Example:

from canvas_sdk.commands import PlanCommand

def compute():

    existing_plan = PlanCommand(command_uuid='63hdik', narrative='something new')
    new_plan = PlanCommand(note_uuid='rk786p', narrative='new')
    new_plan.narrative = 'newer'

    return [existing_plan.edit(), new_plan.originate()]

Command-specific details for each command class can be found below.

AdjustPrescription #

Command-specific parameters:

NameTypeRequiredDescription
new_fdb_codestringtrueThe FDB code for the new medication.

Check the Prescribe command for the other parameters used in the Refill command.

from canvas_sdk.commands import AdjustPrescriptionCommand, PrescribeCommand
from canvas_sdk.commands.constants import ClinicalQuantity

AdjustPrescriptionCommand(
    fdb_code="172480",
    new_fdb_code="216092",
    icd10_codes=["R51"],
    sig="Take one tablet daily after meals",
    days_supply=30,
    quantity_to_dispense=30,
    type_to_dispense=ClinicalQuantity(
        representative_ndc="12843016128",
        ncpdp_quantity_qualifier_code="C48542"
    ),
    refills=3,
    substitutions=PrescribeCommand.Substitutions.ALLOWED,
    pharmacy="Main Street Pharmacy",
    prescriber_id="provider_123",
    note_to_pharmacist="Please verify patient's insurance before processing."
)

Allergy #

Command-specific parameters:

NameTypeRequiredDescription
allergyAllergenfalseRepresents the allergen. See details in the Allergen type below.
severitySeverity enumfalseThe severity of the allergic reaction. Must be one of AllergyCommand.Severity.
narrativestringfalseA narrative or free-text description of the allergy.
approximate_datedatetimefalseThe approximate date the allergy was identified.

Enums and Types:

Allergen

AttributeTypeDescription
concept_idintegerThe identifier for the allergen concept.
concept_typeAllergenType enumThe type of allergen. See AllergenType values below.
AllergenTypeDescription
ALLERGEN_GROUPRepresents a group of allergens.
MEDICATIONRepresents a medication allergen.
INGREDIENTRepresents an ingredient allergen.
SeverityDescription
MILDIndicates a mild reaction.
MODERATEIndicates a moderate reaction.
SEVEREIndicates a severe reaction.

Example:

from canvas_sdk.commands import AllergyCommand, AllergenType, Allergen
from datetime import date

allergy = AllergyCommand(
    note_uuid="rk786p",
    allergy=Allergen(concept_id=12345, concept_type=AllergenType.MEDICATION),
    severity=AllergyCommand.Severity.SEVERE,
    narrative="Severe rash and difficulty breathing after penicillin.",
    approximate_date=date(2023, 6, 15)
)

Assess #

Command-specific parameters:

NameTypeRequiredDescription
condition_idstringtrueThe externally exposable id of the condition being assessed.
backgroundstringfalseBackground information about the diagnosis.
statusStatus enumfalseThe current status of the diagnosis. Must be one of AssessCommand.Status
narrativestringfalseThe narrative for the current assessment.
StatusValue
IMPROVED“improved”
STABLE“stable”
DETERIORATED“deteriorated”

Example:

from canvas_sdk.commands import AssessCommand

assess = AssessCommand(
    note_uuid='rk786p',
    condition_id='hu38rlo',
    background='started in 2012',
    status=AssessCommand.Status.STABLE,
    narrative='experiencing more pain lately'
)

CloseGoal #

Command-specific parameters:

NameTypeRequiredDescription
goal_idinttrueThe externally exposable ID of the goal being closed.
achievement_statusAchievementStatus enumfalseThe final achievement status of the goal. Must be one of GoalCommand.AchievementStatus.
progressstringfalseA narrative about the patient’s progress toward the goal.

Example:

from canvas_sdk.commands import CloseGoalCommand, GoalCommand

close_goal = CloseGoalCommand(
    note_uuid="rk786p",
    goal_id=12345,
    achievement_status=GoalCommand.AchievementStatus.ACHIEVED,
    progress="Patient has achieved the target weight goal of 150 lbs."
)

FamilyHistory #

Command-specific parameters:

NameTypeRequiredDescription
family_historystringtrueA description of the family history being documented.
relativestringfalseA description of the relative (e.g., mother, uncle).
notestringfalseAdditional notes or context about the family history.

Example:

from canvas_sdk.commands import FamilyHistoryCommand

family_history = FamilyHistoryCommand(
    note_uuid="rk786p",
    family_history="Diabetes Type 2",
    relative="Mother",
    note="Diagnosed at age 45"
)

FollowUp #

Command-specific parameters:

NameTypeRequiredDescription
structuredbooleanfalseWhether the RFV is structured or not. Defaults to False.
requested_datedatefalseThe desired follow up date.
note_type_idUUID (str)falseThe desired type of appointment.
codingCoding or UUID (str)true if structured=TrueThe coding for the structured RFV. Either a full Coding object (with code, system, display) or a UUID string referencing a verified coding record. If a Coding is provided, it is validated against existing records
commentstringfalseAdditional commentary on the RFV.

Example:

from canvas_sdk.commands import FollowUpCommand
from datetime import date

structured = FollowUpCommand(
  note_uuid='rk786p',
  structured=True,
  requested_date=date(2025, 3, 2),
  note_type_id="kz986a",
  coding={'code': '', 'system': '', 'display': ''},
  comment='also wants to discuss treatment options'
)

# Example with a UUID string referencing a Coding record
structured2 = FollowUpCommand(
  note_uuid='rk786p',
  structured=True,
  requested_date=date(2025, 3, 2),
  note_type_id="kz986a",
  coding="e2b1e1e3-3f52-4a0a-bb3a-123456789abc",  # Must correspond to an existing coding record
  comment="Discuss treatment options"
)

unstructured = FollowUpCommand(
  note_uuid='rk786p',
  requested_date=date(2025, 3, 2),
  note_type_id="kz986a",
  comment='also wants to discuss treatment options'
)


Diagnose #

Command-specific parameters:

NameTypeRequiredDescription
icd10_codestringtrueICD-10 code of the condition being diagnosed.
backgroundstringfalseBackground information about the diagnosis.
approximate_date_of_onsetdatetimefalseThe approximate date the condition began.
today_assessmentstringfalseThe narrative for the initial assessment of the condition.

Example:

from canvas_sdk.commands import DiagnoseCommand
from datetime import datetime

diagnose = DiagnoseCommand(
    note_uuid='rk786p',
    icd10_code='M54.50',
    background='lifted heavy box',
    approximate_date_of_onset=datetime(2012, 1, 1),
    today_assessment='unable to sleep lately'
)

Goal #

Command-specific parameters:

NameTypeRequiredDescription
goal_statementstringtrueDescription of the goal.
start_datedatetimefalseThe date the goal begins.
due_datedatetimefalseThe date the goal is due.
achievement_statusAchievementStatus enumfalseThe current achievement status of the goal.
priorityPriority enumfalseThe priority of the goal.
progressstringfalseA narrative about the patient’s progress toward the goal.
AchievementStatusValue
IN_PROGRESS“in-progress”
IMPROVING“improving”
WORSENING“worsening”
NO_CHANGE“no-change”
ACHIEVED“achieved”
SUSTAINING“sustaining”
NOT_ACHIEVED“not-achieved”
NO_PROGRESS“no-progress”
NOT_ATTAINABLE“not-attainable”
PriorityValue
HIGH“high-priority”
MEDIUM“medium-priority”
LOW“low-priority”

Example:

from canvas_sdk.commands import GoalCommand
from datetime import datetime

goal = GoalCommand(
    note_uuid='rk786p',
    goal_statement='Eat more healthy vegetables.',
    start_date=datetime(2024, 1, 1),
    due_date=datetime(2024, 12, 31),
    achievement_status=GoalCommand.AchievementStatus.IN_PROGRESS,
    priority=GoalCommand.Priority.HIGH,
    progress='patient is frequenting local farmers market to find healthy options'
)

HistoryOfPresentIllness #

Command-specific parameters:

NameTypeRequiredDescription
narrativestringtrueThe narrative of the patient’s history of present illness.

Example:

from canvas_sdk.commands import HistoryOfPresentIllnessCommand

hpi = HistoryOfPresentIllnessCommand(
        note_uuid='rk786p',
        narrative='presents with chronic back pain and headaches'
    )

ImagingOrder #

Command-specific parameters:

NameTypeRequiredDescription
image_codestringtrueCode identifier of the imaging order.
diagnosis_codeslist[string]trueICD-10 Diagnosis codes justifying the imaging order.
priorityPriority enumfalsePriority of the imaging order. Must be one of ImagingOrderCommand.Priority.
additional_detailsstringfalseAdditional details or instructions related to the imaging order.
service_providerServiceProvidertrueService provider of the imaging order.
commentstringfalseAdditional comments.
ordering_provider_keystringtrueThe key for the provider ordering the imaging.
linked_items_urnslist[string]falseList of URNs for items linked to the imaging order command.

Enums and Types:

Priority

PriorityDescription
ROUTINEIndicates a routine order.
URGENTIndicates un urgent order.

ServiceProvider:

Represents the detailed information of the service provider.

Field NameTypeDescription
first_namestringService provider’s first name (max length 512)
last_namestringService provider’s last name (max length 512)
specialtystringProvider’s specialty (max length 512)
practice_namestringName of the practice (max length 512)
business_faxOptional[string]Business fax number (optional, max length 512)
business_phoneOptional[string]Business phone number (optional, max length 512)
business_addressOptional[string]Business address (optional, max length 512)
notesOptional[string]Additional notes (optional, max length 512)

Example:

from canvas_sdk.commands import ImagingOrderCommand
from canvas_sdk.commands.constants import ServiceProvider

imaging_order = ImagingOrderCommand(
    note_uuid="rk786p",
    image_code="G0204",
    diagnosis_codes=["E119"],
    priority=ImagingOrderCommand.Priority.ROUTINE,
    comment="this is a comment",
    additional_details="more details",
    ordering_provider_key="pk3920p",
    service_provider=ServiceProvider(
      first_name="Clinic",
      last_name="Imaging",
      practice_name="Clinic Imaging",
      specialty="radiology",
      business_address="Street Address",
      business_phone="1234569874",
      business_fax="1234569874"
 ),
)

Instruct #

Command-specific parameters:

NameTypeRequiredDescription
codingCodingtrueThe SNOMED code or UNSTRUCTURED code that represents the instruction.
commentstringfalseAdditional comments related to the instruction.

Example:

from canvas_sdk.commands import InstructCommand
from canvas_sdk.commands.constants import CodeSystems, Coding

# SNOMED code
InstructCommand(
    note_uuid='rk786p',
    coding=Coding(system=CodeSystems.SNOMED, code="65921008"),
    comment="To address mild dehydration symptoms"
)

# UNSTRUCTURED code
InstructCommand(
    note_uuid='rk786p',
    coding=Coding(system=CodeSystems.UNSTRUCTURED, code="Physical medicine neuromuscular training"),
)

LabOrder #

The LabOrderCommand is used to initiate a lab order through the Canvas system. This command requires detailed information about the lab partner, the tests being ordered, and the provider placing the order. Built-in validations ensure that:

  • The specified lab partner exists (whether provided by name or ID).
  • The ordered tests are available for the chosen lab partner.

Command-specific parameters:

NameTypeRequiredDescription
lab_partnerstringtrueThe lab partner processing the order. Accepts either the lab partner’s name or its unique identifier (ID).
tests_order_codeslist[string]trueA list of codes or IDs for the tests being ordered. The system verifies that each provided value corresponds to an available test for the specified lab partner.
ordering_provider_keystringfalseThe key for the provider ordering the tests.
diagnosis_codeslist[string]falseICD-10 Diagnosis codes justifying the lab order.
fasting_requiredbooleanfalseIndicates if fasting is required for the tests.
commentstringfalseAdditional comments related to the lab order.

Validations #

  • Lab Partner Validation: The system checks that the provided lab_partner (by name or ID) exists in the system. If no matching lab partner is found, a validation error is raised.

  • Tests Order Codes Validation: Each test code or ID in tests_order_codes is verified against the tests available for the specified lab partner. If one or more tests cannot be found, the error will indicate which codes or IDs are missing.

Example:

from canvas_sdk.commands import LabOrderCommand
from canvas_sdk.v1.data.lab import LabPartner, LabPartnerTest

partner = LabPartner.objects.first()
tests = [test.order_code for test in LabPartnerTest.objects.filter(lab_partner=partner)]

LabOrderCommand(
  lab_partner=str(partner.id),
  tests_order_codes=tests,
  ordering_provider_key="provider_key_123",
  diagnosis_codes=["E119"],
  fasting_required=True,
  comment="Patient should fast for 8 hours before the test."
)

MedicalHistory #

Command-specific parameters:

NameTypeRequiredDescription
past_medical_historystringtrueA description of the past medical condition or history.
approximate_start_datedatefalseApproximate start date of the condition.
approximate_end_datedatefalseApproximate end date of the condition.
show_on_condition_listbooleanfalseWhether the condition should appear on the condition list.
commentsstringfalseAdditional comments (max length: 1000 characters).

Example:

from canvas_sdk.commands import MedicalHistoryCommand
from datetime import date

MedicalHistoryCommand(
    past_medical_history="Resistant Hypertension",
    approximate_start_date=date(2015, 1, 1),
    show_on_condition_list=True,
    comments="Controlled with medication."
)

MedicationStatement #

Command-specific parameters:

NameTypeRequiredDescription
fdb_codestringtrueThe fdb code of the medication.
sigstringfalseAdministration details of the medication.

Example:

from canvas_sdk.commands import MedicationStatementCommand

medication_statement = MedicationStatementCommand(
    note_uuid='rk786p',
    fdb_code='198698',
    sig='two pills taken orally'
)

SurgicalHistory #

Command-specific parameters:

NameTypeRequiredDescription
past_surgical_historystringtrueA description of the past surgical procedure.
approximate_datedatefalseApproximate date of the surgery.
commentstringfalseAdditional comments (max length: 1000 characters).

Example:

from canvas_sdk.commands import PastSurgicalHistoryCommand
from datetime import date

PastSurgicalHistoryCommand(
    past_surgical_history="Appendectomy",
    approximate_date=date(2008, 6, 15),
    comment="No complications reported."
)

Perform #

Command-specific parameters:

NameTypeRequiredDescription
cpt_codestringtrueThe CPT code of the procedure or action performed.
notesstringfalseAdditional notes related to the performed procedure.

Example:

from canvas_sdk.commands import PerformCommand

PerformCommand(
    cpt_code="99213",
    notes="Patient presented with a common cold."
)

Plan #

Command-specific parameters:

NameTypeRequiredDescription
narrativestringtrueThe narrative of the patient’s plan.

Example:

from canvas_sdk.commands import PlanCommand

plan = PlanCommand(
    note_uuid='rk786p',
    narrative='will return in 2 weeks to check on pain management'
)

Prescribe #

Command-specific parameters:

NameTypeRequiredDescription
fdb_codestringtrueFDB code for the medication.
icd10_codeslist[string]falseList of ICD-10 codes (maximum 2) associated with the prescription.
sigstringtrueAdministration instructions/details of the medication.
days_supplyintegerfalseNumber of days the prescription is intended to cover.
quantity_to_dispenseDecimal | float | integertrueThe amount of medication to dispense.
type_to_dispenseClinicalQuantitytrueInformation about the form or unit of the medication to dispense.
refillsintegertrueNumber of refills allowed for the prescription.
substitutionsSubstitutions EnumtrueSpecifies whether substitutions (e.g., generic drugs) are allowed.
pharmacystringfalseThe NCPDP ID of the pharmacy where the prescription should be sent.
prescriber_idstringtrueThe key of the prescriber.
note_to_pharmaciststringfalseAdditional notes or instructions for the pharmacist.

Enums and Types

SubstitutionsValueDescription
ALLOWED"allowed"Generic or substitute medications are permitted.
NOT_ALLOWED"not_allowed"Only the prescribed brand is allowed.

ClinicalQuantity:

Represents the detailed information about the form or unit of the medication.

Field NameTypeDescription
representative_ndcstringNational Drug Code (NDC) representing the medication.
ncpdp_quantity_qualifier_codestringNCPDP code indicating the quantity qualifier.

Example

from canvas_sdk.commands.constants import ClinicalQuantity
from canvas_sdk.commands import PrescribeCommand

prescription = PrescribeCommand(
    fdb_code="216092",
    icd10_codes=["R51"],
    sig="Take one tablet daily after meals",
    days_supply=30,
    quantity_to_dispense=30,
    type_to_dispense=ClinicalQuantity(
        representative_ndc="12843016128",
        ncpdp_quantity_qualifier_code="C48542"
    ),
    refills=3,
    substitutions=PrescribeCommand.Substitutions.ALLOWED,
    pharmacy="Main Street Pharmacy",
    prescriber_id="provider_123",
    note_to_pharmacist="Please verify patient's insurance before processing."
)

PhysicalExam #

Command-specific parameters:

NameTypeRequiredDescription
questionnaire_idstringtrueThe externally exposable id of the questionnaire being answered by the patient.
resultstringfalseA summary of the result of the patient’s answers.

Example:

from canvas_sdk.commands import PhysicalExamCommand

questionnaire = PhysicalExamCommand(
    note_uuid='rk786p',
    questionnaire_id='g73hd9',
    result='The patient is feeling average today.'
)

Note: The PhysicalExamCommand is a subclass of the QuestionnaireCommand, so it supports all the questionnaire features (including response recording, question mapping, etc.). For detailed information on these features, please refer to the Questionnaire Command Documentation.


Questionnaire #

Overview #

The QuestionnaireCommand is used to present a questionnaire to a patient and commit their responses to an interview. It requires the ID of the questionnaire

In addition to the basic parameters, this command supports a dynamic response interface. Once instantiated, you can retrieve the list of questions via the questions property, and then record responses for each question using the question object’s add_response() method. Each question type enforces its expected response format:

  • Text questions (TYPE_TEXT): Accept a keyword argument text (a string).
  • Integer questions (TYPE_INTEGER): Accept a keyword argument integer (an integer or a value convertible to an integer).
  • Radio questions (TYPE_RADIO): Accept a keyword argument option (a ResponseOption instance); only one option may be selected.
  • Checkbox questions (TYPE_CHECKBOX): Accept a keyword argument option (a ResponseOption instance) along with an optional boolean selected (defaulting to True) and an optional string comment. Multiple responses can be recorded.

Command-specific parameters:

NameTypeRequiredDescription
questionnaire_idstringtrueThe externally exposable id of the questionnaire being answered by the patient.
resultstringfalseA summary of the result of the patient’s answers.

Example:

from canvas_sdk.commands import QuestionnaireCommand

questionnaire = QuestionnaireCommand(
    note_uuid='rk786p',
    questionnaire_id='g73hd9',
    result='The patient is feeling average today.'
)

Usage Example #

Below is an example that demonstrates how to instantiate a QuestionnaireCommand, retrieve the questions, and add responses to them based on their type:

from canvas_sdk.commands.questionnaire import QuestionnaireCommand
from canvas_sdk.commands.questionnaire.question import ResponseOption

q = Questionnaire.objects.filter(name="Exercise").first()
# Create a QuestionnaireCommand instance.
command = QuestionnaireCommand(questionnaire_id=str(q.id))

# Retrieve the list of questions.
questions = command.questions

# Record responses for each question.
for question in questions:
    if question.type == RO.TYPE_TEXT:
        # For text questions, pass a 'text' keyword argument.
        question.add_response(text=f"Thanks for all the fish")
    elif question.type == RO.TYPE_INTEGER:
        # For integer questions, pass an 'integer' keyword argument.
        question.add_response(integer=42)
    elif question.type == RO.TYPE_RADIO:
        # For radio questions, pass an 'option' keyword argument (a ResponseOption instance).
        first_option = question.options[0]
        question.add_response(option=first_option)
    elif question.type == RO.TYPE_CHECKBOX:
        # For checkbox questions, add responses with option, selected flag, and optionally a comment.
        first_option = question.options[0]
        last_option = question.options[-1]
        question.add_response(option=first_option, selected=True, comment="Don't panic")
        question.add_response(option=last_option, selected=True)

Explanation #

  • Retrieving Questions:
    The questions property returns a list of question objects created from the questionnaire’s data.

  • Recording Responses: Each question object provides an add_response() method that enforces the correct response format:

    • For TextQuestion, you must pass a text parameter.
    • For IntegerQuestion, you must pass an integer parameter.
    • For RadioQuestion, you must pass an option parameter (a ResponseOption instance) that corresponds to one of the allowed options.
    • For CheckboxQuestion, you must pass an option parameter along with an optional selected flag (defaulting to True) and an optional comment. Multiple responses can be recorded for checkbox questions.
    • Note for Checkboxes: Only the responses explicitly provided in the command payload will be updated in the UI. If a checkbox response is already selected and is not sent as unselected in the payload, its state remains unchanged.

ReasonForVisit #

Command-specific parameters:

NameTypeRequiredDescription
structuredbooleanfalseWhether the RFV is structured or not. Defaults to False.
codingCoding or UUID (str)true if structured=TrueThe coding for the structured RFV. Either a full Coding object (with code, system, display) or a UUID string referencing a verified coding record. If a Coding is provided, it is validated against existing records
commentstringfalseAdditional commentary on the RFV.

Example:

from canvas_sdk.commands import ReasonForVisitCommand

structured_rfv = ReasonForVisitCommand(
  note_uuid='rk786p',
  structured=True,
  coding={'code': '', 'system': '', 'display': ''},
  comment='also wants to discuss treatment options'
)

# Example with a UUID string referencing a Coding record
structured_rfv2 = ReasonForVisitCommand(
  note_uuid='rk786p',
  structured=True,
  coding="e2b1e1e3-3f52-4a0a-bb3a-123456789abc",  # Must correspond to an existing coding record
  comment="Discuss treatment options"
)

unstructured_rfv = ReasonForVisitCommand(
  note_uuid='rk786p',
  comment='also wants to discuss treatment options'
)

Refer #

Command-specific parameters:

NameTypeRequiredDescription
service_providerServiceProvidertrueThe service provider associated with the referral command.
diagnosis_codeslist[string]trueA list of relevant ICD-10 Diagnosis.
clinical_questionClinicalQuestion enumtrueThe clinical question prompting the referral. Must be one of ReferCommand.ClinicalQuestion
priorityPriority enumfalsePriority of the imaging order. Must be one of ReferCommand.Priority.
notes_to_specialiststringtrueNotes or additional information directed to the specialist.
include_visit_notebooleanfalseFlag indicating whether the visit note should be included in the referral.
commentstringfalseAn optional comment providing further details about the referral.
linked_items_urnslist[string]falseList of URNs for items linked to the referral command.

Enums and Types:

Priority

PriorityDescription
ROUTINEIndicates a routine order.
URGENTIndicates un urgent order.

ClinicalQuestion

Clinical QuestionDescription
COGNITIVE_ASSISTANCECognitive Assistance (Advice/Guidance)
ASSISTANCE_WITH_ONGOING_MANAGEMENTAssistance with Ongoing Management
SPECIALIZED_INTERVENTIONSpecialized intervention
DIAGNOSTIC_UNCERTAINTYDiagnostic Uncertainty

ServiceProvider:

Represents the detailed information of the service provider.

Field NameTypeDescription
first_namestringService provider’s first name (max length 512)
last_namestringService provider’s last name (max length 512)
specialtystringProvider’s specialty (max length 512)
practice_namestringName of the practice (max length 512)
business_faxOptional[string]Business fax number (optional, max length 512)
business_phoneOptional[string]Business phone number (optional, max length 512)
business_addressOptional[string]Business address (optional, max length 512)
notesOptional[string]Additional notes (optional, max length 512)

Example:

from canvas_sdk.commands import ReferCommand
from canvas_sdk.commands.constants import ServiceProvider

refer_command = ReferCommand(
    note_uuid="rk786p",
    diagnosis_codes=["E119"],
    priority=ReferCommand.Priority.ROUTINE,
    clinical_question=ReferCommand.ClinicalQuestion.DIAGNOSTIC_UNCERTAINTY,
    comment="this is a comment",
    notes_to_specialist="This is a note to specialist",
    include_visit_note=True,
    service_provider=ServiceProvider(
      first_name="Clinic",
      last_name="Acupuncture",
      practice_name="Clinic Acupuncture",
      specialty="Acupuncture",
      business_address="Street Address",
      business_phone="1234569874",
      business_fax="1234569874"
 ),
)

Refill #

Command-specific parameters:

Check the Prescribe command for the parameters used in the Refill command.

Example:

from canvas_sdk.commands import RefillCommand, PrescribeCommand
from canvas_sdk.commands.constants import ClinicalQuantity

RefillCommand(
    fdb_code="216092",
    icd10_codes=["R51"],
    sig="Take one tablet daily after meals",
    days_supply=30,
    quantity_to_dispense=30,
    type_to_dispense=ClinicalQuantity(
        representative_ndc="12843016128",
        ncpdp_quantity_qualifier_code="C48542"
    ),
    refills=3,
    substitutions=PrescribeCommand.Substitutions.ALLOWED,
    pharmacy="Main Street Pharmacy",
    prescriber_id="provider_123",
    note_to_pharmacist="Please verify patient's insurance before processing."
)

RemoveAllergy #

Command-specific parameters:

NameTypeRequiredDescription
allergy_idstringtrueThe external ID of the allergy to remove.
narrativestringfalseAdditional context or narrative for the removal.

Example:

from canvas_sdk.commands import RemoveAllergyCommand

RemoveAllergyCommand(
    allergy_id="123",
    narrative="Allergy no longer applies after reassessment."
)

Resolve Condition #

Command-specific parameters:

NameTypeRequiredDescription
condition_idstringtrueThe externally exposable id of the condition being resolved.
show_in_condition_listbooleanfalseDetermines whether the condition remains visible in patient chart summary.
rationalestringfalseAdditional context.
from canvas_sdk.commands.commands import ResolveConditionCommand
from canvas_sdk.v1.data import Condition

patient_condition = Condition.objects.for_patient(self.event.context["patient"]["id"]).committed().active().first()

ResolveConditionCommand(
   condition_id=patient_condition.id,
   show_in_condition_list=True,
   rationale="Additional notes.",
   note_uuid="rk786p",
)

Review of Systems #

Command-specific parameters:

NameTypeRequiredDescription
questionnaire_idstringtrueThe externally exposable id of the questionnaire being answered by the patient.
resultstringfalseA summary of the result of the patient’s answers.

Example:

from canvas_sdk.commands import ReviewOfSystemsCommand

questionnaire = ReviewOfSystemsCommand(
    note_uuid='rk786p',
    questionnaire_id='g73hd9',
    result='The patient is feeling average today.'
)

Note: The ReviewOfSystemsCommand is a subclass of the QuestionnaireCommand, so it supports all the questionnaire features (including response recording, question mapping, etc.). For detailed information on these features, please refer to the Questionnaire Command Documentation.


StopMedication #

Command-specific parameters:

NameTypeRequiredDescription
medication_idstringtrueExternally exposable id of the patient’s medication being stopped.
rationalestringfalseThe reason for stopping the medication.

Example:

from canvas_sdk.commands import StopMedicationCommand

stop_medication = StopMedicationCommand(
    note_uuid='rk786p',
    medication_id='2u309j',
    rationale='In remission'
)

StructuredAssessment #

Command-specific parameters:

NameTypeRequiredDescription
questionnaire_idstringtrueThe externally exposable id of the questionnaire being answered by the patient.
resultstringfalseA summary of the result of the patient’s answers.

Example:

from canvas_sdk.commands import StructuredAssessmentCommand

questionnaire = StructuredAssessmentCommand(
    note_uuid='rk786p',
    questionnaire_id='g73hd9',
    result='The patient is feeling average today.'
)

Note: The StructuredAssessmentCommand is a subclass of the QuestionnaireCommand, so it supports all the questionnaire features (including response recording, question mapping, etc.). For detailed information on these features, please refer to the Questionnaire Command Documentation.


Task #

Command-specific parameters:

NameTypeRequiredDescription
titlestringtrueThe title or summary of the task.
assign_toTaskAssignertrueSpecifies the assignee (role, team, or individual).
due_datedatefalseDue date for completing the task.
commentstringfalseAdditional comments or notes about the task.
labelslist[string]falseLabels associated with the task.
linked_items_urnslist[string]falseURNs for items linked to the task.

Enums and Types:

TaskAssigner Type:

KeyTypeRequiredDescription
toAssigneeTypetrueType of assignee (e.g., role, team, etc.).
idintegerfalseIdentifier of the specific assignee.
AssigneeTypeValueDescription
ROLE"role"Task assigned to a specific role.
TEAM"team"Task assigned to a specific team.
UNASSIGNED"unassigned"Task is unassigned.
STAFF"staff"Task assigned to a specific staff member.

Example:

from canvas_sdk.commands import TaskCommand
from canvas_sdk.commands.commands.task import TaskAssigner, AssigneeType
from datetime import date

TaskCommand(
    title="Follow-up appointment scheduling",
    assign_to=TaskAssigner(to=AssigneeType.STAFF, id=123),
    due_date=date(2024, 12, 15),
    comment="Ensure the patient schedules a follow-up within 30 days.",
    labels=["Urgent"],
    linked_items_urns=["urn:task:123", "urn:note:456"]
)

UpdateDiagnosis #

Command-specific parameters:

NameTypeRequiredDescription
condition_codestringtrueThe ICD-10 code of the existing diagnosis to update.
new_condition_codestringtrueThe new condition ICD-10 code to replace the existing diagnosis.
backgroundstringfalseBackground information or notes related to the updated diagnosis.
narrativestringfalseA narrative or explanation about the update.

Example

from canvas_sdk.commands import UpdateDiagnosisCommand

UpdateDiagnosisCommand(
    condition_code="E119",
    new_condition_code="E109",
    background="Patient previously diagnosed with diabetes type 2; now updated to diabetes type 1.",
    narrative="Updating condition based on recent clinical findings."
)

UpdateGoal #

Command-specific parameters:

NameTypeRequiredDescription
goal_idstringtrueExternally exposable id of the goal being updated.
due_datedatetimefalseThe date the goal is due.
achievement_statusAchievementStatus enumfalseThe current achievement status of the goal.
priorityPriority enumfalseThe priority of the goal.
progressstringfalseA narrative about the patient’s progress toward the goal.
AchievementStatus 
IN_PROGRESS“in-progress”
IMPROVING“improving”
WORSENING“worsening”
NO_CHANGE“no-change”
ACHIEVED“achieved”
SUSTAINING“sustaining”
NOT_ACHIEVED“not-achieved”
NO_PROGRESS“no-progress”
NOT_ATTAINABLE“not-attainable”
Priority 
HIGH“high-priority”
MEDIUM“medium-priority”
LOW“low-priority”

Example:

from canvas_sdk.commands import UpdateGoalCommand, GoalCommand
from datetime import datetime

update_goal = UpdateGoalCommand(
    note_uuid='rk786p',
    goal_id='0j9whjjk',
    due_date=datetime(2025, 3, 31),
    achievement_status=GoalCommand.AchievementStatus.WORSENING,
    priority=GoalCommand.Priority.MEDIUM,
    progress='patient has slowed down progress and requesting to move due date out'
)

Vitals #

Command-specific parameters:

NameTypeRequiredDescription
heightintegerfalseHeight in inches.
weight_lbsintegerfalseWeight in pounds.
weight_ozintegerfalseWeight in ounces.
waist_circumferenceintegerfalseWaist circumference in inches.
body_temperatureintegerfalseBody temperature in Fahrenheit.
body_temperature_siteenumfalseSite of body temperature measurement.
blood_pressure_systoleintegerfalseSystolic blood pressure.
blood_pressure_diastoleintegerfalseDiastolic blood pressure.
blood_pressure_position_and_siteenumfalsePosition and site of blood pressure measurement.
pulseintegerfalsePulse rate in beats per minute.
pulse_rhythmenumfalseRhythm of the pulse.
respiration_rateintegerfalseRespiration rate in breaths per minute.
oxygen_saturationintegerfalseOxygen saturation in percentage.
notestringfalseAdditional notes (max length: 150 characters).

Enums and Types:

BodyTemperatureSiteValueDescription
AXILLARY0Measurement taken from the armpit.
ORAL1Measurement taken from the mouth.
RECTAL2Measurement taken from the rectum.
TEMPORAL3Measurement taken from the forehead.
TYMPANIC4Measurement taken from the ear.
BloodPressureSiteValueDescription
SITTING_RIGHT_UPPER0Sitting position, right upper arm.
SITTING_LEFT_UPPER1Sitting position, left upper arm.
STANDING_RIGHT_UPPER4Standing position, right upper arm.
SUPINE_LEFT_LOWER11Supine position, left lower arm.
PulseRhythmValueDescription
REGULAR0Regular rhythm.
IRREGULARLY_IRREGULAR1Completely irregular rhythm.
REGULARLY_IRREGULAR2Regularly irregular rhythm.

Example:

from canvas_sdk.commands import VitalsCommand

VitalsCommand(
    height=70,
    weight_lbs=150,
    body_temperature=98,
    body_temperature_site=VitalsCommand.BodyTemperatureSite.ORAL,
    blood_pressure_systole=120,
    blood_pressure_diastole=80,
    blood_pressure_position_and_site=VitalsCommand.BloodPressureSite.SITTING_RIGHT_UPPER,
    pulse=72,
    pulse_rhythm=VitalsCommand.PulseRhythm.REGULAR,
    oxygen_saturation=98,
    note="Vitals are within normal range."
)