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

Create Prescribe command class #18

Merged
merged 2 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion canvas_sdk/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
48 changes: 48 additions & 0 deletions canvas_sdk/commands/commands/prescribe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from decimal import Decimal
from enum import Enum

from pydantic import Field

from canvas_sdk.commands.commands.base import _BaseCommand
mbiannaccone marked this conversation as resolved.
Show resolved Hide resolved


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,
}
Loading