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 | Type | Description | |
---|---|---|---|
patient_id | required | String | The id of the patient the alert should be associated with. |
key | required | String | An identifier that categorizes the alert. |
narrative | required | String | The content of the alert. |
placement | required | list[Placement] | List of areas the alert should show. |
intent | optional | Intent | Affects the styling of the alert. |
href | optional | String | If 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()