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