Customize Search Results

Canvas’s search functions are typically used dozens of times in a single patient interaction. Navigating through the thousands of options within a drop-down can be a daunting task for a clinician. Keywords and quick-picks can help improve the experience, but their impact is often limited. Our plugins allow you to add your own complex logic to help surface the right options, with the right context, at the right time. We currently support altering our condition search results through the Plugins beta, and will continue to expand this offering throughout the platform.

First time using plugins? Follow our quickstart guide to get started.

What you’ll learn #

In this guide, you will learn how to do the following:

  • Customize Condition Search
  • Customize Medication Search (coming soon)
  • Customize Refer Search (coming soon)

Customize Condition Search #

Your care team may identify ways to make searching easier in Canvas. Plugins can be used to add custom logic, tags, and/or options to the Canvas’s search results. Use the examples below to help you brainstorm with your team how to implement changes that would better support your care model.

  • Replace the results entirely
    • Only surface the 10 diagnoses that are treated based on your diagnostic range
    • Call out to an external API to leverage a different source of data or search tool (i.e IMO)
  • Add Results
    • Add updated descriptions for difficult to find ICD-10 codes
  • Remove Results
    • Remove age specific codes that do not match the patient’s profile
    • Remove codes that are excluded benefits
    • Remove BMI codes that do not match the patient’s vitals
  • Reorder Results
    • Prioritize specific codes over unspecified codes
    • Prioritize risk adjustable codes
    • Highlight suspect diagnoses based on captured clinical data
  • Add Annotations to Result
    • Add warnings for unspecified codes
    • Add warnings for already diagnosed conditions
    • Surface payer specific HCC and risk adjustment data
    • Surface necessary buddy code warnings

Condition search can be modified by intercepting one of two events: PreSearch and PostSearch.

Use PreSearch if you want to entirely bypass the built-in Canvas search function entirely, and supply your own results based on the user query. In this case, you need to add results to the pre search event. They need to be formatted properly, including icd10_code, icd10_text, and preferred_snomed_term so that the application can use them correctly. You can specify the order and add annotations if desired. This could be useful if your care model has a narrow diagnostic range or if you are calling out another tool’s API to return results.

The example below replaces the Canvas condition search results with the six options listed.

from canvas_core import events, logging
from import PreSearch
from import CONDITION_SEARCH, Condition, SearchResult

logger = logging.get_logger(__name__)

@events.handle_event(PreSearch, origin=CONDITION_SEARCH)
def handle_condition_presearch(event: PreSearch[Condition]) -> None:
    """Override the condition search result to return recommended conditions""""Event Interception for Conditions", query=event.query, usage=event.usage)

    if event.usage != 'command.diagnose':
        return"Pre-searching for diagnose conditions", query=event.query, usage=event.usage)

    event.results = [
            icd10_text= "Depression, unspecified",
            preferred_snomed_term="Depression, unspecified"
            icd10_text='Anxiety disorder, unspecified',
            preferred_snomed_term='Anxiety disorder, unspecified'
            icd10_text='Bipolar disorder, unspecified',
            preferred_snomed_term='Bipolar disorder, unspecified'
            icd10_text= "Unspecified dementia with behavioral disturbance",
            preferred_snomed_term="Unspecified dementia with behavioral disturbance"
            icd10_text='Post-traumatic stress disorder, acute',
            preferred_snomed_term='Post-traumatic stress disorder, acute'
            icd10_text='Autistic disorder',
            preferred_snomed_term='Autistic disorder'
    ]"Finished results for condition search", query=event.query)

Use PostSearch if you want to start with the results from the built-in Canvas search function and work with those. You can add results, remove results, reorder results, or annotate results.

The example below adds HCC weight information to the search results for the specified ICD10 codes.

from canvas_core import events, logging
from import events as search_events
from import results

logger = logging.get_logger(__name__)

HCC_WEIGHTS: dict[str, str] = {
    "I110": "HCC 85, weight 0.42",
    "T8621": "HCC 186, weight 1.0",
    "T8622": "HCC 186, weight 1.0",
    "I501": "HCC 85, weight 0.42",
    "I5020": "HCC 85, weight 0.42",
    "I5021": "HCC 85, weight 0.42",
    "I5022": "HCC 85, weight 0.42",
    "I5023": "HCC 85, weight 0.42",
    "I5030": "HCC 85, weight 0.42",
    "I5031": "HCC 85, weight 0.42",
    "I5032": "HCC 85, weight 0.42",
    "I5033": "HCC 85, weight 0.42",

def handle_search_pre_search(event: search_events.PreSearch) -> None:
    """Log a message before a search request is executed."""
    logger.debug("Handling pre-search event.", source=event.source, query=event.query)

@events.handle_event(search_events.PostSearch, origin=results.CONDITION_SEARCH)
def handle_search_condition_post_search(event: search_events.PostSearch[results.Condition]) -> None:
    """Annotate condition search results with HCC weights."""
    for condition in event.results:
        if in HCC_WEIGHTS:

        "Handling post-search event.",

Customize Medication Search (coming soon) #

Customize Refer Search (coming soon) #