Exemple #1
0
    def get_kp_prev_achievement(self, domain):
        config = {
            'domain':
            domain,
            'age':
            get_age_ranges(self.get_list_property('kp_prev_age')),
            'district':
            self.get_list_property('kp_prev_district'),
            'activity_type':
            self.post_data.get('kp_prev_activity_type', None),
            'type_visit':
            self.post_data.get('kp_prev_visit_type', None),
            'client_type':
            self.get_list_property('kp_prev_client_type'),
            'user_id':
            get_user_ids_for_group(
                self.get_list_property('kp_prev_user_group')),
            'want_hiv_test':
            self.post_data.get('kp_prev_want_hiv_test', None),
        }
        update_date_property(config, self.post_data, 'kp_prev_visit_date',
                             'visit_date')

        achievement = UICFromEPMDataSource(config=config).data
        return achievement.get(PREVENTION_XMLNS, {}).get('uic', 0)
Exemple #2
0
    def generate_data(self, domain):
        config = {
            'domain':
            domain,
            'district':
            self.get_list_property('district'),
            'type_visit':
            self.post_data.get('visit_type', None),
            'activity_type':
            self.post_data.get('activity_type', None),
            'client_type':
            self.get_list_property('client_type'),
            'user_id':
            get_user_ids_for_group(self.get_list_property('organization')),
            'fiscal_year':
            self.post_data.get('fiscal_year', None),
        }

        update_date_property(config, self.post_data, 'visit_date',
                             'visit_date')
        update_date_property(config, self.post_data, 'posttest_date',
                             'posttest_date')
        update_date_property(config, self.post_data, 'first_art_date',
                             'first_art_date')
        update_date_property(config, self.post_data, 'date_handshake',
                             'date_handshake')
        update_date_property(config, self.post_data, 'date_last_vl_test',
                             'date_last_vl_test')

        target_client_types = []
        for client_type in config['client_type']:
            if client_type == 'client_fsw':
                client_type = 'cfsw'
            target_client_types.append(client_type.lower())
        config.update({'clienttype': target_client_types})
        targets = TargetsDataSource(config=config.copy()).data
        kp_prev = UICFromEPMDataSource(config=config.copy()).data
        htc_tst = UICFromCCDataSource(config=config.copy()).data
        htc_pos = HivStatusDataSource(config=config.copy()).data
        care_new = FormCompletionDataSource(config=config.copy()).data
        tx_new = FirstArtDataSource(config=config.copy()).data
        tz_undetect = LastVLTestDataSource(config=config).data

        return {
            'target_kp_prev': (targets.get('target_kp_prev', 0) or 0),
            'target_htc_tst': (targets.get('target_htc_tst', 0) or 0),
            'target_htc_pos': (targets.get('target_htc_pos', 0) or 0),
            'target_care_new': (targets.get('target_care_new', 0) or 0),
            'target_tx_new': (targets.get('target_tx_new', 0) or 0),
            'target_tx_undetect': (targets.get('target_tx_undetect', 0) or 0),
            'kp_prev': (kp_prev.get(PREVENTION_XMLNS, {}).get('uic', 0) or 0),
            'htc_tst': (htc_tst.get(POST_TEST_XMLNS, {}).get('uic', 0) or 0),
            'htc_pos': (htc_pos.get(POST_TEST_XMLNS, {}).get('uic', 0) or 0),
            'care_new': (care_new.get(ACCOMPAGNEMENT_XMLNS, {}).get('uic', 0)
                         or 0),
            'tx_new': (tx_new.get(SUIVI_MEDICAL_XMLNS, {}).get('uic', 0) or 0),
            'tx_undetect':
            (tz_undetect.get(SUIVI_MEDICAL_XMLNS, {}).get('uic', 0) or 0),
        }
Exemple #3
0
    def get_kp_prev_achievement(self, domain):
        config = {
            'domain': domain,
            'age': get_age_ranges(self.get_list_property('kp_prev_age')),
            'district': self.get_list_property('kp_prev_district'),
            'activity_type': self.post_data.get('kp_prev_activity_type', None),
            'type_visit': self.post_data.get('kp_prev_visit_type', None),
            'client_type': self.get_list_property('kp_prev_client_type'),
            'user_id': get_user_ids_for_group(self.get_list_property('kp_prev_user_group')),
            'want_hiv_test': self.post_data.get('kp_prev_want_hiv_test', None),
        }
        update_date_property(config, self.post_data, 'kp_prev_visit_date', 'visit_date')

        achievement = UICFromEPMDataSource(config=config).data
        return achievement.get(PREVENTION_XMLNS, {}).get('uic', 0)
Exemple #4
0
    def generate_data(self, domain):
        config = {
            'domain': domain,
            'district': self.get_list_property('district'),
            'cbo': self.get_list_property('cbo'),
            'type_visit': self.post_data.get('visit_type', None),
            'activity_type': self.post_data.get('activity_type', None),
            'client_type': self.get_list_property('client_type'),
            'user_id': get_user_ids_for_group(self.get_list_property('organization')),
            'fiscal_year': self.post_data.get('fiscal_year', None),
        }

        update_date_property(config, self.post_data, 'visit_date', 'visit_date')
        update_date_property(config, self.post_data, 'posttest_date', 'posttest_date')
        update_date_property(config, self.post_data, 'first_art_date', 'first_art_date')
        update_date_property(config, self.post_data, 'date_handshake', 'date_handshake')
        update_date_property(config, self.post_data, 'date_last_vl_test', 'date_last_vl_test')

        target_client_types = []
        for client_type in config['client_type']:
            if client_type == 'client_fsw':
                client_type = 'cfsw'
            target_client_types.append(client_type.lower())
        config.update({'clienttype': target_client_types})
        targets = TargetsDataSource(config=config.copy()).data
        kp_prev = UICFromEPMDataSource(config=config.copy()).data
        htc_tst = UICFromCCDataSource(config=config.copy()).data
        htc_pos = HivStatusDataSource(config=config.copy()).data
        care_new = FormCompletionDataSource(config=config.copy()).data
        tx_new = FirstArtDataSource(config=config.copy()).data
        tz_undetect = LastVLTestDataSource(config=config).data

        return {
            'target_kp_prev': (targets.get('target_kp_prev', 0) or 0),
            'target_htc_tst': (targets.get('target_htc_tst', 0) or 0),
            'target_htc_pos': (targets.get('target_htc_pos', 0) or 0),
            'target_care_new': (targets.get('target_care_new', 0) or 0),
            'target_tx_new': (targets.get('target_tx_new', 0) or 0),
            'target_tx_undetect': (targets.get('target_tx_undetect', 0) or 0),
            'kp_prev': (kp_prev.get(PREVENTION_XMLNS, {}).get('uic', 0) or 0),
            'htc_tst': (htc_tst.get(POST_TEST_XMLNS, {}).get('uic', 0) or 0),
            'htc_pos': (htc_pos.get(POST_TEST_XMLNS, {}).get('uic', 0) or 0),
            'care_new': (care_new.get(ACCOMPAGNEMENT_XMLNS, {}).get('uic', 0) or 0),
            'tx_new': (tx_new.get(SUIVI_MEDICAL_XMLNS, {}).get('uic', 0) or 0),
            'tx_undetect': (tz_undetect.get(SUIVI_MEDICAL_XMLNS, {}).get('uic', 0) or 0),
        }
Exemple #5
0
 def get_kp_prev_achievement(self, domain):
     config = {
         'domain':
         domain,
         'age':
         self.post_data.get('kp_prev_age', None),
         'district':
         self.post_data.get('kp_prev_district', None),
         'visit_date_start':
         self.post_data.get('kp_prev_visit_date_start', None),
         'visit_date_end':
         self.post_data.get('kp_prev_visit_date_end', None),
         'activity_type':
         self.post_data.get('kp_prev_activity_type', None),
         'type_visit':
         self.post_data.get('kp_prev_visit_type', None),
         'client_type':
         self.post_data.get('kp_prev_client_type', None),
         'user_id':
         get_user_ids_for_group(
             self.post_data.get('kp_prev_user_group', None)),
     }
     achievement = UICFromEPMDataSource(config=config).data
     return achievement.get(PREVENTION_XMLNS, {}).get('uic', 0)
Exemple #6
0
    def generate_data(self, domain):
        config = {
            'domain':
            domain,
            'district':
            self.post_data.get('district', None),
            'type_visit':
            self.post_data.get('visit_type', None),
            'activity_type':
            self.post_data.get('activity_type', None),
            'client_type':
            self.post_data.get('client_type', None),
            'organization':
            self.post_data.get('organization', None),
            'visit_date_start':
            self.post_data.get('visit_date_start', None),
            'visit_date_end':
            self.post_data.get('visit_date_end', None),
            'posttest_date_start':
            self.post_data.get('post_date_start', None),
            'posttest_date_end':
            self.post_data.get('post_date_end', None),
            'first_art_date_start':
            self.post_data.get('first_art_date_start', None),
            'first_art_date_end':
            self.post_data.get('first_art_date_end', None),
            'date_handshake_start':
            self.post_data.get('date_handshake_start', None),
            'date_handshake_end':
            self.post_data.get('date_handshake_end', None),
            'date_last_vl_test_start':
            self.post_data.get('date_last_vl_test_start', None),
            'date_last_vl_test_end':
            self.post_data.get('date_last_vl_test_end', None),
            'fiscal_year':
            self.post_data.get('fiscal_year', None),
        }
        client_type = self.post_data.get('client_type', None)
        if client_type:
            if client_type == 'client_fsw':
                client_type = 'cfsw'
            client_type = client_type.lower()
        config.update({'clienttype': client_type})

        targets = TargetsDataSource(config=config).data
        kp_prev = UICFromEPMDataSource(config=config).data
        htc_tst = UICFromCCDataSource(config=config).data
        htc_pos = HivStatusDataSource(config=config).data
        care_new = FormCompletionDataSource(config=config).data
        tx_new = FirstArtDataSource(config=config).data
        tz_undetect = LastVLTestDataSource(config=config).data

        return {
            'target_kp_prev': (targets.get('target_kp_prev', 0) or 0),
            'target_htc_tst': (targets.get('target_htc_tst', 0) or 0),
            'target_htc_pos': (targets.get('target_htc_pos', 0) or 0),
            'target_care_new': (targets.get('target_care_new', 0) or 0),
            'target_tx_new': (targets.get('target_tx_new', 0) or 0),
            'target_tx_undetect': (targets.get('target_tx_undetect', 0) or 0),
            'kp_prev': (kp_prev.get(PREVENTION_XMLNS, {}).get('uic', 0) or 0),
            'htc_tst': (htc_tst.get(POST_TEST_XMLNS, {}).get('uic', 0) or 0),
            'htc_pos': (htc_pos.get(POST_TEST_XMLNS, {}).get('uic', 0) or 0),
            'care_new': (care_new.get(ACCOMPAGNEMENT_XMLNS, {}).get('uic', 0)
                         or 0),
            'tx_new': (tx_new.get(SUIVI_MEDICAL_XMLNS, {}).get('uic', 0) or 0),
            'tx_undetect':
            (tz_undetect.get(SUIVI_MEDICAL_XMLNS, {}).get('uic', 0) or 0),
        }