def main_merge(database):
    c = Controller(database)
    c.action_merge_wealth_data_into_birth_table()
    c.action_merge_wealth_data_into_birth_table_egypt()
    c.action_merge_wealth_data_into_birth_table_philippines()
    c.action_merge_wealth_data_into_birth_table_indonesia()
    print('merge of wealth and birth data completed.')
def main(database):

    print('This script will generate a file named tablelist.csv.\n This list '
          'contains all of the tables in the indicated database.\n If there '
          'are any tables in the list that you do not want to include in the '
          'consolidated dataset, \n please remove them from this list.' )

    c = Controller(database)

    try:
        c.action_write_table_list_to_csv()

    except:
        "An error occurred while generating the tablelist.csv file"
def main(database, tablefile):

    c = Controller(database)

    ## function to add table names to each table.

    c.action_add_table_name_to_each_database_table(tablefile)

    ## Function to convert table names to lower case

    c.action_set_table_names_to_lowercase()

    ## Function to convert column names to lower case

    c.action_set_field_names_to_lowercase()
示例#4
0
    def __init__(self, dbname, tablelist, varlist):

        self.c = Controller(dbname)

        self.varlist = list(pd.read_csv(varlist).values.flatten())
        self.tables = list(pd.read_csv(tablelist).values.flatten())
def main_births(database, tablefile, variablefile):

    c = Controller(database)

    c.action_add_list_of_variables_to_all_tables(tablefile, variablefile)
def main_wealth(database, tablefile):

    c = Controller(database)

    c.action_build_intersection_fields_table('intersection_table', tablefile)
    c.action_get_variables_by_table_csv_file()
    c.action_insert_data_to_table(tablefile, 'intersection_table')
    c.action_add_wealth_id_column_to_intersection_table()
    c.action_add_wealth_v002_column_to_intersection_table()
    c.action_add_wealth_v003_column_to_intersection_table()
    c.action_separate_whhid_to_cluster_and_household_id()
    c.action_rename_intersection_table('intersection_table_wealth')
    print('wealth intersection table built.')
示例#7
0
    def test_add_column_name_to_each_db_table(self):

        c = Controller('db_antonio_india')
        c.action_add_table_name_to_each_database_table('tablelist2.csv')
示例#8
0
 def test_create_union_table(self):
     c = Controller('db_antonio_india')
     c.action_build_union_fields_table('union_table', 'tablelist2.csv')
示例#9
0
 def test_insert_data_into_master_table(self):
     c = Controller('db_antonio_india')
     c.action_insert_data_to_union_table('tablelist2.csv', 'union_table')
示例#10
0
 def test_union_of_columns(self):
     c = Controller('db_antonio_india')
     c.action_get_union_of_fields_across_database_tables('tablelist2.csv')
示例#11
0
 def test_create_table_from_union_of_columns(self):
     c = Controller('db_antonio_india')
     c.action_build_union_fields_table('tablelist2.csv')
示例#12
0
 def test_sqlalchemy_get_variables_from_each_table(self):
     c = Controller('db_antonio_india')
     res = c.action_get_variable_names_for_each_table_in_database(
         'tablelist2.csv')
     assert isinstance(res, dict)
示例#13
0
 def test_sqlalchemy_write_table_names_to_csv(self):
     c = Controller('db_antonio_india')
     c.action_write_table_list_to_csv()
示例#14
0
 def test_standardize_database_columns(self):
     c = Controller('db_antonio_india')
     c.action_standardize_fields()
def main_birth(database, tablefile):

    c = Controller(database)

    c.action_build_intersection_fields_table('intersection_table', tablefile)
    c.action_insert_data_to_table(tablefile, 'intersection_table')
    c.action_add_wealth_id_column_to_intersection_table()
    c.action_add_wealth_wlthindf_column_to_intersection_table()
    c.action_add_wealth_wlthind5_column_to_intersection_table()
    c.action_rename_intersection_table('intersection_table_birth')
    c.action_add_columns_for_merge()

    d = Controller_postprocessing(database)
    d.update_b2_dates_to_four_digits()
    d.update_v007_dates_to_four_digits()
    d.update_v190_recode()

    print("birth intersection table built.")
示例#16
0
def main(database):


    c = Controller(database)

    c.action_standardize_fields()