Web Controller

Defines helper methods and handlers for eObs Mobile.

class nh_eobs_mobile.controllers.main.MobileFrontend[source]

Defines handler methods for routes defined in urls.

static calculate_ews_class(score)[source]

Returns the EWS class. :param score: EWS score :type score: str :returns: EWS class :rtype: str

d_three(**kw)[source]

Returns /static/lib/js/d3.js response object. :returns: /static/lib/js/d3.js :rtype: http.Response

get_big_icon(**kw)[source]

Returns /static/src/icon/hd_hi.png response object. :returns: /static/src/icon/hd_hi.png :rtype: http.Response

get_bristol_stools_chart(**kw)[source]

Returns /static/src/img/bristol_stools.png response object. :returns: /static/src/img/bristol_stools.png :rtype: http.Response

get_font(**kw)[source]

Returns font-woff response object from fonts contained in /static/srs/font/. :returns: a Web Open Font Format (WOFF) font :rtype: http.Response

get_jquery(**kw)[source]

Returns /static/src/js/jquery.js response object. :returns: /static/src/js/jquery.js :rtype: http.Response

Returns /static/src/img/open_eobs_logo.png response object. :returns: /static/src/img/open_eobs_logo.png :rtype: http.Response

get_manifest(**kw)[source]

Returns /static/src/manifest.json response object. :returns: /static/src/manifest.json :rtype: http.Response

get_observation_js(**kw)[source]

Returns /static/src/js/observation.js response object. :returns: /static/src/js/observation.js :rtype: http.Response

get_observation_validation(**kw)[source]

Returns /static/src/js/validation.js response object. :returns: /static/src/js/validation.js :rtype: http.Response

get_patient(**kw)[source]

Renders the patient view. :returns: patient response object :rtype: http.Response

get_patients(**kw)[source]

Returns the patient task list for patients. :returns: patient task list response object :rtype: http.Response

get_share_patients(**kw)[source]

Renders the shared patient list. :returns: shared patient list response object :rtype: http.Response

get_small_icon(**kw)[source]

Returns /static/src/icon/hd_small.png response object. :returns: /static/src/icon/hd_small.png :rtype: http.Response

get_stylesheet(**kw)[source]

Returns /static/src/css/nhc.css (custom stylesheet) response object. :returns: /static/src/css/nhc.css :rtype: http.Response

get_task(**kw)[source]

Returns a notification, observation or placement task. If the task is neither of these then an error is returned. :param task_id: id of task :type task_id: int :returns: task response object :rtype: http.Response

get_task_form(cr, uid, task, patient, request, context=None)[source]

Get the form for a task

Parameters:task – task object
Returns:tuple of form and form inputs
get_tasks(**kw)[source]

Renders the patient task list for tasks. :returns: task list response object :rtype: http.Response

graph_lib(**kw)[source]

Returns /static/src/js/nh_graphlib.js response object. :returns: /static/src/js/nh_graphlib.js :rtype: http.Response

index(**kw)[source]

Redirects user to task list if logged in. Otherwise the user will be redirect to login. :returns: Response :rtype: werkzeug.wrappers.Response object

mobile_login(**kw)[source]

Logs a user in (HTTP POST), redirecting to the task list. If username or password is invalid, the login page response is returned with a message. For HTTP GET, the the login page response is returned. :returns: Either task list or login response objects :rtype: http.Response

mobile_logout(**kw)[source]

Logs a user out, returning them to the login page. :returns: login page response object :rtype: http.Response

patient_graph_js(**kw)[source]

Returns /static/src/js/draw_ews_graph.js response object. :returns: /static/src/js/draw_ews_graph.js :rtype: http.Response

process_form(**kw)[source]
static process_form_fields(form_desc)[source]

Process the form fields and set them up for rendering

Parameters:form_desc – A list of form field dicts from get_form_description
Returns:tuple of list of processed form inputs and form dictionary
process_patient_list(cr, uid, patient_list, context=None)[source]
process_task_list(cr, uid, task_list, context=None)[source]

Process the task list from nh.eobs.api.get_activities

Parameters:
  • cr – Odoo cursor
  • uid – user id
  • task_list – list of tasks from get_activities
  • context – Odoo context
Returns:

list of tasks with extra processing

take_patient_observation(**kw)[source]

Renders the observation entry view. :returns: observations entry response object :rtype: http.Response

nh_eobs_mobile.controllers.main.abort_and_redirect(url)[source]

Aborts and redirects to url. :param url: URL :type url: str :returns: 302 Found status code and redirection to url

nh_eobs_mobile.controllers.main.ensure_db(redirect='/mobile/login/')[source]

Used by client when a http.route() has authentication method parameter as “none” (auth='none') and if the route is dependent on a database. If no database is found, it will redirect to URL assigned to redirect parameter. If database name is from a query parameter, it will be checked by http.db_filter() thus to avoid database forgery that could lead to xss attacks. :param redirect: URL to redirect to :type redirect: str :returns: None :rtype: NoneType