def main(): # Download XML bills get_xml_bills() # Clear database db_utils.clear_bills_db() # Write basic data db_utils.write_db() # Write top terms db_utils.write_db_top_term() db_utils.write_db_top_terms() # Download XML people get_xml_people() db_utils.write_db_people() db_utils.write_db_sponsors() # Write related bills data db_utils.write_db_related_bills() # Create text index of summaries ix_utils.create_summary_index()
def main(): tests_dir = general.ROOT_DIR / 'tests' db_utils.clear_bills_db() general.init_db() # Load basic data for f in tests_dir.files('bill*.xml'): db_utils.db_create_bill(xml_utils.bill_of_file(f)) # Add related bills for f in tests_dir.files('bill*.xml'): b = xml_utils.bill_of_file(f) b_obj = Bill.query.filter_by(id=b['id']).first() for r_id in b['related']: r_obj = Bill.query.filter_by(id=r_id).first() b_obj.related_bills.append(r_obj) general.close_db(write=True) # Create text index of summaries ix_utils.create_summary_index()