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:

dict

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:
  • refusal_episode (dict) – Raw data from the database.
  • clinical_review_frequency (bool) – Indicates whether to create a clinical_review_frequency task or something else. This only works because there is currently only 2 different types of task created by this method.
Returns:

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

Create or replace the refused_chain_count table for use in get_refusal_episodes

Parameters:cr – Odoo cursor
classmethod validate_dict(dictionary)[source]

Validate that a passed argument is a dictionary that is not empty.

Parameters:dictionary
Returns:No return, raises if invalid.
validate_refusal_episode_dict_key(refusal_episode, key)[source]

Validate that a ‘refusal episode’ dictionary has the desired key and that the key does not have a value of None.

Parameters:
  • refusal_episode (dict) – Raw data from the database.
  • key (str) – Key to be validated.
Returns: