Skip to content

Commit

Permalink
Merge pull request #306 from openhealthcare/v0.2.9-part-2-no-gloss
Browse files Browse the repository at this point in the history
V0.2.9 part 2 no gloss
  • Loading branch information
davidmiller committed Nov 28, 2017
2 parents b5fb8c8 + 851deff commit 1afb954
Show file tree
Hide file tree
Showing 22 changed files with 8 additions and 1,034 deletions.
34 changes: 1 addition & 33 deletions elcid/api.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import json
import datetime
from django.conf import settings
from collections import defaultdict

from rest_framework import viewsets
from rest_framework.response import Response
from elcid import gloss_api
from opal.core.api import OPALRouter
from opal.core.api import PatientViewSet, patient_from_pk
from opal import models
from opal.core.api import patient_from_pk
from opal.core.views import json_response
from elcid import models as emodels

Expand All @@ -17,30 +13,6 @@
ANAEROBIC = "anaerobic"


class GlossEndpointApi(viewsets.ViewSet):
base_name = 'glossapi'

def create(self, request):
request_data = json.loads(request.data)
gloss_api.bulk_create_from_gloss_response(request_data)
return Response("ok")


def gloss_api_query_monkey_patch(fn):
"""
Decorator that passes an episode or returns a 404 from pk kwarg.
"""
def query_api_first(self, request, pk=None):
if settings.GLOSS_ENABLED:
patient = models.Patient.objects.get(pk=pk)
hospital_number = patient.demographics_set.get().hospital_number
gloss_api.patient_query(hospital_number)
return fn(self, request, pk=pk)
return query_api_first

PatientViewSet.retrieve = gloss_api_query_monkey_patch(PatientViewSet.retrieve)


class BloodCultureResultApi(viewsets.ViewSet):
base_name = 'blood_culture_results'

Expand Down Expand Up @@ -149,7 +121,3 @@ def retrieve(self, request, patient):

elcid_router = OPALRouter()
elcid_router.register(BloodCultureResultApi.base_name, BloodCultureResultApi)


gloss_router = OPALRouter()
gloss_router.register('glossapi', GlossEndpointApi)
14 changes: 0 additions & 14 deletions elcid/detail.py

This file was deleted.

194 changes: 0 additions & 194 deletions elcid/gloss_api.py

This file was deleted.

16 changes: 0 additions & 16 deletions elcid/management/commands/update_all_patients_from_gloss.py

This file was deleted.

7 changes: 0 additions & 7 deletions elcid/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ def set_death_indicator(self, value, *args, **kwargs):
class Meta:
verbose_name_plural = "Demographics"

@classmethod
def get_form_template(cls, patient_list=None, episode_type=None):
if settings.GLOSS_ENABLED:
return super(Demographics, cls).get_form_template(patient_list=None, episode_type=None)
else:
return "forms/demographics_form_pre_gloss.html"


class ContactDetails(PatientSubrecord):
_is_singleton = True
Expand Down
28 changes: 1 addition & 27 deletions elcid/pathways.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from lab import models as lmodels
from django.db import transaction
from django.conf import settings
from elcid import gloss_api


from opal.core.pathway.pathways import (
Expand Down Expand Up @@ -69,33 +68,8 @@ def save(self, data, user, patient=None, episode=None):
if the patient already exists, create a new episode.
if the patient doesn't exist and we're gloss enabled query gloss.
if the patient isn't in gloss, or gloss is down, just create a
new patient/episode
set the start date on the episode
"""
if settings.GLOSS_ENABLED:
demographics = data.get("demographics")
hospital_number = demographics[0]["hospital_number"]

if patient:
# the patient already exists

# refreshes the saved patient
gloss_api.patient_query(hospital_number)
episode = patient.create_episode()
else:
# the patient doesn't exist
patient = gloss_api.patient_query(hospital_number)

if patient:
# nuke whatever is passed in in demographics as this will
# have been updated by gloss
data.pop("demographics")
episode = patient.episode_set.get()

gloss_api.subscribe(hospital_number)

patient, episode = super(AddPatientPathway, self).save(
data, user=user, patient=patient, episode=episode
)
Expand Down
17 changes: 0 additions & 17 deletions elcid/search.py

This file was deleted.

10 changes: 0 additions & 10 deletions elcid/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,6 @@
'opal.wsgi')



GLOSS_ENABLED = False

if GLOSS_ENABLED:
GLOSS_URL_BASE = "http://0.0.0.0:6767"
GLOSS_USERNAME = "override_this"
GLOSS_PASSWORD = "and_override_this"
OPAL_SEARCH_BACKEND = "elcid.search.GlossQuery"


EXTRACT_ASYNC = True


Expand Down
11 changes: 0 additions & 11 deletions elcid/templates/forms/demographics_form_pre_gloss.html

This file was deleted.

Loading

0 comments on commit 1afb954

Please sign in to comment.