Skip to content

Commit

Permalink
feat: events and effects for patient portal intake forms (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmpsilva authored Jan 6, 2025
1 parent 54b8008 commit 4f68da8
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 4 deletions.
4 changes: 2 additions & 2 deletions canvas_generated/messages/effects_pb2.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions canvas_generated/messages/effects_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ class EffectType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
COMMIT_STRUCTURED_ASSESSMENT_COMMAND: _ClassVar[EffectType]
ENTER_IN_ERROR_STRUCTURED_ASSESSMENT_COMMAND: _ClassVar[EffectType]
SHOW_ACTION_BUTTON: _ClassVar[EffectType]
PATIENT_PORTAL__INTAKE_FORM_RESULTS: _ClassVar[EffectType]
UNKNOWN_EFFECT: EffectType
LOG: EffectType
ADD_PLAN_COMMAND: EffectType
Expand Down Expand Up @@ -315,6 +316,7 @@ DELETE_STRUCTURED_ASSESSMENT_COMMAND: EffectType
COMMIT_STRUCTURED_ASSESSMENT_COMMAND: EffectType
ENTER_IN_ERROR_STRUCTURED_ASSESSMENT_COMMAND: EffectType
SHOW_ACTION_BUTTON: EffectType
PATIENT_PORTAL__INTAKE_FORM_RESULTS: EffectType

class Effect(_message.Message):
__slots__ = ("type", "payload", "plugin_name", "classname")
Expand Down
4 changes: 2 additions & 2 deletions canvas_generated/messages/events_pb2.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions canvas_generated/messages/events_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ class EventType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
CLAIM__CONDITIONS: _ClassVar[EventType]
PLUGIN_CREATED: _ClassVar[EventType]
PLUGIN_UPDATED: _ClassVar[EventType]
PATIENT_PORTAL__GET_INTAKE_FORMS: _ClassVar[EventType]
UNKNOWN: EventType
ALLERGY_INTOLERANCE_CREATED: EventType
ALLERGY_INTOLERANCE_UPDATED: EventType
Expand Down Expand Up @@ -1305,6 +1306,7 @@ PATIENT_PROFILE__ADD_PHARMACY__POST_SEARCH: EventType
CLAIM__CONDITIONS: EventType
PLUGIN_CREATED: EventType
PLUGIN_UPDATED: EventType
PATIENT_PORTAL__GET_INTAKE_FORMS: EventType

class Event(_message.Message):
__slots__ = ("type", "target", "context", "target_type")
Expand Down
Empty file.
24 changes: 24 additions & 0 deletions canvas_sdk/effects/patient_portal/intake_form_results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from typing import Any

from pydantic import Field

from canvas_sdk.effects.base import EffectType, _BaseEffect


class IntakeFormResults(_BaseEffect):
"""An Effect that will decide which intake forms (questionnaires) appear on the patient portal."""

class Meta:
effect_type = EffectType.PATIENT_PORTAL__INTAKE_FORM_RESULTS

questionnaire_ids: list = Field(min_length=0)

@property
def values(self) -> dict[str, Any]:
"""The IntakeFormResults's values."""
return {"questionnaire_ids": [str(q) for q in self.questionnaire_ids]}

@property
def effect_payload(self) -> dict[str, Any]:
"""The payload of the effect."""
return {"data": self.values}
1 change: 1 addition & 0 deletions protobufs/canvas_generated/messages/effects.proto
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ enum EffectType {

SHOW_ACTION_BUTTON = 1000;

PATIENT_PORTAL__INTAKE_FORM_RESULTS = 2000;
}

message Effect {
Expand Down
2 changes: 2 additions & 0 deletions protobufs/canvas_generated/messages/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,8 @@ enum EventType {

PLUGIN_CREATED = 102000;
PLUGIN_UPDATED = 102001;

PATIENT_PORTAL__GET_INTAKE_FORMS = 110000;
}

message Event {
Expand Down

0 comments on commit 4f68da8

Please sign in to comment.