From eb780ea0e341b99fa20846c6472f878ed3749a75 Mon Sep 17 00:00:00 2001 From: pragati1610 Date: Fri, 9 Sep 2022 22:56:07 +0530 Subject: [PATCH] feat: modify pressure_sore and create new pain_scale_enhanced field --- .../migrations/0315_auto_20220909_0925.py | 25 +++++++++++++++++ care/facility/models/daily_round.py | 4 +++ .../models/json_schema/daily_round.py | 27 +++++++++++++------ docker/.local.env | 1 + 4 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 care/facility/migrations/0315_auto_20220909_0925.py diff --git a/care/facility/migrations/0315_auto_20220909_0925.py b/care/facility/migrations/0315_auto_20220909_0925.py new file mode 100644 index 0000000000..501a8cdeaf --- /dev/null +++ b/care/facility/migrations/0315_auto_20220909_0925.py @@ -0,0 +1,25 @@ +# Generated by Django 2.2.11 on 2022-09-09 03:55 + +import care.utils.models.validators +import django.contrib.postgres.fields.jsonb +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('facility', '0314_patientconsultation_icd11_diagnoses'), + ] + + operations = [ + migrations.AddField( + model_name='dailyround', + name='pain_scale_enhanced', + field=django.contrib.postgres.fields.jsonb.JSONField(default=list, validators=[care.utils.models.validators.JSONFieldSchemaValidator({'$schema': 'http://json-schema.org/draft-07/schema#', 'items': [{'additionalProperties': False, 'properties': {'description': {'type': 'string'}, 'region': {'type': 'string'}, 'scale': {'maximum': 5, 'minimum': 1, 'type': 'number'}}, 'required': ['region', 'scale'], 'type': 'object'}], 'type': 'array'})]), + ), + migrations.AlterField( + model_name='dailyround', + name='pressure_sore', + field=django.contrib.postgres.fields.jsonb.JSONField(default=list, validators=[care.utils.models.validators.JSONFieldSchemaValidator({'$schema': 'http://json-schema.org/draft-07/schema#', 'items': [{'additionalProperties': False, 'properties': {'description': {'type': 'string'}, 'region': {'type': 'string'}, 'scale': {'maximum': 5, 'minimum': 1, 'type': 'number'}}, 'required': ['region', 'scale'], 'type': 'object'}], 'type': 'array'})]), + ), + ] diff --git a/care/facility/models/daily_round.py b/care/facility/models/daily_round.py index e0fe835728..e00874b966 100644 --- a/care/facility/models/daily_round.py +++ b/care/facility/models/daily_round.py @@ -17,6 +17,7 @@ NURSING_PROCEDURE, OUTPUT, PRESSURE_SORE, + PAIN_SCALE_ENHANCED, ) from care.facility.models.patient_base import CURRENT_HEALTH_CHOICES, SYMPTOM_CHOICES from care.facility.models.patient_consultation import PatientConsultation @@ -319,6 +320,9 @@ class InsulinIntakeFrequencyType(enum.Enum): null=True, validators=[MinValueValidator(0), MaxValueValidator(10)], ) + pain_scale_enhanced = JSONField( + default=list, validators=[JSONFieldSchemaValidator(PAIN_SCALE_ENHANCED)] + ) ph = models.DecimalField( decimal_places=2, max_digits=4, diff --git a/care/facility/models/json_schema/daily_round.py b/care/facility/models/json_schema/daily_round.py index 1c97512aa5..eb47813eda 100644 --- a/care/facility/models/json_schema/daily_round.py +++ b/care/facility/models/json_schema/daily_round.py @@ -33,10 +33,7 @@ "items": [ { "type": "object", - "properties": { - "name": {"type": "string"}, - "quantity": {"type": "number"}, - }, + "properties": {"name": {"type": "string"}, "quantity": {"type": "number"},}, "additionalProperties": False, "required": ["name", "quantity"], } @@ -66,10 +63,7 @@ "items": [ { "type": "object", - "properties": { - "name": {"type": "string"}, - "quantity": {"type": "number"}, - }, + "properties": {"name": {"type": "string"}, "quantity": {"type": "number"},}, "additionalProperties": False, "required": ["name", "quantity"], } @@ -85,6 +79,7 @@ "properties": { "region": {"type": "string"}, "scale": {"type": "number", "minimum": 1, "maximum": 5}, + "description": {"type": "string"}, }, "additionalProperties": False, "required": ["region", "scale"], @@ -92,6 +87,22 @@ ], } +PAIN_SCALE_ENHANCED = { + "$schema": f"http://json-schema.org/draft-07/schema#", + "type": "array", + "items": [ + { + "type": "object", + "properties": { + "region": {"type": "string"}, + "scale": {"type": "number", "minimum": 1, "maximum": 5}, + "description": {"type": "string"}, + }, + "additionalProperties": False, + "required": ["region", "scale"], + } + ], +} NURSING_PROCEDURE = { "$schema": f"http://json-schema.org/draft-07/schema#", diff --git a/docker/.local.env b/docker/.local.env index 0de74cbf10..0bb08b190e 100644 --- a/docker/.local.env +++ b/docker/.local.env @@ -10,3 +10,4 @@ DJANGO_DEBUG=False FILE_UPLOAD_BUCKET=patient-bucket FACILITY_S3_BUCKET=facility-bucket +JWKS_BASE64=eyJrZXlzIjogW3sibiI6ICI2Q1Q5ZkZRRkFNSENIN3JyVFFHeFlfX2NOWXJkWkdwWG5MSU9uaTU3VHpTbHZqako5Z0lpWGVhaDVUNEIyVEc2R1oxZU5Fc2FYQ2Y5Y09QVi1jQzNEbzQyd2k4SnEyM0lNWHhlb3dNcE9QYng2TVczb1FpeHZxU2ZZay1MYk1Nak5tVVBJQW9mTkZ3MVN5NWlMYzk4ODI0QXJoRDdtenEwR3pWNU45NXNQcnlZcTRpZ2lPRm5vV3B4NDVzSThTbWo0YXRhUUJDUmN5NFNCcGlweUNSV1dEVEhxdzVReTc2NFYzZFZYQVN4WGdLc09YMzh1TnpLY2VnNklubFplaTNoMzJPQTJJMGl5UENTY1g2Qm53YVZBUWhFUUdGLU9CSXdDd3dEMlZWU3U1dmtVbjB3dnI5d0JPbm5PQTA3dGNYV1dXd3ZRMndXbXUwQkl2ZW02TE1xSHciLCAiZSI6ICJBUUFCIiwgImQiOiAiS2paWHRaemRrQWFya3ZOOVJfSnYzRHd4UWJjdmpNdmRoSXZJSnJGVEVOTUU5SE1GSG12QzdnbzdGQ0ZUV3JnMUctVkd0UUdYR0h6WkZBY0o2TEZIV0NrNkFkTmwwYnRUdE5QbHJZU3NvVVFlTnZLRThvNVBLOWhwZHduNTAxd2tjZ2FzV21vY3hIdWo0VGpjOTNHTVNnT05zaGs2ZHo2VWM0SWt1YWtEUy1ETXhiMTZXdnl5MHJKQmJ4VE9DOXdiclN3RDJnWVNWQllrY2MzcVd4cERHTDE0MElwRlNDOG9wMnIxMlI3RW50Y1NJanR0dXM0VUdiczlKMm1oR2kxSTJLRE1NSUJFcmxkZC1iUS1DQ3UtQjBSU1VqZEVtVENhSU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