Example #1
0
 def get_bay_shelf_entity_type_fk(self):
     # self.rds_conn = PSProjectConnector(self.project_name, DbUsers.CalculationEng)
     # entity_type_fk = 1601
     entity_type_fk = pd.read_sql_query(
         PNGJP_SAND2Queries.get_entity_type_fk_query(),
         self.rds_conn.db)['pk'].iloc[0]
     return entity_type_fk
 def get_kpi_static_data(self):
     """
     This function extracts the static KPI data and saves it into one global data frame.
     The data is taken from static.kpi / static.atomic_kpi / static.kpi_set.
     """
     query = PNGJP_SAND2Queries.get_all_kpi_data()
     kpi_static_data = pd.read_sql_query(query, self.rds_conn.db)
     return kpi_static_data
Example #3
0
 def sync_bay_shelf_combination_to_custom_entity(self, bay_no, shelf_no):
     # self.rds_conn = PSProjectConnector(self.project_name, DbUsers.CalculationEng)
     # entity_type_fk = 1601
     insert_query = PNGJP_SAND2Queries.insert_into_custom_entity_query(
         bay_no, shelf_no, self.bay_shelf_entity_type_fk)
     cur = self.rds_conn.db.cursor()
     cur.execute(insert_query)
     custom_entity_fk = cur.lastrowid
     self.rds_conn.db.commit()
     Log.info(
         "Saved a record in custom_entity for bay:{} shelf:{} - pk = {}".
         format(bay_no, shelf_no, custom_entity_fk))
     return custom_entity_fk
Example #4
0
 def get_match_display_in_scene(self):
     query = PNGJP_SAND2Queries.get_match_display(self.session_uid)
     match_display = pd.read_sql_query(query, self.rds_conn.db)
     match_display = match_display[match_display[SceneInfoConsts.SCENE_FK].\
                                             isin(self.scene_info[SceneInfoConsts.SCENE_FK].values)]
     match_display = match_display.merge(self.scene_info[[
         SceneInfoConsts.SCENE_FK, SceneInfoConsts.TEMPLATE_FK
     ]],
                                         on=SceneInfoConsts.SCENE_FK,
                                         how='left')
     match_display = match_display.merge(self.all_templates,
                                         on=SceneInfoConsts.TEMPLATE_FK,
                                         how='left',
                                         suffixes=['', '_y'])
     return match_display
 def get_match_display(self):
     """
     This function extracts the display matches data and saves it into one global data frame.
     The data is taken from probedata.match_display_in_scene.
     """
     query = PNGJP_SAND2Queries.get_match_display(self.session_uid)
     match_display = pd.read_sql_query(query, self.rds_conn.db)
     match_display = match_display.merge(self.scene_info[[
         SceneInfoConsts.SCENE_FK, SceneInfoConsts.TEMPLATE_FK
     ]],
                                         on=SceneInfoConsts.SCENE_FK,
                                         how='left')
     match_display = match_display.merge(self.all_templates,
                                         on=TemplatesConsts.TEMPLATE_FK,
                                         how='left',
                                         suffixes=['', '_y'])
     return match_display
 def get_probe_group(self, session_uid):
     query = PNGJP_SAND2Queries.get_probe_group(session_uid)
     probe_group = pd.read_sql_query(query, self.rds_conn.db)
     return probe_group
Example #7
0
 def get_all_kpi_external_targets(self):
     query = PNGJP_SAND2Queries.get_kpi_external_targets(self.visit_date)
     external_targets = pd.read_sql_query(query, self.rds_conn.db)
     return external_targets
Example #8
0
 def get_bay_shelf_combination_from_custom_entity(self):
     # self.rds_conn = PSProjectConnector(self.project_name, DbUsers.CalculationEng)
     query = PNGJP_SAND2Queries.get_all_custom_entities_query()
     bay_shelf_number_info = pd.read_sql_query(query, self.rds_conn.db)
     return bay_shelf_number_info