Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionButton event context contains an integer id rather than a UUID, inconsistent with other areas of the SDK #339

Open
aduane opened this issue Jan 17, 2025 · 0 comments

Comments

@aduane
Copy link
Collaborator

aduane commented Jan 17, 2025

I just made an action button located in the note header. Here is the full code of the handler:

from canvas_sdk.effects import Effect
from canvas_sdk.handlers.action_button import ActionButton
from logger import log

class MyButton(ActionButton):
    BUTTON_TITLE = "Log Stuff"
    BUTTON_KEY = "LOG_STUFF"
    BUTTON_LOCATION = ActionButton.ButtonLocation.NOTE_HEADER

    def handle(self) -> list[Effect]:
        log.info(self.event.context)
        log.info(self.event.target)
        return []

The logs show the following (this is test data):

INFO 2025-01-16 23:59:39,721 {'key': 'LOG_STUFF', 'note_id': 7}
INFO 2025-01-16 23:59:39,721 TargetType(id='5eaddc1d2f41498fb2b5e5313d25590f', type=None)

The event context contains the note id, but it's an integer id, not the note's UUID that I would use with the Note class in the data module.

Additionally, the target is the id of the patient whose chart the note is within. Because the button is located on a specific note, I would expect that note to be the target. The patient's id is useful information, but I would expect to see that as a patient_id value in the context. I feel less strongly about this though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant