Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Develop To Staging v24.29.0 #2300

Merged
merged 5 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Generated by Django 4.2.8 on 2024-07-05 10:47

from django.db import migrations, models

import care.utils.models.validators


class Migration(migrations.Migration):
dependencies = [
("facility", "0443_remove_patientconsultation_consent_records_and_more"),
]

operations = [
migrations.AlterField(
model_name="medicineadministration",
name="dosage",
field=models.CharField(
blank=True,
max_length=100,
null=True,
validators=[
care.utils.models.validators.DenominationValidator(
allow_floats=True,
max_amount=5000,
min_amount=0.0001,
precision=4,
units={
"ampule(s)",
"mg",
"g",
"tsp",
"drop(s)",
"mcg",
"unit(s)",
"ml",
},
)
],
),
),
migrations.AlterField(
model_name="prescription",
name="base_dosage",
field=models.CharField(
blank=True,
max_length=100,
null=True,
validators=[
care.utils.models.validators.DenominationValidator(
allow_floats=True,
max_amount=5000,
min_amount=0.0001,
precision=4,
units={
"ampule(s)",
"mg",
"g",
"tsp",
"drop(s)",
"mcg",
"unit(s)",
"ml",
},
)
],
),
),
migrations.AlterField(
model_name="prescription",
name="max_dosage",
field=models.CharField(
blank=True,
max_length=100,
null=True,
validators=[
care.utils.models.validators.DenominationValidator(
allow_floats=True,
max_amount=5000,
min_amount=0.0001,
precision=4,
units={
"ampule(s)",
"mg",
"g",
"tsp",
"drop(s)",
"mcg",
"unit(s)",
"ml",
},
)
],
),
),
migrations.AlterField(
model_name="prescription",
name="route",
field=models.CharField(
blank=True,
choices=[
("ORAL", "Oral"),
("IV", "IV"),
("IM", "IM"),
("SC", "S/C"),
("INHALATION", "Inhalation"),
("NASOGASTRIC", "Nasogastric/Gastrostomy tube"),
("INTRATHECAL", "intrathecal injection"),
("TRANSDERMAL", "Transdermal"),
("RECTAL", "Rectal"),
("SUBLINGUAL", "Sublingual"),
],
max_length=100,
null=True,
),
),
migrations.AlterField(
model_name="prescription",
name="target_dosage",
field=models.CharField(
blank=True,
max_length=100,
null=True,
validators=[
care.utils.models.validators.DenominationValidator(
allow_floats=True,
max_amount=5000,
min_amount=0.0001,
precision=4,
units={
"ampule(s)",
"mg",
"g",
"tsp",
"drop(s)",
"mcg",
"unit(s)",
"ml",
},
)
],
),
),
]
1 change: 1 addition & 0 deletions care/facility/models/prescription.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Routes(enum.Enum):
INTRATHECAL = "intrathecal injection"
TRANSDERMAL = "Transdermal"
RECTAL = "Rectal"
SUBLINGUAL = "Sublingual"


class PrescriptionType(enum.Enum):
Expand Down
4 changes: 2 additions & 2 deletions care/utils/models/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def __call__(self, value: str):

if len(amount) != len(str(amount_number)):
raise ValidationError(
f"Input amount must be a valid number without leading{ ' or trailing ' if self.allow_floats else ' ' }zeroes"
f"Input amount must be a valid number without leading{' or trailing ' if self.allow_floats else ' '}zeroes"
)

if self.min_amount > amount_number or amount_number > self.max_amount:
Expand Down Expand Up @@ -190,7 +190,7 @@ def __eq__(self, __value: object) -> bool: # pragma: no cover
dosage_validator = DenominationValidator(
min_amount=0.0001,
max_amount=5000,
units={"mg", "g", "ml", "drop(s)", "ampule(s)", "tsp"},
units={"mg", "g", "ml", "drop(s)", "ampule(s)", "tsp", "mcg", "unit(s)"},
allow_floats=True,
precision=4,
)
Loading