Skip to content

Commit

Permalink
feat: modify pressure_sore and create new pain_scale_enhanced field
Browse files Browse the repository at this point in the history
  • Loading branch information
Pragati1610 committed Sep 9, 2022
1 parent 08db30b commit 33c89c4
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 8 deletions.
25 changes: 25 additions & 0 deletions care/facility/migrations/0315_auto_20220909_0925.py
Original file line number Diff line number Diff line change
@@ -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'})]),
),
]
4 changes: 4 additions & 0 deletions care/facility/models/daily_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
27 changes: 19 additions & 8 deletions care/facility/models/json_schema/daily_round.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
}
Expand Down Expand Up @@ -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"],
}
Expand All @@ -85,13 +79,30 @@
"properties": {
"region": {"type": "string"},
"scale": {"type": "number", "minimum": 1, "maximum": 5},
"description": {"type": "string"},
},
"additionalProperties": False,
"required": ["region", "scale"],
}
],
}

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#",
Expand Down
1 change: 1 addition & 0 deletions docker/.local.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ CELERY_BROKER_URL=redis://redis:6379/0

FILE_UPLOAD_BUCKET=patient-bucket
FACILITY_S3_BUCKET=facility-bucket
JWKS_BASE64=eyJrZXlzIjogW3sibiI6ICI2Q1Q5ZkZRRkFNSENIN3JyVFFHeFlfX2NOWXJkWkdwWG5MSU9uaTU3VHpTbHZqako5Z0lpWGVhaDVUNEIyVEc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