Open-eObs API Extensions

class nh_eobs_mental_health.models.nh_eobs_api.NHeObsAPI(pool, cr)[source]

Defines attributes and methods used by Open eObs in the making of patient observations.

_active_observations are the observation types supported by eObs.

discharge(*args, **kwargs)[source]

Extends discharge(), closing the spell of a patient.

Parameters:
  • hospital_number (str) – hospital number of the patient
  • data (dict) – may contain the key discharge_date
Returns:

True

Return type:

bool

get_active_observations(*args, **kwargs)[source]

Returns all active observation types supported by eObs, if the patient has an active spell.

Parameters:
  • cr – Odoo Cursor
  • uid – User doing operation
  • patient_id (int) – id of patient
  • context – Odoo context
Returns:

list of all observation types

Return type:

list

set_rapid_tranq(*args, **kwargs)[source]

Handles requests to the rapid_tranq endpoint for the controller.

When called with a ‘GET’ method a rapid_tranq parameter is returned in the body of the response with the current value.

When called with a ‘POST’ method a rapid_tranq parameter is expected in the body of the request with the new value to be set on the field. A rapid_tranq parameter is also returned in the body of the response with the new, updated rapid_tranq value.

Additionally a GET message can pass a check parameter with a boolean value (‘true’ or ‘false’) to test what the effect of a POST would be. The response will be the same as for the POST, but additionally will return a title and description with appropriate messages. If there will be no change in the state of the resource then the messages advise the user to reload their page, as of writing this that is the only known scenario a case where the user attempts to update the rapid_tranq field to a value it already has. Otherwise if the POST would result in an update, confirmation messages are returned.

Parameters:
  • request – Request object passed from a controller.
  • kwargs – Keyword arguments passed from a controller.
Returns:

JSON encoded string.

Return type:

str

transfer(*args, **kwargs)[source]

Extends transfer(), transferring a patient to a location.

  • Set transferred patients to not have obs_stop flag set
Parameters:
  • cr – Odoo cursor
  • uid – User doing the operation
  • hospital_number (str) – hospital number of the patient
  • data – dictionary parameter that may contain the key location
  • context – Odoo Context
Returns:

True

Return type:

bool