Welcome to Open-eObs’s documentation!¶
Open-eObs is an electronic observation, ward management and task management software for Acute and Mental Health hospitals.
Open-eObs Base¶
The Open-eObs Base module provides all the functionality needed for an Acute hospital to manage it’s wards. Combined with the mobile module for observation entry this is all that’s needed for an Acute hospital.
Open-eObs API Wrapper¶
Defines the core methods for Open eObs in the taking of
patient
observations.
API¶
-
class
api.
nh_eobs_api
(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.-
admit
(*args, **kwargs)[source]¶ Extends
admit()
, admitting a patient into a specifiedlocation
.Parameters: Returns: True
Return type:
-
admit_update
(*args, **kwargs)[source]¶ Wraps
admit_update()
, updating thespell
information of apatient
.Parameters: Returns: True
Return type:
-
assign
(*args, **kwargs)[source]¶ Assigns an
activity
to 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_osv
Returns: True
Return type:
-
cancel
(*args, **kwargs)[source]¶ Cancel an
activity
, updating it with submitteddata
.Parameters: Returns: True
Return type:
-
cancel_admit
(*args, **kwargs)[source]¶ Extends
cancel_admit()
, cancelling the openspell
of apatient
.Parameters: hospital_number (str) – hospital number of the patient Returns: True
Return type: bool
-
cancel_discharge
(*args, **kwargs)[source]¶ Extends
cancel_discharge()
of apatient
.Parameters: hospital_number (str) – hospital number of the patient Returns: True
Return 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: True
Return type: bool
-
check_patient_responsibility
(*args, **kwargs)[source]¶ Verifies that a
user
is responsible for apatient
.Parameters: Returns: True
if user is responsible. OtherwiseFalse
Return 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 theuser
is not permitted to complete the activity.Parameters: Raises: osv.except_osv
Returns: True
Return type:
-
create_activity_for_patient
(*args, **kwargs)[source]¶ Creates an
activity
of specified type for apatient
if 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_osv
Returns: id of activity
Return type:
-
discharge
(*args, **kwargs)[source]¶ Extends
discharge()
, closing thespell
of apatient
.Parameters: Returns: True
Return type:
-
follow_invite
(*args, **kwargs)[source]¶ Creates a
follow activity
for theuser
to follow thepatients
. Raises an exception if the user is not responsible for a patient.Parameters: Raises: osv.except_osv
Returns: id of the follow activity
Return type:
-
get_active_observations
(*args, **kwargs)[source]¶ Returns all active observation types supported by eObs, if the
patient
has 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
activities
for apatient
in 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
activities
for 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_type
has also been given - end_date (str) – retrieve activities only on or before this
date. Must be provided if
activity_type
has 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
False
Return type:
-
get_assigned_activities
(*args, **kwargs)[source]¶ Gets
users
open assignedactivities
of 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
reason
for 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
patients
followed byuser
in 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) – patient
idReturns: 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
patient
information 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
patient
for 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
user
information 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
,id
andpatients
for 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: True
orFalse
Return type: bool
-
register
(*args, **kwargs)[source]¶ Wraps
register()
, register apatient
in the system.Parameters: Returns: True
Return 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_osv
Returns: True
Return type: bool
-
submit
(*args, **kwargs)[source]¶ Updates submitted
activity
data.Parameters: Returns: True
Return type:
-
transfer
(*args, **kwargs)[source]¶ Extends
transfer()
, transferring apatient
to alocation
.Parameters: - hospital_number (str) – hospital number of the patient
- data – dictionary parameter that may contain the key
location
Returns: True
Return type:
-
unassign
(*args, **kwargs)[source]¶ Unassign the
activity
from theuser
.Parameters: Returns: True
Return type:
-
Base Extension¶
Extends nh_clinical_location
for
additional Open eObs UI.
UI Location¶
-
class
base_extension.
nh_ui_location
(pool, cr)[source]¶ Extends
location
.-
_get_patient_info
(*args, **kwargs)[source]¶ Used by function fields
patient_score
andpatient_risk
to get the currentEWS
information for eachpatient
in an openspell
.
-
Exceptions¶
Python’s standard exception class hierarchy.
Exceptions found here are defined both in the exceptions module and the built-in namespace. It is recommended that user-defined exceptions inherit from Exception. See the documentation for the exception inheritance hierarchy.
Helpers¶
Import Validation¶
Extensions to nh_clinical module¶
nh_clinical_extension.py extends several NH Clinical classes to add relevant observations related functionality.
Extensions to nh_observation module¶
Frequency Notification Extension¶
Critical Care Extension¶
Diabetes Extension¶
MRSA Extension¶
o2 Target Extension¶
Blood Product Observation Extension¶
Bowels Open Observation Extension¶
EWS Observation Extension¶
Height Observation Extension¶
Pain Observation Extension¶
Urine Output Observation Extension¶
Palliative Care Extension¶
Postural Blood Pressure Monitoring Extension¶
Post Surgery Extension¶
Overdue Tasks¶
Defines overdue
and
doctors activities
.
Doctor Activities¶
-
class
overdue.
nh_clinical_doctor_activities
(pool, cr)[source]¶ Extends
activity
to create doctor activities used by view Doctor Tasks. Shows alldoctor assessment
activities still pending. i.e. not completed or cancelled.-
activity_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
location
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
summary
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
Overdue Tasks¶
-
class
overdue.
nh_clinical_overdue
(pool, cr)[source]¶ Extends
activity
to create overdue activities used by view overdue_view.xml Includes fieldsdelay_string
to record time overdue anduser_name
to record user the activity is assigned to.-
activity_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
delay
¶
-
delay_string
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
groups
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
location
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
name
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
nhs_number
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
parent_location
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
patient_name
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
state
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
Patient Monitoring Exception¶
Contains models related to patient monitoring exceptions.
Patient Monitoring Exception¶
-
class
nh_eobs.models.nh_clinical_patient_monitoring_exception.
PatientMonitoringException
(pool, cr)[source]¶ A ‘patient monitoring exception’ is a waiver on the regular monitoring of a patient. While a patient monitoring exception is in effect the system will not enforce observations on a patient in the usual way as there is some reason why the patient cannot be or should not be monitored.
Patient monitoring exceptions are implemented as activity data related to an activity. When the activity is ‘started’ then the patient monitoring exception is in effect. When the activity is ‘completed’ then the patient monitoring exception ceases and normal monitoring resumes.
-
get_activities_by_spell_activity
(spell_activity)[source]¶ Get all patient monitoring exception activities from the passed spell activity.
Parameters: spell_activity – Returns:
-
get_activity_by_spell_activity
(spell_activity)[source]¶ Get a patient monitoring exception activity from the passed spell activity.
Parameters: spell_activity – Returns:
-
reason
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
spell
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
Patient Monitoring Exception Reason¶
-
class
nh_eobs.models.nh_clinical_patient_monitoring_exception.
PatientMonitoringExceptionReason
(pool, cr)[source]¶ A ‘patient monitoring exception reason’ is any reason why a patient is currently not being monitored (i.e. regular observations are not being performed).
-
display_text
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
Patient Placement¶
Shows all patients
pending a
placement
in a
bed location
.
Patient Placement¶
-
class
placement.
nh_clinical_placement
(pool, cr)[source]¶ Extends
activity
to create placement activities, showing allplacements
activities still pending. i.e. not completed or cancelled. These will bepatients
waiting to be ‘placed’ in abed location
.-
activity_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
complete
(*args, **kwargs)[source]¶ Extends
complete()
to place apatient
in a bedlocation
.Parameters: ids (list) – ids of placement Returns: an action to present a form view of placement
Return type: dict
-
hospital_number
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
location_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
nhs_number
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
pos_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
Hospital Policy¶
Defines the policy for operations
and
ADT
.
See trigger_policy()
for how policies are executed.
Patient Report¶
Creates a report containing information about observations performed on a patient.
Terminology¶
report entry: A single line on the report. One activity may result in multiple ‘entries’ on the report.
report data: A giant dictionary containing all data that will be used to generate the report.
Report¶
-
class
nh_eobs.report.report_nh_clinical_observation_report.
ObservationReport
(pool, cr)[source]¶ -
-
classmethod
build_monitoring_exception_domain
(spell_activity_id, start_date=None, end_date=None)[source]¶ Contained in the domain is all the business logic for deciding whether an activity may need to be included on the report in some way.
The domain uses Polish Notation. You can learn how to read it on Wikipedia.
Parameters: - spell_activity_id –
- start_date –
- end_date –
Returns:
-
create_patient_monitoring_exception_dictionary
(data, spell_activity_id)[source]¶ Creates a dictionary containing data for patient monitoring exceptions that can be used to populate the observation report.
Parameters: - data –
- spell_activity_id (int) –
Returns: Return type:
-
get_activity_data
(*args, **kwargs)[source]¶ Returns a list of dictionaries, each one representing the values of one :class:<nh_activity.activity.nh_activity> record.
Parameters: - spell_activity_id –
- model (str) – The name of the model matching the type of activity data to retrieve activities for.
- start_time –
- end_time –
Returns: Return type:
-
get_and_process_report_data
(data)[source]¶ Calls get_report_data as well as some additional methods that massage the data.
Parameters: data – Returns: Return type: dict
-
get_ews_observations
(*args, **kwargs)[source]¶ Gets all completed or cancelled EWS observations associated with the passed spell activity id and returns them as a list of dictionaries.
Parameters: - data –
- spell_activity_id (int) –
Returns: Return type:
-
get_model_data
(spell_activity_id, model, start, end)[source]¶ Get activities associated with the passed model and spell id and return them as a dictionary.
Parameters: Returns: Activities for the passed spell id and model within the date range.
Return type:
-
get_model_values
(model, activity_data)[source]¶ Adds a values key to the passed activity dictionary which is associated with another dictionary of values representing the record which is the data ref of the passed activity.
Parameters: Returns: Return type:
-
get_monitoring_exception_report_data_from_activities
(pme_activity_ids)[source]¶ Calls :method:<get_monitoring_exception_report_data_from_activity> recursively.
Parameters: pme_activity_ids (list) – Returns: Return type: dict
-
get_monitoring_exception_report_data_from_activity
(pme_activity_id)[source]¶ Gets data from the activities with the passed ids and returns a dictionary containing just the values needed for the observation report.
Parameters: pme_activity_id (int) – Returns: Return type: dict
-
get_patient_monitoring_exception_activity_ids
(spell_activity_id, start_date=None, end_date=None)[source]¶ Returns a list of ids for all activities whose information should be included in the report. Exactly what entries should be created for these activities on the report is decided later.
Parameters: Returns:
-
get_patient_monitoring_exception_report_data
(spell_activity_id, start_date=None, end_date=None)[source]¶ Returns a dictionary with a ‘patient_monitoring_exception_history’ key which contains a list of dictionaries containing data for ‘new style’ patient monitoring exceptions. These are patient monitoring exceptions which are records of the :class:<nh_eobs.models.PatientMonitoringException> model.
The data returned is meant for use on the observation report, it is not a full representation of the record, just a few fields that are ready to be mapped directly onto the report.
The ‘patient_monitoring_exception_history’ list is sorted chronologically.
Parameters: Returns: Return type:
-
get_report_data
(data, ews_only=False)[source]¶ Returns a dictionary that will be used to populate the report. Most of the values are themselves dictionaries returned by activity.read(). However they also have an additional key named ‘values’ that contains the activities data_ref record as dictionaries returned by model.read().
Parameters: - data –
- ews_only –
Returns: Return type:
-
get_report_entry_dictionary
(pme_activity_id, pme_started=True)[source]¶ Creates a dictionary that contains the data that will be used to populate the report for a single entry concerning a patient monitoring exception activity.
Contains various bits of logic to return different values depending on whether the PME has been started, stopped, or cancelled.
Parameters: Returns: Return type:
-
get_triggered_action_ids
(*args, **kwargs)[source]¶ Recursively get the triggered actions of the activity passed to it and then it’s children and so on.
Parameters: - activity_id (int) – The current activity under inspection
- activity_list – the list to use
Returns: list of activity ids
Return type:
-
is_activity_date_terminated_within_date_range
(activity, start_date=None, end_date=None)[source]¶ Returns a boolean indicating whether a particular activity’s date_terminated field falls within the specified date range.
Parameters: Returns: Return type:
-
static
is_date_range_within_active_pme
(activity, start_date, end_date)[source]¶ Checks to see if supplied start and end dates are within a PME event
Parameters: - activity – PME activity
- start_date – report start date
- end_date – report end date
Returns: True if date range within activities date range, False if not
Return type:
-
classmethod
is_datetime_within_range
(date_time, start_date=None, end_date=None)[source]¶ Returns a boolean indicating whether the passed datetime falls within the specified date range.
Parameters: Returns: Return type:
-
monitoring_dict
= {'critical_care_history': 'nh.clinical.patient.critical_care', 'diabetes_history': 'nh.clinical.patient.diabetes', 'mrsa_history': 'nh.clinical.patient.mrsa', 'palliative_care_history': 'nh.clinical.patient.palliative_care', 'post_surgery_history': 'nh.clinical.patient.post_surgery', 'targeto2': 'nh.clinical.patient.o2target'}¶
-
patient_id
= None¶
-
render_html
(*args, **kwargs)[source]¶ ” This is a special method that the Odoo report module executes instead of it’s built-in render_html method when generating a report.
-
spell_activity_id
= None¶
-
classmethod
Helpers for the report¶
-
class
nh_eobs.report.helpers.
DataObj
(spell_id=None, start_time=None, end_time=None, ews_only=None)[source]¶
-
nh_eobs.report.helpers.
convert_db_date_to_context_date
(cr, uid, date_string, dformat, context=None)[source]¶
-
nh_eobs.report.helpers.
create_search_filter
(spell_activity_id, model, start_datetime, end_datetime, states='completed', date_field='date_terminated')[source]¶
-
nh_eobs.report.helpers.
merge_dicts
(*dict_args)[source]¶ Given any number of dicts, shallow copy and merge into a new dict, precedence goes to key value pairs in latter dicts.
-
class
nh_eobs.report.helpers.
DataObj
(spell_id=None, start_time=None, end_time=None, ews_only=None)[source]
-
class
nh_eobs.report.helpers.
BaseReport
(user, company_name, company_logo, time_generated)[source]
-
class
nh_eobs.report.helpers.
ReportDates
(report_start, report_end, spell_start, spell_end)[source]
Open-eObs Settings¶
Settings Configuration Wizard¶
-
class
nh_eobs.settings.
NHEobsConfigSettings
(pool, cr)[source]¶ -
activity_period
¶
-
discharge_transfer_period
¶
-
workload_bucket_period
¶ One2many field; the value of such a field is the recordset of all the records in comodel_name such that the field inverse_name is equal to the current record.
Parameters: - comodel_name – name of the target model (string)
- inverse_name – name of the inverse Many2one field in comodel_name (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - limit – optional limit to use upon read (integer)
The attributes comodel_name and inverse_name are mandatory except in the case of related fields or field extensions.
-
Settings¶
-
class
nh_eobs.settings.
NHEobsSettings
(pool, cr)[source]¶ -
WORKLOAD_BUCKET_REGEX
= '^\\d+[-|+]{1}(\\d+)?.+$'¶
-
activity_period
¶
-
discharge_transfer_period
¶
-
workload_bucket_period
¶ One2many field; the value of such a field is the recordset of all the records in comodel_name such that the field inverse_name is equal to the current record.
Parameters: - comodel_name – name of the target model (string)
- inverse_name – name of the inverse Many2one field in comodel_name (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - limit – optional limit to use upon read (integer)
The attributes comodel_name and inverse_name are mandatory except in the case of related fields or field extensions.
-
Workload Bucket¶
-
class
nh_eobs.settings.
NHEobsWorkloadBucket
(pool, cr)[source]¶ -
name
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
sequence
¶
-
settings_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
SQL View Extensions¶
SQL Overrides¶
-
class
sql_statements.
NHEobsSQL
(pool, cr)[source]¶ -
WORKLOAD_BUCKET_EXTRACT
= '^(\\d+)[-|+]{1}(\\d+)?\\sminutes\\s([late|remain]+)$'¶
-
collect_activities_skeleton
= "\n select distinct activity.id,\n activity.summary,\n patient.id as patient_id,\n ews1.clinical_risk,\n case\n when activity.date_scheduled is not null then\n activity.date_scheduled::text\n when activity.create_date is not null then\n activity.create_date::text\n else ''\n end as deadline,\n case\n when activity.date_scheduled is not null then\n case when greatest(\n now() at time zone 'UTC', activity.date_scheduled) !=\n activity.date_scheduled\n then 'overdue: ' else '' end ||\n case when extract(days from (greatest(\n now() at time zone 'UTC', activity.date_scheduled) -\n least(now() at time zone 'UTC',\n activity.date_scheduled))) > 0\n then extract(days from (greatest(\n now() at time zone 'UTC', activity.date_scheduled) -\n least(now() at time zone 'UTC', activity.date_scheduled)\n )) || ' day(s) '\n else '' end ||\n to_char(justify_hours(greatest(now() at time zone 'UTC',\n activity.date_scheduled) - least(now() at time zone 'UTC',\n activity.date_scheduled)), 'HH24:MI') || ' hours'\n when activity.create_date is not null then\n case when greatest(now() at time zone 'UTC',\n activity.create_date) != activity.create_date\n then 'overdue: ' else '' end ||\n case when extract(days from (greatest(now() at time zone\n 'UTC', activity.create_date) - least(now() at time zone\n 'UTC', activity.create_date))) > 0\n then extract(days from (greatest(now() at time zone 'UTC',\n activity.create_date) - least(now() at time zone 'UTC',\n activity.create_date))) || ' day(s) '\n else '' end ||\n to_char(justify_hours(greatest(now() at time zone 'UTC',\n activity.create_date) - least(now() at time zone 'UTC',\n activity.create_date)), 'HH24:MI') || ' hours'\n else to_char((interval '0s'), 'HH24:MI') || ' hours'\n end as deadline_time,\n coalesce(patient.family_name, '') || ', ' ||\n coalesce(patient.given_name, '') || ' ' ||\n coalesce(patient.middle_names,'') as full_name,\n location.name as location,\n location_parent.name as parent_location,\n case\n when ews1.score is not null then ews1.score::text\n else ''\n end as ews_score,\n case\n when ews1.id is not null and ews2.id is not null and\n (ews1.score - ews2.score) = 0 then 'same'\n when ews1.id is not null and ews2.id is not null and\n (ews1.score - ews2.score) > 0 then 'up'\n when ews1.id is not null and ews2.id is not null and\n (ews1.score - ews2.score) < 0 then 'down'\n when ews1.id is null and ews2.id is null then 'none'\n when ews1.id is not null and ews2.id is null then 'first'\n when ews1.id is null and ews2.id is not null then 'no latest'\n end as ews_trend,\n case\n when position('notification' in activity.data_model)::bool\n then true\n else false\n end as notification\n from nh_activity activity\n inner join nh_activity spell_activity\n on spell_activity.id = activity.parent_id\n inner join nh_clinical_patient patient\n on patient.id = activity.patient_id\n inner join nh_clinical_location location\n on location.id = spell_activity.location_id\n inner join nh_clinical_location location_parent\n on location_parent.id = location.parent_id\n left join ews1 on ews1.spell_activity_id = spell_activity.id\n left join ews2 on ews2.spell_activity_id = spell_activity.id\n where activity.id in ({activity_ids})\n and spell_activity.state = 'started'\n order by deadline asc, activity.id desc\n "¶
-
collect_patients_skeleton
= "\n select distinct activity.id,\n patient.id,\n patient.dob,\n patient.gender,\n patient.sex,\n patient.other_identifier,\n case char_length(patient.patient_identifier) = 10\n when true then substring(patient.patient_identifier from 1\n for 3) || ' ' || substring(patient.patient_identifier from 4\n for 3) || ' ' || substring(patient.patient_identifier from 7\n for 4)\n else patient.patient_identifier\n end as patient_identifier,\n coalesce(patient.family_name, '') || ', ' ||\n coalesce(patient.given_name, '') || ' ' ||\n coalesce(patient.middle_names,'') as full_name,\n case\n when ews0.date_scheduled is not null then\n case when greatest(now() at time zone 'UTC',\n ews0.date_scheduled) != ews0.date_scheduled\n then 'overdue: ' else '' end ||\n case when extract(days from (greatest(now() at time zone\n 'UTC', ews0.date_scheduled) - least(now() at time zone\n 'UTC', ews0.date_scheduled))) > 0\n then extract(days from (greatest(now() at time zone 'UTC',\n ews0.date_scheduled) - least(now() at time zone 'UTC',\n ews0.date_scheduled))) || ' day(s) '\n else '' end ||\n to_char(justify_hours(greatest(now() at time zone 'UTC',\n ews0.date_scheduled) - least(now() at time zone 'UTC',\n ews0.date_scheduled)), 'HH24:MI') || ' hours'\n else to_char((interval '0s'), 'HH24:MI') || ' hours'\n end as next_ews_time,\n location.name as location,\n location_parent.name as parent_location,\n case\n when ews1.score is not null then ews1.score::text\n else ''\n end as ews_score,\n ews1.clinical_risk,\n case\n when ews1.id is not null and ews2.id is not null and\n (ews1.score - ews2.score) = 0 then 'same'\n when ews1.id is not null and ews2.id is not null and\n (ews1.score - ews2.score) > 0 then 'up'\n when ews1.id is not null and ews2.id is not null and\n (ews1.score - ews2.score) < 0 then 'down'\n when ews1.id is null and ews2.id is null then 'none'\n when ews1.id is not null and ews2.id is null then 'first'\n when ews1.id is null and ews2.id is not null then 'no latest'\n end as ews_trend,\n case\n when ews0.frequency is not null then ews0.frequency\n else 0\n end as frequency\n from nh_activity activity\n inner join nh_clinical_patient patient\n on patient.id = activity.patient_id\n inner join nh_clinical_location location\n on location.id = activity.location_id\n inner join nh_clinical_location location_parent\n on location_parent.id = location.parent_id\n left join ews1 on ews1.spell_activity_id = activity.id\n left join ews2 on ews2.spell_activity_id = activity.id\n left join ews0 on ews0.spell_activity_id = activity.id\n where activity.state = 'started' and activity.data_model =\n 'nh.clinical.spell' and activity.id in ({spell_ids})\n order by location\n "¶
-
discharge_transfer_skeleton
= "\n SELECT\n activity.spell_id AS spell_id,\n array_agg(DISTINCT users.id) AS user_ids,\n array_agg(DISTINCT users2.id) AS ward_user_ids\n FROM wb_spell_ranked activity\n INNER JOIN wb_{table}_ranked {table}\n ON {table}.parent_id = activity.id\n AND {table}.rank = 1 AND {table}.state = 'completed'\n INNER JOIN nh_clinical_patient_{table} {table}_data\n ON {table}_data.id = {table}.data_id\n INNER JOIN nh_clinical_location location\n ON location.id = {table}_data.{location_row}\n INNER JOIN ward_locations wl ON wl.id = location.id\n LEFT JOIN user_location_rel ulrel ON ulrel.location_id = location.id\n LEFT JOIN res_users users ON users.id = ulrel.user_id\n LEFT JOIN user_location_rel ulrel2 ON ulrel2.location_id = wl.ward_id\n LEFT JOIN res_users users2 ON users2.id = ulrel2.user_id\n WHERE now() AT TIME ZONE 'UTC' - {table}.date_terminated <\n INTERVAL '{time}'\n AND activity.rank = 1 AND activity.state = '{state}'\n GROUP BY activity.spell_id"¶
-
wardboard_skeleton
= "\n SELECT DISTINCT\n spell.id AS id,\n spell.patient_id AS patient_id,\n spell_activity.id AS spell_activity_id,\n spell_activity.date_started AS spell_date_started,\n spell_activity.date_terminated AS spell_date_terminated,\n spell.pos_id,\n spell.code AS spell_code,\n spell_activity.state AS spell_state,\n CASE\n WHEN extract(days FROM justify_hours(now() AT TIME ZONE 'UTC'\n - spell_activity.date_started)) > 0 THEN extract(days FROM\n justify_hours(now() AT TIME ZONE 'UTC' -\n spell_activity.date_started)) || ' day(s) '\n ELSE ''\n END || to_char(justify_hours(now() AT TIME ZONE 'UTC' -\n spell_activity.date_started), 'HH24:MI') time_since_admission,\n spell.move_date,\n patient.family_name,\n patient.given_name,\n patient.middle_names,\n CASE\n WHEN patient.given_name IS NULL THEN ''\n ELSE upper(substring(patient.given_name FROM 1 FOR 1))\n END AS initial,\n coalesce(patient.family_name, '') || ', ' ||\n coalesce(patient.given_name, '') || ' ' ||\n coalesce(patient.middle_names,'') AS full_name,\n location.name AS location,\n location.id AS location_id,\n wlocation.ward_id AS ward_id,\n patient.sex,\n patient.dob,\n patient.other_identifier AS hospital_number,\n CASE char_length(patient.patient_identifier) = 10\n WHEN TRUE THEN substring(patient.patient_identifier FROM 1 FOR 3)\n || ' ' || substring(patient.patient_identifier FROM 4 FOR 3) ||\n ' ' || substring(patient.patient_identifier FROM 7 FOR 4)\n ELSE patient.patient_identifier\n END AS nhs_number,\n extract(year FROM age(now(), patient.dob)) AS age,\n ews0.next_diff_polarity ||\n CASE\n WHEN ews0.date_scheduled IS NOT NULL THEN\n CASE WHEN extract(days FROM (greatest(now() AT TIME ZONE 'UTC',\n ews0.date_scheduled) - least(now() AT TIME ZONE 'UTC',\n ews0.date_scheduled))) > 0\n THEN extract(days FROM (greatest(now() AT TIME ZONE 'UTC',\n ews0.date_scheduled) - least(now() AT TIME ZONE 'UTC',\n ews0.date_scheduled))) || ' day(s) '\n ELSE '' END ||\n to_char(justify_hours(greatest(now() AT TIME ZONE 'UTC',\n ews0.date_scheduled) - least(now() AT TIME ZONE 'UTC',\n ews0.date_scheduled)), 'HH24:MI') || ' hours'\n ELSE to_char((INTERVAL '0s'), 'HH24:MI')\n END AS next_diff,\n CASE ews0.frequency < 60\n WHEN true THEN ews0.frequency || ' min(s)'\n ELSE ews0.frequency/60 || ' hour(s) ' || ews0.frequency -\n ews0.frequency/60*60 || ' min(s)'\n END AS frequency,\n ews0.date_scheduled,\n CASE WHEN ews1.id IS NULL THEN 'none' ELSE ews1.score::text END\n AS ews_score_string,\n ews1.score AS ews_score,\n CASE\n WHEN ews1.id IS NOT NULL AND ews2.id IS NOT NULL\n AND (ews1.score - ews2.score) = 0 THEN 'same'\n WHEN ews1.id IS NOT NULL AND ews2.id IS NOT NULL\n AND (ews1.score - ews2.score) > 0 THEN 'up'\n WHEN ews1.id IS NOT NULL AND ews2.id IS NOT NULL\n AND (ews1.score - ews2.score) < 0 THEN 'down'\n WHEN ews1.id IS NULL AND ews2.id IS NULL THEN 'none'\n WHEN ews1.id IS NOT NULL AND ews2.id IS NULL THEN 'first'\n WHEN ews1.id IS NULL AND ews2.id IS NOT NULL THEN 'no latest'\n END AS ews_trend_string,\n CASE WHEN ews1.id IS NULL THEN 'NoScore' ELSE ews1.clinical_risk END\n AS clinical_risk,\n ews1.score - ews2.score AS ews_trend,\n param.height,\n param.o2target_level_id AS o2target,\n CASE WHEN param.mrsa THEN 'yes' ELSE 'no' END AS mrsa,\n CASE WHEN param.diabetes THEN 'yes' ELSE 'no' END AS diabetes,\n CASE WHEN pbp.status THEN 'yes' ELSE 'no' END AS pbp_monitoring,\n CASE WHEN param.status THEN 'yes' ELSE 'no' END AS palliative_care,\n CASE\n WHEN param.post_surgery AND param.post_surgery_date > now() -\n INTERVAL '4h' THEN 'yes'\n ELSE 'no'\n END AS post_surgery,\n CASE\n WHEN param.critical_care AND param.critical_care_date > now() -\n INTERVAL '24h' THEN 'yes'\n ELSE 'no'\n END AS critical_care,\n param.uotarget_vol,\n param.uotarget_unit,\n consulting_doctors.names AS consultant_names,\n CASE\n WHEN spell_activity.date_terminated > now() - INTERVAL '{time}'\n AND spell_activity.state = 'completed' THEN true\n ELSE false\n END AS recently_discharged\n\n FROM nh_clinical_spell spell\n INNER JOIN nh_activity spell_activity\n ON spell_activity.id = spell.activity_id\n INNER JOIN nh_clinical_patient patient ON spell.patient_id = patient.id\n LEFT JOIN nh_clinical_location location ON location.id = spell.location_id\n LEFT JOIN ews1 ON spell.id = ews1.spell_id\n LEFT JOIN ews2 ON spell.id = ews2.spell_id\n LEFT JOIN ews0 ON spell.id = ews0.spell_id\n LEFT JOIN ward_locations wlocation ON wlocation.id = location.id\n LEFT JOIN consulting_doctors ON consulting_doctors.spell_id = spell.id\n LEFT JOIN pbp pbp ON pbp.spell_id = spell.id\n LEFT JOIN param ON param.spell_id = spell.id\n ORDER BY location.name"¶
-
wb_transfer_ranked_skeleton
= "\n select *\n from (\n select\n spell.id as spell_id,\n activity.*,\n split_part(activity.data_ref, ',', 2)::int as data_id,\n rank() over (partition by spell.id, activity.data_model,\n activity.state order by activity.sequence desc)\n from nh_clinical_spell spell\n inner join nh_activity activity\n on activity.spell_activity_id = spell.activity_id\n and activity.data_model = 'nh.clinical.patient.transfer') sub_query\n where rank = 1\n "¶
-
workload_skeleton
= "\n WITH activity AS (\n SELECT\n activity.id AS id,\n spell.id AS activity_id,\n extract (EPOCH FROM (coalesce(activity.date_scheduled,\n activity.date_deadline) - now() AT TIME ZONE 'UTC'))::INT/60\n AS proximity,\n activity.summary AS summary,\n activity.state AS state,\n activity.user_id AS user_id,\n coalesce(activity.date_scheduled,\n activity.date_deadline) AS date_scheduled,\n activity.data_model AS data_model,\n patient.other_identifier AS patient_other_id,\n patient.patient_identifier AS nhs_number,\n patient.family_name AS family_name,\n CASE\n WHEN patient.given_name IS NULL THEN ''\n ELSE upper(substring(patient.given_name FROM 1 FOR 1))\n END AS initial,\n ward.id AS ward_id\n FROM nh_activity activity\n INNER JOIN nh_clinical_patient patient\n ON activity.patient_id = patient.id\n INNER JOIN nh_clinical_location bed\n ON activity.location_id = bed.id\n INNER JOIN nh_clinical_location ward\n ON bed.parent_id = ward.id\n INNER JOIN nh_activity spell\n ON spell.data_model = 'nh.clinical.spell'\n AND spell.patient_id = activity.patient_id\n WHERE activity.state != 'completed'\n AND activity.state != 'cancelled'\n AND spell.state = 'started')\n SELECT\n id,\n activity_id,\n {proximity_interval},\n summary,\n state,\n user_id,\n date_scheduled,\n data_model,\n patient_other_id,\n nhs_number,\n ward_id,\n family_name,\n initial\n FROM activity"¶
-
Ward Dashboard¶
Gives an overview of the current state of ward and bed
locations
.
Bed Dashboard¶
-
class
ward_dashboard.
nh_eobs_bed_dashboard
(pool, cr)[source]¶ Extends
location
, providing an overall state of a bed location.It shows number of assigned and following nurses and hcas
users
as well as thepatient
placed in the bed.-
assigned_hca_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
assigned_nurse_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
hca_follower_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
location_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
nurse_follower_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
patient_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
Ward Dashboard¶
-
class
ward_dashboard.
nh_eobs_ward_dashboard
(pool, cr)[source]¶ Extends
location
, providing an overall state of a ward location.It shows number of related
users
by type, number of free beds, number ofpatients
by risk, number of waiting patients, etc.-
assigned_doctor_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
assigned_wm_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
bed_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
free_beds
¶
-
high_risk_patients
¶
-
kanban_color
¶
-
location_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
low_risk_patients
¶
-
med_risk_patients
¶
-
no_risk_patients
¶
-
noscore_patients
¶
-
patient_board
(*args, **kwargs)[source]¶ Returns an Odoo action which defines a form view for a
wardboard
for allpatients
in an openspell
andplaced
in a bedlocation
.Returns: Odoo action definition Return type: dict
-
patients_in_bed
¶
-
waiting_patient_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
waiting_patients
¶
-
Wardboard¶
Defines models for the Wardboard view.
Device Session¶
-
class
wardboard.
nh_clinical_device_session
(pool, cr)[source]¶ Extends
session
.-
device_session_complete
(*args, **kwargs)[source]¶ Returns an Odoo form window action for
device session complete
for the viewview_wardboard_device_session_complete_form
.Parameters: ids (list) – record ids Returns: Odoo action definition Return type: dict
-
Wardboard¶
-
class
wardboard.
nh_clinical_wardboard
(pool, cr)[source]¶ Represents a
patient
with basic patient information (admission, spell, location, etc.).Also includes
observation
data such asEWS
etc.Wardboard overrides the init method and others to provide an implementation that is backed by database views. When accessing fields on a wardboard, rather than allowing Odoo’s ORM to retrieve them from database tables, we are using function fields that call methods that execute hand-written SQL queries on database views. We ensure that the database views these methods use are created when the model is first loaded and it’s init method is called.
Calling create on wardboard fails. Instead you should just browse for them as if they already exist, using the spell id as the id (or multiple spell ids). The id(s) used are passed to the function fields to retrieve the data, so a wardboard record with the correct id simply has the means to get the data you’d expect, it does not need to be formally created.
-
age
¶
-
clinical_risk
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
company_logo
¶
-
consultant_names
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
critical_care
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
critical_care_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
date_scheduled
¶
-
device_session_start
(*args, **kwargs)[source]¶ Returns an Odoo form window action for
device session start
for the viewview_wardboard_device_session_start_form
.Parameters: ids (list) – records ids Returns: Odoo form window action Return type: dict
-
diabetes
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
diabetes_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
dob
¶
-
ews_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
ews_list_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
ews_score
¶
-
ews_score_string
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
ews_trend
¶
-
ews_trend_string
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
family_name
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
fields_view_get
([view_id | view_type='form'])[source]¶ Get the detailed composition of the requested view like fields, model, view architecture
Parameters: - view_id – id of the view or None
- view_type – type of the view to return if view_id is None (‘form’, ‘tree’, …)
- toolbar – true to include contextual actions
- submenu – deprecated
Returns: dictionary describing the composition of the requested view (including inherited views and extensions)
Raises: - AttributeError –
- if the inherited view has unknown position to work with other than ‘before’, ‘after’, ‘inside’, ‘replace’
- if some tag other than ‘position’ is found in parent view
- Invalid ArchitectureError – if there is view type other than form, tree, calendar, search etc defined on the structure
-
frequency
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
full_name
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
gcs_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
given_name
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
height
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
hospital_number
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
initial
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
location
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
location_full_name
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
location_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
middle_names
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
move_date
¶
-
move_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
mrsa
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
mrsa_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
next_diff
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
nhs_number
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
o2target
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
o2target_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
onchange_critical_care
(*args, **kwargs)[source]¶ Checks if any of the other special circumstances parameters are
True
and returns a warning if that is the case.Parameters: Returns: dictionary containing warning and/or values
Return type:
-
onchange_palliative_care
(*args, **kwargs)[source]¶ Checks if any of the other special circumstances parameters are
True
and returns a warning if that is the case.Parameters: Returns: dictionary containing warning and/or values
Return type:
-
onchange_post_surgery
(*args, **kwargs)[source]¶ Checks if any of the other special circumstances parameters are
True
and returns a warning if that is the case.Parameters: Returns: dictionary containing warning and/or values
Return type:
-
open_previous_spell
(*args, **kwargs)[source]¶ Returns an Odoo form window action for
wardboard
for the viewview_wardboard_form_discharged
to open a previousspell
.Parameters: ids (list) – records ids Returns: Odoo form window action Return type: dict
-
pain_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
palliative_care
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
palliative_care_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
pbp_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
pbp_monitoring
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
pbp_monitoring_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
pos_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
post_surgery
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
post_surgery_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
recently_discharged
¶
-
recently_discharged_uids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
sex
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
spell_activity_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
spell_code
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
spell_date_started
¶
-
spell_date_terminated
¶
-
spell_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
spell_state
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
started_device_session_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
terminated_device_session_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
time_since_admission
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
transferred_user_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
uotarget_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
uotarget_unit
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
uotarget_vol
¶
-
urine_output_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
ward_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
wardboard_chart
(*args, **kwargs)[source]¶ Returns an Odoo form window action for
wardboard
for the viewview_wardboard_chart_form
.Parameters: ids (list) – records ids Returns: Odoo form window action Return type: dict
-
wardboard_ews
(*args, **kwargs)[source]¶ Returns an Odoo tree window action for completed
ews
.Parameters: ids (list) – records ids Returns: Odoo form window action Return type: dict
-
wardboard_patient_placement
(*args, **kwargs)[source]¶ Returns an Odoo form window action for
patient placement
for the viewview_wardboard_patient_placement_form
. Raises an exception ifpatient
isn’t placed in a bed.Parameters: ids (list) – records ids Raises: osv.except_osv
Returns: Odoo form window action Return type: dict
-
wardboard_place
(*args, **kwargs)[source]¶ Returns an Odoo form window action for
patient placement
for the viewview_patient_placement_complete
.Parameters: ids (list) – records ids Returns: Odoo form window action Return type: dict
-
wardboard_prescribe
(*args, **kwargs)[source]¶ Returns an Odoo form window action for
wardboard
for the viewview_wardboard_prescribe_form
.Parameters: ids (list) – records ids Returns: Odoo form window action Return type: dict
-
Device Session Complete¶
Device Session Start¶
-
class
wardboard.
wardboard_device_session_start
(pool, cr)[source]¶ Starts a
device
session.-
do_start
(*args, **kwargs)[source]¶ Starts a
session
for a device.Parameters: ids (list) – record ids Returns: True
Return type: bool
-
onchange_device_category_id
(*args, **kwargs)[source]¶ Returns domain dictionary containing the
type
id of thedevice
.Parameters: device_category_id (int) – category
id of the deviceReturns: domain dictionary containing device_type_id
Return type: dict
-
Patient Placement¶
Wizard¶
Notification Cancellation Wizard¶
Print Observation Wizard¶
-
class
nh_eobs.wizard.print_observation_report.
print_observation_report_wizard
(pool, cr)[source]¶ The model is used to capture options selected by the user for a report and then to delegate to ‘nh.clinical.observation_report’ to actually generate it.
The user can select a datetime range that they are interested in using the ‘Start Time’ and ‘End Time’ fields, only patient data created within that time frame will be shown on the generated report.
-
end_time
¶
-
print_report
(*args, **kwargs)[source]¶ Render the report name for the given IDs. The report must be defined for this model, not another.
-
start_time
¶
-
Workload¶
Shows the pending activities
by
proximity interval.
Workload¶
-
class
workload.
nh_clinical_workload
(pool, cr)[source]¶ Extends
activity
, categorising each pending activity by distance from when the activity is scheduled for, including overdue activities.-
activity_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
data_model
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
date_scheduled
¶
-
family_name
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
initial
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
nhs_number
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
patient_other_id
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
proximity_interval
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
state
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
summary
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
user_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
ward_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
Open-eObs ADT GUI¶
Spell Management¶
Defines models used for Open eObs spellboard UI.
Spell Board¶
-
class
nh_eobs_adt_gui.spell_management.
nh_clinical_spellboard
(pool, cr)[source]¶ Provides patient spell information and operations for the GUI.
-
activity_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Button called by view_spellboard_form view to call form to cancel the admission of a patient.
-
cancel_discharge
(*args, **kwargs)[source]¶ Cancels the discharge of one or more patients.
Parameters: ids (list) – spell ids Returns: True
if successful. OtherwiseFalse
Return type: bool
-
code
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
con_doctor_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
create
(*args, **kwargs)[source]¶ Admits a patients or raises an exception.
Parameters: vals (dict) – must contain keys patient_id
,location_id
,code
,start_date
,ref_doctor_ids
andcon_doctor_ids
Raises: osv.except_osv
Returns: id of new record Return type: int
Button called by view_spellboard_form view to call form to discharge patient.
-
fetch_patient_id
(*args, **kwargs)[source]¶ Fetch the patient_id from the provided Hospital Number or NHS Number.
-
format_data
(data)[source]¶ Removes any non alphanumeric symbols from hospital number and NHS number fields.
-
hospital_number
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
location_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
move_date
¶
-
nhs_number
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
pos_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
ref_doctor_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
start_date
¶
Button called by view_spellboard_form view to call form to transfer patient.
-
ward_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
Wizards¶
Defines wizards used by ADT GUI operations.
Cancel Patient Admit Wizard¶
-
class
nh_eobs_adt_gui.wizards.
CancelAdmitPatientWizard
(pool, cr)[source]¶ Wizard for cancelling the admission of a patient.
-
cancel_admit
(*args, **kwargs)[source]¶ Button called by view_cancel_transfer_wizard to cancel the admissions of a patient.
-
nhs_number
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
transfer_location_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
ward_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
Patient Discharge Wizard¶
-
class
nh_eobs_adt_gui.wizards.
DischargePatientWizard
(pool, cr)[source]¶ Wizard for discharging a patient.
-
discharge
(*args, **kwargs)[source]¶ Button called by view_discharge_wizard view to discharge patient.
-
nhs_number
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
ward_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
Patient Transfer Wizard¶
-
class
nh_eobs_adt_gui.wizards.
TransferPatientWizard
(pool, cr)[source]¶ Wizard for transferring a patient.
-
nhs_number
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
transfer_location_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
ward_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
Open-eObs Analysis¶
NEWS Report¶
Open-eObs NEWS OLAP Report¶
-
class
news.
nh_eobs_news_report
(pool, cr)[source]¶ -
clinical_risk
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
date_scheduled
¶
-
date_terminated
¶
-
delay
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
location_str
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
minutes_early
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
not_on_time
¶
-
on_time
¶
-
previous_risk
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
previous_score
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
score
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
staff_type
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
trend_down
¶
-
trend_same
¶
-
trend_up
¶
-
user_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
ward_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
Groupby Override¶
-
models_groupby.
read_group_format_result_override
(self, data, annotated_groupbys, groupby, groupby_dict, domain, context)[source]¶ Helper method to format the data contained in the dictionary data by adding the domain corresponding to its values, the groupbys in the context and by properly formatting the date/datetime values.
Open-eObs REST API¶
Routing¶
Response JSON¶
-
class
routing.
ResponseJSON
[source]¶ Class managing a JSON-encoded response (for an API request).
-
HEADER_CONTENT_TYPE
= {'Content-Type': 'application/json'}¶
-
STATUS_ERROR
= 'error'¶
-
STATUS_FAIL
= 'fail'¶
-
STATUS_SUCCESS
= 'success'¶
-
static
get_json_data
(status='error', title=False, description=False, data=False)[source]¶ Build a dictionary containing all the arguments’ data, and encode it as JSON.
Parameters: - status – A string with the status of the response (please, use the STATUS_* constants defined in this class!)
- title – A string with summary information about the response (in case of error: the name of the Exception)
- description – A string with complete information about the response (in case of error: the complete error message)
- data – A dictionary with the actual payload of the JSON response
Returns: A JSON-encoded dictionary containing all the data from the arguments passed to this function
-
Route¶
Route Manager¶
-
class
routing.
RouteManager
(server_protocol='http', server_address='localhost', server_port=None, url_prefix='/')[source]¶ Class storing and managing Route objects.
-
add_route
(route)[source]¶ Add a new route to the dictionary ROUTES.
Parameters: route – A Route object Raises: KeyError – If ‘name’ of the Route object to be added is the same of another Route object already in the dictionary
-
expose_route
(route_name, url_prefix=None)[source]¶ Expose all the properties of an existing route, formatted as a dictionary.
Parameters: - route_name – A string matching the ‘name’ key of the route to be returned
- url_prefix – A string add as a prefix when returning the ‘url’ property of the Route object
Returns: A dictionary with all the properties inside the Route object looked for
Raise: KeyError (if no Route object matching the ‘route_name’ parameter is found)
-
expose_route2
(route_name, url_prefix=None, additional_parameters=None)[source]¶ Expose all the properties of an existing route, formatted as a dictionary.
Parameters: - route_name – A string matching the ‘name’ key of the route to be returned
- url_prefix – A string add as a prefix when returning the ‘url’ property of the Route object
- additional_parameters – A dictionary with additional key-value arguments to be exposed
Returns: A dictionary with all the properties inside the Route object looked for
Raise: KeyError (if no Route object matching the ‘route_name’ parameter is found)
-
get_javascript_routes
(template_name, template_path, route_list=None, additional_context=None)[source]¶ Render a template file using Jinja.
Parameters: - template_name – The name of the template file
- template_path – The absolute path of the template file (omitting the name of the template file)
- route_list – A list of Route objects, used to render the template (OPTIONAL)
- additional_context – A dictionary that will extend the context used to render the template (OPTIONAL)
Returns: The template file rendered as a string (with a default template variable called “routes” that stores a list of Route objects)
-
Open-eObs Backup¶
Backup Procedure¶
Flag to indicate need to backup spell data¶
Locations to backup¶
Settings¶
-
class
backup_procedure.
NHClinicalObservationBackupSettings
(pool, cr)[source]¶ -
-
locations_to_print
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
Extension of observation complete method to set backup flag¶
Open-eObs Mobile¶
Open-eObs Mobile is the mobile interface used by clinical staff to submit observations, complete escalation tasks and view observation data.
Contents:
Mobile NFC¶
Adds functionality for NFC (Near Field Communication) user cards.
-
class
nfc_models.
nh_eobs_mobile_nfc
(pool, cr)[source]¶ Extend
users
with a card’s PIN field for NFC authentication.-
card_pin
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
Web Controllers¶
The main purpose of the Open-eObs Mobile module is supply a set of web controllers to allow for rendering pages.
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
-
get_logo
(**kw)[source]¶ 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
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
orplacement
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
-
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
-
static
-
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 tourl
-
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 toredirect
parameter. If database name is from a query parameter, it will be checked byhttp.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
Open-eObs Mental Health¶
Open-eObs Web Controller Overrides¶
Open-eObs Report Overrides¶
Clinical Review Report Extensions¶
-
class
nh_eobs_mental_health.report.clinical_review.
NhClinicalObservationReport
(pool, cr)[source]¶ -
-
add_extra_ews_with_clinical_review_in_datetime_range
(data, ews_activities, spell_activity_id)[source]¶
-
Refused Observation Report Extensions¶
-
class
nh_eobs_mental_health.report.refused_observations.
MentalHealthObservationReport
(pool, cr)[source]¶ -
get_clinical_review_column_data
(refusal_episode)[source]¶ Get the data necessary to populate the ‘Clinical Review’ column of the ‘Patient Refusal Events Data’ section of the observation report.
Parameters: refusal_episode (dict) – Raw data from the database. Returns: Return type: dict
-
get_clinical_review_frequency_set_column_data
(refusal_episode)[source]¶ Get the data necessary to populate the ‘Clinical Review Frequency Set’ column of the ‘Patient Refusal Events Data’ section of the observation report.
Parameters: refusal_episode (dict) – Raw data from the database. Returns: Return type: dict
-
get_first_refusal_column_data
(refusal_episode)[source]¶ Get the data necessary to populate the ‘First Refusal’ column of the ‘Patient Refusal Events Data’ section of the observation report.
Parameters: refusal_episode (dict) – Raw data from the database. Returns: Return type: dict
-
get_refusal_episodes
(spell_activity_id)[source]¶ Collect the refusal episodes for the spell provided
Parameters: spell_activity_id – Spell activity id for the patient Returns: list of dicts Return type: list
-
get_refusal_events_data
()[source]¶ Get a dictionary containing all the information necessary to populate the ‘Patient Refusal Events Data’ section of the observation report.
Returns: Return type: dict
-
get_refusals_until_news_obs_taken_column_data
(refusal_episode)[source]¶ Get the data necessary to populate the ‘Refusals Until News Obs Taken’ column of the ‘Patient Refusal Events Data’ section of the observation report.
Parameters: refusal_episode (dict) – Raw data from the database. Returns: Return type: dict
-
get_report_data
(data, ews_only=False)[source]¶ Returns a dictionary that will be used to populate the report. Most of the values are themselves dictionaries returned by activity.read(). However they also have an additional key named ‘values’ that contains the model record as dictionaries returned by model.read().
Parameters: - data –
- ews_only –
Returns: Return type:
-
get_task_column_data
(refusal_episode, clinical_review_frequency=False)[source]¶ Generic method that can get the necessary data for multiple different columns that display information about different types of task.
Parameters: Returns:
-
init
(*args, **kwargs)[source]¶ Create or replace the refused_chain_count table for use in get_refusal_episodes
Parameters: cr – Odoo cursor
-
Open-eObs Model Overrides¶
Overrides and extensions to classes lower down in the module dependencies.
Doctor Activity Extensions¶
Clinical Review Notification¶
Clinical Review Frequency Notification¶
Overdue Tasks Extensions¶
EWS Observation Extensions¶
-
class
nh_eobs_mental_health.models.nh_clinical_patient_observation_ews.
NHClinicalPatientObservationEWS
(pool, cr)[source]¶ Override of nh.clinical.patient.observation.ews for generic mental health behaviour
-
complete
(*args, **kwargs)[source]¶ It determines which acuity case the current observation is in with the stored data and responds to the different policy triggers accordingly defined on the
_POLICY
dictionary:{'ranges': [0, 4, 6], 'case': '0123', --> Used with bisect to determine the acuity case based on the score. 'frequencies': [720, 240, 60, 30], --> frequency of recurrency of the NEWS observation, based on the case. 'notifications': [...], Information sent to the trigger_notifications method, based on case. 'risk': ['None', 'Low', 'Medium', 'High']} --> Clinical risk of the patient, based on case.
All the case based lists work in a simple way: list[case] –> value used
After the policy triggers take place the activity is completed and a new NEWS activity is created. Then the case based frequency is applied, effectively scheduling it.
In the case of having a partial observation we won’t have a new frequency so the new activity is scheduled to the same time the one just completed was, as the need for a complete observation is still there.
Returns: True
Return type: bool
-
create_clinical_review_task
(*args, **kwargs)[source]¶ Create a ‘nh.clinical.notification.clinical_review’ record and associated activity.
Parameters: activity ('nh.activity' record) –
-
is_refusal_in_effect
(*args, **kwargs)[source]¶ Use the last_refused_ews SQL view to see if activity_id is part of a patient refusal
Parameters: - cr – Odoo cursor
- uid – User doing operation
- activity_id – <nh.activity> Activity ID
- mode – Mode to operate on, parent goes up chain, child goes down
- context – Odoo Context
Returns: If the patient is currently in refusal
-
partial_reason
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
Observation Stop Patient Monitoring Exception¶
-
class
nh_eobs_mental_health.models.nh_clinical_pme_obs_stop.
NhClinicalObsStop
(pool, cr)[source]¶ -
-
cancel_open_ews
(*args, **kwargs)[source]¶ Cancel all open EWS observations.
Parameters: - spell_activity_id – ID of the spell activity
- cancel_reason_id –
Returns: True is successful, False if not
-
create_new_ews
(*args, **kwargs)[source]¶ Create a new EWS task an hour in the future. Used when patient is taken off obs_stop.
Returns: ID of created EWS
-
classmethod
force_v7_api
(obj)[source]¶ Trick Odoo into thinking this is a 7.0 ORM API style method before the complete method is called on the activity. I believe there may be a problem in the decorator that is used on all activity data methods which specifically looks for all args. :param obj: :return:
-
reason
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
set_obs_stop_flag
(*args, **kwargs)[source]¶ Toggle the obs_stop flag on the spell object.
Parameters: value (bool) – Returns: True
-
set_refusing_obs_flag
(*args, **kwargs)[source]¶ Set the value of the ‘refusing_obs’ flag on the spell object
Parameters: value – Value to change flag too Returns: True
-
start_message
= 'Stop Observations'¶
-
stop_message
= 'Restart Observations'¶
-
Rapid Tranquilisation Patient Monitoring Exception¶
-
class
nh_eobs_mental_health.models.nh_clinical_pme_rapid_tranq.
NhClinicalRapidTranq
(pool, cr)[source]¶ -
-
static
changed
(set_value, existing_value)[source]¶ Indicates whether or not the 2 passed booleans are different from one another.
Parameters: - set_value –
- existing_value –
Returns: Return type:
-
check_set_rapid_tranq
(*args, **kwargs)[source]¶ Check what the effect of setting the rapid tranq status would be and return a dictionary with user-friendly messages which the caller can use for things such as raising exceptions and creating popups.
Parameters: set_value (bool) – Returns: Return type: dict
-
set_rapid_tranq
(value)[source]¶ Toggle the obs_stop flag on the spell object.
Parameters: value (bool) – Returns: True
-
start_message
= 'Start Rapid Tranq.'¶
-
stop_message
= 'Stop Rapid Tranq.'¶
-
static
Settings Extensions¶
-
class
nh_eobs_mental_health.models.nh_clinical_settings.
NHEobsMentalHealthConfig
(pool, cr)[source]¶
Spell Extensions¶
Wardboard Extensions¶
-
class
nh_eobs_mental_health.models.nh_clinical_wardboard.
NHClinicalWardboard
(pool, cr)[source]¶ -
acuity_index
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
acuity_selection
= [('NoScore', 'New Pt / Obs Restart'), ('High', 'High Risk'), ('Medium', 'Medium Risk'), ('Low', 'Low Risk'), ('None', 'No Risk'), ('ObsStop', 'Obs Stop'), ('Refused', 'Refused')]¶
-
end_obs_stop
(**kwargs)[source]¶ Completes the patient monitoring exception activity and toggles the ‘obs stop’ flag on the spell to False as there are no longer any patient monitoring exceptions in effect.
-
fields_view_get
(*args, **kwargs)[source]¶ Override nh_eobs.wardboard.fields_view_get to change next_diff to ‘Observations Stopped’ if obs_stop flag set on patient spell :param cr: Odoo Cursor :param uid: ID of user performing action :param view_id: XML_ID of view :param view_type: Type of view (form, kanban etc) :param context: Odoo context :param toolbar: If has toolbar or not :param submenu: Submenu :return: ui.ir.view for rendering on frontend
-
init
(*args, **kwargs)[source]¶ Override the init function to add the new get_last_finished_obs_stop SQL view.
Parameters: cr – Odoo Cursor
-
obs_stop
¶
-
prompt_user_for_obs_stop_reason
(*args, **kwargs)[source]¶ Returns an action to the front-end that instructs it to open another view in which the user can select a reason for observations to be stopped. :return: An action that opens another view. :rtype: dict
-
rapid_tranq
¶
-
read
(*args, **kwargs)[source]¶ Override of read method of wardboard to override next_diff and frequency fields with obs_stop information is flag set :param cr: Odoo cursor :param user: User doing operation :param ids: Record IDs to read :param fields: Fields to read from records :param context: Odoo context :param load: Type of loading to do :return: list of dicts or objects
-
set_rapid_tranq
(*args, **kwargs)[source]¶ Set the rapid_tranq field of the patient’s spell to the passed value.
Parameters: value – The new value for the rapid_tranq field. Return type: bool or dict Returns:
-
spell_has_open_escalation_tasks
(*args, **kwargs)[source]¶ Check to see if spell has any open escalation tasks.
Parameters: - cr – Odoo cursor
- uid – User carrying out operation
- spell_activity_id – IDs of the spell
- context – Odoo context
Returns: True if open tasks, False if not
-
start_obs_stop
(**kwargs)[source]¶ Creates a new patient monitoring exception with the passed reason.
Creates an activity with a reference to the monitoring exception, save the ‘spell activity id’ on the activity, and start it. It is difficult to retrieve the monitoring exception activity later to complete it if the spell activity id is not set.
Toggles the ‘obs stop’ flag on the spell to True as there is now a patient monitoring exception in effect.
-
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 thespell
of apatient
.Parameters: Returns: True
Return type:
-
get_active_observations
(*args, **kwargs)[source]¶ Returns all active observation types supported by eObs, if the
patient
has an activespell
.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:
-
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:
-
transfer
(*args, **kwargs)[source]¶ Extends
transfer()
, transferring apatient
to alocation
.- 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:
-
Open-eObs Mobile Controller Extensions¶
-
class
nh_eobs_mental_health.models.nh_eobs_mobile_main.
NHEobsMobileMain
(pool, cr)[source]¶ -
-
get_status_map_for_patient_ids
(*args, **kwargs)[source]¶ Take a list of patient IDs and return the spells
Parameters: - cr – Odoo cursor
- uid – user
- patient_ids – list of patient IDs
- context – Odoo context
Returns: dict containing patient ID to status flag mapping
-
Ward Dashboard Extensions¶
Gives an overview of the current state of ward and bed
locations
.
-
class
nh_eobs_mental_health.models.nh_eobs_ward_dashboard.
NHClinicalWardDashboard
(pool, cr)[source]¶ Extends
location
, providing an overall state of a ward location.It shows number of related
users
by type, number of free beds, number ofpatients
by risk, number of waiting patients, etc.-
acute_hospital_ed_count
¶
-
awol_count
¶
-
capacity_count
¶
-
extended_leave_count
¶
-
init
(*args, **kwargs)[source]¶ Init the module - set up SQL views to help with pulling together ward dashboard :param cr: Odoo cursor
-
on_ward_count
¶
-
patient_board
(*args, **kwargs)[source]¶ Return the view dict for showing the Acuity Board for the selecte ward
-
refused_obs_count
¶
-
workload_count
¶
-
Open-eObs SQL Overrides¶
Refused Observations SQL¶
-
class
nh_eobs_mental_health.sql.refused_observations.
RefusedObservationsSQL
(pool, cr)[source]¶ -
ews_activities_skeleton
= "\n SELECT ews.id AS ews_id,\n activity.id AS id,\n activity.data_ref,\n activity.data_model,\n ews.partial_reason,\n activity.spell_activity_id,\n activity.creator_id,\n activity.state,\n activity.summary,\n activity.date_terminated,\n activity.sequence\n FROM nh_activity as activity\n INNER JOIN nh_clinical_patient_observation_ews as ews\n ON split_part(activity.data_ref, ',', 2)::int = ews.id\n WHERE activity.data_model = 'nh.clinical.patient.observation.ews'\n "¶
-
get_refused_wardboard
(interval)[source]¶ Override wardboard SQL view to include acuity index :param interval: Time interval used for recently transferred / discharged :return: SQL statement used in nh_eobs.init()
-
refused_chain_count_skeleton
= "\n SELECT (\n with reasons (reason) as (\n select unnest(partial_tree)\n )\n select count(*)\n from reasons\n where reason = 'refused'\n ) as count,\n first_activity_id as activity_id,\n spell_activity_id,\n first_activity_date_terminated\n FROM (\n SELECT *,\n row_number() over(\n partition by last_activity_id\n ORDER BY\n last_activity_id DESC,\n first_activity_id ASC\n ) AS last_activity_rank,\n row_number() over(\n partition by first_activity_id\n ORDER BY\n last_activity_id DESC,\n first_activity_id ASC\n ) AS first_activity_rank\n FROM refused_ews_activities\n WHERE NOT array_to_string(partial_tree, ',', 'null') LIKE '%null%'\n ) AS refused_ews\n WHERE last_activity_rank = 1\n AND first_activity_rank = 1\n "¶
-
refused_ews_skeleton
= "\n WITH RECURSIVE refused_ews_tree AS (\n --Select the fields we want to use from the original table\n SELECT id,\n ews_id,\n creator_id,\n data_model,\n data_ref,\n spell_activity_id,\n state,\n ARRAY[id] as activity_ids,\n partial_reason,\n ARRAY[partial_reason] as partial_tree,\n id as first_activity_id,\n id as last_activity_id,\n true as refused,\n sequence,\n date_terminated as first_activity_date_terminated,\n date_terminated as last_activity_date_terminated\n FROM ews_activities\n --Make sure we only get EWS\n WHERE partial_reason = 'refused'\n AND state = 'completed'\n --Join the two tables\n UNION ALL\n --Select the same table but join it with parent row (via creator_id)\n SELECT child_act.id,\n child_act.ews_id,\n child_act.creator_id,\n child_act.data_model,\n child_act.data_ref,\n child_act.spell_activity_id,\n child_act.state,\n array_append(act.activity_ids, child_act.id) AS activity_ids,\n child_act.partial_reason,\n array_append(act.partial_tree, child_act.partial_reason)\n AS partial_tree,\n activity_ids[1] AS first_activity_id,\n child_act.id AS last_activity_id,\n NOT array_to_string(\n array_cat(\n partial_tree,\n ARRAY[child_act.partial_reason]\n ), ', ') <> array_to_string(\n array_cat(\n partial_tree,\n ARRAY[child_act.partial_reason]\n ), ', ', '(null)')\n AS refused,\n act.sequence,\n act.first_activity_date_terminated\n as first_activity_date_terminated,\n child_act.date_terminated as last_activity_date_terminated\n FROM ews_activities as child_act\n INNER JOIN refused_ews_tree as act\n ON (child_act.creator_id = act.id)\n WHERE child_act.state = 'completed'\n )\n\n SELECT *,\n row_number() over(\n partition by spell_activity_id\n ORDER BY spell_activity_id ASC,\n first_activity_id DESC,\n last_activity_id DESC\n ) AS rank\n FROM refused_ews_tree\n "¶
-
refused_last_ews_skeleton
= "\n SELECT refused.id,\n refused.ews_id,\n refused.refused,\n acts.spell_id,\n acts.spell_activity_id,\n acts.date_terminated\n from refused_ews_activities AS refused\n RIGHT OUTER JOIN wb_activity_ranked AS acts\n ON acts.id = refused.id AND refused.rank = 1\n WHERE acts.rank = 1\n AND acts.state = 'completed'\n AND acts.data_model = 'nh.clinical.patient.observation.ews'\n "¶
-
refused_review_chain_skeleton
= "\n SELECT rchain.count,\n rchain.spell_activity_id,\n review_activity.state as review_state,\n review_activity.date_terminated as review_date_terminated,\n review_activity.terminate_uid as review_terminate_uid,\n freq_activity.state as freq_state,\n freq_activity.date_terminated as freq_date_terminated,\n freq_activity.terminate_uid as freq_terminate_uid,\n rchain.first_activity_date_terminated\n as first_refusal_date_terminated\n FROM refused_chain_count AS rchain\n LEFT JOIN nh_activity AS review_activity\n ON review_activity.creator_id = rchain.activity_id\n AND review_activity.data_model = 'nh.clinical.notification.clinical_review'\n LEFT JOIN nh_activity AS freq_activity\n ON freq_activity.creator_id = review_activity.id\n AND freq_activity.data_model =\n 'nh.clinical.notification.clinical_review_frequency'\n "¶
-
Ward Dashboard SQL Override¶
-
class
nh_eobs_mental_health.sql.ward_dashboard.
WardDashboardSQL
(pool, cr)[source]¶ -
-
get_wardboard
(interval)[source]¶ Override wardboard SQL view to include acuity index :param interval: Time interval used for recently transferred / discharged :return: SQL statement used in nh_eobs.init()
-
last_finished_obs_stop_for_spell_skeleton
= "\n SELECT\n activity.id AS id,\n spell.activity_id AS spell_activity_id,\n spell.id AS spell_id,\n activity.date_terminated AS activity_date_terminated,\n activity.state as activity_state\n FROM nh_clinical_spell AS spell\n JOIN (\n SELECT DISTINCT ON (spell_activity_id) * FROM nh_activity\n WHERE data_model = 'nh.clinical.pme.obs_stop'\n AND state = ANY('{cancelled, completed}')\n ORDER BY spell_activity_id, date_terminated DESC\n ) AS activity\n ON activity.spell_activity_id = spell.activity_id\n "¶
-
ward_dashboard_bed_count_skeleton
= "\n SELECT\n ward_locations.ward_id AS location_id,\n count(loc.id)\n FROM nh_clinical_location AS loc\n INNER JOIN wdb_ward_locations AS ward_locations\n ON ward_locations.id = loc.id\n WHERE loc.usage = 'bed'\n GROUP BY ward_locations.ward_id\n "¶
-
ward_dashboard_capacity_skeleton
= '\n SELECT\n bed_count.location_id,\n (bed_count.count - workload.count) AS count\n FROM wdb_bed_count AS bed_count\n INNER JOIN wdb_workload_count AS workload\n ON bed_count.location_id = workload.location_id\n '¶
-
ward_dashboard_obs_stop_skeleton
= "\n SELECT\n ward_locations.ward_id AS location_id,\n SUM(CASE WHEN spell.obs_stop = 't' THEN 1 ELSE 0 END) AS count\n FROM nh_clinical_spell AS spell\n INNER JOIN nh_clinical_location AS location\n ON location.id = spell.location_id AND location.usage = 'bed'\n INNER JOIN wdb_ward_locations AS ward_locations\n ON ward_locations.id = location.id\n GROUP BY ward_locations.ward_id"¶
-
ward_dashboard_on_ward_skeleton
= '\n SELECT\n avail.location_id,\n (avail.patients_in_bed - obs_stop.count) AS count\n FROM loc_availability AS avail\n INNER JOIN wdb_obs_stop_count AS obs_stop\n ON avail.location_id = obs_stop.location_id\n '¶
-
ward_dashboard_reason_count_skeleton
= '\n select * from wdb_reasons where reason = {reason}'¶
-
ward_dashboard_reason_view_skeleton
= "\n SELECT\n ward_locations.ward_id AS location_id,\n count(spell.patient_id),\n obs_stop.reason\n FROM nh_clinical_spell AS spell\n LEFT JOIN nh_clinical_location AS location\n ON spell.location_id = location.id\n AND location.usage = 'bed'\n LEFT JOIN wdb_ward_locations AS ward_locations\n ON location.id = ward_locations.id\n LEFT JOIN nh_clinical_pme_obs_stop AS obs_stop\n ON spell.id = obs_stop.spell\n LEFT JOIN nh_activity AS activity\n ON obs_stop.activity_id = activity.id\n AND activity.state = 'started'\n WHERE obs_stop.reason IS NOT NULL\n AND activity.state IS NOT NULL\n GROUP BY ward_locations.ward_id, obs_stop.reason"¶
-
ward_dashboard_refused_obs_count_skeleton
= '\n SELECT ward_beds.location_id,\n coalesce(\n sum(\n CASE WHEN spell.refusing_obs = TRUE THEN 1 ELSE 0 END),0)\n AS count\n FROM nh_clinical_spell AS spell\n LEFT JOIN ward_beds\n ON spell.location_id = ANY(bed_ids)\n GROUP BY ward_beds.location_id\n '¶
-
ward_dashboard_skeleton
= "\n -- Create Ward Dashboard\n SELECT\n location.id AS id,\n location.id AS location_id,\n lwp.waiting_patients,\n avail.patients_in_bed,\n avail.free_beds,\n clu1.related_users AS related_hcas,\n clu2.related_users AS related_nurses,\n clu3.related_users AS related_doctors,\n rpc.high_risk_patients,\n rpc.med_risk_patients,\n rpc.low_risk_patients,\n rpc.no_risk_patients,\n rpc.noscore_patients,\n CASE\n WHEN rpc.high_risk_patients > 0 THEN 2\n WHEN rpc.med_risk_patients > 0 THEN 3\n WHEN rpc.low_risk_patients > 0 THEN 4\n WHEN rpc.no_risk_patients > 0 THEN 0\n WHEN rpc.noscore_patients > 0 THEN 7\n ELSE 7\n END AS kanban_color,\n awol.count AS awol_count,\n acute_ed.count AS acute_hospital_ed_count,\n extended_leave.count AS extended_leave_count,\n capacity.count AS capacity_count,\n workload.count AS workload_count,\n on_ward.count AS on_ward_count,\n refused_obs.count AS refused_obs_count\n FROM nh_clinical_location AS location\n LEFT JOIN loc_waiting_patients AS lwp\n ON lwp.location_id = location.id\n LEFT JOIN wdb_awol_count AS awol ON awol.location_id = location.id\n LEFT JOIN wdb_acute_hospital_ed_count AS acute_ed\n ON acute_ed.location_id = location.id\n LEFT JOIN wdb_extended_leave_count AS extended_leave\n ON extended_leave.location_id = location.id\n LEFT JOIN wdb_capacity_count AS capacity\n ON capacity.location_id = location.id\n LEFT JOIN wdb_workload_count AS workload\n ON workload.location_id = location.id\n LEFT JOIN wdb_on_ward_count AS on_ward\n ON on_ward.location_id = location.id\n LEFT JOIN wdb_refused_obs_count AS refused_obs\n ON refused_obs.location_id = location.id\n LEFT JOIN loc_availability AS avail\n ON avail.location_id = location.id\n LEFT JOIN child_loc_users AS clu1\n ON clu1.location_id = location.id\n AND clu1.group_name = 'NH Clinical HCA Group'\n LEFT JOIN child_loc_users AS clu2\n ON clu2.location_id = location.id\n AND clu2.group_name = 'NH Clinical Nurse Group'\n LEFT JOIN child_loc_users AS clu3\n ON clu3.location_id = location.id\n AND clu3.group_name = 'NH Clinical Doctor Group'\n LEFT JOIN loc_risk_patients_count AS rpc\n ON rpc.location_id = location.id\n WHERE location.usage = 'ward'\n "¶
-
ward_dashboard_workload_skeleton
= '\n SELECT\n ward_locations.ward_id AS location_id,\n count(spell.patient_id)\n FROM nh_clinical_spell AS spell\n INNER JOIN nh_clinical_location AS location\n ON location.id = spell.location_id\n INNER JOIN wdb_ward_locations AS ward_locations\n ON ward_locations.id = location.id\n GROUP BY ward_locations.ward_id'¶
-
Mental Health Wizards¶
Patient Monitoring Exception Reason Selection Wizard¶
-
class
nh_eobs_mental_health.wizard.nh_clinical_patient_monitoring_exception_select_reason.
PatientMonitoringExceptionSelectReason
(pool, cr)[source]¶ A model used for displaying a drop down list of patient monitoring exception ‘reasons’ so that the user can select one.
‘spell_has_open_escalation_tasks’ is used as a flag in the view so that warning messages can be shown.
‘patient_name’ allows the view to easily display the patient name.
-
patient_name
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
reasons
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
spell_has_open_escalation_tasks
¶
-
start_patient_monitoring_exception
(*args, **kwargs)[source]¶ As this model is only for the purposes of display in the UI this method is limited in that it simply receives the call from the view and passes on the necessary data in the model to ~models.nh_clinical_wardboard.NHClinicalWardboard .start_obs_stop where most of the logic is implemented.
-
Blood Glucose¶
Blood Glucose Observation¶
-
class
nh_blood_glucose.models.nh_clinical_patient_observation_blood_glucose.
NHClinicalPatientObservationBloodGlucose
(pool, cr)[source]¶ Represents the action of measuring a
patient
blood glucose concentration.-
blood_glucose
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
classmethod
get_data_visualisation_resource
()[source]¶ Returns URL of JS file to plot data visualisation so can be loaded on mobile and desktop
Returns: URL of JS file to plot graph Return type: str
-
Wardboard extension¶
-
class
nh_blood_glucose.models.nh_clinical_wardboard.
NhClinicalWardboardBloodGlucose
(pool, cr)[source]¶ -
blood_glucose_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
Early Warning Score¶
Early Warning Score Observation¶
Defines the Early Warning Score observation class and its standard behaviour and policy triggers based on the UK NEWS standard.
-
class
ews.
nh_clinical_patient_observation_ews
(pool, cr)[source]¶ Represents an Early Warning Score
observation
which stores a group of physiological parameters measured from thepatient
that together determine a score that serves as an indicator of the illness current acuity.The basis of the scoring system are the following six parameters: respiratory rate, oxygen saturations, temperature, systolic blood pressure, pulse rate and level of consciousness.
-
avpu_text
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
blood_pressure_diastolic
¶
-
blood_pressure_systolic
¶
-
body_temperature
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
bp_display
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
calculate_score
(*args, **kwargs)[source]¶ Computes the score and clinical risk values based on the NEWS parameters provided.
It will return as extra information the presence of any Red Score parameter within the data. (any parameter that scores 3)
Parameters: ews_data (dict) – The NEWS parameters: respiration_rate
,indirect_oxymetry_spo2
,body_temperature
,blood_pressure_systolic
,pulse_rate
,oxygen_administration_flag
andavpu_text
Returns: score
,clinical_risk
andthree_in_one
Return type: dict
-
can_decrease_obs_frequency
(*args, **kwargs)[source]¶ Determines whether or not the frequency of the patients observations can be reduced to a lower value. There are certain situations where this is allowed depending on the ward’s policy.
Parameters: - cr –
- uid –
- patient_id –
- threshold_value –
- context –
Returns:
-
change_activity_frequency
(*args, **kwargs)[source]¶ Convenience that allows you to pass a ‘case’ instead of a ‘frequency’ and the method will do the lookup for you.
See nh_observations.nh_clinical_extension .nh_clinical_api_extension.change_activity_frequency.
Parameters: - cr –
- uid –
- patient_id –
- name –
- case –
- context –
Returns:
-
clinical_risk
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
complete
(*args, **kwargs)[source]¶ It determines which acuity case the current observation is in with the stored data and responds to the different policy triggers accordingly defined on the
_POLICY
dictionary:{'ranges': [0, 4, 6], 'case': '0123', --> Used with bisect to determine the acuity case based on the score. 'frequencies': [720, 240, 60, 30], --> frequency of recurrency of the NEWS observation, based on the case. 'notifications': [...], Information sent to the trigger_notifications method, based on case. 'risk': ['None', 'Low', 'Medium', 'High']} --> Clinical risk of the patient, based on case.
All the case based lists work in a simple way: list[case] –> value used
After the policy triggers take place the activity is completed and a new NEWS activity is created. Then the case based frequency is applied, effectively scheduling it.
In the case of having a partial observation we won’t have a new frequency so the new activity is scheduled to the same time the one just completed was, as the need for a complete observation is still there.
Returns: True
Return type: bool
-
concentration
¶
-
cpap_peep
¶
-
create_activity
(*args, **kwargs)[source]¶ When creating a new activity of this type every other not completed or cancelled instance related to the same patient will be automatically cancelled.
Returns: activity
id.Return type: int
-
create_next_obs
(*args, **kwargs)[source]¶ Creates a new observation and activity based on a given closed observation activity.
If the previous observation is partial, the new observation is scheduled for the same time as the old one, in other words, there is a good chance it will be due right away. If the previous observation is not a partial then it will be scheduled based on the frequency implied by the clinical risk of the previous observation.
It only makes sense to create the next observation activity based on an activity for an observation of the same type as this one. An exception will be raised if the same type of activity is not passed.
If the observation is neither completed or cancelled then it is still open and a new observation activity should not be created, thus an exception will be raised.
Parameters: previous_obs_activity – Returns:
-
device_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
flow_rate
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
get_case
(observation)[source]¶ Return an integer based on the clinical risk of the observation to be used as an index when accessing elements of
_POLICY
.Parameters: observation – EWS observation Returns: case Return type: int
-
classmethod
get_data_visualisation_resource
()[source]¶ Returns URL of JS file to plot data visualisation so can be loaded on mobile and desktop
Returns: URL of JS file to plot graph Return type: str
-
get_date_scheduled_for_refusal
(*args, **kwargs)[source]¶ Get the expected schedule date for a new observation triggered based on the passed completion date of the previous observation and it’s frequency.
Parameters: Returns:
-
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) – patient
idReturns: a list of dictionaries Return type: list
-
get_frequency_for_refusal
(*args, **kwargs)[source]¶ Get the expected frequency for a new observation triggered by completion of the passed one if it is also refused.
Parameters: previous_obs_activity ('nh.activity' record) – Returns:
-
get_last_case
(*args, **kwargs)[source]¶ Checks for the last completed NEWS for the provided
patient
and returns the acuity case:0 - No Risk 1 - Low Risk 2 - Medium Risk 3 - High Risk
Returns: False
or the acuity caseReturn type: int
-
get_last_full_obs_activity
(*args, **kwargs)[source]¶ Gets the most recent full observation.
Parameters: spell_activity_id (int) – Returns: observation activity Return type: nh.activity
-
get_notifications
(*args, **kwargs)[source]¶ Get notifications that should be triggered upon completion of the passed activity for an EWS observation.
Parameters: activity – activity referencing an EWS observation Returns: a list of dictionaries representing notifications Return type: list
-
get_submission_message
(*args, **kwargs)[source]¶ Override of nh.clincal.patient.observation method.
Returns:
-
handle_o2_devices
(*args, **kwargs)[source]¶ Checks the current state of supplemental oxygen
device sessions
on the relatedspell
.It
completes
the sessions if the current NEWS does not have the oxygen administration flag up.It
completes
any session with an oxygen administrationdevice type
that does not match the NEWS device.It
starts
a new session if the NEWS device provided does not have already an open one related to the spell.Parameters: activity_id (int) – activity
id.
-
indirect_oxymetry_spo2
¶
-
is_partial
¶
-
lookup_adjusted_frequency_for_patient_refusal
(case, frequency=None)[source]¶ Lookup the frequency adjusted to take into account the fact that the patient is refusing observations. There are some cases where this needs to be different to the usual frequency dictated by the policy which necessitates this lookup.
Parameters: Returns:
-
mews_score
¶
-
niv_backup
¶
-
niv_epap
¶
-
niv_ipap
¶
-
o2_display
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
order_by
¶
-
oxygen_administration_flag
¶
-
pulse_rate
¶
-
respiration_rate
¶
-
score
¶
-
score_display
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
three_in_one
¶
-
update_next_obs_after_partial
(*args, **kwargs)[source]¶ Updates the frequency and date scheduled of the newly created next_obs_activity from their default values to their correct values based on previous observations and the refusal status.
Parameters: - partial_obs_activity ('nh.activity' record) – Observation activity expected to be a partial and the most recently completed observation for the spell.
- next_obs_activity ('nh.activity' record) – Observation activity expected to be the most recently created one triggered by the passed partial.
Returns:
-
EWS Parameters¶
parameters.py define extra observation parameters related to the Early Warning Score observation and relevant to its policies.
Oxygen Level Parameter¶
Oxygen Target Parameter¶
-
class
nh_ews.parameters.
nh_clinical_patient_o2target
(pool, cr)[source]¶ Represents a
patient
oxygen saturation target. Set by clinicians after assessing the patient condition, if necessary.-
get_last
(*args, **kwargs)[source]¶ Checks if there is a target assigned for the provided
patient
Parameters: Returns: oxygen range
id.Return type:
-
level_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
Escalation Tasks (Notifications)¶
notifications.py define notification types necessary for the Early Warning Score policy triggers.
Assess Patient Notification¶
Review Frequency Notification¶
Inform Medical Team Notification¶
-
class
nh_ews.notifications.
nh_clinical_notification_medical_team
(pool, cr)[source]¶ This notification addresses the specific need of the responsible medical team having to be informed about the current
patient
condition.
Food and Fluid¶
Models¶
Dietary Need¶
Food and Fluid Observation¶
-
class
nh_food_and_fluid.models.food_and_fluid.
NHClinicalFoodAndFluid
(pool, cr)[source]¶ -
active_food_fluid_period
(spell_activity_id)[source]¶ Check to see if any food and fluid observations have been submitted in this period :param spell_activity_id: ID of patient’s spell activity :return: True if food and fluid observation have been submitted in the current period :rtype: bool
-
classmethod
before_seven_am
(date_time)[source]¶ True if the passed date_time is before 07:00 in the morning.
Parameters: date_time (datetime) – Returns: Return type: bool
-
bowels_open
¶
-
calculate_fluid_balance
(spell_activity_id, date_time)[source]¶ Calculates the fluid balance for supplied date_time (which is an Odoo string representation of a datetime) :param spell_activity_id: ID of the patient’s spell activity :param date_time: Odoo string representation of a datetime :type date_time: str :return: Fluid Balance :rtype: int
-
calculate_total_fluid_intake
(spell_activity_id, date_time)[source]¶ Returns the sum of all the fluid_taken values from all the food and fluid observations completed in a particular period.
The period to calculate for is determined by the date_time argument. The date_time argument can be any time. Whichever period the date_time is a part of will be the period used for the calculation.
Parameters: - spell_activity_id (int) –
- date_time –
Type: str or datetime
Returns: Total fluid intake.
Return type:
-
dietary_needs
¶
-
fluid_description
¶
-
fluid_output
¶
-
fluid_taken
¶
-
food_fluid_rejected
¶
-
food_taken
¶
-
format_period_datetimes
(periods)[source]¶ Format the datetimes in the passed period dictionaries to be more user-friendly.
Parameters: periods – Returns:
-
classmethod
get_data_visualisation_resource
()[source]¶ Returns URL of JS file to plot data visualisation so can be loaded on mobile and desktop
Returns: URL of JS file to plot graph Return type: str
-
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 this observation.
Adds the lists of recorded concerns and dietary needs to the form description as these are stored in separate models to allow for multi select
Parameters: patient_id (int) – patient
idReturns: a list of dictionaries Return type: list
-
get_formatted_obs
(*args, **kwargs)[source]¶ Override of nh.clinical.patient.observation.
Returns: Return type: dict
-
get_obs_activities_for_period
(spell_activity_id, date_time)[source]¶ Get a list of food and fluid observation activities for the date_time passed in :param spell_activity_id: ID of the patient’s spell activity :param date_time: Odoo string representation of a date_time :type date_time: str :return: list of food and fluid observation activities :rtype: list
-
get_period_dictionaries
(food_and_fluid_observations, include_units=False)[source]¶ Get a list of dictionaries, each one representing a 24 hour observation period. Each dictionary contains data about the period as well as a nested list of data for the observations.
Parameters: - food_and_fluid_observations –
- include_units (bool) – Include measurements with units where applicable.
Returns:
-
get_period_domain
(date_time)[source]¶ The period to produce domain parameters for is determined by the date_time argument. The date_time argument can be any time. Whichever period the date_time is a part of will be the period used for the calculation.
Parameters: date_time (datetime or str) – Returns: Domain parameters that will limit results to a 24 hour period. Return type: list
-
get_period_end_datetime
(date_time)[source]¶ Get the datetime representing the first microsecond of the period after the one that the passed date_time is a part of.
Parameters: date_time (datetime or str) – Returns: Return type: str
-
get_period_start_datetime
(date_time)[source]¶ Get the datetime representing the beginning of the period that the passed datetime occurs in.
Parameters: date_time (datetime or str) – Returns: Return type: str
-
passed_urine
¶
-
recorded_concerns
¶
-
Food and Fluid Review Escalation Task¶
-
class
nh_food_and_fluid.models.food_fluid_review.
FoodAndFluidReview
(pool, cr)[source]¶ Food and Fluid Review task
-
ESCALATION_TASKS
= {0: ['Confirm adequate intake'], 1: ['Encourage fluid intake to above 1500ml', 'Keep monitoring', 'Inform Shift Coordinator'], 2: ['Encourage hourly fluids immediately', 'Inform Shift Coordinator'], 3: ['Inform medical staff immediately']}¶
-
cancel_review_tasks
(cancel_reason, spell_activity_id=None)[source]¶ Cancel all open review tasks activities with the passed cancel reason for either one spell or all spells. :param spell_activity_id: If passed, only cancels review tasks for the associated spell. If left as the default
None
, cancels review tasks for all spells. :type spell_activity_id: int :param cancel_reason:
-
get_escalation_tasks_for_score
(score)[source]¶ Get the list of escalation tasks associated with a given F&F score :param score: F&F score for period :return: list of escalation task names
-
get_review_task_summary
(*args, **kwargs)[source]¶ Get the summary for the review task :return: string for summary :rtype: str
-
get_view_description
(form_desc)[source]¶ Transform the form description into view description that can be used by the mobile. This will return a list of dicts similar to:
[ { 'type': 'template', 'template': 'nh_observation.custom_template' }, { 'type': 'task', 'inputs': [] } ]
Parameters: form_desc (list) – List of dicts representing the inputs for the form Returns: list of dicts representing a view description
-
manage_review_tasks_for_active_periods
(*args, **kwargs)[source]¶ Ensure all spells have the correct food and fluid review tasks associated with them. This involves cancelling existing ones and creating new ones at specific times. :return:
-
static
process_period_datetimes
(period)[source]¶ Change the format in the supplied period to be similar to 7am dd/mm :param period: period dictionary :return: period dictionary
-
schedule_review
(spell_activity)[source]¶ Create the activity for the Food and Fluid Review Task :param spell_activity: Activity for patient’s spell :return: activity ID
-
should_trigger_review
(*args, **kwargs)[source]¶ Take the current localised time for the user and figure out if the review task should be triggered :return: True if correct localised time :rtype: bool
-
trigger_review_tasks_for_active_periods
(*args, **kwargs)[source]¶ Method to trigger F&F review tasks for any active periods in the system Called by Scheduled Action every hour
-
trigger_times
= [15, 6]¶
-
Wardboard Extension¶
-
class
nh_food_and_fluid.models.nh_clinical_wardboard.
NhClinicalWardboardNeuro
(pool, cr)[source]¶ -
food_fluid_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
Open-eObs API Extension¶
-
class
nh_food_and_fluid.models.nh_eobs_api.
NhEobsApi
(pool, cr)[source]¶ -
discharge
(*args, **kwargs)[source]¶ Override of discharge to cancel open food and fluid review tasks for the current spell of the patient who is being discharged. :param hospital_number: :type hospital_number: str :param data: Dictionary parameter that may contain the key
discharge_date
. :type data: dict :return:True
:rtype: bool
-
transfer
(*args, **kwargs)[source]¶ Override of transfer to cancel open food and fluid review tasks for the current spell of the patient who is being transferred. :param hospital_number: :type hospital_number: str :param data: dictionary parameter that may contain the key
location
. :type data: dict :return:True
:rtype: bool
-
Recorded Concern¶
Glasgow Coma Scale¶
Glasgow Coma Scale Observations¶
gcs.py defines the Glasgow Coma Scale observation class and its standard behaviour and policy triggers based on this worldwide standard.
-
class
gcs.
nh_clinical_patient_observation_gcs
(pool, cr)[source]¶ Represents an Glasgow Coma Scale
observation
which stores three parameters that are used as a way to communicate about the level of consciousness ofpatients
with acute brain injury.The basis of the scale system are the following parameters: Eye response: spontaneous, to sound, to pressure, none. Verbal response: orientated, confused, words, sounds, none. Motor response: obey commands, localising, normal flexion, abnormal flexion, extension, none.
-
complete
(*args, **kwargs)[source]¶ It determines which acuity case the current observation is in with the stored data and responds to the different policy triggers accordingly defined on the
_POLICY
dictionary.Returns: True
Return type: bool
-
create_activity
(*args, **kwargs)[source]¶ When creating a new activity of this type, an exception will be raised if the
spell
already has an open GCS.Returns: activity
id.Return type: int
-
eyes
¶
-
motor
¶
-
verbal
¶
-
Neurological Observations¶
Models¶
Neurological Observation¶
-
class
nh_neurological.models.nh_clinical_patient_observation_neurological.
NhClinicalPatientObservationNeurological
(pool, cr)[source]¶ -
classmethod
get_data_visualisation_resource
()[source]¶ Returns URL of JS file to plot data visualisation so can be loaded on mobile and desktop
Returns: URL of JS file to plot graph Return type: str
-
get_form_description
(*args, **kwargs)[source]¶ Returns a list of dicts that represent the form description used by the mobile
Parameters: patient_id – ID for the patient Returns: list of dicts
-
limb_movement_left_arm
¶
-
limb_movement_left_leg
¶
-
limb_movement_right_arm
¶
-
limb_movement_right_leg
¶
-
pupil_left_reaction
¶
-
pupil_left_size
¶
-
pupil_right_reaction
¶
-
pupil_right_size
¶
-
classmethod
Wardboard Override¶
-
class
nh_neurological.models.nh_clinical_wardboard.
NhClinicalWardboardNeuro
(pool, cr)[source]¶ -
neuro_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
Neurovascular Observations¶
Neurovascular Observation¶
neurovascular.py defines the neurovascular observation class and its standard behaviour and policy triggers. There is currently no standard being followed by clinicians so the logic is quite generic.
-
class
neurovascular.
nh_clinical_patient_observation_neurovascular
(pool, cr)[source]¶ Represents a Neurovascular
observation
for acute limb compartment syndrome detection.-
colour
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
limb
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
movement
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
pulse
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
sensation
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
Open-eObs Observation¶
Observation Fields¶
Extension of Odoo’s field classes to add the ‘necessary’ attribute.
The necessary attribute declares whether or not a field must be populated in order for an observation to be considered ‘full’.
Fields which represent the data that actually makes up an observation therefore need to use the types in this module rather than Odoo’s own fields.
-
nh_observations.fields.
get_odoo_field_type_classes
()¶
-
nh_observations.fields.
set_odoo_field_type_classes
()¶
Many2One Field¶
-
class
nh_observations.fields.
Many2one
(comodel_name=None, string=None, necessary=True, **kwargs)[source]¶ -
column_attrs
= [('auto_join', '_column_auto_join'), ('change_default', '_column_change_default'), ('context', '_column_context'), ('copy', '_column_copy'), ('deprecated', '_column_deprecated'), ('domain', '_column_domain'), ('groups', '_column_groups'), ('help', '_column_help'), ('manual', '_column_manual'), ('obj', '_column_obj'), ('ondelete', '_column_ondelete'), ('readonly', '_column_readonly'), ('required', '_column_required'), ('select', '_column_select'), ('states', '_column_states'), ('string', '_column_string')]¶
-
description_attrs
= [('change_default', '_description_change_default'), ('company_dependent', '_description_company_dependent'), ('context', '_description_context'), ('depends', '_description_depends'), ('deprecated', '_description_deprecated'), ('domain', '_description_domain'), ('groups', '_description_groups'), ('help', '_description_help'), ('manual', '_description_manual'), ('readonly', '_description_readonly'), ('related', '_description_related'), ('relation', '_description_relation'), ('required', '_description_required'), ('searchable', '_description_searchable'), ('sortable', '_description_sortable'), ('states', '_description_states'), ('store', '_description_store'), ('string', '_description_string')]¶
-
One2Many Field¶
-
class
nh_observations.fields.
One2many
(comodel_name=None, inverse_name=None, string=None, necessary=True, **kwargs)[source]¶ -
column_attrs
= [('auto_join', '_column_auto_join'), ('change_default', '_column_change_default'), ('context', '_column_context'), ('copy', '_column_copy'), ('deprecated', '_column_deprecated'), ('domain', '_column_domain'), ('fields_id', '_column_fields_id'), ('groups', '_column_groups'), ('help', '_column_help'), ('limit', '_column_limit'), ('manual', '_column_manual'), ('obj', '_column_obj'), ('readonly', '_column_readonly'), ('required', '_column_required'), ('select', '_column_select'), ('states', '_column_states'), ('string', '_column_string')]¶
-
description_attrs
= [('change_default', '_description_change_default'), ('company_dependent', '_description_company_dependent'), ('context', '_description_context'), ('depends', '_description_depends'), ('deprecated', '_description_deprecated'), ('domain', '_description_domain'), ('groups', '_description_groups'), ('help', '_description_help'), ('manual', '_description_manual'), ('readonly', '_description_readonly'), ('related', '_description_related'), ('relation', '_description_relation'), ('relation_field', '_description_relation_field'), ('required', '_description_required'), ('searchable', '_description_searchable'), ('sortable', '_description_sortable'), ('states', '_description_states'), ('store', '_description_store'), ('string', '_description_string')]¶
-
Float Field¶
-
class
nh_observations.fields.
Float
(*args, **kwargs)[source]¶ -
column_attrs
= [('change_default', '_column_change_default'), ('copy', '_column_copy'), ('deprecated', '_column_deprecated'), ('digits', '_column_digits'), ('digits_compute', '_column_digits_compute'), ('group_operator', '_column_group_operator'), ('groups', '_column_groups'), ('help', '_column_help'), ('manual', '_column_manual'), ('readonly', '_column_readonly'), ('required', '_column_required'), ('select', '_column_select'), ('states', '_column_states'), ('string', '_column_string')]¶
-
description_attrs
= [('change_default', '_description_change_default'), ('company_dependent', '_description_company_dependent'), ('depends', '_description_depends'), ('deprecated', '_description_deprecated'), ('digits', '_description_digits'), ('groups', '_description_groups'), ('help', '_description_help'), ('manual', '_description_manual'), ('readonly', '_description_readonly'), ('related', '_description_related'), ('required', '_description_required'), ('searchable', '_description_searchable'), ('sortable', '_description_sortable'), ('states', '_description_states'), ('store', '_description_store'), ('string', '_description_string')]¶
-
Integer Field¶
-
class
nh_observations.fields.
Integer
(string=None, necessary=True, **kwargs)[source]¶ -
column_attrs
= [('change_default', '_column_change_default'), ('copy', '_column_copy'), ('deprecated', '_column_deprecated'), ('group_operator', '_column_group_operator'), ('groups', '_column_groups'), ('help', '_column_help'), ('manual', '_column_manual'), ('readonly', '_column_readonly'), ('required', '_column_required'), ('select', '_column_select'), ('states', '_column_states'), ('string', '_column_string')]¶
-
description_attrs
= [('change_default', '_description_change_default'), ('company_dependent', '_description_company_dependent'), ('depends', '_description_depends'), ('deprecated', '_description_deprecated'), ('groups', '_description_groups'), ('help', '_description_help'), ('manual', '_description_manual'), ('readonly', '_description_readonly'), ('related', '_description_related'), ('required', '_description_required'), ('searchable', '_description_searchable'), ('sortable', '_description_sortable'), ('states', '_description_states'), ('store', '_description_store'), ('string', '_description_string')]¶
-
Many2Many Field¶
-
class
nh_observations.fields.
Many2Many
(comodel_name=None, relation=None, column1=None, column2=None, string=None, necessary=True, **kwargs)[source]¶ -
column_attrs
= [('change_default', '_column_change_default'), ('context', '_column_context'), ('copy', '_column_copy'), ('deprecated', '_column_deprecated'), ('domain', '_column_domain'), ('groups', '_column_groups'), ('help', '_column_help'), ('id1', '_column_id1'), ('id2', '_column_id2'), ('limit', '_column_limit'), ('manual', '_column_manual'), ('obj', '_column_obj'), ('readonly', '_column_readonly'), ('rel', '_column_rel'), ('required', '_column_required'), ('select', '_column_select'), ('states', '_column_states'), ('string', '_column_string')]¶
-
description_attrs
= [('change_default', '_description_change_default'), ('company_dependent', '_description_company_dependent'), ('context', '_description_context'), ('depends', '_description_depends'), ('deprecated', '_description_deprecated'), ('domain', '_description_domain'), ('groups', '_description_groups'), ('help', '_description_help'), ('manual', '_description_manual'), ('readonly', '_description_readonly'), ('related', '_description_related'), ('relation', '_description_relation'), ('required', '_description_required'), ('searchable', '_description_searchable'), ('sortable', '_description_sortable'), ('states', '_description_states'), ('store', '_description_store'), ('string', '_description_string')]¶
-
MultiSelect Field¶
-
class
nh_observations.fields.
MultiSelect
(string=None, necessary=True, initially_hidden=False, reference=None, minimum=None, maximum=None, *args, **kwargs)[source]¶ -
column_attrs
= [('change_default', '_column_change_default'), ('copy', '_column_copy'), ('deprecated', '_column_deprecated'), ('groups', '_column_groups'), ('help', '_column_help'), ('manual', '_column_manual'), ('readonly', '_column_readonly'), ('required', '_column_required'), ('select', '_column_select'), ('states', '_column_states'), ('string', '_column_string')]¶
-
description_attrs
= [('change_default', '_description_change_default'), ('company_dependent', '_description_company_dependent'), ('depends', '_description_depends'), ('deprecated', '_description_deprecated'), ('groups', '_description_groups'), ('help', '_description_help'), ('manual', '_description_manual'), ('readonly', '_description_readonly'), ('related', '_description_related'), ('required', '_description_required'), ('searchable', '_description_searchable'), ('sortable', '_description_sortable'), ('states', '_description_states'), ('store', '_description_store'), ('string', '_description_string')]¶
-
Observation Field¶
-
class
nh_observations.fields.
ObservationField
(string=None, necessary=True, initially_hidden=False, reference=None, minimum=None, maximum=None, *args, **kwargs)[source]¶ -
column_attrs
= [('change_default', '_column_change_default'), ('copy', '_column_copy'), ('deprecated', '_column_deprecated'), ('groups', '_column_groups'), ('help', '_column_help'), ('manual', '_column_manual'), ('readonly', '_column_readonly'), ('required', '_column_required'), ('select', '_column_select'), ('states', '_column_states'), ('string', '_column_string')]¶
-
description_attrs
= [('change_default', '_description_change_default'), ('company_dependent', '_description_company_dependent'), ('depends', '_description_depends'), ('deprecated', '_description_deprecated'), ('groups', '_description_groups'), ('help', '_description_help'), ('manual', '_description_manual'), ('readonly', '_description_readonly'), ('related', '_description_related'), ('required', '_description_required'), ('searchable', '_description_searchable'), ('sortable', '_description_sortable'), ('states', '_description_states'), ('store', '_description_store'), ('string', '_description_string')]¶
-
Selection Field¶
-
class
nh_observations.fields.
Selection
(*args, **kwargs)[source]¶ -
column_attrs
= [('change_default', '_column_change_default'), ('copy', '_column_copy'), ('deprecated', '_column_deprecated'), ('groups', '_column_groups'), ('help', '_column_help'), ('manual', '_column_manual'), ('readonly', '_column_readonly'), ('required', '_column_required'), ('select', '_column_select'), ('selection', '_column_selection'), ('states', '_column_states'), ('string', '_column_string')]¶
-
description_attrs
= [('change_default', '_description_change_default'), ('company_dependent', '_description_company_dependent'), ('depends', '_description_depends'), ('deprecated', '_description_deprecated'), ('groups', '_description_groups'), ('help', '_description_help'), ('manual', '_description_manual'), ('readonly', '_description_readonly'), ('related', '_description_related'), ('required', '_description_required'), ('searchable', '_description_searchable'), ('selection', '_description_selection'), ('sortable', '_description_sortable'), ('states', '_description_states'), ('store', '_description_store'), ('string', '_description_string')]¶
-
Text Field¶
-
class
nh_observations.fields.
Text
(string=None, necessary=True, **kwargs)[source]¶ -
column_attrs
= [('change_default', '_column_change_default'), ('copy', '_column_copy'), ('deprecated', '_column_deprecated'), ('groups', '_column_groups'), ('help', '_column_help'), ('manual', '_column_manual'), ('readonly', '_column_readonly'), ('required', '_column_required'), ('select', '_column_select'), ('states', '_column_states'), ('string', '_column_string'), ('translate', '_column_translate')]¶
-
description_attrs
= [('change_default', '_description_change_default'), ('company_dependent', '_description_company_dependent'), ('depends', '_description_depends'), ('deprecated', '_description_deprecated'), ('groups', '_description_groups'), ('help', '_description_help'), ('manual', '_description_manual'), ('readonly', '_description_readonly'), ('related', '_description_related'), ('required', '_description_required'), ('searchable', '_description_searchable'), ('sortable', '_description_sortable'), ('states', '_description_states'), ('store', '_description_store'), ('string', '_description_string'), ('translate', '_description_translate')]¶
-
Observation Frequencies¶
A single place for different frequency values to be read from.
Models¶
Field Utilities¶
Height Observation¶
-
class
nh_observations.models.nh_clinical_patient_observation_height.
NhClinicalPatientObservationHeight
(pool, cr)[source]¶ Represents the action of measuring a
patient
height.-
height
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
Scored Observation Base Class¶
-
class
nh_observations.models.nh_clinical_patient_observation_scored.
NhClinicalPatientObservationScored
(pool, cr)[source]¶ Extends the ‘nh.clinical.patient.observation’ model to introduce the concept of a score. Provides a computed ‘score’ field with a default implementation for its calculation.
-
calculate_score
(*args, **kwargs)[source]¶ Gets the values of the ‘score fields’ that contribute to the overall score of the observation and maps them to an integer score.
This generic score calculation implementation is then to simply sum all the individual fields scores to get the overall score for the observation.
Parameters: - obs_data (record or dict) – Observation field values. If an Odoo record is passed then the ‘score fields’ are looked up for the calculation. If a dictionary of field data is passed, only the fields in the dictionary are used.
- return_dictionary (bool) – Would you like the score returned in a dictionary?
Returns: score
Return type:
-
convert_field_values_to_labels
(obs)[source]¶ Convert the values in the passed dictionary to their corresponding labels.
NOTE: Only converts fields whose names are not in the _scored class variable. This is a temporary implementation to get the functionality working for GCS / Neurological.
Parameters: obs (list) –
-
convert_field_values_to_scores
(obs)[source]¶ Converts the values of all ‘score fields’ to their individual field scores.
Parameters: obs (list of dict) – Returns: Return type: list of dict
-
fields_view_get
(*args, **kwargs)[source]¶ Hack to allow display of field scores instead of field values in Odoo views. When an Odoo view is rendered the field definitions are retrieved via this method as well as the field values themselves. Validation occurs client-side and if it fails the values seem to be silently omitted from the view.
This method intercepts the retrieval of the field definition and converts the type of the fields to ‘text’, effectively allowing the converted score value of the field (which is a string representation of a number) to pass validation.
Parameters: - args –
- kwargs –
Returns:
-
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) – patient
idReturns: a list of dictionaries Return type: list
-
classmethod
get_score_for_value
(model, field_name, field_value)[source]¶ The values of ‘score fields’ are decoupled from the integer score that they contribute to the overall score of the observation. This is to make changes to the scoring system easier as score values themselves are not stored in the database, so adding or changing the scores certain field values map to has less impact.
This method returns the integer score a field value represents based on the position it is declared in the fields ‘selection’ attribute.
Parameters: Returns: Return type:
-
read
(*args, **kwargs)[source]¶ An override of read to ensure that for scored observations, reads will by default return the mapped score values for fields rather then their actual field values. Usually when read is called instead of browse it is because the raw data is needed to send over the network. Often in these situations the score value is desirable over the normal score-agnostic value.
The decision to make this behaviour default is based only on a few use cases encountered since starting to use this model, it may be that refactoring is appropriate in future.
Parameters: - fields –
- load –
- convert_field_values_to_scores (bool) –
Returns: Return type:
-
score
¶
-
NHClinical Overrides¶
nh_clinical_extension.py extends several NH Clinical classes to add relevant observations related functionality.
NHClinical API Overrides¶
-
class
nh_observations.nh_clinical_extension.
nh_clinical_api_extension
(pool, cr)[source]¶ Extends the NH Clinical
API
-
cancel_open_activities
(*args, **kwargs)[source]¶ Cancels all not completed or cancelled activities of the provided type and
spell
.Parameters: Returns: True
Return type:
-
change_activity_frequency
(*args, **kwargs)[source]¶ Creates and completes a new
rev frequency
task to update the frequency of the specified activity type.The update of the frequency also triggers an update of the date_scheduled. See nh_observations.observations .nh_clinical_patient_observation.write.
Parameters: Returns: True
Return type:
-
change_activity_frequency_notification
(*args, **kwargs)[source]¶ Creates and completes a new
rev frequency
task to update the frequency of the specified activity type.Parameters: Returns: True
Return type:
-
trigger_notifications
(*args, **kwargs)[source]¶ Creates a new
notification
for every element in the notifications list provided invalues
:{ 'notifications': [{ 'model': (str) type of notification, //required 'summary': (str) notification text, //optional 'groups': (list of str) user groups for which the notification is created, //required 'assign': (bool) //assign the notification to the user? }, ...], 'parent_id': spell type activity id, 'creator_id': activity id triggering, 'patient_id': patient id, 'model': self._name, 'group': group name of the user triggering ('hca','nurse') }
Parameters: values (dict) – contains information to create the notifications.
-
Escalation Tasks (Notifications)¶
notifications.py defines a set of activity types to serve as informative reminders for the users that some action needs to take place. They usually don’t represent an action themselves. A complete notification means the notification was read and the action it refers to was done. The abstract definition of a notification from which all other notifications inherit is also included here.
Escalation Tasks Base Model¶
-
class
nh_observations.notifications.
nh_clinical_notification
(pool, cr)[source]¶ Abstract representation of what a clinical notification is. Contains common information that all notifications will have but does not represent any entity itself, so it basically acts as a template for every other notification.
-
get_form_description
(*args, **kwargs)[source]¶ Returns a description in dictionary format of the input fields that would be required in the user gui when the notification is shown.
Parameters: patient_id (int) – patient
idReturns: a list of dictionaries Return type: list
-
get_view_description
(*args, **kwargs)[source]¶ Transform the form description into view description that can be used by the mobile. This will return a list of dicts similar to:
[ { 'type': 'template', 'template': 'nh_observation.custom_template' }, { 'type': 'task', 'inputs': [] } ]
Parameters: form_desc (list) – List of dicts representing the inputs for the form Returns: list of dicts representing view description
-
is_cancellable
(*args, **kwargs)[source]¶ Notifications cannot be cancelled by the user by default. :returns:
False
:rtype: bool
-
is_valid
(*args, **kwargs)[source]¶ Check the validity of the notification (each subclass to supply rules)
Returns: Boolean representing if notification instance is valid Return type: bool
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
reason
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
Doctor Assessment Escalation Task¶
Review Frequency Escalation Task¶
-
class
nh_observations.notifications.
nh_clinical_notification_frequency
(pool, cr)[source]¶ This notification addresses the specific need of an observation frequency that needs to be reviewed by the medical staff.
-
frequency
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
observation
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
HCA Escalation Task¶
Observations¶
observations.py
defines a set of activity types to record basic
medical observations. They have in common their simple logic and data as
none of them should require complex policies to be implemented.
The abstract definition of an observation from which all other observations inherit is also included here.
Blood Product Observation¶
-
class
nh_observations.observations.
nh_clinical_patient_observation_blood_product
(pool, cr)[source]¶ Represents the action of measuring any of the
patient
blood components. Usually related to blood transfusions.-
product
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
vol
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
Bowels Open Observation¶
-
class
nh_observations.observations.
nh_clinical_patient_observation_bowels_open
(pool, cr)[source]¶ Represents the action of observing if a
patient
has the bowels open or not.-
bowels_open
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
Observation Base Class¶
-
class
nh_observations.observations.
NhClinicalPatientObservation
(pool, cr)[source]¶ Abstract representation of what a medical observation is. Contains common information that all observations will have but does not represent any entity itself, so it basically acts as a template for every other observation.
-
convert_field_values_to_labels
(obs)[source]¶ Convert the values in the passed dictionary to their corresponding labels.
Parameters: obs (list) –
-
create
(*args, **kwargs)[source]¶ Checks for
null
numeric values before writing to the database and removes them from thevals
dictionary to avoid Odoo writing incorrect0
values and then callscreate
.Passing a field key with a falsey value will cause that value to be excluded from the partial calculation due to the logic used, so don’t pass keys at all for fields that have not been submitted, even if they are using falsey values.
Returns: nh_clinical_patient_observation
id.Return type: int
-
frequency
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
get_activity_location_id
(*args, **kwargs)[source]¶ Looks for the related
spell
and gets its current location.Parameters: activity_id (int) – activity
idReturns: location
idReturn type: int
-
classmethod
get_data_visualisation_resource
()[source]¶ Returns URL of JS file to plot data visualisation so can be loaded on mobile and desktop
Returns: URL of JS file to plot graph Return type: str
-
get_field_value_label
(field_name, field_value)[source]¶ Lookup the label for the passed field value and return it.
Parameters: Returns: Field label.
Return type:
-
get_first_obs_created_after_datetime
(*args, **kwargs)[source]¶ Gets the first observation created after the passed datetime.
Parameters: Returns:
-
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) – patient
idReturns: a list of dictionaries Return type: list
-
get_formatted_obs
(*args, **kwargs)[source]¶ Get a dictionary of observation data formatted for display.
Returns: Return type: dict
-
get_last_obs
(*args, **kwargs)[source]¶ Get the last observation made for the given patient_id.
Parameters: - cr –
- uid –
- patient_id (int) –
- context –
Returns: False
orobservation
-
get_last_obs_activity
(*args, **kwargs)[source]¶ Get the activity for the last observation made for the given patient_id.
Parameters: - cr –
- uid –
- patient_id (int) –
- context –
Returns: False
oractivity
-
get_next_obs_activity
(*args, **kwargs)[source]¶ When one observation activity is completed it triggers the creation of another one, this method returns the observation activity triggered by the given one.
Parameters: - obs_activity ('nh.activity' record) –
- data_model (str) –
Returns: Return type: ‘nh.activity’ record
-
get_open_obs_activity
(*args, **kwargs)[source]¶ Gets a list of all ‘open’ activities. ‘Open’ is anything that is not ‘completed’ or ‘cancelled’.
As far as I know there is not yet a situation where there should be more than one observation that is open but there may be in the future. It is up to the caller to check they are happy with the length of the returned list.
Returns: Search results for open EWS observations. Return type: list
-
get_submission_message
()[source]¶ Provides a message to be displayed when the observation is submitted. :return: :rtype str
-
get_view_description
(*args, **kwargs)[source]¶ Transform the form description into view description that can be used by the mobile. This will return a list of dicts similar to:
[ { 'type': 'template', 'template': 'nh_observation.custom_template' }, { 'type': 'form', 'inputs': [] } ]
Parameters: form_desc (list) – List of dicts representing the inputs for the form Returns: list of dicts representing view description
-
is_last_obs_refused
(*args, **kwargs)[source]¶ Check if the last completed observation was a partial with reason ‘refused’.
Parameters: patient_id – Returns:
-
is_partial
¶
-
none_values
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
null_values
¶ Very similar to
Char
but used for longer contents, does not have a size and usually displayed as a multiline text box.Parameters: translate – whether the value of this field can be translated
-
partial_reason
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
read
(*args, **kwargs)[source]¶ Calls
read
and then looks for potential numeric values that might be actuallynull
instead of0
(as Odoo interprets every numeric value as0
when it findsnull
in the database) and fixes the return value accordingly.Rounds all floats to n decimal places, where n is the number specified in the digits tuple that is an attribute of the field definition on the model.
Returns: dictionary with the read values Return type: dict
-
read_labels
(*args, **kwargs)[source]¶ Return a ‘read-like’ dictionary with field labels instead of values.
Parameters: - fields –
- load –
Returns: Return type:
-
read_obs_for_patient
(*args, **kwargs)[source]¶ Read all observations for the patient.
Parameters: patient_id (int) – Returns: Return type: dict
-
write
(*args, **kwargs)[source]¶ Checks for
null
numeric values before writing to the database and removes them from thevals
dictionary to avoid Odoo writing incorrect0
values and then callswrite
.If the
frequency
is updated, the observation will be rescheduled accordingly.Returns: True
Return type: bool
-
Pain Observation¶
Urine Output Observation¶
-
class
nh_observations.observations.
nh_clinical_patient_observation_urine_output
(pool, cr)[source]¶ Represents the action of measuring a
patient
urine output per hour.-
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 this observation.
Adds an additional label to the
urine_output
field with thetarget
if thepatient
has one.Parameters: patient_id (int) – patient
idReturns: a list of dictionaries Return type: list
-
urine_output
¶
-
Parameters¶
parameters.py defines a set of activity types to record basic medical parameters. They have in common that they are not measurements like the observations.
They can represent a patient state, flag or any simple medical information that is not measured, but set by the medical staff.
They are represented by activity types mainly for audit purposes as their static nature would allow them to be fields instead. The last completed one would represent the current status regarding that specific parameter.
Critical Care¶
-
class
nh_observations.parameters.
nh_clinical_patient_critical_care
(pool, cr)[source]¶ Represents the action of setting the
patient
critical care status to yes or no. This would mainly depend on hospital policy and the medical staff assessment.-
current_status
(*args, **kwargs)[source]¶ Checks if the provided
patient
was marked with critical care status within the last 24 hours.Parameters: patient_id (int) – patient
id.Returns: True
orFalse
Return type: bool
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
status
¶
-
Diabetes¶
-
class
nh_observations.parameters.
nh_clinical_patient_diabetes
(pool, cr)[source]¶ Represents the action of setting the
patient
diabetes status to yes or no. Depending on whether the patient is diabetic or not.-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
status
¶
-
MRSA¶
-
class
nh_observations.parameters.
nh_clinical_patient_mrsa
(pool, cr)[source]¶ Represents the action of setting the
patient
MRSA infection status to yes or no. Depending on whether the patient has the infection or not.-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
status
¶
-
Palliative Care¶
-
class
nh_observations.parameters.
nh_clinical_patient_palliative_care
(pool, cr)[source]¶ Represents the action of setting the
patient
palliative care status to yes or no. This would mainly depend on hospital policy and the medical staff assessment.-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
status
¶
-
Post Surgery¶
-
class
nh_observations.parameters.
nh_clinical_patient_post_surgery
(pool, cr)[source]¶ Represents the action of setting the
patient
post surgery status to yes or no. This would be set as yes after surgery has taken place and then set to no after recovery has been completed. Although mainly depends on hospital policy and medical staff assessment.-
current_status
(*args, **kwargs)[source]¶ Checks if the provided
patient
had surgery in the last 4 hours.Parameters: patient_id (int) – patient
id.Returns: True
orFalse
Return type: bool
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
status
¶
-
Urine Output Target¶
-
class
nh_observations.parameters.
nh_clinical_patient_urine_output_target
(pool, cr)[source]¶ Represents the action of setting the current urine output target for the
patient
. This would mainly be decided by the medical staff assessment.This parameter is directly related to the
output
observation.-
current_target
(*args, **kwargs)[source]¶ Gets the current urine output target for the provided
patient
Returns: [volume,unit]
Return type: list
-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
unit
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
volume
¶
-
Postural Blood Pressure Observations¶
Postural Blood Pressure Observation¶
pbp.py defines the postural blood pressure observation class and its standard behaviour and policy triggers.
-
class
pbp.
nh_clinical_patient_observation_pbp
(pool, cr)[source]¶ Represents a Postural Blood Pressure
observation
for postural hypotension detection, storing the systolic and dyastolic blood pressure for both standing and sitting postures.-
complete
(*args, **kwargs)[source]¶ It determines which acuity case the current observation is in with the stored data and responds to the different policy triggers accordingly defined on the
_POLICY
dictionary.Calls
complete
and then creates and schedules a new postural blood pressure observation if the currentpbp monitoring
parameter isTrue
.Returns: True
Return type: bool
-
diastolic_sitting
¶
-
diastolic_standing
¶
-
result
¶ Basic string field, can be length-limited, usually displayed as a single-line string in clients
Parameters:
-
schedule
(*args, **kwargs)[source]¶ If a specific
date_scheduled
parameter is not specified. The _POLICY[‘schedule’] dictionary value will be used to find the closest time to the current time from the ones specified (0 to 23 hours)Then it will call
schedule
Returns: True
Return type: bool
-
systolic_sitting
¶
-
systolic_standing
¶
-
Parameters¶
parameters.py defines the blood pressure monitoring parameter which is directly related to the postural blood pressure observation.
-
class
parameters.
nh_clinical_patient_pbp_monitoring
(pool, cr)[source]¶ Represents the action of setting the
patient
blood pressure monitoring status to yes or no. This would mainly depend on hospital policy and the medical staff assessment.This parameter is directly related to the
postural blood pressure
observation.-
patient_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute comodel_name is mandatory except in the case of related fields or field extensions.
-
status
¶
-
Bristol Stool Scale Observation¶
Bristol Stool Scale¶
stools.py defines the bristol stool scale observation class and its standard behaviour and policy triggers. There are currently no standard scalation policies defined.
-
class
stools.
nh_clinical_patient_observation_stools
(pool, cr)[source]¶ Represents a Bristol Stool Scale
observation
, which is used as a useful research tool to evaluate the effectiveness of treatments for various diseases of the bowel.-
bowel_open
¶
-
bristol_type
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
colour
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
laxatives
¶
-
nausea
¶
-
offensive
¶
-
quantity
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
rectal_exam
¶
-
samples
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
strain
¶
-
vomiting
¶
-
Urinary Analysis Observation¶
Urinary Analysis¶
urinary_analysis.py defines the urine analysis observation class and its standard behaviour and policy triggers. There are currently no standard scalation policies defined.
-
class
urinary_analysis.
nh_clinical_patient_observation_urinary_analysis
(pool, cr)[source]¶ Represents a Urine Analysis
observation
, which can used by the medical staff to assist in the diagnosis, monitoring and treatment of a wide range of diseases.The test will show if there are any abnormal products in the urine such as sugar (
glucose
),protein
orblood
. In addition to other useful biochemical parameters.-
blood
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
glucose
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
ketones
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
leucocytes
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
nitrates
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
ph
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
protein
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
Visual Infusion Phlebitis Score Observation¶
Visual Infusion Phlebitis Score¶
vips.py defines the visual infusion phlebitis score observation class and its standard behaviour and policy triggers.
-
class
vips.
nh_clinical_patient_observation_vips
(pool, cr)[source]¶ Represents a Visual Infusion Phlebitis Score
observation
, which is used to early detect the possible development of phlebitis on any patient with an intravenous access device in place.The score is computed from several visual assessments done by the medical staff in charge:
pain
,redness
,swelling
, palpable venouscord
andpyrexia
.-
calculate_score
(vips_data)[source]¶ Computes the score based on the VIPS parameters provided.
Parameters: vips_data (dict) – The VIPS parameters: pain
,redness
,swelling
,cord
andpyrexia
.Returns: score
Return type: dict
-
complete
(*args, **kwargs)[source]¶ It determines which acuity case the current observation is in with the stored data and responds to the different policy triggers accordingly defined on the
_POLICY
dictionary.After the policy triggers take place the activity is completed and a new VIPS activity is created. Then the case based frequency is applied, effectively scheduling it.
Returns: True
Return type: bool
-
cord
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
pain
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
pyrexia
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
redness
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
score
¶
-
swelling
¶ Parameters: - selection – specifies the possible values for this field. It is given as either a list of pairs (value, string), or a model method, or a method name.
- selection_add – provides an extension of the selection in the case of an overridden field. It is a list of pairs (value, string).
The attribute selection is mandatory except in the case of related fields or field extensions.
-
Open-eObs Weight Observation¶
Weight Models and Overrides¶
Overrides and extensions to classes lower down in the module dependencies.
Weight Observation¶
-
class
nh_weight.models.nh_clinical_patient_observation_weight.
NhClinicalPatientObservationWeight
(pool, cr)[source]¶ Represents the action of measuring a
patient
weight.-
static
calculate_bmi
(weight, height)[source]¶ Calculates the patient’s BMI.
Parameters: - weight – Patient weight in kilograms.
- height – Patient height in centimetres.
Returns: Patient BMI in kilograms per metre squared to one decimal place.
Return type:
-
calculate_score
(*args, **kwargs)[source]¶ Override of nh.clinical.patient.observation_scored method.
Parameters: - obs_data –
- return_dictionary –
Returns:
-
complete
(*args, **kwargs)[source]¶ Calls
complete
and then creates and schedules a new weight observation if the currentmonitoring
parameter isTrue
.Returns: True
Return type: bool
-
classmethod
get_data_visualisation_resource
()[source]¶ Returns URL of JS file to plot data visualisation so can be loaded on mobile and desktop
Returns: URL of JS file to plot graph Return type: str
-
get_form_description
(*args, **kwargs)[source]¶ Override of nh.clinical.patient.observation_scored method.
Parameters: patient_id – Returns:
-
schedule
(*args, **kwargs)[source]¶ If a specific
date_scheduled
parameter is not specified. The _POLICY[‘schedule’] dictionary value will be used to find the closest time to the current time from the ones specified (0 to 23 hours)Then it will call
schedule
Returns: True
Return type: bool
-
score
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
waist_measurement
¶
-
weight
¶
-
static
Wardboard Extensions¶
-
class
nh_weight.models.nh_clinical_wardboard.
NhClinicalWardboardWeight
(pool, cr)[source]¶ -
wardboard_weight_chart
(*args, **kwargs)[source]¶ Returns an Odoo form window action for
wardboard
for the viewview_wardboard_weight_chart_form
.Parameters: ids (list) – records ids Returns: Odoo form window action Return type: dict
-
weight_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute comodel_name is mandatory except in the case of related fields or field extensions.
Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records in the table relation (string)
- column2 – optional name of the column referring to “those” records in the table relation (string)
The attributes relation, column1 and column2 are optional. If not given, names are automatically generated from model names, provided model_name and comodel_name are different!
Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-