Exemplo n.º 1
0
    def __create_measures(self):
        df_cym, df_cyd, df_pmt, df_hr_scorecard, df_hr_absences, df_hr_sickness, df_hr_training, df_dcs_complaints = self.get_data_frames()
        if df_cym is None:
            raise RGError('Unable to create measures from invalid data frame object [{}]'.format(df_cym))
        self.__entities = list()

        d_list = list()
        m_list = list()
        m_ids = set()

        for idx, line in df_cym.iterrows():
            m = RGMeasureFactory.create_measure(m_type=get_val(line, MEASURE_TYPE).upper(), df=line)
            m_ids.add(m.m_id)
            m_list.append(m)
        for idx, line in df_cyd.iterrows():
            d_list.append(RGDataFactory.create_data(m_type=get_val(line, MEASURE_TYPE).upper(), df=line))

        m_ids = sorted(m_ids)
        m_list.sort(key=lambda x: x.m_id)
        d_list.sort(key=lambda x: x.m_id)

        for m_id in m_ids:
            m_cfy = None
            m_lfy = None
            d_cfy = None
            d_lfy = None
            for m in m_list:
                if m.m_id == m_id:
                    if m.f_year == get_cfy_prefix(cfy=self.year):
                        m_cfy = m
                        continue
                    if m.f_year == get_lfy_prefix(cfy=self.year):
                        m_lfy = m
                        continue
            if m_cfy is not None:
                d_cfy = self.__get_data_for_measure(m_cfy, d_list)
            if m_lfy is not None:
                d_lfy = self.__get_data_for_measure(m_lfy, d_list)
            if m_cfy is not None and m_lfy is not None and \
                    d_cfy is not None and len(d_cfy) > 0 and \
                    d_lfy is not None and len(d_lfy) > 0:
                self.__entities.append(
                    RGEntityFactory.create_entity(m_type=m_cfy.m_type, data_cfy=d_cfy, data_lfy=d_lfy,
                                                  measure_cfy=m_cfy, measure_lfy=m_lfy))
        # parse unknown data frame
        self.__parse_abnormal_data(df_pmt, PMT_ADDITIONAL)
        self.__parse_abnormal_data(df_hr_scorecard, HR_SCORECARD)
        self.__parse_abnormal_data(df_hr_absences, HR_ABSENCES)
        self.__parse_abnormal_data(df_hr_sickness, HR_SICKNESS)
        self.__parse_abnormal_data(df_hr_training, HR_TRAINING)
        self.__parse_abnormal_data(df_dcs_complaints, DCS_COMPLAINTS)

        logging.debug('[{}] entities has been parsed'.format(len(self.__entities)))
Exemplo n.º 2
0
 def __init__(self, m_type=HR_ABSENCES, df=None):
     HrDataModel.__init__(self, m_type=m_type, df=df)
     self.adult_social_care = get_val(df, ADULTS_SOCIAL_CARE, is_float=True)
     self.education_and_skills = get_val(df,
                                         EDUCATION_AND_SKILLS,
                                         is_float=True)
     self.inclusive_growth = get_val(df, INCLUSIVE_GROWTH, is_float=True)
     self.finance_and_governance = get_val(df,
                                           FINANCE_AND_GOVERNANCE,
                                           is_float=True)
     self.neighbourhoods = get_val(df, NEIGHBOURHOODS, is_float=True)
     self.pip = get_val(df,
                        PARTNERSHIPS_INSIGHT_AND_PREVENTION,
                        is_float=True)
     self.digital_and_customer_services = get_val(
         df, DIGITAL_AND_CUSTOMER_SERVICES, is_float=True)
     self.hr_and_od = get_val(df,
                              HR_AND_ORGANISATION_DEVELOPMENT,
                              is_float=True)
     self.bcc = get_val(df, BIRMINGHAM_CITY_COUNCIL, is_float=True)
     self.cwg = get_val(df, COMMONWEALTH_GAMES, is_float=True)
 def __init__(self, m_type=None, df=None):
     if m_type is None or df is None:
         raise RGError(
             'Invalid measure type [{}] or data frame [{}] provided'.format(
                 m_type, df))
     self.m_type = m_type
     self.f_year = get_val(df, FISCAL_YEAR)
     self.m_id = get_val(df, MEASURE_ID)
     self.m_ref_no = get_val(df, MEASURE_REF_NO)
     self.m_title = get_val(df, MEASURE_TITLE)
     self.month = get_val(df, MONTH)
     if self.m_title is None:
         self.m_title = get_val(df, MEASURE)
     self.year = get_val(df, YEAR)
     self.year_month = get_val(df, YEAR_MONTH)
Exemplo n.º 4
0
 def __init__(self, m_type=PMT_ADDITIONAL, df=None):
     RGModelBase.__init__(self, m_type=m_type, df=df)
     self.frequency = get_val(df, FREQUENCY, is_str=True)
     self.quarter = get_val(df, QUARTER, is_str=True)
     self.measure_text_column_1 = get_val(df,
                                          MEASURE_TEXT_COLUMN_1,
                                          is_str=True)
     self.measure_text_column_2 = get_val(df,
                                          MEASURE_TEXT_COLUMN_2,
                                          is_str=True)
     self.dmt_sign_off_date = get_val(df, DMT_SIGN_OFF_DATE, is_date=True)
     self.cabinet_members_sign_off_date = get_val(
         df, CABINET_MEMBERS_SIGN_OFF_DATE, is_date=True)
Exemplo n.º 5
0
 def __init__(self, m_type=None, df=None):
     RGModelBase.__init__(self, m_type=m_type, df=df)
     self.m_desc = get_val(df, MEASURE_DESCRIPTION)
     self.frequency = get_val(df,
                              FREQUENCY_MONTHLY_QUARTERLY_1_2_YEARLY_ANNUAL,
                              is_str=True)
     self.outcome = get_val(df, OUTCOME, is_str=True)
     self.outcome_no = get_val(df, OUTCOME_NO, is_int=True)
     self.outcome_priority_no = get_val(df,
                                        OUTCOME_PRIORITY_NO,
                                        is_int=True)
     self.priority = get_val(df, PRIORITY)
     self.additional_kpi_information = get_val(df, ADDITIONAL_KPI_INFO)
     self.new_existing = get_val(df, NEW_EXISTING)
     self.pref_dot = get_val(df, PREFERRED_DOT)
     self.aim = get_val(df, AIM)
     self.data_format = get_val(df, DATA_FORMAT, is_str=True)
     self.data_presented = get_val(df, DATA_PRESENTED)
     self.baseline = get_val(df, BASELINE, is_float=True)
     self.tolerance = get_val(df, TOLERANCES)
     self.directorate = get_val(df, DIRECTORATE)
     self.cabinet_member_portfolio = get_val(df, CABINET_MEMBER_PORTFOLIO)
     self.corporate_director = get_val(df, CORPORATE_DIRECTOR)
     self.responsible_officer = get_val(df, RESPONSIBLE_OFFICER)
     self.measure_owner = get_val(df, MEASURE_OWNER)
     self.data_source = get_val(df, DATA_SOURCE)
     self.expected_availability = get_val(df, EXPECTED_AVAILABILITY)
     self.final_dqaf_received = get_val(df, FINAL_DQAF_RECEIVED)
     self.theme = get_val(df, THEME)
     self.theme_priority_no = get_val(df, THEME_PRIORITY_NO)
Exemplo n.º 6
0
 def __init__(self, m_type=None, df=None):
     RGModelBase.__init__(self, m_type=m_type, df=df)
     self.frequency = get_val(df, FREQUENCY, is_str=True)
     self.quarter = get_val(df, QUARTER)
     self.result = get_val(df, RESULT)
     self.target = get_val(df, TARGET)
     self.performance = get_val(df, PERFORMANCE)
     self.variance_from_target = get_val(df, VARIANCE_FROM_TARGET)
     self.dot_from_previous_month = get_val(df,
                                            DOT_FROM_PREVIOUS_MONTH,
                                            is_str=True)
     self.dot_from_previous_quarter = get_val(df,
                                              DOT_FROM_PREVIOUS_QUARTER,
                                              is_str=True)
     self.dot_from_same_period_last_year = get_val(
         df, DOT_FROM_SAME_PERIOD_LAST_YEAR, is_str=True)
     self.status = get_val(df, STATUS_PROVISIONAL_CONFIRMED, is_str=True)
     self.d_comments = get_val(df, DIRECTORATE_COMMENTARY, is_str=True)
     self.r_comments = get_val(df, REPORT_COMMENTARY, is_str=True)
     self.bck_nationally = get_val(df,
                                   BENCHMARKABLE_NATIONALLY,
                                   is_str=True)
     self.bck_result = get_val(df, BENCHMARK_RESULT, is_float=True)
     self.bck_group = get_val(df,
                              BENCHMARK_GROUP_FOR_REPORTING_PURPOSES,
                              is_str=True)
     self.brum_result_at_bck = get_val(
         df, BIRMINGHAM_RESULT_AT_TIME_OF_BENCHMARK, is_float=True)
     self.brum_quartile_pos = get_val(df,
                                      BIRMINGHAM_QUARTILE_POSITION,
                                      is_str=True)
     self.year_of_bck_data = get_val(df,
                                     YEAR_OF_BENCHMARK_DATA,
                                     is_str=True)
     self.reason_of_no_national_bck = get_val(
         df, REASON_FOR_NON_NATIONAL_BENCHMARK_IF_RELEVANT, is_str=True)
     self.quartile_projection = get_val(df, QUARTILE_PROJECTION)
     self.assistant_director_sign_off = get_val(
         df, ASSISTANT_DIRECTOR_SIGN_OFF)
     self.dmt_sign_off_date = get_val(df, DMT_SIGN_OFF_DATE)
     self.cabinet_mem_sign_off_date = get_val(
         df, CABINET_MEMBERS_SIGN_OFF_DATE)
     self.year_quarter = get_val(df, YEAR_QUARTER)
Exemplo n.º 7
0
 def __init__(self, m_type=None, df=None):
     RGModelBase.__init__(self, m_type=m_type, df=df)
     self.data_format = get_val(df, DATA_FORMAT)
Exemplo n.º 8
0
 def __init__(self, m_type=HR_SICKNESS, df=None):
     HrDataModel.__init__(self, m_type=m_type, df=df)
     self.total = get_val(df, TOTAL, is_int=True)
     self.percentage = get_val(df, PERCENTAGE, is_float=True)