Skip to content

Commit

Permalink
create hpi command
Browse files Browse the repository at this point in the history
  • Loading branch information
mbiannaccone committed Feb 21, 2024
1 parent 9bd89e9 commit da6b98c
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 8 deletions.
17 changes: 12 additions & 5 deletions canvas_sdk/commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
from canvas_sdk.commands.assess.assess import AssessCommand
from canvas_sdk.commands.diagnose.diagnose import DiagnoseCommand
from canvas_sdk.commands.goal.goal import GoalCommand
from canvas_sdk.commands.plan.plan import PlanCommand
from canvas_sdk.commands.assess import AssessCommand
from canvas_sdk.commands.diagnose import DiagnoseCommand
from canvas_sdk.commands.goal import GoalCommand
from canvas_sdk.commands.history_present_illness import HistoryOfPresentIllnessCommand
from canvas_sdk.commands.plan import PlanCommand

__all__ = ("PlanCommand", "AssessCommand", "DiagnoseCommand", "GoalCommand")
__all__ = (
"PlanCommand",
"AssessCommand",
"DiagnoseCommand",
"GoalCommand",
"HistoryOfPresentIllnessCommand",
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions canvas_sdk/commands/history_present_illness.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from canvas_sdk.commands.base import _BaseCommand


class HistoryOfPresentIllnessCommand(_BaseCommand):
"""A class for managing a HPI command within a specific note."""

narrative: str

@property
def values(self) -> dict:
"""The HPI command's field values."""
return {"narrative": self.narrative}
File renamed without changes.
33 changes: 30 additions & 3 deletions canvas_sdk/commands/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
import pytest
from pydantic import ValidationError

from canvas_sdk.commands import AssessCommand, DiagnoseCommand, GoalCommand, PlanCommand
from canvas_sdk.commands import (
AssessCommand,
DiagnoseCommand,
GoalCommand,
HistoryOfPresentIllnessCommand,
PlanCommand,
)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -189,10 +195,24 @@
"1 validation error for GoalCommand\nprogress\n Input should be a valid string [type=string_type, input_value=1, input_type=int]",
{"user_id": 5, "goal_statement": "do some stuff!"},
),
(
HistoryOfPresentIllnessCommand,
{"user_id": 5},
"1 validation error for HistoryOfPresentIllnessCommand\nnarrative\n Field required [type=missing, input_value={'user_id': 5}, input_type=dict]",
{"user_id": 1, "narrative": "hiya"},
),
(
HistoryOfPresentIllnessCommand,
{"user_id": 5, "narrative": None},
"1 validation error for HistoryOfPresentIllnessCommand\nnarrative\n Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]",
{"user_id": 1, "narrative": "hiya"},
),
],
)
def test_command_raises_error_when_kwarg_given_incorrect_type(
Command: PlanCommand | AssessCommand | DiagnoseCommand | GoalCommand,
Command: (
PlanCommand | AssessCommand | DiagnoseCommand | GoalCommand | HistoryOfPresentIllnessCommand
),
err_kwargs: dict,
err_msg: str,
valid_kwargs: dict,
Expand Down Expand Up @@ -308,10 +328,17 @@ def test_command_raises_error_when_kwarg_given_incorrect_type(
{"user_id": 1, "goal_statement": "get out there!", "progress": "hi"},
{"user_id": 1, "goal_statement": "get out there!", "progress": None},
),
(
HistoryOfPresentIllnessCommand,
{"user_id": 1, "narrative": "hi!"},
{"user_id": 1, "narrative": "hows your day!"},
),
],
)
def test_command_allows_kwarg_with_correct_type(
Command: PlanCommand | AssessCommand | DiagnoseCommand | GoalCommand,
Command: (
PlanCommand | AssessCommand | DiagnoseCommand | GoalCommand | HistoryOfPresentIllnessCommand
),
test_init_kwarg: dict,
test_updated_value: dict,
) -> None:
Expand Down

0 comments on commit da6b98c

Please sign in to comment.