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

Add Telemedicine as a rounds type option #1760

Merged
merged 5 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 20 additions & 6 deletions care/facility/api/serializers/daily_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
from care.facility.models.bed import Bed
from care.facility.models.daily_round import DailyRound
from care.facility.models.notification import Notification
from care.facility.models.patient_base import CURRENT_HEALTH_CHOICES, SYMPTOM_CHOICES
from care.facility.models.patient_base import (
CURRENT_HEALTH_CHOICES,
SYMPTOM_CHOICES,
SuggestionChoices,
)
from care.users.api.serializers.user import UserBaseMinimumSerializer
from care.utils.notification_handler import NotificationGenerator
from care.utils.queryset.consultation import get_consultation_queryset
Expand Down Expand Up @@ -180,14 +184,24 @@
# Authorisation Checks End

with transaction.atomic():
consultation = get_object_or_404(
get_consultation_queryset(self.context["request"].user).filter(
id=validated_data["consultation"].id
)
)
if (
validated_data.get("rounds_type")
== DailyRound.RoundsType.TELEMEDICINE.value
and consultation.suggestion != SuggestionChoices.DC
):
raise ValidationError(

Check warning on line 197 in care/facility/api/serializers/daily_round.py

View check run for this annotation

Codecov / codecov/patch

care/facility/api/serializers/daily_round.py#L197

Added line #L197 was not covered by tests
{
"rounds_type": "Telemedicine Rounds are only allowed for Domiciliary Care patients"
}
)
if "clone_last" in validated_data:
should_clone = validated_data.pop("clone_last")
if should_clone:
consultation = get_object_or_404(
get_consultation_queryset(self.context["request"].user).filter(
id=validated_data["consultation"].id
)
)
last_objects = DailyRound.objects.filter(
consultation=consultation
).order_by("-created_date")
Expand Down
26 changes: 26 additions & 0 deletions care/facility/migrations/0403_alter_dailyround_rounds_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.6 on 2023-12-09 10:13

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("facility", "0402_patientconsultation_new_discharge_reason"),
]

operations = [
migrations.AlterField(
model_name="dailyround",
name="rounds_type",
field=models.IntegerField(
choices=[
(0, "NORMAL"),
(100, "VENTILATOR"),
(200, "ICU"),
(300, "AUTOMATED"),
(400, "TELEMEDICINE"),
],
default=0,
),
),
]
1 change: 1 addition & 0 deletions care/facility/models/daily_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class RoundsType(enum.Enum):
VENTILATOR = 100
ICU = 200
AUTOMATED = 300
TELEMEDICINE = 400

RoundsTypeChoice = [(e.value, e.name) for e in RoundsType]
RoundsTypeDict = covert_choice_dict(RoundsTypeChoice)
Expand Down
Loading