Skip to content

Commit

Permalink
modify pressure_sore and create new pain_scale_enhanced field (#1016)
Browse files Browse the repository at this point in the history
* fix: remove description from pressure_sore field

* feat: modify pressure_sore and create new pain_scale_enhanced field

* remove unrelated change from .local.env
  • Loading branch information
Pragati1610 authored Sep 16, 2022
1 parent 3d8dfa1 commit 8e48faa
Show file tree
Hide file tree
Showing 3 changed files with 48 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 @@ -21,6 +21,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 @@ -330,6 +331,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

0 comments on commit 8e48faa

Please sign in to comment.