def test_03_data_obj_w_spell_w_start_time_wout_end_time_w_ews_only(self):
     test_dict = {
         'spell_id': self.spell_id,
         'start_time': self.start_time,
         'end_time': None,
         'ews_only': True
     }
     test_data_obj = data_dict_to_obj(test_dict)
     self.assertEqual(
         test_data_obj.spell_id,
         self.spell_id,
         'Created Data Obj spell_id attribute does not match'
     )
     self.assertEqual(
         test_data_obj.start_time,
         self.start_time,
         'Created Data Obj start_time attr does not match'
     )
     self.assertEqual(
         test_data_obj.end_time,
         None,
         'Created data obj end_time attr does not match'
     )
     self.assertEqual(
         test_data_obj.ews_only,
         True,
         'Created data obj ews_only does not match'
     )
Example #2
0
 def test_12_data_obj_with_empty_dictionary(self):
     test_data_obj = data_dict_to_obj({})
     self.assertEqual(test_data_obj.spell_id, None,
                      'Created Data Obj spell_id attribute does not match')
     self.assertEqual(test_data_obj.start_time, None,
                      'Created Data Obj start_time attr does not match')
     self.assertEqual(test_data_obj.end_time, None,
                      'Created data obj end_time attr does not match')
     self.assertEqual(test_data_obj.ews_only, None,
                      'Created data obj ews_only does not match')
Example #3
0
 def setUp(self):
     super(TestGetReportData, self).setUp()
     self.report_model = self.env['report.nh.clinical.observation_report']
     self.test_utils_model = self.env['nh.clinical.test_utils']
     self.test_utils_model.create_patient_and_spell()
     report_data = {
         'spell_id': self.test_utils_model.spell.id,
         'start_date': None,
         'end_date': None,
         'ews_only': True
     }
     self.example_data = helpers.data_dict_to_obj(report_data)
 def setUp(self):
     super(TestGetReportData, self).setUp()
     self.report_model = self.env['report.nh.clinical.observation_report']
     self.test_utils_model = self.env['nh.clinical.test_utils']
     self.test_utils_model.create_patient_and_spell()
     report_data = {
         'spell_id': self.test_utils_model.spell.id,
         'start_date': None,
         'end_date': None,
         'ews_only': True
     }
     self.example_data = helpers.data_dict_to_obj(report_data)
Example #5
0
 def test_05_data_obj_w_spell_wout_start_time_w_end_time_w_ews_only(self):
     test_dict = {
         'spell_id': self.spell_id,
         'start_time': None,
         'end_time': self.end_time,
         'ews_only': True
     }
     test_data_obj = data_dict_to_obj(test_dict)
     self.assertEqual(test_data_obj.spell_id, self.spell_id,
                      'Created Data Obj spell_id attribute does not match')
     self.assertEqual(test_data_obj.start_time, None,
                      'Created Data Obj start_time attr does not match')
     self.assertEqual(test_data_obj.end_time, self.end_time,
                      'Created data obj end_time attr does not match')
     self.assertEqual(test_data_obj.ews_only, True,
                      'Created data obj ews_only does not match')
 def test_12_data_obj_with_empty_dictionary(self):
     test_data_obj = data_dict_to_obj({})
     self.assertEqual(
         test_data_obj.spell_id,
         None,
         'Created Data Obj spell_id attribute does not match'
     )
     self.assertEqual(
         test_data_obj.start_time,
         None,
         'Created Data Obj start_time attr does not match'
     )
     self.assertEqual(
         test_data_obj.end_time,
         None,
         'Created data obj end_time attr does not match'
     )
     self.assertEqual(
         test_data_obj.ews_only,
         None,
         'Created data obj ews_only does not match'
     )
    def setUp(self):
        super(TestDatetimesAreCorrectlyLocalised, self).setUp()
        self.report_model = self.env['report.nh.clinical.observation_report']
        self.activity_model = self.env['nh.activity']
        self.test_utils = self.env['nh.clinical.test_utils']
        self.test_utils.create_patient_and_spell()
        self.test_utils.copy_instance_variables(self)

        # Create different obs types.
        self.blood_glucose_model = \
            self.env['nh.clinical.patient.observation.blood_glucose']
        self.blood_product_model = \
            self.env['nh.clinical.patient.observation.blood_product']
        self.weight_model = self.env['nh.clinical.patient.observation.weight']

        ews_obs_activity = self.test_utils\
            .create_and_complete_ews_obs_activity(
                self.patient.id, self.spell.id)

        blood_glucose_activity_id = self.blood_glucose_model.create_activity(
            {'parent_id': self.spell_activity.id},
            {
                'patient_id': self.patient.id,
                'blood_glucose': 40
            }
        )
        blood_product_activity_id = self.blood_product_model.create_activity(
            {'parent_id': self.spell_activity.id},
            {
                'patient_id': self.patient.id,
                'vol': 55,
                'product': self.blood_product_model._blood_product_values[0][0]
            }
        )
        weight_activity_id = self.weight_model.create_activity(
            {'parent_id': self.spell_activity.id},
            {
                'patient_id': self.patient.id,
                'weight': 70,
                'waist_measurement': 80
            }
        )

        self.activity_model.complete(blood_glucose_activity_id)
        self.activity_model.complete(blood_product_activity_id)
        self.activity_model.complete(weight_activity_id)

        blood_glucose_activity = \
            self.activity_model.browse(blood_glucose_activity_id)
        blood_product_activity = \
            self.activity_model.browse(blood_product_activity_id)
        weight_activity = self.activity_model.browse(weight_activity_id)

        datetime_utc = '2017-06-06 13:00:00'
        self.datetime_bst = '2017-06-06 14:00:00'
        self.datetime_bst_formatted = '14:00 06/06/17'

        ews_obs_activity.date_terminated = datetime_utc
        blood_glucose_activity.date_terminated = datetime_utc
        blood_product_activity.date_terminated = datetime_utc
        weight_activity.date_terminated = datetime_utc

        ews_obs_activity.data_ref.date_terminated = datetime_utc
        blood_glucose_activity.data_ref.date_terminated = datetime_utc
        blood_product_activity.data_ref.date_terminated = datetime_utc
        weight_activity.data_ref.date_terminated = datetime_utc

        report_input_dict = {
            'spell_id': self.test_utils.spell.id,
            'start_date': '2017-06-05 12:00:00',
            'end_date': '2017-06-07 12:00:00'
        }
        report_input_obj = helpers.data_dict_to_obj(report_input_dict)

        self.report_data = self.report_model\
            .with_context({'tz': 'Europe/London'})\
            .get_and_process_report_data(report_input_obj)
    def setUp(self):
        super(TestDatetimesAreCorrectlyLocalised, self).setUp()
        self.report_model = self.env['report.nh.clinical.observation_report']
        self.activity_model = self.env['nh.activity']
        self.test_utils = self.env['nh.clinical.test_utils']
        self.test_utils.create_patient_and_spell()
        self.test_utils.copy_instance_variables(self)

        # Create different obs types.
        self.blood_glucose_model = \
            self.env['nh.clinical.patient.observation.blood_glucose']
        self.blood_product_model = \
            self.env['nh.clinical.patient.observation.blood_product']
        self.weight_model = self.env['nh.clinical.patient.observation.weight']

        ews_obs_activity = self.test_utils\
            .create_and_complete_ews_obs_activity(
                self.patient.id, self.spell.id)

        blood_glucose_activity_id = self.blood_glucose_model.create_activity(
            {'parent_id': self.spell_activity.id}, {
                'patient_id': self.patient.id,
                'blood_glucose': 40
            })
        blood_product_activity_id = self.blood_product_model.create_activity(
            {'parent_id': self.spell_activity.id}, {
                'patient_id': self.patient.id,
                'vol': 55,
                'product': self.blood_product_model._blood_product_values[0][0]
            })
        weight_activity_id = self.weight_model.create_activity(
            {'parent_id': self.spell_activity.id}, {
                'patient_id': self.patient.id,
                'weight': 70,
                'waist_measurement': 80
            })

        self.activity_model.complete(blood_glucose_activity_id)
        self.activity_model.complete(blood_product_activity_id)
        self.activity_model.complete(weight_activity_id)

        blood_glucose_activity = \
            self.activity_model.browse(blood_glucose_activity_id)
        blood_product_activity = \
            self.activity_model.browse(blood_product_activity_id)
        weight_activity = self.activity_model.browse(weight_activity_id)

        datetime_utc = '2017-06-06 13:00:00'
        self.datetime_bst = '2017-06-06 14:00:00'
        self.datetime_bst_formatted = '14:00 06/06/17'

        ews_obs_activity.date_terminated = datetime_utc
        blood_glucose_activity.date_terminated = datetime_utc
        blood_product_activity.date_terminated = datetime_utc
        weight_activity.date_terminated = datetime_utc

        ews_obs_activity.data_ref.date_terminated = datetime_utc
        blood_glucose_activity.data_ref.date_terminated = datetime_utc
        blood_product_activity.data_ref.date_terminated = datetime_utc
        weight_activity.data_ref.date_terminated = datetime_utc

        report_input_dict = {
            'spell_id': self.test_utils.spell.id,
            'start_date': '2017-06-05 12:00:00',
            'end_date': '2017-06-07 12:00:00'
        }
        report_input_obj = helpers.data_dict_to_obj(report_input_dict)

        self.report_data = self.report_model\
            .with_context({'tz': 'Europe/London'})\
            .get_and_process_report_data(report_input_obj)