def _report_domains(self, do_report_domains, do_report_domains_coded_values): """Report domains information.""" domains = self.gdb.get_domains() if not domains: return df = pd.DataFrame.from_dict(domains).sort_values(by='Name') df['Range'].fillna(value='', inplace=True) if do_report_domains: for domain_name in sorted( df[df['Domain type'] == 'CodedValue']['Name'].values): _build_html.add_li_to_toc( parent_id='tocDomains', section_header_id='dmn' + domain_name, li_text=domain_name, report_path=self.report_file_path) _build_html.add_div_to_html_page( df=df.drop('Coded values', 1), section_header_id='domains', section_title='Domains', report_path=self.report_file_path) if do_report_domains_coded_values: df_coded_values = { item['Name']: item['Coded values'] for item in df.to_dict(orient='records') if item['Domain type'] == 'CodedValue' } for domain_name, coded_values_dict in sorted( df_coded_values.items(), key=lambda i: i[0]): df = pd.DataFrame([{ 'Code': k, 'Value': v, } for k, v in coded_values_dict.items()]) _build_html.add_div_to_html_page( df, section_header_id='dmn' + domain_name, section_title=domain_name, header_size='h3', report_path=self.report_file_path) return
def _report_fcs( self, do_report_fcs, do_report_fcs_fields, do_report_fcs_subtypes, do_report_fcs_indexes, ): """Report feature classes information.""" fcs = self.gdb.get_feature_classes() if fcs: if do_report_fcs: fcs_info = self._get_fcs_info(fcs) _build_html.add_div_to_html_page( fcs_info, section_header_id='fcs', section_title='Feature classes', report_path=self.report_file_path) for fc_name in fcs_info['Name'].values: _build_html.add_li_to_toc(parent_id='tocFcs', section_header_id=fc_name, report_path=self.report_file_path) if do_report_fcs_fields: fc_fields = self._get_fc_fields(fc_name) if fc_fields is not None: _build_html.add_div_to_html_page( fc_fields, section_header_id=fc_name, section_title=fc_name, header_size='h3', report_path=self.report_file_path) if do_report_fcs_subtypes and self.arcpy_found: fc_subtypes = self._get_fc_subtypes(fc_name) if fc_subtypes is not None: if do_report_fcs_fields: section_title = 'Subtypes' else: section_title = 'Subtypes ({0})'.format(fc_name) _build_html.add_div_to_html_page( fc_subtypes, section_header_id=fc_name, section_title=section_title, header_size='h4', report_path=self.report_file_path) if do_report_fcs_indexes and self.arcpy_found: fc_indexes = self._get_fc_indexes(fc_name) if fc_indexes is not None: if do_report_fcs_fields: section_title = 'Indexes' else: section_title = 'Indexes ({0})'.format(fc_name) _build_html.add_div_to_html_page( fc_indexes, section_header_id=fc_name, section_title=section_title, header_size='h4', report_path=self.report_file_path) return
def _report_tables( self, do_report_tables, do_report_tables_fields, do_report_tables_subtypes, do_report_tables_indexes, ): """Report tables information.""" tables = self.gdb.get_tables() if tables: tables_info = self._get_tables_info(tables) if do_report_tables: _build_html.add_div_to_html_page( tables_info, section_header_id='tables', section_title='Tables', report_path=self.report_file_path) for table_name in tables_info['Name'].values: try: _build_html.add_li_to_toc( parent_id='tocTables', section_header_id=table_name, report_path=self.report_file_path) if do_report_tables_fields: table_fields = self._get_table_fields(table_name) if table_fields is not None: _build_html.add_div_to_html_page( table_fields, section_header_id=table_name, section_title=table_name, header_size='h3', report_path=self.report_file_path) if do_report_tables_subtypes and self.arcpy_found: table_subtypes = self._get_table_subtypes(table_name) if table_subtypes is not None: if do_report_tables_fields: section_title = 'Subtypes' else: section_title = 'Subtypes ({0})'.format( table_name) _build_html.add_div_to_html_page( table_subtypes, section_header_id=table_name, section_title=section_title, header_size='h4', report_path=self.report_file_path) if do_report_tables_indexes and self.arcpy_found: table_indexes = self._get_table_indexes(table_name) if do_report_tables_fields is not None: section_title = 'Indexes' else: section_title = 'Indexes ({0})'.format(table_name) _build_html.add_div_to_html_page( table_indexes, section_header_id=table_name, section_title=section_title, header_size='h4', report_path=self.report_file_path) except Exception as e: logging.error(str(e.args[0])) tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] logging.error(tbinfo) return
def _report_tables( self, do_report_tables, do_report_tables_fields, do_report_tables_subtypes, do_report_tables_indexes, ): """Report tables information.""" tables = self.gdb.get_tables() if tables: tables_info = self._get_tables_info(tables) if do_report_tables: _build_html.add_div_to_html_page( tables_info, section_header_id='tables', section_title='Tables', report_path=self.report_file_path) for table_name in tables_info['Name'].values: _build_html.add_li_to_toc( parent_id='tocTables', section_header_id=table_name, report_path=self.report_file_path) if do_report_tables_fields: table_fields = self._get_table_fields(table_name) if table_fields is not None: _build_html.add_div_to_html_page( table_fields, section_header_id=table_name, section_title=table_name, header_size='h3', report_path=self.report_file_path) if do_report_tables_subtypes and self.arcpy_found: table_subtypes = self._get_table_subtypes(table_name) if table_subtypes is not None: if do_report_tables_fields: section_title = 'Subtypes' else: section_title = 'Subtypes ({0})'.format(table_name) _build_html.add_div_to_html_page( table_subtypes, section_header_id=table_name, section_title=section_title, header_size='h4', report_path=self.report_file_path) if do_report_tables_indexes and self.arcpy_found: table_indexes = self._get_table_indexes(table_name) if do_report_tables_fields is not None: section_title = 'Indexes' else: section_title = 'Indexes ({0})'.format(table_name) _build_html.add_div_to_html_page( table_indexes, section_header_id=table_name, section_title=section_title, header_size='h4', report_path=self.report_file_path) return