From ee311a150ee86a57f895a394ca01f6b3efb6359e Mon Sep 17 00:00:00 2001 From: Jason Mok <106209849+jasonmokk@users.noreply.github.com> Date: Sun, 2 Jun 2024 08:06:48 -0500 Subject: [PATCH] Remove `PatientTeleConsultation` model (#2184) * Remove PatientTeleConsultation model * Remove tele_consultation_history * Remove @property annotation * update migrations --------- Co-authored-by: Aakash Singh Co-authored-by: Vignesh Hari --- care/facility/admin.py | 2 -- care/facility/api/serializers/patient.py | 9 --------- .../0441_delete_patientteleconsultation.py | 15 ++++++++++++++ care/facility/models/__init__.py | 1 - care/facility/models/patient.py | 4 ---- .../models/patient_tele_consultation.py | 20 ------------------- 6 files changed, 15 insertions(+), 36 deletions(-) create mode 100644 care/facility/migrations/0441_delete_patientteleconsultation.py delete mode 100644 care/facility/models/patient_tele_consultation.py diff --git a/care/facility/admin.py b/care/facility/admin.py index db0ac6a173..c25684e243 100644 --- a/care/facility/admin.py +++ b/care/facility/admin.py @@ -7,7 +7,6 @@ from care.facility.models.asset import Asset from care.facility.models.bed import AssetBed, Bed from care.facility.models.patient_sample import PatientSample -from care.facility.models.patient_tele_consultation import PatientTeleConsultation from .models import ( Building, @@ -198,7 +197,6 @@ class FacilityUserAdmin(DjangoQLSearchMixin, admin.ModelAdmin, ExportCsvMixin): admin.site.register(Ambulance, AmbulanceAdmin) admin.site.register(AmbulanceDriver, AmbulanceDriverAdmin) admin.site.register(PatientRegistration, PatientAdmin) -admin.site.register(PatientTeleConsultation) admin.site.register(PatientSample, PatientSampleAdmin) admin.site.register(Disease) admin.site.register(FacilityInventoryUnit) diff --git a/care/facility/api/serializers/patient.py b/care/facility/api/serializers/patient.py index 680022c7d0..048b3ba715 100644 --- a/care/facility/api/serializers/patient.py +++ b/care/facility/api/serializers/patient.py @@ -39,7 +39,6 @@ ) from care.facility.models.patient_consultation import PatientConsultation from care.facility.models.patient_external_test import PatientExternalTest -from care.facility.models.patient_tele_consultation import PatientTeleConsultation from care.hcx.models.claim import Claim from care.hcx.models.policy import Policy from care.users.api.serializers.lsg import ( @@ -160,11 +159,6 @@ class MedicalHistorySerializer(serializers.Serializer): disease = ChoiceField(choices=DISEASE_CHOICES) details = serializers.CharField(required=False, allow_blank=True) - class PatientTeleConsultationSerializer(serializers.ModelSerializer): - class Meta: - model = PatientTeleConsultation - fields = "__all__" - facility = ExternalIdSerializerField( queryset=Facility.objects.all(), required=False ) @@ -172,9 +166,6 @@ class Meta: child=MedicalHistorySerializer(), required=False ) - tele_consultation_history = serializers.ListSerializer( - child=PatientTeleConsultationSerializer(), read_only=True - ) last_consultation = PatientConsultationSerializer(read_only=True) facility_object = FacilitySerializer(source="facility", read_only=True) # nearest_facility_object = FacilitySerializer( diff --git a/care/facility/migrations/0441_delete_patientteleconsultation.py b/care/facility/migrations/0441_delete_patientteleconsultation.py new file mode 100644 index 0000000000..977b4722dc --- /dev/null +++ b/care/facility/migrations/0441_delete_patientteleconsultation.py @@ -0,0 +1,15 @@ +# Generated by Django 4.2.10 on 2024-06-02 11:31 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("facility", "0440_merge_20240528_1613"), + ] + + operations = [ + migrations.DeleteModel( + name="PatientTeleConsultation", + ), + ] diff --git a/care/facility/models/__init__.py b/care/facility/models/__init__.py index f5f21da821..8993152ef2 100644 --- a/care/facility/models/__init__.py +++ b/care/facility/models/__init__.py @@ -15,7 +15,6 @@ from .patient_external_test import * # noqa from .patient_investigation import * # noqa from .patient_sample import * # noqa -from .patient_tele_consultation import * # noqa from .prescription import * # noqa from .resources import * # noqa from .shifting import * # noqa diff --git a/care/facility/models/patient.py b/care/facility/models/patient.py index 9c30e76914..6e8d020f95 100644 --- a/care/facility/models/patient.py +++ b/care/facility/models/patient.py @@ -439,10 +439,6 @@ class TestTypeEnum(enum.Enum): def __str__(self): return f"{self.name} - {self.year_of_birth} - {self.get_gender_display()}" - @property - def tele_consultation_history(self): - return self.patientteleconsultation_set.order_by("-id") - def _alias_recovery_to_recovered(self) -> None: if self.disease_status == DiseaseStatusEnum.RECOVERY.value: self.disease_status = DiseaseStatusEnum.RECOVERED.value diff --git a/care/facility/models/patient_tele_consultation.py b/care/facility/models/patient_tele_consultation.py deleted file mode 100644 index 148af50990..0000000000 --- a/care/facility/models/patient_tele_consultation.py +++ /dev/null @@ -1,20 +0,0 @@ -from django.db import models -from multiselectfield import MultiSelectField -from multiselectfield.utils import get_max_length - -from care.facility.models import SYMPTOM_CHOICES, PatientRegistration -from care.users.models import User - - -class PatientTeleConsultation(models.Model): - patient = models.ForeignKey(PatientRegistration, on_delete=models.PROTECT) - symptoms = MultiSelectField( - choices=SYMPTOM_CHOICES, max_length=get_max_length(SYMPTOM_CHOICES, None) - ) - other_symptoms = models.TextField(blank=True, null=True) - reason = models.TextField(blank=True, null=True, verbose_name="Reason for calling") - created_date = models.DateTimeField(auto_now_add=True) - created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True) - - def __str__(self): - return self.patient.name + " on " + self.created_date.strftime("%d-%m-%Y")