Skip to content

Commit

Permalink
Merge e851f97 into 8096939
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Mar 4, 2020
2 parents 8096939 + e851f97 commit 408de78
Show file tree
Hide file tree
Showing 26 changed files with 542 additions and 274 deletions.
52 changes: 18 additions & 34 deletions apps/tb/api.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,24 @@
"""
Specific API endpoints for the TB module
"""
from django.utils import timezone
from opal.core.views import json_response
from opal.core.api import patient_from_pk, LoginRequiredViewset
from collections import OrderedDict
from plugins.labtests.api import RecentResultsApiView

from apps.tb.utils import get_tb_summary_information


class TbTestSummary(LoginRequiredViewset):
class TbTestSummary(RecentResultsApiView):
base_name = 'tb_test_summary'
""""
Example payload
return [
{
name: 'C REACTIVE PROTEIN',
date: '',
result: '1'
},
{
name: 'ALT',
date: '',
result: '1'
}
]
"""
@patient_from_pk
def retrieve(self, request, patient):
tb_summary_information = get_tb_summary_information(patient)
result = []
for obs_name, summary in tb_summary_information.items():
result.append({
"name": obs_name,
"date": summary["observation_datetime"],
"result": summary["observation_value"]
})

return json_response(dict(results=result))
RELEVANT_TESTS = OrderedDict((
("AFB : CULTURE", ["TB: Culture Result"]),
("TB PCR TEST", ["TB PCR"]),
("C REACTIVE PROTEIN", ["C Reactive Protein"]),
("LIVER PROFILE", ["ALT", "AST", "Total Bilirubin"]),
("QUANTIFERON TB GOLD IT", [
"QFT IFN gamma result (TB1)",
"QFT IFN gamme result (TB2)",
"QFT TB interpretation"
]),
('HEPATITIS B SURFACE AG', ["Hepatitis B 's'Antigen........"]),
('HEPATITIS C ANTIBODY', ["Hepatitis C IgG Antibody......"]),
('HIV 1 + 2 ANTIBODIES', ['HIV 1 + 2 Antibodies..........']),
("25-OH Vitamin D", ["25-OH Vitamin D"]),
),)
2 changes: 0 additions & 2 deletions apps/tb/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ class TbPlugin(plugins.OpalPlugin):
'js/tb/controllers/tb_treatment.js',
'js/tb/controllers/mantoux_test.js',
'js/tb/controllers/add_episode_helper.js',
'js/tb/directives.js'
# 'js/tb/services/larry.js',
],
'opal.services': [
'js/tb/services/treatment_utils.js',
'js/tb/services/treatment_record.js',
'js/tb/services/test_summary_loader.js',
],
}

Expand Down
29 changes: 0 additions & 29 deletions apps/tb/static/js/tb/directives.js

This file was deleted.

21 changes: 0 additions & 21 deletions apps/tb/static/js/tb/services/test_summary_loader.js

This file was deleted.

3 changes: 2 additions & 1 deletion apps/tb/templates/detail/tb.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{% load panels %}
{% load forms %}
{% load key_investigations %}
<div class="row">
<div class="col-md-6">
{% include "panels/external_links.html" %}
{% include "partials/tb_summary_tests.html" %}
{% key_investigations "/api/v0.1/tb_test_summary/" body_class="panel-footer" %}
{% include "panels/symptoms.html" %}

{% include 'panels/primary_diagnosis.html' %}
Expand Down
1 change: 0 additions & 1 deletion apps/tb/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from plugins.labtests import models
from rest_framework.reverse import reverse
from opal.core.test import OpalTestCase
from apps.tb import utils


class TestMultipleResults(OpalTestCase):
Expand Down
27 changes: 0 additions & 27 deletions apps/tb/tests/test_utils.py

This file was deleted.

7 changes: 0 additions & 7 deletions apps/tb/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
from apps.tb.models import PatientConsultation
from django.views.generic import TemplateView
from opal.core.serialization import deserialize_datetime
from apps.tb.utils import get_tb_summary_information

from apps.tb.models import Treatment
from elcid.models import Diagnosis
from opal import views
Expand Down Expand Up @@ -41,11 +39,6 @@ def get_context_data(self, *args, **kwargs):
category=Treatment.TB
)
ctx["communication_considerations"] = patient.communinicationconsiderations_set.get()
ctx["results"] = get_tb_summary_information(patient)
for result in ctx["results"].values():
result["observation_datetime"] = deserialize_datetime(
result["observation_datetime"]
)
ctx["travel_list"] = episode.travel_set.all()
ctx["adverse_reaction_list"] = episode.adversereaction_set.all()
ctx["past_medication_list"] = episode.antimicrobial_set.all()
Expand Down
4 changes: 4 additions & 0 deletions config/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module.exports = function(config){
__dirname + '/../elcid/assets/js/elcid/services/records/*',
__dirname + '/../intrahospital_api/static/js/intrahospital_api/controllers/*',
__dirname + '/../apps/tb/static/js/tb/controllers/*',
__dirname + '/../plugins/labtests/static/js/labtests/controllers/*',
__dirname + '/../plugins/labtests/static/js/labtests/services/*',
];
var includedFiles = [
'opal/app.js',
Expand All @@ -17,6 +19,8 @@ module.exports = function(config){
__dirname + '/../intrahospital_api/static/js/intrahospital_api/*.js',
__dirname + '/../apps/tb/static/js/tb/**/*',
__dirname + '/../apps/tb/static/js/test/**/*',
__dirname + '/../plugins/labtests/static/js/**/*',
__dirname + '/../plugins/labtests/static/js/**/*',
];

var defaultConfig = karmaDefaults(includedFiles, baseDir, coverageFiles);
Expand Down
26 changes: 26 additions & 0 deletions elcid/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import datetime
import re
from collections import defaultdict, OrderedDict
from plugins.labtests.api import RecentResultsApiView
from operator import itemgetter

from django.conf import settings
Expand Down Expand Up @@ -463,10 +464,35 @@ def create(self, request):
)


class AntifungalKeyInvestigations(RecentResultsApiView):
base_name = 'antifungal_key_investigations'
RELEVANT_TESTS = OrderedDict((
("BETA D GLUCAN TEST", [
"Beta Glucan test:"
"Beta Glucan concentration",
]),
("GALACTOMANNAN AGN. ELISA", [
"Galactomannan Agn. ELISA"
"Galactomannan Agn. INDEX",
]),
("T2MR", ["T2MR PCR result"]),
("ANTIFUNGAL DRUG ASSAY", [
"Antifungal Drug Assay of",
"Specimen Level"
])
),)


elcid_router = OPALRouter()
elcid_router.register(
UpstreamBloodCultureApi.base_name, UpstreamBloodCultureApi
)
elcid_router.register(
AntifungalKeyInvestigations.base_name, AntifungalKeyInvestigations
)
elcid_router.register(
AntifungalKeyInvestigations.base_name, AntifungalKeyInvestigations
)
elcid_router.register(DemographicsSearch.base_name, DemographicsSearch)
elcid_router.register(BloodCultureIsolateApi.base_name, BloodCultureIsolateApi)

Expand Down
5 changes: 5 additions & 0 deletions elcid/templates/detail/infection_service.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load panels %}
{% load forms %}
{% load key_investigations %}
<div class="col-md-6">
{% record_panel models.Location %}
{% teams_panel %}
Expand All @@ -14,6 +15,10 @@
</div>
{% endif %}

<div ng-if="patient.is_antifungal">
{% key_investigations "/elcid/v0.1/antifungal_key_investigations/" title="Antifungal Investgations" body_class="panel-body" %}
</div>


{% record_panel models.PrimaryDiagnosis %}

Expand Down
32 changes: 0 additions & 32 deletions intrahospital_api/management/commands/load_tests_from_json.py

This file was deleted.

81 changes: 0 additions & 81 deletions intrahospital_api/test/test_load_tests_from_json.py

This file was deleted.

Loading

0 comments on commit 408de78

Please sign in to comment.