diff --git a/care/facility/migrations/0461_remove_patientconsultation_prescriptions_and_more.py b/care/facility/migrations/0461_remove_patientconsultation_prescriptions_and_more.py new file mode 100644 index 0000000000..87faccf001 --- /dev/null +++ b/care/facility/migrations/0461_remove_patientconsultation_prescriptions_and_more.py @@ -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, + ), + ] diff --git a/care/facility/models/daily_round.py b/care/facility/models/daily_round.py index fdb0e71572..6904809f84 100644 --- a/care/facility/models/daily_round.py +++ b/care/facility/models/daily_round.py @@ -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) diff --git a/care/facility/models/patient_consultation.py b/care/facility/models/patient_consultation.py index afea466020..bf241779a0 100644 --- a/care/facility/models/patient_consultation.py +++ b/care/facility/models/patient_consultation.py @@ -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( diff --git a/data/dummy/facility.json b/data/dummy/facility.json index 7314e0d17f..b33eaf7ad8 100644 --- a/data/dummy/facility.json +++ b/data/dummy/facility.json @@ -12,7 +12,14 @@ "verified": false, "facility_type": 2, "kasp_empanelled": false, - "features": [1, 2, 3, 4, 5, 6], + "features": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], "longitude": null, "latitude": null, "pincode": 670000, @@ -49,7 +56,10 @@ "verified": false, "facility_type": 1300, "kasp_empanelled": false, - "features": [1, 6], + "features": [ + 1, + 6 + ], "longitude": null, "latitude": null, "pincode": 670112, @@ -86,7 +96,11 @@ "verified": false, "facility_type": 1500, "kasp_empanelled": false, - "features": [1, 4, 6], + "features": [ + 1, + 4, + 6 + ], "longitude": "78.6757364624373000", "latitude": "21.4009146842158660", "pincode": 670000, @@ -123,7 +137,11 @@ "verified": false, "facility_type": 1510, "kasp_empanelled": false, - "features": [1, 3, 5], + "features": [ + 1, + 3, + 5 + ], "longitude": "75.2139014820876600", "latitude": "18.2774285038890340", "pincode": 670000, @@ -1956,7 +1974,6 @@ "consultation_notes": "Transfer", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2016,7 +2033,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2076,7 +2092,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2136,7 +2151,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2196,7 +2210,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2256,7 +2269,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2316,7 +2328,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2376,7 +2387,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2436,7 +2446,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2496,7 +2505,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2556,7 +2564,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2616,7 +2623,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2676,7 +2682,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2736,7 +2741,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2796,7 +2800,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2856,7 +2859,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2916,7 +2918,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -2976,7 +2977,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -3036,7 +3036,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -3096,7 +3095,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -3156,7 +3154,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -3216,7 +3213,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -3276,7 +3272,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -3336,7 +3331,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -3396,7 +3390,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -3456,7 +3449,6 @@ "consultation_notes": "generalnote", "course_in_facility": null, "investigation": [], - "prescriptions": {}, "procedure": [], "suggestion": "A", "route_to_facility": 10, @@ -3993,8 +3985,14 @@ "default_unit": 1, "description": "", "min_quantity": 150.0, - "allowed_units": [1, 2], - "tags": [1, 2] + "allowed_units": [ + 1, + 2 + ], + "tags": [ + 1, + 2 + ] } }, { @@ -4005,8 +4003,13 @@ "default_unit": 1, "description": "", "min_quantity": 2.0, - "allowed_units": [1, 2], - "tags": [2] + "allowed_units": [ + 1, + 2 + ], + "tags": [ + 2 + ] } }, { @@ -4017,8 +4020,12 @@ "default_unit": 7, "description": "", "min_quantity": 10.0, - "allowed_units": [7], - "tags": [2] + "allowed_units": [ + 7 + ], + "tags": [ + 2 + ] } }, { @@ -4029,7 +4036,9 @@ "default_unit": 4, "description": "", "min_quantity": 100.0, - "allowed_units": [4], + "allowed_units": [ + 4 + ], "tags": [] } }, @@ -4041,7 +4050,9 @@ "default_unit": 4, "description": "", "min_quantity": 100.0, - "allowed_units": [4], + "allowed_units": [ + 4 + ], "tags": [] } }, @@ -4053,7 +4064,9 @@ "default_unit": 4, "description": "", "min_quantity": 100.0, - "allowed_units": [4], + "allowed_units": [ + 4 + ], "tags": [] } }, @@ -4065,8 +4078,12 @@ "default_unit": 7, "description": "", "min_quantity": 10.0, - "allowed_units": [7], - "tags": [2] + "allowed_units": [ + 7 + ], + "tags": [ + 2 + ] } }, {