def __init__(self, data_provider, output, common): GlobalSessionToolBox.__init__(self, data_provider, output, common) self.main_template, self.invasion_template = self.get_template() self.relevant_scenes_exist_value = self.do_relevant_scenes_exist() self.relevant_scif = self.scif[self.scif['template_name'].isin( self.relevant_scenes_exist_value)]
def __init__(self, data_provider, output, common): GlobalSessionToolBox.__init__(self, data_provider, output, common) self.ps_data_provider = PsDataProvider(data_provider) self.own_manufacturer = int(self.data_provider.own_manufacturer.param_value.values[0]) self.all_templates = self.data_provider[Data.ALL_TEMPLATES] self.project_templates = {} self.parse_template() self.store_type = self.store_info['store_type'].iloc[0] self.survey = Survey(self.data_provider, output, ps_data_provider=self.ps_data_provider, common=self.common) self.att2 = self.store_info['additional_attribute_2'].iloc[0] self.results_df = pd.DataFrame(columns=['kpi_name', 'kpi_fk', 'numerator_id', 'numerator_result', 'denominator_id', 'denominator_result', 'result', 'score', 'identifier_result', 'identifier_parent', 'should_enter']) self.products = self.data_provider[Data.PRODUCTS] scif = self.scif[['brand_fk', 'facings', 'product_type']].groupby(by='brand_fk').sum() self.mpis = self.matches \ .merge(self.products, on='product_fk', suffixes=['', '_p']) \ .merge(self.scene_info, on='scene_fk', suffixes=['', '_s']) \ .merge(self.all_templates[['template_fk', TEMPLATE_GROUP]], on='template_fk') \ .merge(scif, on='brand_fk')[COLUMNS] self.mpis['store_fk'] = self.store_id self.calculations = { COMBO: self.calculate_combo, POSM_AVAILABILITY: self.calculate_posm_availability, SCORING: self.calculate_scoring, SHARE_OF_EMPTY: self.calculate_share_of_empty, SOS: self.calculate_sos, SURVEY: self.calculate_survey, }
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.templates = {} self.parse_template() self.rds_conn = PSProjectConnector(self.project_name, DbUsers.CalculationEng) self.scif = self.data_provider[Data.SCENE_ITEM_FACTS] self.match_product_in_scene = self.data_provider[Data.MATCHES] self.match_display_in_scene = self.data_provider.match_display_in_scene self._filter_display_in_scene() self.match_scene_item_facts = pd.merge( self.scif, self.match_product_in_scene, how='right', left_on=['item_id', 'scene_id'], right_on=['product_fk', 'scene_fk']) # Merges scif with mpis on product_fk self.match_scene_item_facts.rename(columns={ 'product_fk_x': 'product_fk', 'scene_fk_x': Consts.SCENE_FK }, inplace=True) self._filter_scif_and_mpis_by_template_name_scene_type_and_category_name( ) self._filter_scif_by_by_template_name_scene_type_and_category_name() # self.own_manufacturer_fk = int(self.data_provider.own_manufacturer.param_value.values[0]) self.results_df = pd.DataFrame(columns=[ 'kpi_name', 'kpi_fk', 'numerator_id', 'numerator_result', 'context_id', 'denominator_id', 'denominator_result', 'result', 'score' ])
def __init__(self, data_provider, output, common): GlobalSessionToolBox.__init__(self, data_provider, output, common) self.mpis = self.matches.merge(self.scene_info, on='scene_fk')[COLUMNS] self.results_df = pd.DataFrame( columns=[FK, NUMERATOR_ID, DENOMINATOR_ID, CONTEXT_ID, RESULT, SCORE] )
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.scif = self.data_provider[Data.SCENE_ITEM_FACTS] self.visit_date = datetime.combine(self.data_provider[Data.VISIT_DATE], datetime.min.time()) self.relevant_template = self.retrieve_price_target_df() self.mpis = self.data_provider[Data.MATCHES] self.manufacturer_fk = self.data_provider.own_manufacturer.param_value.values[0] if \ self.data_provider.own_manufacturer.param_value.values[0] else 2
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.adjacency = Adjancency(data_provider) self.block = Block(data_provider) self.kpi_static_data = self.common.get_kpi_static_data() self.ps_data_provider = PsDataProvider(data_provider) self._scene_types = None self.external_targets = self.ps_data_provider.get_kpi_external_targets( )
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.own_manufacturer_fk = int(self.data_provider.own_manufacturer.param_value.values[0]) self.parser = Parser self.all_products = self.data_provider[Data.ALL_PRODUCTS] self.assortment = Assortment(self.data_provider, self.output) self.ps_data = PsDataProvider(self.data_provider, self.output) self.kpi_external_targets = self.ps_data.get_kpi_external_targets(key_fields=Consts.KEY_FIELDS, data_fields=Consts.DATA_FIELDS)
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.assortment = Assortment(data_provider) self.ps_data = PsDataProvider(data_provider) self.display_in_scene = data_provider.match_display_in_scene self.static_display = data_provider.static_display self.manufacturer_fk = int(self.manufacturer_fk) self._add_display_data_to_scif() self._add_client_name_and_sub_brand_data()
def __init__(self, data_provider, common): GlobalSessionToolBox.__init__(self, data_provider, None) self.filtered_mdis = self._get_filtered_match_display_in_scene() self.store_number_1 = self.store_info.store_number_1[0] self.filtered_scif = self._get_filtered_scif() self.ps_data_provider = PsDataProvider(data_provider) self.target = self._get_case_count_targets() self.matches = self.get_filtered_matches() self.excluded_product_fks = self._get_excluded_product_fks() self.adj_graphs_per_scene = {} self.common = common
def __init__(self, data_provider, common): GlobalSessionToolBox.__init__(self, data_provider, None) # self.matches = self.get_filtered_matches() self.store_number = self.store_info.store_number_1.iloc[0] self.ps_data_provider = PsDataProvider(self.data_provider, self.output) self.rds_conn = PSProjectConnector(self.project_name, DbUsers.CalcAdmin) self.custom_entity = self.get_custom_entity() self.targets = self.ps_data_provider.get_kpi_external_targets(kpi_fks=[6006], key_fields=['store_number_1', 'product_fk'], key_filters={'store_number_1': self.store_number}) self.common = common
def __init__(self, data_provider, output, common): GlobalSessionToolBox.__init__(self, data_provider, output, common) self.scene_types = self.scif['template_name'].unique().tolist() self.gz = self.store_info['additional_attribute_4'].iloc[0] self.city = self.store_info['address_city'].iloc[0] self.relevant_targets = self._get_relevant_external_targets( kpi_operation_type='acomodo_cigarros') self.invasion_targets = self._get_relevant_external_targets( kpi_operation_type='invasion') self._determine_target_product_fks() self.leading_products = self._get_leading_products_from_scif() self.scene_realograms = self._calculate_scene_realograms() self.ps_data_provider = PsDataProvider(self.data_provider) self.match_product_in_probe_state_reporting = self.ps_data_provider.get_match_product_in_probe_state_reporting( )
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.ps_data_provider = PsDataProvider(self.data_provider, self.output) self.results_df = pd.DataFrame(columns=[ 'kpi_name', 'kpi_fk', 'numerator_id', 'numerator_result', 'denominator_id', 'denominator_result', 'result', 'score', 'identifier_result', 'identifier_parent', 'should_enter', 'target' ]) self.templates = {} self.parse_template() self.own_manuf_fk = int( self.data_provider.own_manufacturer.param_value.values[0]) self.scif = self.scif[self.scif['product_type'] != 'Irrelevant'] self.scene_survey_results = self.get_scene_survey_response() self.session_survey_results = self.get_session_survey_response() self.custom_entities = self.ps_data_provider.get_custom_entities(1002)
def __init__(self, data_provider, output, common): GlobalSessionToolBox.__init__(self, data_provider, output, common) self.common_v2 = common self.ps_data_provider = PsDataProvider(data_provider) self.store_type = self.store_info['store_type'].iloc[0] self.templates = {} self.parse_template() self.own_manuf_fk = int(self.data_provider.own_manufacturer.param_value.values[0]) self.template_fk = self.scif.template_fk.iloc[0] self.survey_response = self.data_provider[Data.SURVEY_RESPONSES] self.assortment_template = self.templates[ASSORTMENT] self.match_product_in_scene = self.data_provider['matches'] self.important_survey = self.survey_response[self.survey_response.question_fk.isin([22])] # self.survey = Survey(self.data_provider, output=output, ps_data_provider=self.ps_data_provider, # common=self.common_v2) self.results_df = pd.DataFrame(columns=['kpi_name', 'kpi_fk', 'numerator_id', 'numerator_result', 'denominator_id', 'denominator_result', 'result', 'score', 'identifier_result', 'identifier_parent', 'should_enter'])
def __init__(self, data_provider, output, common): GlobalSessionToolBox.__init__(self, data_provider, output, common) self.ps_data_provider = PsDataProvider(data_provider) self.own_manufacturer = int( self.data_provider.own_manufacturer.param_value.values[0]) self.templates = {} self.parse_template() self.store_type = self.store_info['store_type'].iloc[0] self.survey = Survey(self.data_provider, output, ps_data_provider=self.ps_data_provider, common=self.common) self.att2 = self.store_info['additional_attribute_2'].iloc[0] self.products = self.data_provider[Data.PRODUCTS] self.survey = self.data_provider.survey_responses self.results_df = pd.DataFrame(columns=[ 'kpi_name', 'kpi_fk', 'numerator_id', 'numerator_result', 'denominator_id', 'denominator_result', 'result', 'score', 'identifier_result', 'identifier_parent', 'should_enter' ])
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.templates = {} self.parse_template() self.match_product_in_scene = self.data_provider[Data.MATCHES] self.match_scene_item_facts = pd.merge( self.scif, self.match_product_in_scene, how='right', left_on=['item_id', 'scene_id'], right_on=['product_fk', 'scene_fk']) # Merges scif with mpis on product_fk self.block = Block(data_provider) self.own_manufacturer_fk = int( self.data_provider.own_manufacturer.param_value.values[0]) self.results_df = pd.DataFrame(columns=[ 'kpi_name', 'kpi_fk', 'numerator_id', 'numerator_result', 'context_id', 'denominator_id', 'denominator_result', 'result', 'score' ])
def __init__(self, data_provider, output, common): GlobalSessionToolBox.__init__(self, data_provider, output, common) self.ps_data_provider = PsDataProvider(self.data_provider, self.output) self.own_manufacturer = self.data_provider[Data.OWN_MANUFACTURER].iloc[0]['param_value'] self.products = data_provider[Data.PRODUCTS] self.store_areas = self.get_store_area_df() \ .rename(columns={"store_area_name": LOCATION, 'store_area_fk': 'location_fk'}) key_packages = self.scif[[PRODUCT_FK, KEY_PACKAGE]] \ .drop_duplicates() product_facings = self.scif[[SCENE_FK, 'location_type_fk', PRODUCT_FK, FACINGS, 'facings_ign_stack']] \ .rename(columns={'facings_ign_stack': 'SKUs', 'location_type_fk': LOCATION}) survey_response = self.ps_data_provider.get_scene_surveys_responses() \ .rename(columns={'question_fk': 'survey_question_fk', 'selected_option_text': 'scene_survey_response'}) try: self.mpis = self.matches \ .merge(self.products, how='left', on=PRODUCT_FK, suffixes=['', '_p']) \ .merge(self.scene_info, how='left', on=SCENE_FK, suffixes=['', '_s']) \ .merge(self.templates, how='left', on=TEMPLATE_FK, suffixes=['', '_t']) \ .merge(self.store_areas, how='left', on=SCENE_FK, suffixes=['', '_sa']) \ .merge(key_packages, how='left', on=PRODUCT_FK, suffixes=['', '_kp']) \ .merge(product_facings, how='left', on=[SCENE_FK, PRODUCT_FK], suffixes=['', '_pf']) \ .merge(survey_response, how='left', on=SCENE_FK, suffixes=['', '_sr'])[MPIS_COLUMNS] self.mpis.loc[:, 'Own-Manufacturer'] = self.own_manufacturer except ValueError: self.mpis = pd.DataFrame() self.kpi_templates = self.get_kpi_template(PATH, 'Data') self.results_df = pd.DataFrame( columns=RESULTS_COLUMNS) self.scene_availability_df = pd.DataFrame( columns=RESULTS_COLUMNS) self.calculations = { COMPLIANT_BAY_COUNT: self.calculate_compliant_bay, SCENE_AVAILABILITY: self.calculate_scene_availability, SHARE_OF_SCENES: self.calculate_share_of_scenes, FACINGS_SOS: self.calculate_facings_sos, }
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.templates = {} self.scene_kpi_results_fix = {} self.scene_kpi_ratio_pass = {} self.scenes_result = self.data_provider.scene_kpi_results
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.assortment = Assortment(self.data_provider) self.ps_data = PsDataProvider(self.data_provider, self.output) self.result_values = self.ps_data.get_result_values() self.db_handler = DBHandler(self.data_provider.project_name, self.data_provider.session_uid)
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output)
def __init__(self, data_provider, common): GlobalSessionToolBox.__init__(self, data_provider, None) self.filtered_mdis = self._get_filtered_match_display_in_scene() self.filtered_scif = self._get_filtered_scif() self.matches = self.get_filtered_matches() self.common = common
def __init__(self, data_provider, output): GlobalSessionToolBox.__init__(self, data_provider, output) self.assortment = Assortment(self.data_provider, self.output)