From 4970de3c8dd5efb7d2e88c219b8490d03aba9182 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Thu, 19 Sep 2024 11:08:52 +0530 Subject: [PATCH 1/3] Fixed incoming fhir data parsing (#2446) --- care/hcx/utils/fhir.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/care/hcx/utils/fhir.py b/care/hcx/utils/fhir.py index 46ee5326c6..93df49ba82 100644 --- a/care/hcx/utils/fhir.py +++ b/care/hcx/utils/fhir.py @@ -1017,8 +1017,10 @@ def process_coverage_elibility_check_response(self, response): coverageeligibilityresponse.CoverageEligibilityResponse( **list( filter( - lambda entry: entry.resource - is coverageeligibilityresponse.CoverageEligibilityResponse, + lambda entry: isinstance( + entry.resource, + coverageeligibilityresponse.CoverageEligibilityResponse, + ), coverage_eligibility_check_bundle.entry, ) )[0].resource.dict() @@ -1027,7 +1029,7 @@ def process_coverage_elibility_check_response(self, response): coverage_request = coverage.Coverage( **list( filter( - lambda entry: entry.resource is coverage.Coverage, + lambda entry: isinstance(entry.resource, coverage.Coverage), coverage_eligibility_check_bundle.entry, ) )[0].resource.dict() @@ -1057,7 +1059,9 @@ def process_claim_response(self, response): claim_response = claimresponse.ClaimResponse( **list( filter( - lambda entry: entry.resource is claimresponse.ClaimResponse, + lambda entry: isinstance( + entry.resource, claimresponse.ClaimResponse + ), claim_bundle.entry, ) )[0].resource.dict() From 57d966bcbed095fe728fc0c4533ace57011794b2 Mon Sep 17 00:00:00 2001 From: Bodhish Thomas Date: Thu, 19 Sep 2024 16:42:49 +0530 Subject: [PATCH 2/3] New Crowdin updates (#2453) * New translations django.po (Tamil) * New translations django.po (Hindi) * New translations django.po (Malayalam) * New translations django.po (Kannada) * New translations django.po (Tamil) * New translations django.po (Hindi) * New translations django.po (Malayalam) * New translations django.po (Kannada) * New translations django.po (Tamil) * New translations django.po (Hindi) * New translations django.po (Malayalam) * New translations django.po (Kannada) * New translations django.po (Tamil) * New translations django.po (Hindi) * New translations django.po (Malayalam) * New translations django.po (Kannada) * New translations django.po (Tamil) * New translations django.po (Hindi) * New translations django.po (Tamil) * New translations django.po (Hindi) * New translations django.po (Tamil) * New translations django.po (Hindi) * New translations django.po (Tamil) * New translations django.po (Hindi) --- locale/hi/LC_MESSAGES/django.po | 6 +++--- locale/kn/LC_MESSAGES/django.po | 6 +++--- locale/ml/LC_MESSAGES/django.po | 8 ++++---- locale/ta/LC_MESSAGES/django.po | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/locale/hi/LC_MESSAGES/django.po b/locale/hi/LC_MESSAGES/django.po index f7122369b9..a63e6bcfa7 100644 --- a/locale/hi/LC_MESSAGES/django.po +++ b/locale/hi/LC_MESSAGES/django.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: ohccarefe\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-25 17:02+0530\n" -"PO-Revision-Date: 2024-09-16 10:57\n" +"PO-Revision-Date: 2024-09-16 14:40\n" "Last-Translator: \n" "Language-Team: Hindi\n" "Language: hi_IN\n" @@ -14,8 +14,8 @@ msgstr "" "X-Crowdin-Project: ohccarefe\n" "X-Crowdin-Project-ID: 704503\n" "X-Crowdin-Language: hi\n" -"X-Crowdin-File: /[ohcnetwork.care] develop/locale/ta/LC_MESSAGES/django.po\n" -"X-Crowdin-File-ID: 70\n" +"X-Crowdin-File: /[ohcnetwork.care] develop/locale/kn/LC_MESSAGES/django.po\n" +"X-Crowdin-File-ID: 76\n" #: care/abdm/apps.py:7 msgid "ABDM Integration" diff --git a/locale/kn/LC_MESSAGES/django.po b/locale/kn/LC_MESSAGES/django.po index 8c1bf28934..39aa3fc1df 100644 --- a/locale/kn/LC_MESSAGES/django.po +++ b/locale/kn/LC_MESSAGES/django.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: ohccarefe\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-25 17:02+0530\n" -"PO-Revision-Date: 2024-09-16 10:57\n" +"PO-Revision-Date: 2024-09-16 12:34\n" "Last-Translator: \n" "Language-Team: Kannada\n" "Language: kn_IN\n" @@ -14,8 +14,8 @@ msgstr "" "X-Crowdin-Project: ohccarefe\n" "X-Crowdin-Project-ID: 704503\n" "X-Crowdin-Language: kn\n" -"X-Crowdin-File: /[ohcnetwork.care] develop/locale/ta/LC_MESSAGES/django.po\n" -"X-Crowdin-File-ID: 70\n" +"X-Crowdin-File: /[ohcnetwork.care] develop/locale/kn/LC_MESSAGES/django.po\n" +"X-Crowdin-File-ID: 76\n" #: care/abdm/apps.py:7 msgid "ABDM Integration" diff --git a/locale/ml/LC_MESSAGES/django.po b/locale/ml/LC_MESSAGES/django.po index 432ca296f8..5b0e3c8386 100644 --- a/locale/ml/LC_MESSAGES/django.po +++ b/locale/ml/LC_MESSAGES/django.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: ohccarefe\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-25 17:02+0530\n" -"PO-Revision-Date: 2024-09-16 10:58\n" +"PO-Revision-Date: 2024-09-16 12:34\n" "Last-Translator: \n" "Language-Team: Malayalam\n" "Language: ml_IN\n" @@ -14,8 +14,8 @@ msgstr "" "X-Crowdin-Project: ohccarefe\n" "X-Crowdin-Project-ID: 704503\n" "X-Crowdin-Language: ml-IN\n" -"X-Crowdin-File: /[ohcnetwork.care] develop/locale/ta/LC_MESSAGES/django.po\n" -"X-Crowdin-File-ID: 70\n" +"X-Crowdin-File: /[ohcnetwork.care] develop/locale/kn/LC_MESSAGES/django.po\n" +"X-Crowdin-File-ID: 76\n" #: care/abdm/apps.py:7 msgid "ABDM Integration" @@ -116,7 +116,7 @@ msgstr "HCX ഇൻ്റഗ്രേഷൻ" #: care/templates/pages/home.html:8 msgid "Open Healthcare Network" -msgstr "ആരോഗ്യ സംരക്ഷണ ശൃംഖല" +msgstr "ഹെൽത്ത് കെയർ നെറ്റ്‌വർക്ക് തുറക്കുക" #: care/templates/pages/home.html:9 msgid "Our Goal is to defend the Healthcare system of Kerala from overloading beyond capacity." diff --git a/locale/ta/LC_MESSAGES/django.po b/locale/ta/LC_MESSAGES/django.po index ad237a7acd..e1ff832ea4 100644 --- a/locale/ta/LC_MESSAGES/django.po +++ b/locale/ta/LC_MESSAGES/django.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: ohccarefe\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-25 17:02+0530\n" -"PO-Revision-Date: 2024-09-16 10:57\n" +"PO-Revision-Date: 2024-09-16 14:40\n" "Last-Translator: \n" "Language-Team: Tamil\n" "Language: ta_IN\n" @@ -14,8 +14,8 @@ msgstr "" "X-Crowdin-Project: ohccarefe\n" "X-Crowdin-Project-ID: 704503\n" "X-Crowdin-Language: ta\n" -"X-Crowdin-File: /[ohcnetwork.care] develop/locale/ta/LC_MESSAGES/django.po\n" -"X-Crowdin-File-ID: 70\n" +"X-Crowdin-File: /[ohcnetwork.care] develop/locale/kn/LC_MESSAGES/django.po\n" +"X-Crowdin-File-ID: 76\n" #: care/abdm/apps.py:7 msgid "ABDM Integration" From a06913e237cde250d9a7428a252c5dd1a7e3a559 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Thu, 19 Sep 2024 18:15:48 +0530 Subject: [PATCH 3/3] Adds fields for social profile: socioeconomic status and domestic healthcare support (#2464) * Adds fields for social profile: socioeconomic status and domestic healthcare support * Add tests --- care/facility/api/serializers/patient.py | 14 +++- ...fo_domestic_healthcare_support_and_more.py | 39 +++++++++ care/facility/models/patient.py | 83 +++++++++++-------- care/facility/tests/test_patient_api.py | 21 +++++ 4 files changed, 123 insertions(+), 34 deletions(-) create mode 100644 care/facility/migrations/0457_patientmetainfo_domestic_healthcare_support_and_more.py diff --git a/care/facility/api/serializers/patient.py b/care/facility/api/serializers/patient.py index d662aba855..32e378dc9a 100644 --- a/care/facility/api/serializers/patient.py +++ b/care/facility/api/serializers/patient.py @@ -54,7 +54,19 @@ class PatientMetaInfoSerializer(serializers.ModelSerializer): - occupation = ChoiceField(choices=PatientMetaInfo.OccupationChoices, allow_null=True) + occupation = ChoiceField( + choices=PatientMetaInfo.OccupationChoices, allow_null=True, required=False + ) + socioeconomic_status = ChoiceField( + choices=PatientMetaInfo.SocioeconomicStatus.choices, + allow_null=True, + required=False, + ) + domestic_healthcare_support = ChoiceField( + choices=PatientMetaInfo.DomesticHealthcareSupport.choices, + allow_null=True, + required=False, + ) class Meta: model = PatientMetaInfo diff --git a/care/facility/migrations/0457_patientmetainfo_domestic_healthcare_support_and_more.py b/care/facility/migrations/0457_patientmetainfo_domestic_healthcare_support_and_more.py new file mode 100644 index 0000000000..6a883b5ec4 --- /dev/null +++ b/care/facility/migrations/0457_patientmetainfo_domestic_healthcare_support_and_more.py @@ -0,0 +1,39 @@ +# Generated by Django 4.2.10 on 2024-09-19 07:07 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("facility", "0456_dailyround_appetite_dailyround_bladder_drainage_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="patientmetainfo", + name="domestic_healthcare_support", + field=models.SmallIntegerField( + blank=True, + choices=[ + (0, "NO_SUPPORT"), + (10, "FAMILY_MEMBER"), + (20, "PAID_CAREGIVER"), + ], + null=True, + ), + ), + migrations.AddField( + model_name="patientmetainfo", + name="socioeconomic_status", + field=models.SmallIntegerField( + blank=True, + choices=[ + (10, "VERY_POOR"), + (20, "POOR"), + (30, "MIDDLE_CLASS"), + (40, "WELL_OFF"), + ], + null=True, + ), + ), + ] diff --git a/care/facility/models/patient.py b/care/facility/models/patient.py index 226fbb108d..17eb7f248c 100644 --- a/care/facility/models/patient.py +++ b/care/facility/models/patient.py @@ -589,43 +589,60 @@ def format_diagnoses(diagnosis_ids): class PatientMetaInfo(models.Model): - class OccupationEnum(enum.Enum): - STUDENT = 1 - BUSINESSMAN = 2 - HEALTH_CARE_WORKER = 3 - HEALTH_CARE_LAB_WORKER = 4 - ANIMAL_HANDLER = 5 - OTHERS = 6 - HEALTHCARE_PRACTITIONER = 7 - PARADEMICS = 8 - BUSINESS_RELATED = 9 - ENGINEER = 10 - TEACHER = 11 - OTHER_PROFESSIONAL_OCCUPATIONS = 12 - OFFICE_ADMINISTRATIVE = 13 - CHEF = 14 - PROTECTIVE_SERVICE = 15 - HOSPITALITY = 16 - CUSTODIAL = 17 - CUSTOMER_SERVICE = 18 - SALES_SUPERVISOR = 19 - RETAIL_SALES_WORKER = 20 - INSURANCE_SALES_AGENT = 21 - SALES_REPRESENTATIVE = 22 - REAL_ESTATE = 23 - CONSTRUCTION_EXTRACTION = 24 - AGRI_NATURAL = 25 - PRODUCTION_OCCUPATION = 26 - PILOT_FLIGHT = 27 - VEHICLE_DRIVER = 28 - MILITARY = 29 - HOMEMAKER = 30 - UNKNOWN = 31 - NOT_APPLICABLE = 32 + class OccupationEnum(models.IntegerChoices): + STUDENT = 1, "STUDENT" + BUSINESSMAN = 2, "BUSINESSMAN" + HEALTH_CARE_WORKER = 3, "HEALTH_CARE_WORKER" + HEALTH_CARE_LAB_WORKER = 4, "HEALTH_CARE_LAB_WORKER" + ANIMAL_HANDLER = 5, "ANIMAL_HANDLER" + OTHERS = 6, "OTHERS" + HEALTHCARE_PRACTITIONER = 7, "HEALTHCARE_PRACTITIONER" + PARADEMICS = 8, "PARADEMICS" + BUSINESS_RELATED = 9, "BUSINESS_RELATED" + ENGINEER = 10, "ENGINEER" + TEACHER = 11, "TEACHER" + OTHER_PROFESSIONAL_OCCUPATIONS = 12, "OTHER_PROFESSIONAL_OCCUPATIONS" + OFFICE_ADMINISTRATIVE = 13, "OFFICE_ADMINISTRATIVE" + CHEF = 14, "CHEF" + PROTECTIVE_SERVICE = 15, "PROTECTIVE_SERVICE" + HOSPITALITY = 16, "HOSPITALITY" + CUSTODIAL = 17, "CUSTODIAL" + CUSTOMER_SERVICE = 18, "CUSTOMER_SERVICE" + SALES_SUPERVISOR = 19, "SALES_SUPERVISOR" + RETAIL_SALES_WORKER = 20, "RETAIL_SALES_WORKER" + INSURANCE_SALES_AGENT = 21, "INSURANCE_SALES_AGENT" + SALES_REPRESENTATIVE = 22, "SALES_REPRESENTATIVE" + REAL_ESTATE = 23, "REAL_ESTATE" + CONSTRUCTION_EXTRACTION = 24, "CONSTRUCTION_EXTRACTION" + AGRI_NATURAL = 25, "AGRI_NATURAL" + PRODUCTION_OCCUPATION = 26, "PRODUCTION_OCCUPATION" + PILOT_FLIGHT = 27, "PILOT_FLIGHT" + VEHICLE_DRIVER = 28, "VEHICLE_DRIVER" + MILITARY = 29, "MILITARY" + HOMEMAKER = 30, "HOMEMAKER" + UNKNOWN = 31, "UNKNOWN" + NOT_APPLICABLE = 32, "NOT_APPLICABLE" OccupationChoices = [(item.value, item.name) for item in OccupationEnum] + class SocioeconomicStatus(models.IntegerChoices): + VERY_POOR = 10, "VERY_POOR" + POOR = 20, "POOR" + MIDDLE_CLASS = 30, "MIDDLE_CLASS" + WELL_OFF = 40, "WELL_OFF" + + class DomesticHealthcareSupport(models.IntegerChoices): + NO_SUPPORT = 0, "NO_SUPPORT" + FAMILY_MEMBER = 10, "FAMILY_MEMBER" + PAID_CAREGIVER = 20, "PAID_CAREGIVER" + occupation = models.IntegerField(choices=OccupationChoices, blank=True, null=True) + socioeconomic_status = models.SmallIntegerField( + choices=SocioeconomicStatus.choices, blank=True, null=True + ) + domestic_healthcare_support = models.SmallIntegerField( + choices=DomesticHealthcareSupport.choices, blank=True, null=True + ) head_of_household = models.BooleanField(blank=True, null=True) diff --git a/care/facility/tests/test_patient_api.py b/care/facility/tests/test_patient_api.py index 3f031d9370..98f75613ea 100644 --- a/care/facility/tests/test_patient_api.py +++ b/care/facility/tests/test_patient_api.py @@ -331,6 +331,27 @@ def setUpTestData(cls): def get_base_url(self) -> str: return "/api/v1/patient/" + def test_update_patient_with_meta_info(self): + self.client.force_authenticate(user=self.user) + res = self.client.patch( + f"{self.get_base_url()}{self.patient.external_id}/", + data={ + "meta_info": { + "socioeconomic_status": "VERY_POOR", + "domestic_healthcare_support": "FAMILY_MEMBER", + } + }, + format="json", + ) + self.assertEqual(res.status_code, status.HTTP_200_OK) + self.assertDictContainsSubset( + { + "socioeconomic_status": "VERY_POOR", + "domestic_healthcare_support": "FAMILY_MEMBER", + }, + res.data.get("meta_info"), + ) + def test_has_consent(self): self.client.force_authenticate(user=self.user) response = self.client.get(self.get_base_url())