def load_domain_value_files(base_path):
    """Load domain values (Country codes, Program Activity, Object Class, CFDA)."""
    logger.info('Loading Object Class')
    load_object_class(base_path)
    logger.info('Loading CFDA Program')
    load_cfda_program(base_path)
    logger.info('Loading Program Activity')
    load_program_activity_data(base_path)
    logger.info('Loading Country codes')
    load_country_codes(base_path)
def load_domain_value_files(base_path):
    """Load domain values (Country codes, Program Activity, Object Class, CFDA)."""
    logger.info('Loading Object Class')
    load_object_class(base_path)
    logger.info('Loading CFDA Program')
    load_cfda_program(base_path)
    logger.info('Loading Program Activity')
    load_program_activity_data(base_path)
    logger.info('Loading Country codes')
    load_country_codes(base_path)
def main():
    parser = argparse.ArgumentParser(
        description='Initialize the DATA Act Broker.')
    parser.add_argument('-i',
                        '--initialize',
                        help='Run all broker initialization tasks',
                        action='store_true')
    parser.add_argument('-db',
                        '--setup_db',
                        help='Create broker database and helper tables',
                        action='store_true')
    parser.add_argument('-a',
                        '--create_admin',
                        help='Create an admin user',
                        action='store_true')
    parser.add_argument('-r',
                        '--load_rules',
                        help='Load SQL-based validation rules',
                        action='store_true')
    parser.add_argument(
        '-d',
        '--update_domain',
        help='load slowly changing domain values such as object class',
        action='store_true')
    parser.add_argument('-cc',
                        '--update_country_codes',
                        help='update country codes',
                        action='store_true')
    parser.add_argument('-oc',
                        '--update_object_class',
                        help='load object class to database',
                        action='store_true')
    parser.add_argument('-cfda',
                        '--cfda_load',
                        help='Load CFDA to database',
                        action='store_true')
    parser.add_argument('-pa',
                        '--program_activity',
                        help='Load program activity to database',
                        action='store_true')
    parser.add_argument(
        '-c',
        '--load_agencies',
        help='Update agency data (CGACs, FRECs, SubTierAgencies)',
        action='store_true')
    parser.add_argument('-t',
                        '--update_tas',
                        help='Update broker TAS list',
                        action='store_true')
    parser.add_argument('-s',
                        '--update_sf133',
                        help='Update broker SF-133 reports',
                        action='store_true')
    parser.add_argument('-v',
                        '--update_validator',
                        help='Update validator schema',
                        action='store_true')
    parser.add_argument('-l',
                        '--load_location',
                        help='Load city and county codes',
                        action='store_true')
    parser.add_argument('-z',
                        '--load_zips',
                        help='Load zip code data',
                        action='store_true')
    parser.add_argument('-o',
                        '--load_offices',
                        help='Load FPDS Office Codes',
                        action='store_true')
    parser.add_argument('-u',
                        '--uncache_file_requests',
                        help='Un-cache file generation requests',
                        action='store_true')
    args = parser.parse_args()

    if args.initialize:
        setup_db()
        load_sql_rules()
        load_domain_value_files(validator_config_path)
        load_agency_data(validator_config_path)
        load_tas_lookup()
        load_sf133()
        load_validator_schema()
        load_location_codes()
        load_zip_codes()
        load_offices()
        return

    if args.setup_db:
        setup_db()

    if args.create_admin:
        create_admin()

    if args.load_rules:
        load_sql_rules()

    if args.update_domain:
        load_domain_value_files(validator_config_path)

    if args.update_country_codes:
        load_country_codes(validator_config_path)

    if args.update_object_class:
        load_object_class(validator_config_path)

    if args.cfda_load:
        load_cfda_program(validator_config_path)

    if args.program_activity:
        load_program_activity_data(validator_config_path)

    if args.load_agencies:
        load_agency_data(validator_config_path)

    if args.update_tas:
        load_tas_lookup()

    if args.update_sf133:
        load_sf133()

    if args.update_validator:
        load_validator_schema()

    if args.load_location:
        load_location_codes()

    if args.load_zips:
        load_zip_codes()
        load_location_codes()

    if args.load_offices:
        load_offices()

    if args.uncache_file_requests:
        uncache_file_requests()
def main():
    parser = argparse.ArgumentParser(description='Initialize the DATA Act Broker.')
    parser.add_argument('-i', '--initialize', help='Run all broker initialization tasks', action='store_true')
    parser.add_argument('-db', '--setup_db', help='Create broker database and helper tables', action='store_true')
    parser.add_argument('-a', '--create_admin', help='Create an admin user', action='store_true')
    parser.add_argument('-r', '--load_rules', help='Load SQL-based validation rules', action='store_true')
    parser.add_argument('-d', '--update_domain', help='load slowly changing domain values such as object class',
                        action='store_true')
    parser.add_argument('-cc', '--update_country_codes', help='update country codes', action='store_true')
    parser.add_argument('-oc', '--update_object_class', help='load object class to database', action='store_true')
    parser.add_argument('-cfda', '--cfda_load', help='Load CFDA to database', action='store_true')
    parser.add_argument('-pa', '--program_activity', help='Load program activity to database', action='store_true')
    parser.add_argument('-c', '--load_agencies', help='Update agency data (CGACs, FRECs, SubTierAgencies)',
                        action='store_true')
    parser.add_argument('-t', '--update_tas', help='Update broker TAS list', action='store_true')
    parser.add_argument('-s', '--update_sf133', help='Update broker SF-133 reports', action='store_true')
    parser.add_argument('-v', '--update_validator', help='Update validator schema', action='store_true')
    parser.add_argument('-l', '--load_location', help='Load city and county codes', action='store_true')
    parser.add_argument('-z', '--load_zips', help='Load zip code data', action='store_true')
    parser.add_argument('-o', '--load_offices', help='Load FPDS Office Codes', action='store_true')
    parser.add_argument('-u', '--uncache_all_files', help='Un-cache file generation requests', action='store_true')
    args = parser.parse_args()

    if args.initialize:
        setup_db()
        load_sql_rules()
        load_domain_value_files(validator_config_path)
        load_agency_data(validator_config_path)
        load_tas_lookup()
        load_sf133()
        load_validator_schema()
        load_location_codes()
        load_zip_codes()
        load_offices()
        return

    if args.setup_db:
        setup_db()

    if args.create_admin:
        create_admin()

    if args.load_rules:
        load_sql_rules()

    if args.update_domain:
        load_domain_value_files(validator_config_path)

    if args.update_country_codes:
        load_country_codes(validator_config_path)

    if args.update_object_class:
        load_object_class(validator_config_path)

    if args.cfda_load:
        load_cfda_program(validator_config_path)

    if args.program_activity:
        load_program_activity_data(validator_config_path)

    if args.load_agencies:
        load_agency_data(validator_config_path)

    if args.update_tas:
        load_tas_lookup()

    if args.update_sf133:
        load_sf133()

    if args.update_validator:
        load_validator_schema()

    if args.load_location:
        load_location_codes()

    if args.load_zips:
        load_zip_codes()
        load_location_codes()

    if args.load_offices:
        load_offices()

    if args.uncache_all_files:
        uncache_all_files()