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

Remove COVID-specific fields from Patient model and serializers #2671

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions care/facility/api/serializers/daily_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from care.facility.models import (
CATEGORY_CHOICES,
COVID_CATEGORY_CHOICES,
PatientRegistration,
)
from care.facility.models.bed import Bed
Expand All @@ -27,9 +26,6 @@

class DailyRoundSerializer(serializers.ModelSerializer):
id = serializers.CharField(source="external_id", read_only=True)
deprecated_covid_category = ChoiceField(
choices=COVID_CATEGORY_CHOICES, required=False
) # Deprecated
patient_category = ChoiceField(choices=CATEGORY_CHOICES, required=False)

action = ChoiceField(
Expand Down
4 changes: 0 additions & 4 deletions care/facility/api/serializers/patient_consultation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from care.facility.api.serializers.facility import FacilityBasicInfoSerializer
from care.facility.models import (
CATEGORY_CHOICES,
COVID_CATEGORY_CHOICES,
Facility,
PatientRegistration,
Prescription,
Expand Down Expand Up @@ -78,9 +77,6 @@ class PatientConsultationSerializer(serializers.ModelSerializer):
source="suggestion",
)

deprecated_covid_category = ChoiceField(
choices=COVID_CATEGORY_CHOICES, required=False
)
category = ChoiceField(choices=CATEGORY_CHOICES, required=True)

referred_to_object = FacilityBasicInfoSerializer(
Expand Down
6 changes: 0 additions & 6 deletions care/facility/api/viewsets/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
from care.facility.api.viewsets.mixins.history import HistoryMixin
from care.facility.models import (
CATEGORY_CHOICES,
COVID_CATEGORY_CHOICES,
DISCHARGE_REASON_CHOICES,
FACILITY_TYPES,
BedTypeChoices,
Expand Down Expand Up @@ -122,10 +121,6 @@ class PatientFilterSet(filters.FilterSet):
age_max = filters.NumberFilter(
field_name="age", lookup_expr="lte", validators=[MinValueValidator(0)]
)
deprecated_covid_category = filters.ChoiceFilter(
field_name=f"{last_consultation_field}__deprecated_covid_category",
choices=COVID_CATEGORY_CHOICES,
)
category = filters.ChoiceFilter(
method="filter_by_category",
choices=CATEGORY_CHOICES,
Expand Down Expand Up @@ -234,7 +229,6 @@ def filter_by_bed_type(self, queryset, name, value):
)

# Vaccination Filters
covin_id = filters.CharFilter(field_name="covin_id", max_length=15)
is_vaccinated = filters.BooleanFilter(field_name="is_vaccinated")
number_of_doses = filters.NumberFilter(
field_name="number_of_doses",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Generated by Django 5.1.3 on 2024-12-21 21:07

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('facility', '0468_alter_facilitypatientstatshistory_unique_together_and_more'),
]

operations = [
migrations.RemoveField(
model_name='dailyround',
name='deprecated_covid_category',
),
migrations.RemoveField(
model_name='historicalpatientregistration',
name='contact_with_confirmed_carrier',
),
migrations.RemoveField(
model_name='historicalpatientregistration',
name='contact_with_suspected_carrier',
),
migrations.RemoveField(
model_name='historicalpatientregistration',
name='covin_id',
),
migrations.RemoveField(
model_name='historicalpatientregistration',
name='date_declared_positive',
),
migrations.RemoveField(
model_name='historicalpatientregistration',
name='estimated_contact_date',
),
migrations.RemoveField(
model_name='historicalpatientregistration',
name='has_SARI',
),
migrations.RemoveField(
model_name='historicalpatientregistration',
name='is_declared_positive',
),
migrations.RemoveField(
model_name='historicalpatientregistration',
name='is_vaccinated',
),
migrations.RemoveField(
model_name='historicalpatientregistration',
name='last_vaccinated_date',
),
migrations.RemoveField(
model_name='patientconsultation',
name='deprecated_covid_category',
),
migrations.RemoveField(
model_name='patientregistration',
name='contact_with_confirmed_carrier',
),
migrations.RemoveField(
model_name='patientregistration',
name='contact_with_suspected_carrier',
),
migrations.RemoveField(
model_name='patientregistration',
name='covin_id',
),
migrations.RemoveField(
model_name='patientregistration',
name='date_declared_positive',
),
migrations.RemoveField(
model_name='patientregistration',
name='estimated_contact_date',
),
migrations.RemoveField(
model_name='patientregistration',
name='has_SARI',
),
migrations.RemoveField(
model_name='patientregistration',
name='is_declared_positive',
),
migrations.RemoveField(
model_name='patientregistration',
name='is_vaccinated',
),
migrations.RemoveField(
model_name='patientregistration',
name='last_vaccinated_date',
),
migrations.AlterField(
model_name='facility',
name='facility_type',
field=models.IntegerField(choices=[(1, 'Educational Inst'), (2, 'Private Hospital'), (3, 'Other'), (4, 'Hostel'), (5, 'Hotel'), (6, 'Lodge'), (7, 'TeleMedicine'), (9, 'Govt Labs'), (10, 'Private Labs'), (800, 'Primary Health Centres'), (802, 'Family Health Centres'), (803, 'Community Health Centres'), (830, 'Taluk Hospitals'), (840, 'Women and Child Health Centres'), (860, 'District Hospitals'), (870, 'Govt Medical College Hospitals'), (900, 'Co-operative hospitals'), (910, 'Autonomous healthcare facility'), (1100, 'First Line Treatment Centre'), (1200, 'Second Line Treatment Center'), (1300, 'Shifting Centre'), (1500, 'Request Approving Center'), (1510, 'Request Fulfilment Center'), (1600, 'District War Room')]),
),
migrations.AlterField(
model_name='historicalpatientregistration',
name='source',
field=models.IntegerField(choices=[(10, 'CARE'), (30, 'STAY')], default=10),
),
migrations.AlterField(
model_name='patientcontactdetails',
name='mode_of_contact',
field=models.IntegerField(choices=[(1, 'TOUCHED_BODY_FLUIDS'), (2, 'DIRECT_PHYSICAL_CONTACT'), (3, 'CLEANED_USED_ITEMS'), (4, 'LIVE_IN_SAME_HOUSEHOLD'), (5, 'CLOSE_CONTACT_WITHOUT_PRECAUTION'), (7, 'HEALTH_CARE_WITH_PPE'), (8, 'SHARED_SAME_SPACE_WITHOUT_HIGH_EXPOSURE'), (9, 'TRAVELLED_TOGETHER_WITHOUT_HIGH_EXPOSURE')]),
),
migrations.AlterField(
model_name='patientregistration',
name='source',
field=models.IntegerField(choices=[(10, 'CARE'), (30, 'STAY')], default=10),
),
migrations.AlterField(
model_name='room',
name='room_type',
field=models.IntegerField(choices=[(0, 'Total'), (2, 'Hostel'), (3, 'Single Room with Attached Bathroom'), (40, 'KASP Beds'), (50, 'KASP ICU beds'), (60, 'KASP Oxygen beds'), (70, 'KASP Ventilator beds'), (1, 'General Bed'), (10, 'ICU'), (20, 'Ventilator'), (150, 'Oxygen beds')]),
),
migrations.AlterField(
model_name='shiftingrequest',
name='assigned_facility_type',
field=models.IntegerField(blank=True, choices=[(1, 'Educational Inst'), (2, 'Private Hospital'), (3, 'Other'), (4, 'Hostel'), (5, 'Hotel'), (6, 'Lodge'), (7, 'TeleMedicine'), (9, 'Govt Labs'), (10, 'Private Labs'), (800, 'Primary Health Centres'), (802, 'Family Health Centres'), (803, 'Community Health Centres'), (830, 'Taluk Hospitals'), (840, 'Women and Child Health Centres'), (860, 'District Hospitals'), (870, 'Govt Medical College Hospitals'), (900, 'Co-operative hospitals'), (910, 'Autonomous healthcare facility'), (1100, 'First Line Treatment Centre'), (1200, 'Second Line Treatment Center'), (1300, 'Shifting Centre'), (1500, 'Request Approving Center'), (1510, 'Request Fulfilment Center'), (1600, 'District War Room')], default=None, null=True),
),
]
8 changes: 0 additions & 8 deletions care/facility/models/daily_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from care.facility.models import (
CATEGORY_CHOICES,
COVID_CATEGORY_CHOICES,
PatientBaseModel,
)
from care.facility.models.bed import AssetBed
Expand Down Expand Up @@ -166,13 +165,6 @@ class InsulinIntakeFrequencyType(models.IntegerChoices):
max_digits=4, decimal_places=2, blank=True, null=True, default=None
) # Deprecated
physical_examination_info = models.TextField(null=True, blank=True)
deprecated_covid_category = models.CharField(
choices=COVID_CATEGORY_CHOICES,
max_length=8,
default=None,
blank=True,
null=True,
) # Deprecated
patient_category = models.CharField(
choices=CATEGORY_CHOICES, max_length=13, blank=False, null=True
)
Expand Down
7 changes: 0 additions & 7 deletions care/facility/models/facility.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
(1, "General Bed"),
(10, "ICU"),
(20, "Ventilator"),
(30, "Covid Beds"),
(100, "Covid Ventilators"),
(110, "Covid ICU"),
(120, "Covid Oxygen beds"),
(150, "Oxygen beds"),
]

Expand Down Expand Up @@ -111,15 +107,12 @@ class FacilityFeature(models.IntegerChoices):
# 950, "Corona Testing Labs" # Change from "Corona Testing Labs" to "Govt Labs"
# Use 10xx for Corona Care Center
# 1000, "Corona Care Centre" # Change from "Corona Care Centre" to "Other"
(1010, "COVID-19 Domiciliary Care Center"),
# Use 11xx for First Line Treatment Centre
(1100, "First Line Treatment Centre"),
# Use 12xx for Second Line Treatment Center
(1200, "Second Line Treatment Center"),
# Use 13xx for Shifting Centers
(1300, "Shifting Centre"),
# Use 14xx for Covid Management Centers.
(1400, "Covid Management Center"),
# Use 15xx for Resource Management Centers.
(1500, "Request Approving Center"),
(1510, "Request Fulfilment Center"),
Expand Down
38 changes: 0 additions & 38 deletions care/facility/models/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class PatientRegistration(PatientBaseModel, PatientPermissionMixin):

class SourceEnum(enum.Enum):
CARE = 10
COVID_TRACKER = 20
STAY = 30

SourceChoices = [(e.value, e.name) for e in SourceEnum]
Expand Down Expand Up @@ -158,14 +157,6 @@ class TestTypeEnum(enum.Enum):
verbose_name="Blood Group of Patient",
)

contact_with_confirmed_carrier = models.BooleanField(
default=False, verbose_name="Confirmed Contact with a Covid19 Carrier"
)
contact_with_suspected_carrier = models.BooleanField(
default=False, verbose_name="Suspected Contact with a Covid19 Carrier"
)
estimated_contact_date = models.DateTimeField(null=True, blank=True)

past_travel = models.BooleanField(
default=False,
verbose_name="Travelled to Any Foreign Countries in the last 28 Days",
Expand Down Expand Up @@ -199,9 +190,6 @@ class TestTypeEnum(enum.Enum):
blank=True,
verbose_name="Already pescribed medication if any",
)
has_SARI = models.BooleanField( # noqa: N815
default=False, verbose_name="Does the Patient Suffer from SARI"
)

is_antenatal = models.BooleanField(
default=None, verbose_name="Does the patient require Prenatal Care ?"
Expand Down Expand Up @@ -366,10 +354,6 @@ class TestTypeEnum(enum.Enum):
# IDSP Requirements End

# Vaccination Fields
is_vaccinated = models.BooleanField(
default=False,
verbose_name="Is the Patient Vaccinated Against COVID-19",
)
number_of_doses = models.PositiveIntegerField(
default=0,
null=False,
Expand All @@ -384,17 +368,6 @@ class TestTypeEnum(enum.Enum):
max_length=15,
)

covin_id = models.CharField(
max_length=15,
default=None,
null=True,
blank=True,
verbose_name="COVID-19 Vaccination ID",
)
last_vaccinated_date = models.DateTimeField(
null=True, blank=True, verbose_name="Date Last Vaccinated"
)

# Extras
cluster_name = models.CharField(
max_length=255,
Expand All @@ -403,17 +376,8 @@ class TestTypeEnum(enum.Enum):
null=True,
blank=True,
)
is_declared_positive = models.BooleanField(
default=None,
null=True,
verbose_name="Is Patient Declared Positive",
)
date_declared_positive = models.DateTimeField(
null=True, blank=True, verbose_name="Date Patient is Declared Positive"
)

# Permission Scopes

assigned_to = models.ForeignKey(
User,
on_delete=models.SET_NULL,
Expand Down Expand Up @@ -665,8 +629,6 @@ class ModeOfContactEnum(enum.IntEnum):
LIVE_IN_SAME_HOUSEHOLD = 4
# Close contact within 3ft (1m) of the confirmed case without precautions.
CLOSE_CONTACT_WITHOUT_PRECAUTION = 5
# Passenger of the aeroplane with a confirmed COVID -19 passenger for more than 6 hours.
CO_PASSENGER_AEROPLANE = 6
# Health care workers and other contacts who had full PPE while handling the +ve case
HEALTH_CARE_WITH_PPE = 7
# Shared the same space(same class for school/worked in same room/similar and not having a high risk exposure
Expand Down
10 changes: 1 addition & 9 deletions care/facility/models/patient_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,8 @@ def reverse_choices(choices):
"Cancer": 7,
"OTHER": 8,
}
DISEASE_CHOICES = [(v, k) for k, v in DISEASE_CHOICES_MAP.items()]

COVID_CATEGORY_CHOICES = [
("ASYM", "ASYMPTOMATIC"),
("Mild", "Category-A"),
("Moderate", "Category-B"),
("Severe", "Category-C"),
(None, "UNCLASSIFIED"),
] # Deprecated
DISEASE_CHOICES = [(v, k) for k, v in DISEASE_CHOICES_MAP.items()]

CATEGORY_CHOICES = [
("Comfort", "Comfort Care"),
Expand Down Expand Up @@ -144,7 +137,6 @@ class BedType(enum.Enum):

REVERSE_BLOOD_GROUP_CHOICES = reverse_choices(BLOOD_GROUP_CHOICES)
REVERSE_DISEASE_STATUS_CHOICES = reverse_choices(DISEASE_STATUS_CHOICES)
REVERSE_COVID_CATEGORY_CHOICES = reverse_choices(COVID_CATEGORY_CHOICES) # Deprecated
REVERSE_CATEGORY_CHOICES = reverse_choices(CATEGORY_CHOICES)
REVERSE_BED_TYPE_CHOICES = reverse_choices(BedTypeChoices)
REVERSE_ROUTE_TO_FACILITY_CHOICES = reverse_choices(RouteToFacility.choices)
Expand Down
13 changes: 0 additions & 13 deletions care/facility/models/patient_consultation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from care.facility.models import (
CATEGORY_CHOICES,
COVID_CATEGORY_CHOICES,
PatientBaseModel,
)
from care.facility.models.file_upload import FileUpload
Expand All @@ -17,7 +16,6 @@
DISCHARGE_REASON_CHOICES,
NEW_DISCHARGE_REASON_CHOICES,
REVERSE_CATEGORY_CHOICES,
REVERSE_COVID_CATEGORY_CHOICES,
RouteToFacility,
SuggestionChoices,
reverse_choices,
Expand Down Expand Up @@ -65,13 +63,6 @@ class PatientConsultation(PatientBaseModel, ConsultationRelatedPermissionMixin):
facility = models.ForeignKey(
"Facility", on_delete=models.CASCADE, related_name="consultations"
)
deprecated_covid_category = models.CharField(
choices=COVID_CATEGORY_CHOICES,
max_length=8,
default=None,
blank=True,
null=True,
) # Deprecated
category = models.CharField(
choices=CATEGORY_CHOICES, max_length=13, blank=False, null=True
)
Expand Down Expand Up @@ -231,16 +222,12 @@ def get_related_consultation(self):
"encounter_date": "Date of Admission",
"deprecated_symptoms_onset_date": "Date of Onset of Symptoms",
"deprecated_symptoms": "Symptoms at time of consultation",
"deprecated_covid_category": "Covid Category",
"category": "Category",
"examination_details": "Examination Details",
"suggestion": "Suggestion",
}

CSV_MAKE_PRETTY = {
"deprecated_covid_category": (
lambda x: REVERSE_COVID_CATEGORY_CHOICES.get(x, "-")
),
"category": lambda x: REVERSE_CATEGORY_CHOICES.get(x, "-"),
"suggestion": (
lambda x: PatientConsultation.REVERSE_SUGGESTION_CHOICES.get(x, "-")
Expand Down
Loading