Skip to content

Commit

Permalink
Merge pull request #2491 from ohcnetwork/staging
Browse files Browse the repository at this point in the history
  • Loading branch information
gigincg committed Sep 23, 2024
2 parents 9343820 + 1d69bc9 commit 6560998
Show file tree
Hide file tree
Showing 32 changed files with 933 additions and 398 deletions.
1 change: 0 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ django-cors-headers = "==4.3.1"
django-filter = "==24.2"
django-maintenance-mode = "==0.21.1"
django-model-utils = "==4.5.1"
django-multiselectfield = "==0.1.12"
django-queryset-csv = "==1.1.0"
django-ratelimit = "==4.1.0"
django-redis = "==5.4.0"
Expand Down
10 changes: 1 addition & 9 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions care/audit_log/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import List, NamedTuple

from django.conf import settings
from multiselectfield.db.fields import MSFList
from rest_framework.utils.encoders import JSONEncoder


Expand All @@ -15,7 +14,7 @@ def remove_non_member_fields(d: dict):
def instance_finder(v):
return isinstance(
v,
(list, dict, set, MSFList),
(list, dict, set),
)


Expand Down
27 changes: 27 additions & 0 deletions care/facility/api/serializers/daily_round.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import timedelta

from django.db import transaction
from django.utils import timezone
from django.utils.timezone import localtime, now
from rest_framework import serializers
from rest_framework.exceptions import ValidationError
Expand Down Expand Up @@ -40,6 +41,27 @@ class DailyRoundSerializer(serializers.ModelSerializer):

rounds_type = ChoiceField(choices=DailyRound.RoundsTypeChoice, required=True)

# Community Nurse's Log

bowel_issue = ChoiceField(
choices=DailyRound.BowelDifficultyType.choices, required=False
)
bladder_drainage = ChoiceField(
choices=DailyRound.BladderDrainageType.choices, required=False
)
bladder_issue = ChoiceField(
choices=DailyRound.BladderIssueType.choices, required=False
)
urination_frequency = ChoiceField(
choices=DailyRound.UrinationFrequencyType.choices, required=False
)
sleep = ChoiceField(choices=DailyRound.SleepType.choices, required=False)
nutrition_route = ChoiceField(
choices=DailyRound.NutritionRouteType.choices, required=False
)
oral_issue = ChoiceField(choices=DailyRound.OralIssueType.choices, required=False)
appetite = ChoiceField(choices=DailyRound.AppetiteType.choices, required=False)

# Critical Care Components

consciousness_level = ChoiceField(
Expand Down Expand Up @@ -295,3 +317,8 @@ def validate(self, attrs):
validated["bed_id"] = bed_object.id

return validated

def validate_taken_at(self, value):
if value and value > timezone.now():
raise serializers.ValidationError("Cannot create an update in the future")
return value
14 changes: 13 additions & 1 deletion care/facility/api/serializers/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,19 @@


class PatientMetaInfoSerializer(serializers.ModelSerializer):
occupation = ChoiceField(choices=PatientMetaInfo.OccupationChoices, allow_null=True)
occupation = ChoiceField(
choices=PatientMetaInfo.OccupationChoices, allow_null=True, required=False
)
socioeconomic_status = ChoiceField(
choices=PatientMetaInfo.SocioeconomicStatus.choices,
allow_null=True,
required=False,
)
domestic_healthcare_support = ChoiceField(
choices=PatientMetaInfo.DomesticHealthcareSupport.choices,
allow_null=True,
required=False,
)

class Meta:
model = PatientMetaInfo
Expand Down
20 changes: 20 additions & 0 deletions care/facility/management/commands/load_event_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,26 @@ class Command(BaseCommand):
),
},
{"name": "NURSING", "fields": ("nursing",)},
{
"name": "ROUTINE",
"children": (
{"name": "SLEEP_ROUTINE", "fields": ("sleep",)},
{"name": "BOWEL_ROUTINE", "fields": ("bowel_issue",)},
{
"name": "BLADDER_ROUTINE",
"fields": (
"bladder_drainage",
"bladder_issue",
"experiences_dysuria",
"urination_frequency",
),
},
{
"name": "NUTRITION_ROUTINE",
"fields": ("nutrition_route", "oral_issue", "appetite"),
},
),
},
),
},
{
Expand Down
9 changes: 4 additions & 5 deletions care/facility/migrations/0001_initial_squashed.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import django.core.validators
import django.db.models.deletion
import django.utils.timezone
import multiselectfield.db.fields
import simple_history.models
from django.conf import settings
from django.db import migrations, models
Expand Down Expand Up @@ -1039,7 +1038,7 @@ class Migration(migrations.Migration):
("physical_examination_info", models.TextField(blank=True, null=True)),
(
"additional_symptoms",
multiselectfield.db.fields.MultiSelectField(
models.CharField(
blank=True,
choices=[
(1, "ASYMPTOMATIC"),
Expand Down Expand Up @@ -2052,7 +2051,7 @@ class Migration(migrations.Migration):
("kasp_empanelled", models.BooleanField(default=False)),
(
"features",
multiselectfield.db.fields.MultiSelectField(
models.CharField(
blank=True,
choices=[
(1, "CT Scan Facility"),
Expand Down Expand Up @@ -2402,7 +2401,7 @@ class Migration(migrations.Migration):
),
(
"symptoms",
multiselectfield.db.fields.MultiSelectField(
models.CharField(
blank=True,
choices=[
(1, "ASYMPTOMATIC"),
Expand Down Expand Up @@ -4330,7 +4329,7 @@ class Migration(migrations.Migration):
),
(
"symptoms",
multiselectfield.db.fields.MultiSelectField(
models.CharField(
choices=[
(1, "ASYMPTOMATIC"),
(2, "FEVER"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 4.2.5 on 2024-01-08 17:26

import multiselectfield.db.fields
from django.db import migrations
from django.db import migrations, models


class Migration(migrations.Migration):
Expand All @@ -13,7 +12,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="dailyround",
name="additional_symptoms",
field=multiselectfield.db.fields.MultiSelectField(
field=models.CharField(
blank=True,
choices=[
(1, "ASYMPTOMATIC"),
Expand Down Expand Up @@ -58,7 +57,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="patientconsultation",
name="symptoms",
field=multiselectfield.db.fields.MultiSelectField(
field=models.CharField(
blank=True,
choices=[
(1, "ASYMPTOMATIC"),
Expand Down Expand Up @@ -103,7 +102,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="patientteleconsultation",
name="symptoms",
field=multiselectfield.db.fields.MultiSelectField(
field=models.CharField(
choices=[
(1, "ASYMPTOMATIC"),
(2, "FEVER"),
Expand Down
17 changes: 17 additions & 0 deletions care/facility/migrations/0455_remove_facility_old_features.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.15 on 2024-09-11 13:32

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("facility", "0454_remove_historicalpatientregistration_abha_number_and_more"),
]

operations = [
migrations.RemoveField(
model_name="facility",
name="old_features",
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# Generated by Django 4.2.10 on 2024-09-13 07:06

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("facility", "0455_remove_facility_old_features"),
]

operations = [
migrations.AddField(
model_name="dailyround",
name="appetite",
field=models.SmallIntegerField(
blank=True,
choices=[
(1, "INCREASED"),
(2, "SATISFACTORY"),
(3, "REDUCED"),
(4, "NO_TASTE_FOR_FOOD"),
(5, "CANNOT_BE_ASSESSED"),
],
default=None,
null=True,
),
),
migrations.AddField(
model_name="dailyround",
name="bladder_drainage",
field=models.SmallIntegerField(
blank=True,
choices=[
(1, "NORMAL"),
(2, "CONDOM_CATHETER"),
(3, "DIAPER"),
(4, "INTERMITTENT_CATHETER"),
(5, "CONTINUOUS_INDWELLING_CATHETER"),
(6, "CONTINUOUS_SUPRAPUBIC_CATHETER"),
(7, "UROSTOMY"),
],
default=None,
null=True,
),
),
migrations.AddField(
model_name="dailyround",
name="bladder_issue",
field=models.SmallIntegerField(
blank=True,
choices=[
(0, "NO_ISSUES"),
(1, "INCONTINENCE"),
(2, "RETENTION"),
(3, "HESITANCY"),
],
default=None,
null=True,
),
),
migrations.AddField(
model_name="dailyround",
name="bowel_issue",
field=models.SmallIntegerField(
blank=True,
choices=[(0, "NO_DIFFICULTY"), (1, "CONSTIPATION"), (2, "DIARRHOEA")],
default=None,
null=True,
),
),
migrations.AddField(
model_name="dailyround",
name="is_experiencing_dysuria",
field=models.BooleanField(blank=True, default=None, null=True),
),
migrations.AddField(
model_name="dailyround",
name="nutrition_route",
field=models.SmallIntegerField(
blank=True,
choices=[
(1, "ORAL"),
(2, "RYLES_TUBE"),
(3, "GASTROSTOMY_OR_JEJUNOSTOMY"),
(4, "PEG"),
(5, "PARENTERAL_TUBING_FLUID"),
(6, "PARENTERAL_TUBING_TPN"),
],
default=None,
null=True,
),
),
migrations.AddField(
model_name="dailyround",
name="oral_issue",
field=models.SmallIntegerField(
blank=True,
choices=[(0, "NO_ISSUE"), (1, "DYSPHAGIA"), (2, "ODYNOPHAGIA")],
default=None,
null=True,
),
),
migrations.AddField(
model_name="dailyround",
name="sleep",
field=models.SmallIntegerField(
blank=True,
choices=[
(1, "EXCESSIVE"),
(2, "SATISFACTORY"),
(3, "UNSATISFACTORY"),
(4, "NO_SLEEP"),
],
default=None,
null=True,
),
),
migrations.AddField(
model_name="dailyround",
name="urination_frequency",
field=models.SmallIntegerField(
blank=True,
choices=[(1, "NORMAL"), (2, "DECREASED"), (3, "INCREASED")],
default=None,
null=True,
),
),
migrations.AlterField(
model_name="dailyround",
name="rounds_type",
field=models.IntegerField(
choices=[
(0, "NORMAL"),
(30, "COMMUNITY_NURSES_LOG"),
(50, "DOCTORS_LOG"),
(100, "VENTILATOR"),
(200, "ICU"),
(300, "AUTOMATED"),
(400, "TELEMEDICINE"),
],
default=0,
),
),
]
Loading

0 comments on commit 6560998

Please sign in to comment.