Banner Alerts

The Canvas SDK allows you to place Banners on the Canvas UI.

Adding a Banner Alert #

To add a banner alert, import the AddBannerAlert class and create an instance of it.

Attribute TypeDescription
patient_idrequiredStringThe id of the patient the alert should be associated with.
keyrequiredStringAn identifier that categorizes the alert.
narrativerequiredStringThe content of the alert.
placementrequiredlist[Placement]List of areas the alert should show.
intentoptionalIntentAffects the styling of the alert.
hrefoptionalStringIf given, the alert will appear as a link to this URL.
from canvas_sdk.effects.banner_alert import AddBannerAlert

banner_alert = AddBannerAlert(
    patient_id="d4c933fe8f6948f6a7d2a42a2641b13b",
    key='test-alert',
    narrative='This is only a test.',
    placement=[
        AddBannerAlert.Placement.CHART,
        AddBannerAlert.Placement.APPOINTMENT_CARD,
        AddBannerAlert.Placement.SCHEDULING_CARD,
    ],
    intent=AddBannerAlert.Intent.INFO,
    href="https://docs.canvasmedical.com",
)

banner_alert.apply()

Placement #

This determines where the banner alert appears.

Placement.CHART #

This will place the banner under the patient’s name on their chart

Placement.TIMELINE #

This will place the banner on the top of the patient’s timeline of notes in their chart

Placement.APPOINTMENT_CARD #

This will appear when you click an appointment on the calendar view

Placement.SCHEDULING_CARD #

This will appear when you select a patient during the scheduling of an appointment on the calendar view

Placement.PROFILE #

This will place the banner under the patient’s name on their patient registration page

Intent #

The type or severity of an alert. This will change the appearance of the banner alert.

Intent.INFO #

Intent.WARNING #

Intent.ALERT #

Removing a Banner Alert #

Removing a banner alert is done wih the RemoveBannerAlert class. Create an instance of the class, identifying the key of the alert and the patient id. Return the Effect by calling the .apply() method. Both the key and patient_id attributes are required.

from canvas_sdk.effects.banner_alert import RemoveBannerAlert

banner_alert = RemoveBannerAlert(
    key='test-alert',
    patient_id="d4c933fe8f6948f6a7d2a42a2641b13b",
)

banner_alert.apply()