-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add patient profile section event and effect (#212)
- Loading branch information
Showing
7 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters