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

Switch investigation default from dict to list and remove deprecated prescriptions #2410

Merged
merged 10 commits into from
Sep 21, 2024
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", "0453_merge_20240824_2040"),
]

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 @@ -149,7 +149,6 @@ class InsulinIntakeFrequencyType(enum.Enum):
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
52 changes: 22 additions & 30 deletions data/dummy/facility.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -49,7 +56,10 @@
"verified": false,
"facility_type": 1300,
"kasp_empanelled": false,
"features": [1,6],
"features": [
1,
6
],
"longitude": null,
"latitude": null,
"pincode": 670112,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1956,7 +1974,6 @@
"consultation_notes": "Transfer",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2016,7 +2033,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2076,7 +2092,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2136,7 +2151,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2196,7 +2210,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2256,7 +2269,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2316,7 +2328,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2376,7 +2387,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2436,7 +2446,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2496,7 +2505,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2556,7 +2564,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2616,7 +2623,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2676,7 +2682,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2736,7 +2741,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2796,7 +2800,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2856,7 +2859,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2916,7 +2918,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -2976,7 +2977,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -3036,7 +3036,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -3096,7 +3095,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -3156,7 +3154,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -3216,7 +3213,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -3276,7 +3272,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -3336,7 +3331,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -3396,7 +3390,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down Expand Up @@ -3456,7 +3449,6 @@
"consultation_notes": "generalnote",
"course_in_facility": null,
"investigation": [],
"prescriptions": {},
"procedure": [],
"suggestion": "A",
"route_to_facility": 10,
Expand Down