Skip to content

Commit

Permalink
Adds treatment reason to the antimicrobial model
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Feb 21, 2020
1 parent cffbcb3 commit 16ffa57
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
26 changes: 25 additions & 1 deletion elcid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from opal.models import (
EpisodeSubrecord, PatientSubrecord, ExternallySourcedModel
)
from opal.core.fields import ForeignKeyOrFreeText
from opal.core.fields import ForeignKeyOrFreeText, enum
from opal.core import lookuplists


Expand Down Expand Up @@ -344,13 +344,37 @@ class Antimicrobial(EpisodeSubrecord):
_icon = 'fa fa-flask'
_modal = 'lg'

EMPIRIC = "Empiric"
TARGETTED = "Targetted"
PREEMPTIVE = "Pre-emptive"

TREATMENT_REASON = enum(EMPIRIC, TARGETTED, PREEMPTIVE)


# Antifungals will require a treament reason
ANTIFUNGALS = [
"Anidulafungin",
"Caspofungin",
"Combination",
"Conventional Amphotericin",
"Fluconazole",
"Isavuconazole",
"Liposomal Amphotericin",
"Micfungin",
"Posacanazole",
"Voiconazole"
]

drug = ForeignKeyOrFreeText(omodels.Antimicrobial)
dose = models.CharField(max_length=255, blank=True)
route = ForeignKeyOrFreeText(omodels.Antimicrobial_route)
start_date = models.DateField(null=True, blank=True)
end_date = models.DateField(null=True, blank=True)
delivered_by = ForeignKeyOrFreeText(Drug_delivered)
reason_for_stopping = ForeignKeyOrFreeText(Iv_stop)
treatment_reason = models.CharField(
max_length=256, blank=True, null=True, choices=TREATMENT_REASON
)
adverse_event = ForeignKeyOrFreeText(omodels.Antimicrobial_adverse_event)
comments = models.TextField(blank=True, null=True)
frequency = ForeignKeyOrFreeText(omodels.Antimicrobial_frequency)
Expand Down
4 changes: 2 additions & 2 deletions elcid/templates/forms/antimicrobial_form.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% load forms %}

{% input field="Antimicrobial.drug" %}
{% input field="Antimicrobial.drug" %}
{% radio field="Antimicrobial.treatment_reason" %}
{% datepicker field="Antimicrobial.start_date" %}
{% datepicker field="Antimicrobial.end_date" %}
{% input field="Antimicrobial.dose" %}
Expand Down
5 changes: 5 additions & 0 deletions elcid/templates/records/antimicrobial.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
[[ item|totalDays ]]D [[item.start_date|displayDate]]<span ng-show="item.end_date">&ndash;[[item.end_date|displayDate]]</span>
</span>
[[item.drug]] [[item.dose]] [[item.route]] [[ item.frequency ]] [[item.delivered_by]]
<span ng-show="item.treatment_reason">
<br />
[[ item.treatment_reason ]]
</span>
</span>

0 comments on commit 16ffa57

Please sign in to comment.