Skip to content

Commit

Permalink
updating the version number in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Nov 11, 2016
2 parents 1d0fa89 + 2e3af8b commit 3fa3d5e
Show file tree
Hide file tree
Showing 7 changed files with 334 additions and 16 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## 0.6.2.2 Release

Adds back in date of admission into the add episode modal


## 0.6.2.1 Release

Adds an additional session logger that logs session information.


## 0.6.2 Release

Updates to the email logger providing system information.

The Weekend patient list, allowing the doctors covering weekends to have a patient list covering patients from multiple departments.

## 0.6.1 Release
We now use the field='modelName.field' api for all our forms, this lets us infer attributes such as max length

Expand Down
50 changes: 43 additions & 7 deletions data/lookuplists/lookuplists.json
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,10 @@
"name": "Aspiration Pneumonia",
"synonyms": []
},
{
"name": "Atypical Pneumonia",
"synonyms": []
},
{
"name": "Aseptic Meningitis",
"synonyms": []
Expand Down Expand Up @@ -2445,6 +2449,10 @@
"Hospital Acquired Pneumonia"
]
},
{
"name": "Heart failure",
"synonyms": []
},
{
"name": "Henoch-Sch\u00f6nlein purpura",
"synonyms": []
Expand Down Expand Up @@ -2588,6 +2596,10 @@
"name": "Hypokalaemia",
"synonyms": []
},
{
"name": "Hyponatraemia",
"synonyms": []
},
{
"name": "Hypoparathyroidism",
"synonyms": []
Expand Down Expand Up @@ -2931,11 +2943,15 @@
]
},
{
"name": "Neutropenic sepsis",
"name": "Sepsis (neutropaenic)",
"synonyms": [
"Neutropaenic sepsis"
]
},
{
"name": "Sepsis (non-neutropaenic)",
"synonyms": []
},
{
"name": "Non-Hodgkins Lymphoma",
"synonyms": []
Expand Down Expand Up @@ -3014,7 +3030,7 @@
},
{
"name": "Osteoarthritis",
"synonyms": []
"synonyms": ["OA"]
},
{
"name": "Osteomyelitis",
Expand Down Expand Up @@ -3217,6 +3233,10 @@
"name": "Psoriasis",
"synonyms": []
},
{
"name": "Psoriatic arthritis",
"synonyms": []
},
{
"name": "Pulmonary Fibrosis",
"synonyms": []
Expand Down Expand Up @@ -3267,6 +3287,10 @@
"name": "Rabies",
"synonyms": []
},
{
"name": "Rash of Unknown Aetiology",
"synonyms": []
},
{
"name": "Rat-bite fever",
"synonyms": []
Expand Down Expand Up @@ -3307,10 +3331,6 @@
"RA"
]
},
{
"name": "Rheumatoid Arthtitis",
"synonyms": []
},
{
"name": "Rickettsialpox",
"synonyms": []
Expand Down Expand Up @@ -3395,6 +3415,10 @@
"name": "Secondary Syphilis",
"synonyms": []
},
{
"name": "Sepsis",
"synonyms": []
},
{
"name": "Septicaemia",
"synonyms": []
Expand All @@ -3409,6 +3433,10 @@
"Infected Bursitis"
]
},
{
"name": "Seronegative inflammatory arthritis",
"synonyms": []
},
{
"name": "Severe falciparum malaria",
"synonyms": []
Expand Down Expand Up @@ -3437,6 +3465,10 @@
"name": "Sickle-cell trait",
"synonyms": []
},
{
"name": "Sinusitis",
"synonyms": []
},
{
"name": "Sj\u00f6gren's syndrome",
"synonyms": []
Expand Down Expand Up @@ -4101,6 +4133,10 @@
{
"name": "Erythema Nodosum",
"synonyms": []
},
{
"name": "Uterine fibroid",
"synonyms": []
}
],
"consultant": [
Expand Down Expand Up @@ -4165,7 +4201,7 @@
"synonyms": []
},
{
"name": "Victoria Johnson",
"name": "Victoria Johnston",
"synonyms": []
}
],
Expand Down
68 changes: 62 additions & 6 deletions elcid/middleware.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,69 @@
from django.conf import settings
from django.db import connection
from datetime import datetime
import logging
import time
import random
from datetime import datetime

logger = logging.getLogger('elcid.requestLogger')
from django.conf import settings
from django.db import connection


class SessionMiddleware(object):
logger = logging.getLogger('elcid.sessionLogger')

def process_request(self, request):
username = 'anonymous'
path = request.path
# add an empty line seprator per request
self.logger.info('')

if request.user.is_authenticated():
username = request.user.username
self.logger.info('{0} received a request with user {1} for {2}'.format(
datetime.now().strftime('%d/%m/%Y %H:%M:%S'), username, path
))
self.logger.info('cookies')
self.logger.info(request.COOKIES)
self.logger.info('session')
self.logger.info(request.session.items())
expiry = request.session.get_expiry_date().isoformat()
self.logger.info('expiry {}'.format(expiry))

def process_response(self, request, response):
username = 'anonymous'
path = request.path

if request.user.is_authenticated():
username = request.user.username

self.logger.info('responding to a request with user {0} for {1}'.format(
username, path
))

if request.user.is_authenticated():
if 'expired_token' in request.session:
self.logger.info(
'now logged in, clearing {}'.format(
request.session['expired_token']
)
)
del request.session['expired_token']

if not request.user.is_authenticated():
if "expired_token" not in request.session:
expiration_id = random.randint(1, 1000000000)
self.logger.info(
'no session token found, setting expiry to {}'.format(
expiration_id
)
)
request.session["expired_token"] = expiration_id

return response


class LoggingMiddleware(object):
logger = logging.getLogger('elcid.requestLogger')

def process_request(self, request):
self.start_time = time.time()

Expand All @@ -23,11 +79,11 @@ def process_response(self, request, response):
sql_time = sum(float(q['time']) for q in connection.queries) * 1000
extra_log += " (%s SQL queries, %s ms)" % (len(connection.queries), sql_time)

logger.info("%s %s %s %s %s (%.02f seconds)%s" % (
self.logger.info("%s %s %s %s %s (%.02f seconds)%s" % (
datetime.now(), username, request.method, request.get_full_path(),
response.status_code, req_time, extra_log)
)
except Exception, e:
logging.error("LoggingMiddleware Error: %s" % e)

return response
23 changes: 21 additions & 2 deletions elcid/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
'opal.middleware.DjangoReversionWorkaround',
'reversion.middleware.RevisionMiddleware',
'axes.middleware.FailedLoginMiddleware',
'elcid.middleware.SessionMiddleware',
'elcid.middleware.LoggingMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
Expand Down Expand Up @@ -216,7 +217,7 @@
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'elcid.log.ConfidentialEmailer'
}
},
},
'loggers': {
'django.request': {
Expand All @@ -229,9 +230,27 @@
'level': 'INFO',
'propagate': True,
},
'elcid.sessionLogger': {
'handlers': ['console'],
'level': 'INFO',
'propagate': False,
}
}
}

if 'test' not in sys.argv:
# lets not log to files on travis
LOGGING["handlers"]["session"] = {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': os.path.join(
PROJECT_PATH, "..", "..", "log", "session.log"
)
}
LOGGING["loggers"]["elcid.sessionLogger"]["handlers"] = ['session']



# Honor the 'X-Forwarded-Proto' header for request.is_secure()
# (Heroku requirement)
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
Expand Down Expand Up @@ -278,8 +297,8 @@
EMAIL_HOST = 'localhost'


VERSION_NUMBER = '0.6.2'

VERSION_NUMBER = '0.6.2.2'
#TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
#TEST_RUNNER = 'django_test_coverage.runner.CoverageTestSuiteRunner'

Expand Down
6 changes: 6 additions & 0 deletions elcid/templates/add_episode_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
{% block modal_body %}
<form class="form-horizontal" name="form">
{% include 'partials/_core_demographics.html' %}
<div ng-show="!editing.demographics.external_system">
{% datepicker label="Date of admission" model="editing.date_of_admission" %}
{% select label="Hospital" model="editing.location.hospital" lookuplist="hospital_list" %}
{% select label="Ward" model="editing.location.ward" lookuplist="ward_list" %}
{% input label="Bed" model="editing.location.bed" %}
</div>
{% if teams %}
{% include 'partials/_teams_select.html' %}
{% endif %}
Expand Down
Loading

0 comments on commit 3fa3d5e

Please sign in to comment.