Skip to content

Commit

Permalink
Switch investigation default from dict to list and remove depreca…
Browse files Browse the repository at this point in the history
…ted `prescriptions` (#2410)
  • Loading branch information
rithviknishad authored Sep 21, 2024
1 parent 2788679 commit 8513421
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated by Django 4.2.10 on 2024-08-29 16:49

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("facility", "0460_alter_dailyround_bp_alter_dailyround_feeds_and_more"),
]

def forward_investigations_dict_to_array(apps, schema_editor):
PatientConsultation = apps.get_model("facility", "PatientConsultation")
PatientConsultation.objects.filter(investigation={}).update(investigation=[])

operations = [
migrations.RemoveField(
model_name="patientconsultation",
name="prescriptions",
),
migrations.RemoveField(
model_name="dailyround",
name="medication_given",
),
migrations.AlterField(
model_name="patientconsultation",
name="investigation",
field=models.JSONField(default=list),
),
migrations.RunPython(
forward_investigations_dict_to_array,
reverse_code=migrations.RunPython.noop,
),
]
1 change: 0 additions & 1 deletion care/facility/models/daily_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ class InsulinIntakeFrequencyType(models.IntegerChoices):
choices=CATEGORY_CHOICES, max_length=13, blank=False, null=True
)
other_details = models.TextField(null=True, blank=True)
medication_given = JSONField(default=dict) # To be Used Later on

last_updated_by_telemedicine = models.BooleanField(default=False)
created_by_telemedicine = models.BooleanField(default=False)
Expand Down
3 changes: 1 addition & 2 deletions care/facility/models/patient_consultation.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ class PatientConsultation(PatientBaseModel, ConsultationRelatedPermissionMixin):
treatment_plan = models.TextField(null=True, blank=True)
consultation_notes = models.TextField(null=True, blank=True)
course_in_facility = models.TextField(null=True, blank=True)
investigation = JSONField(default=dict)
prescriptions = JSONField(default=dict) # Deprecated
investigation = JSONField(default=list)
procedure = JSONField(default=dict)
suggestion = models.CharField(max_length=4, choices=SUGGESTION_CHOICES)
route_to_facility = models.SmallIntegerField(
Expand Down
Loading

0 comments on commit 8513421

Please sign in to comment.