API¶
-
class
api.nh_eobs_api(pool, cr)[source]¶ Defines attributes and methods used by Open eObs in the making of patient observations.
_active_observationsare the observation types supported by eObs.-
admit(*args, **kwargs)[source]¶ Extends
admit(), admitting a patient into a specifiedlocation.Parameters: Returns: TrueReturn type:
-
admit_update(*args, **kwargs)[source]¶ Wraps
admit_update(), updating thespellinformation of apatient.Parameters: Returns: TrueReturn type:
-
assign(*args, **kwargs)[source]¶ Assigns an
activityto auser. Raises an exception if the user is not permitted to assign the activity or if the user being assigned cannot be located.Parameters: Raises: osv.except_osvReturns: TrueReturn type:
-
cancel(*args, **kwargs)[source]¶ Cancel an
activity, updating it with submitteddata.Parameters: Returns: TrueReturn type:
-
cancel_admit(*args, **kwargs)[source]¶ Extends
cancel_admit(), cancelling the openspellof apatient.Parameters: hospital_number (str) – hospital number of the patient Returns: TrueReturn type: bool
-
cancel_discharge(*args, **kwargs)[source]¶ Extends
cancel_discharge()of apatient.Parameters: hospital_number (str) – hospital number of the patient Returns: TrueReturn type: bool
-
cancel_transfer(*args, **kwargs)[source]¶ Extends
cancel_transfer(), cancelling the transfer of apatient.Parameters: hospital_number (str location) – hospital number of the patientReturns: TrueReturn type: bool
-
check_patient_responsibility(*args, **kwargs)[source]¶ Verifies that a
useris responsible for apatient.Parameters: Returns: Trueif user is responsible. OtherwiseFalseReturn type:
-
collect_activities(*args, **kwargs)[source]¶ Get activities from the database for a given domain
Parameters: - cr – odoo cursor
- uid – user to perform search as
- domain – domain to look for
- context – odoo context
Returns: list of dictionaries containing activities. See source for specific attributes returned for each activity
Return type:
-
collect_patients(*args, **kwargs)[source]¶ Collect patients for a given domain and return SQL output.
Parameters: - cr – Odoo cursor
- uid – user ID for user doing operation
- domain – search domain to use
- context – Odoo context
Returns: list of dicts
-
complete(*args, **kwargs)[source]¶ Completes an
activity. Raises an exception if theuseris not permitted to complete the activity.Parameters: Raises: osv.except_osvReturns: TrueReturn type:
-
create_activity_for_patient(*args, **kwargs)[source]¶ Creates an
activityof specified type for apatientif there is no open activity of that type for that patient. Raises exception if the activity type is invalid, if there’s no open spell for the patient or if there are no access rules for the activity type.Parameters: Raises: osv.except_osvReturns: id of activity
Return type:
-
discharge(*args, **kwargs)[source]¶ Extends
discharge(), closing thespellof apatient.Parameters: Returns: TrueReturn type:
-
follow_invite(*args, **kwargs)[source]¶ Creates a
follow activityfor theuserto follow thepatients. Raises an exception if the user is not responsible for a patient.Parameters: Raises: osv.except_osvReturns: id of the follow activity
Return type:
-
get_active_observations(*args, **kwargs)[source]¶ Returns all active observation types supported by eObs, if the
patienthas an activespell.Parameters: patient_id (int) – id of patient Returns: list of all observation types Return type: list
-
get_activities(*args, **kwargs)[source]¶ Gets a list of
activities.Parameters: ids (list) – ids of the activities. An empty list returns all activities Returns: list of dictionaries containing activities. See source for specific attributes returned for each activity Return type: list
-
get_activities_for_patient(*args, **kwargs)[source]¶ Returns a list of
activitiesfor apatientin a dictionary (containing every field from the table).Parameters: Returns: list of activity dictionaries for patient
Return type:
-
get_activities_for_spell(*args, **kwargs)[source]¶ Gets all
activitiesfor a patientspell.Parameters: - spell_id (int) – id for the patient spell
- activity_type (str) – The part of the model name after ‘observation.’
- start_date (str) – retrieve activities only on or after this
date. Must be provided if
activity_typehas also been given - end_date (str) – retrieve activities only on or before this
date. Must be provided if
activity_typehas also been given
Returns: list of dictionaries of activities, including all fields and values
Return type:
-
get_activity_score(*args, **kwargs)[source]¶ Gets the activity score for a
observation.Parameters: Returns: observation score. Otherwise
FalseReturn type:
-
get_assigned_activities(*args, **kwargs)[source]¶ Gets
usersopen assignedactivitiesof the specified type (any by default).Parameters: activity_type (str [default is None]) – type of activity [optional]Returns: list of dictionaries containing activities Return type: list
-
get_cancel_reasons(*args, **kwargs)[source]¶ Gets the
reasonfor each cancelledactivity.Returns: list of dictionaries of reasons Return type: list
-
get_data_visualisation_resources(*args, **kwargs)[source]¶ Get data visualisation resources for all installed observations that have data visualisation JS files defined
Returns: list of JS file URLs used for drawing graphs
-
get_followed_patients(*args, **kwargs)[source]¶ Returns a list of
patientsfollowed byuserin a dictionary (containing every field from the table).Parameters: uid (int) – id of the user Returns: list of patient dictionaries Return type: list
-
get_form_description(*args, **kwargs)[source]¶ Returns a description in dictionary format of the input fields that would be required in the user gui to submit the observation.
Parameters: patient_id (int) – patientidReturns: a list of dictionaries Return type: list
-
get_invited_users(*args, **kwargs)[source]¶ Expects the return value from get_patients or get_followed_patients and adds the users that have an open follow invitation for each patient.
-
get_patient_followers(*args, **kwargs)[source]¶ Expects the return value from get_patients or get_followed_patients and adds the followers for each patient.
-
get_patient_info(*args, **kwargs)[source]¶ Gets
patientinformation for a patient, includingactivities.Parameters: hospital_number (str) – hospital number of patient Returns: dictionary containing the patient fields. Return type: dict
-
get_patients(*args, **kwargs)[source]¶ Return containing every field from
patientfor each patients.Parameters: ids (list) – ids of the patients. If empty, then all patients are returned Returns: list of patient dictionaries Return type: list
Gets
userinformation name, id and number of patients responsible for) of each user who is responsible for any location located in any of the wards the user calling the method is responsible for.Parameters: uid (int) – id of user calling method Returns: list of dictionaries containing values name,idandpatientsfor each userReturn type: list
-
get_spell_activity_id(hospital_number)[source]¶ Return the spell activity ID for the patient with the given hospital number. Raises an exception if more than one spell is found.
Parameters: hospital_number (str) – Returns:
-
is_cancellable(*args, **kwargs)[source]¶ Checks if instances belonging to data model can be cancelled. Only data models which are notifications (i.e. either is or have inherited from
notification.Parameters: data_model (str) – data model Returns: TrueorFalseReturn type: bool
-
register(*args, **kwargs)[source]¶ Wraps
register(), register apatientin the system.Parameters: Returns: TrueReturn type:
-
remove_followers(*args, **kwargs)[source]¶ Removes followers (
users) frompatients. Raises an exception if the user is not responsible for a patient.Parameters: patient_ids (list) – ids of the patients to unfollow Raises: osv.except_osvReturns: TrueReturn type: bool
-
submit(*args, **kwargs)[source]¶ Updates submitted
activitydata.Parameters: Returns: TrueReturn type:
-
transfer(*args, **kwargs)[source]¶ Extends
transfer(), transferring apatientto alocation.Parameters: - hospital_number (str) – hospital number of the patient
- data – dictionary parameter that may contain the key
location
Returns: TrueReturn type:
-
unassign(*args, **kwargs)[source]¶ Unassign the
activityfrom theuser.Parameters: Returns: TrueReturn type:
-