From fc92338807a58cd656f764c904dc750cdf51afa7 Mon Sep 17 00:00:00 2001 From: Michela Iannaccone Date: Wed, 20 Mar 2024 12:03:10 -0400 Subject: [PATCH 1/2] create prescribe command --- canvas_sdk/commands/__init__.py | 4 +- canvas_sdk/commands/commands/prescribe.py | 48 +++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 canvas_sdk/commands/commands/prescribe.py diff --git a/canvas_sdk/commands/__init__.py b/canvas_sdk/commands/__init__.py index 85ec6573..a69ef64a 100644 --- a/canvas_sdk/commands/__init__.py +++ b/canvas_sdk/commands/__init__.py @@ -6,17 +6,19 @@ ) from canvas_sdk.commands.commands.medication_statement import MedicationStatementCommand from canvas_sdk.commands.commands.plan import PlanCommand +from canvas_sdk.commands.commands.prescribe import PrescribeCommand from canvas_sdk.commands.commands.questionnaire import QuestionnaireCommand from canvas_sdk.commands.commands.reason_for_visit import ReasonForVisitCommand from canvas_sdk.commands.commands.stop_medication import StopMedicationCommand __all__ = ( - "PlanCommand", "AssessCommand", "DiagnoseCommand", "GoalCommand", "HistoryOfPresentIllnessCommand", "MedicationStatementCommand", + "PlanCommand", + "PrescribeCommand", "QuestionnaireCommand", "ReasonForVisitCommand", "StopMedicationCommand", diff --git a/canvas_sdk/commands/commands/prescribe.py b/canvas_sdk/commands/commands/prescribe.py new file mode 100644 index 00000000..d6703600 --- /dev/null +++ b/canvas_sdk/commands/commands/prescribe.py @@ -0,0 +1,48 @@ +from decimal import Decimal +from enum import Enum + +from pydantic import Field + +from canvas_sdk.commands.commands.base import _BaseCommand + + +class PrescribeCommand(_BaseCommand): + """A class for managing a Prescribe command within a specific note.""" + + class Meta: + key = "prescribe" + + class Substitutions(Enum): + ALLOWED = "allowed" + NOT_ALLOWED = "not_allowed" + + fdb_code: str = Field(json_schema_extra={"commands_api_name": "prescribe"}) + icd10_codes: list[str] | None = Field( + None, json_schema_extra={"commandsd_api_name": "indications"} + ) + sig: str + days_supply: int | None = None + quantity_to_dispense: Decimal + type_to_dispense: str + refills: int + substitutions: Substitutions = Substitutions.ALLOWED # type: ignore + pharmacy: str | None = None + prescriber_id: str = Field(json_schema_extra={"commands_api_name": "prescriber"}) + note_to_pharmacist: str | None = None + + @property + def values(self) -> dict: + """The Prescribe command's field values.""" + return { + "fdb_code": self.fdb_code, + "icd10_codes": self.icd10_codes, + "sig": self.sig, + "days_supply": self.days_supply, + "quantity_to_dispense": self.quantity_to_dispense, + "type_to_dispense": self.type_to_dispense, + "refills": self.refills, + "substitutions": self.substitutions, + "pharmacy": self.pharmacy, + "prescriber_id": self.prescriber_id, + "note_to_pharmacist": self.note_to_pharmacist, + } From de06ffc7c29dd8152be3c32d32412b9a32e3c109 Mon Sep 17 00:00:00 2001 From: Michela Iannaccone Date: Wed, 3 Apr 2024 10:42:33 -0400 Subject: [PATCH 2/2] Update canvas_sdk/commands/commands/prescribe.py --- canvas_sdk/commands/commands/prescribe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/canvas_sdk/commands/commands/prescribe.py b/canvas_sdk/commands/commands/prescribe.py index d6703600..566feacb 100644 --- a/canvas_sdk/commands/commands/prescribe.py +++ b/canvas_sdk/commands/commands/prescribe.py @@ -3,7 +3,7 @@ from pydantic import Field -from canvas_sdk.commands.commands.base import _BaseCommand +from canvas_sdk.commands.base import _BaseCommand class PrescribeCommand(_BaseCommand):