Skip to content

Commit

Permalink
adds in a tb sparklines panel into the tb page
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Feb 18, 2019
1 parent a30f9c0 commit c3fd018
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
14 changes: 14 additions & 0 deletions apps/tb/api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from collections import OrderedDict
from elcid.api import AbstractLabTestSummaryApi


class TBTestSummary(AbstractLabTestSummaryApi):
base_name = "tb_test_summary"

RELEVANT_TESTS = OrderedDict((
("C REACTIVE PROTEIN", "C Reactive Protein"),
('LIVER PROFILE', ['ALT', 'AST', 'Total Bilirubin']),
('HEPATITIS B SURFACE AG', ["Hepatitis B 's'Antigen........"]),
('HEPATITIS C ANTIBODY', ["Hepatitis C IgG Antibody......"]),
('HIV 1 + 2 ANTIBODIES', 'HIV 1 + 2 Antibodies..........'),
))
5 changes: 5 additions & 0 deletions apps/tb/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from opal.models import UserProfile
from apps.tb.urls import urlpatterns
from apps.tb import constants as tb_constants
from apps.tb import api


class TbPlugin(plugins.OpalPlugin):
Expand Down Expand Up @@ -33,6 +34,10 @@ class TbPlugin(plugins.OpalPlugin):
],
}

apis = [
("tb_test_summary", api.TBTestSummary,),
]

@classmethod
def get_menu_items(self, user):
if not user:
Expand Down
10 changes: 10 additions & 0 deletions apps/tb/templates/detail/tb.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
{% include 'panels/nationality.html' %}
{% record_panel models.TBHistory %}
{% include "panels/symptoms.html" %}
<div class="panel panel-default">
<div class="panel-heading"><h3>
{% icon 'fa fa-crosshairs' %} Results
</h3></div>
<div class="panel-body overflow-x-auto">
{% include "tb/tb_sparklines.html" %}
</div>
</div>


{% record_panel models.Travel %}
{% record_panel models.PastMedicalHistory %}
{% record_panel models.Antimicrobial title="Medication History" %}
Expand Down
1 change: 1 addition & 0 deletions apps/tb/templates/tb/tb_sparklines.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "partials/lab_test_sparklines.html" with api_route="/api/v0.1/tb_test_summary/" %}
14 changes: 7 additions & 7 deletions elcid/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,6 @@ class AbstractLabTestSummaryApi(LoginRequiredViewset):
It returns the last 3 weeks of lab tests in the preferred order.
"""

RELEVANT_TESTS = OrderedDict((
("FULL BLOOD COUNT", ["WBC", "Lymphocytes", "Neutrophils"]),
("CLOTTING SCREEN", ["INR"]),
("C REACTIVE PROTEIN", ["C Reactive Protein"]),
("LIVER PROFILE", ["ALT", "AST", "Alkaline Phosphatase"]),
),)

def observation_index(self, obv):
"""
This method returns the index of the observation that
Expand Down Expand Up @@ -436,6 +429,13 @@ def retrieve(self, request, patient):
class InfectionServiceTestSummary(AbstractLabTestSummaryApi):
base_name = 'infection_service_test_summary'

RELEVANT_TESTS = OrderedDict((
("FULL BLOOD COUNT", ["WBC", "Lymphocytes", "Neutrophils"]),
("CLOTTING SCREEN", ["INR"]),
("C REACTIVE PROTEIN", ["C Reactive Protein"]),
("LIVER PROFILE", ["ALT", "AST", "Alkaline Phosphatase"]),
),)


class UpstreamBloodCultureApi(viewsets.ViewSet):
"""
Expand Down

0 comments on commit c3fd018

Please sign in to comment.