From 69b69abefd07c56a8333ade8c167052b6381bd4f Mon Sep 17 00:00:00 2001 From: Aakash Singh Date: Tue, 23 May 2023 16:31:30 +0530 Subject: [PATCH] remove HBA1C field from consultation model Fixes #1200 --- .../0356_remove_patientconsultation_hba1c.py | 17 +++++++++++++++++ care/facility/models/patient_consultation.py | 6 ------ .../commands/populate_investigations.py | 16 +++++++++++----- data/dummy/facility.json | 1 - 4 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 care/facility/migrations/0356_remove_patientconsultation_hba1c.py diff --git a/care/facility/migrations/0356_remove_patientconsultation_hba1c.py b/care/facility/migrations/0356_remove_patientconsultation_hba1c.py new file mode 100644 index 0000000000..4bca6765ee --- /dev/null +++ b/care/facility/migrations/0356_remove_patientconsultation_hba1c.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.11 on 2023-05-23 10:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('facility', '0355_auto_20230512_1122'), + ] + + operations = [ + migrations.RemoveField( + model_name='patientconsultation', + name='HBA1C', + ) + ] diff --git a/care/facility/models/patient_consultation.py b/care/facility/models/patient_consultation.py index aedbe58a65..2bd4cae167 100644 --- a/care/facility/models/patient_consultation.py +++ b/care/facility/models/patient_consultation.py @@ -167,12 +167,6 @@ class PatientConsultation(PatientBaseModel, PatientRelatedPermissionMixin): verbose_name="Patient's Weight in KG", validators=[MinValueValidator(0)], ) - HBA1C = models.FloatField( - default=None, - null=True, - verbose_name="HBA1C parameter for reference to current blood sugar levels", - validators=[MinValueValidator(0)], - ) # ICU Information diff --git a/care/users/management/commands/populate_investigations.py b/care/users/management/commands/populate_investigations.py index 2c27b90eeb..37ab9e77f6 100644 --- a/care/users/management/commands/populate_investigations.py +++ b/care/users/management/commands/populate_investigations.py @@ -1,6 +1,9 @@ from django.core.management import BaseCommand -from care.facility.models.patient_investigation import PatientInvestigation, PatientInvestigationGroup +from care.facility.models.patient_investigation import ( + PatientInvestigation, + PatientInvestigationGroup, +) # TODO Move the Investigations and Investigation Groups into a proper JSON like python dict structure to allow easy updates and additions. investigations = """name unit ideal min max type (Float/String/Choice) choices category_id @@ -62,7 +65,6 @@ GCT mg/dl < 140 mg/dl 0 140 Float 2 GTT mg/dl 140-200 mg/dl 140 200 Float 2 GGT U/L 11-50 U/L 11 50 Float 2 -HbA1C % 4-5.6 % 4 5.6 Float 2 Serum Copper mcg/dl 85-180 mcg/dl 85 180 Float 2 Serum Lead mcg/dl upto 10 mcg/dl 0 10 Float 2 Iron mcg/dl 60-170 mcg/dl 60 170 Float 2 @@ -139,7 +141,7 @@ investigation_groups = """Id Name -1 Haematology +1 Haematology 2 Biochemistry test 3 Urine Test""" @@ -162,9 +164,13 @@ def handle(self, *args, **options): investigation_group_dict = {} for investigation_group in investigation_group_data: current_investigation_group = investigation_group.split("\t") - current_obj = PatientInvestigationGroup.objects.filter(name=current_investigation_group[1]).first() + current_obj = PatientInvestigationGroup.objects.filter( + name=current_investigation_group[1] + ).first() if not current_obj: - current_obj = PatientInvestigationGroup(name=current_investigation_group[1]) + current_obj = PatientInvestigationGroup( + name=current_investigation_group[1] + ) current_obj.save() investigation_group_dict[current_investigation_group[0]] = current_obj investigation_data = investigations.split("\n")[1:] diff --git a/data/dummy/facility.json b/data/dummy/facility.json index 81817caab8..b378864d00 100644 --- a/data/dummy/facility.json +++ b/data/dummy/facility.json @@ -206,7 +206,6 @@ "current_bed": null, "height": 0.0, "weight": 0.0, - "HBA1C": null, "operation": null, "special_instruction": "", "intubation_history": []