Skip to content

Commit

Permalink
feat: add patient profile section event and effect (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmpsilva authored Dec 10, 2024
1 parent f9c41b8 commit f784d8f
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 6 deletions.
4 changes: 2 additions & 2 deletions canvas_generated/messages/effects_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions canvas_generated/messages/effects_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class EffectType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
ANNOTATE_PATIENT_CHART_CONDITION_RESULTS: _ClassVar[EffectType]
ANNOTATE_CLAIM_CONDITION_RESULTS: _ClassVar[EffectType]
SHOW_PATIENT_CHART_SUMMARY_SECTIONS: _ClassVar[EffectType]
SHOW_PATIENT_PROFILE_SECTIONS: _ClassVar[EffectType]
PATIENT_PROFILE__ADD_PHARMACY__POST_SEARCH_RESULTS: _ClassVar[EffectType]
UNKNOWN_EFFECT: EffectType
LOG: EffectType
Expand Down Expand Up @@ -274,6 +275,7 @@ ENTER_IN_ERROR_CLOSE_GOAL_COMMAND: EffectType
ANNOTATE_PATIENT_CHART_CONDITION_RESULTS: EffectType
ANNOTATE_CLAIM_CONDITION_RESULTS: EffectType
SHOW_PATIENT_CHART_SUMMARY_SECTIONS: EffectType
SHOW_PATIENT_PROFILE_SECTIONS: EffectType
PATIENT_PROFILE__ADD_PHARMACY__POST_SEARCH_RESULTS: EffectType

class Effect(_message.Message):
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 @@ -649,6 +649,7 @@ class EventType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
DEFER_CODING_GAP_COMMAND__POST_INSERTED_INTO_NOTE: _ClassVar[EventType]
PATIENT_CHART__CONDITIONS: _ClassVar[EventType]
PATIENT_CHART_SUMMARY__SECTION_CONFIGURATION: _ClassVar[EventType]
PATIENT_PROFILE__SECTION_CONFIGURATION: _ClassVar[EventType]
PATIENT_PROFILE__ADD_PHARMACY__POST_SEARCH: _ClassVar[EventType]
CLAIM__CONDITIONS: _ClassVar[EventType]
PLUGIN_CREATED: _ClassVar[EventType]
Expand Down Expand Up @@ -1293,6 +1294,7 @@ DEFER_CODING_GAP_COMMAND__POST_EXECUTE_ACTION: EventType
DEFER_CODING_GAP_COMMAND__POST_INSERTED_INTO_NOTE: EventType
PATIENT_CHART__CONDITIONS: EventType
PATIENT_CHART_SUMMARY__SECTION_CONFIGURATION: EventType
PATIENT_PROFILE__SECTION_CONFIGURATION: EventType
PATIENT_PROFILE__ADD_PHARMACY__POST_SEARCH: EventType
CLAIM__CONDITIONS: EventType
PLUGIN_CREATED: EventType
Expand Down
42 changes: 42 additions & 0 deletions canvas_sdk/effects/patient_profile_configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from enum import Enum
from typing import Any, TypedDict

from pydantic import Field

from canvas_sdk.effects.base import EffectType, _BaseEffect


class PatientProfileConfiguration(_BaseEffect):
"""
An Effect that will decide which sections appear, and if they start expanded, on the patient's profile in Canvas.
"""

class Meta:
effect_type = EffectType.SHOW_PATIENT_PROFILE_SECTIONS

class Section(Enum):
DEMOGRAPHICS = "demographics"
PREFERENCES = "preferences"
PREFERRED_PHARMACIES = "preferred_pharmacies"
PATIENT_CONSENTS = "patient_consents"
CARE_TEAM = "care_team"
PARENT_GUARDIAN = "parent_guardian"
ADDRESSES = "addresses"
TELECOM = "telecom"
CONTACTS = "contacts"

class Payload(TypedDict):
type: "PatientProfileConfiguration.Section"
start_expanded: bool

sections: list[Payload] = Field(min_length=1)

@property
def values(self) -> dict[str, Any]:
"""The PatientProfileConfiguration's values."""
return {"sections": [{**s, "type": s["type"].value} for s in self.sections]}

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

SHOW_PATIENT_CHART_SUMMARY_SECTIONS = 400;

PATIENT_PROFILE__ADD_PHARMACY__POST_SEARCH_RESULTS = 500;
SHOW_PATIENT_PROFILE_SECTIONS = 500;

PATIENT_PROFILE__ADD_PHARMACY__POST_SEARCH_RESULTS = 501;
}

message Effect {
Expand Down
4 changes: 3 additions & 1 deletion protobufs/canvas_generated/messages/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,9 @@ enum EventType {
PATIENT_CHART__CONDITIONS = 100000;
PATIENT_CHART_SUMMARY__SECTION_CONFIGURATION = 100001;

PATIENT_PROFILE__ADD_PHARMACY__POST_SEARCH = 100002;
PATIENT_PROFILE__SECTION_CONFIGURATION = 100002;
PATIENT_PROFILE__ADD_PHARMACY__POST_SEARCH = 100003;


CLAIM__CONDITIONS = 101000;

Expand Down

0 comments on commit f784d8f

Please sign in to comment.