Esempio n. 1
0
def main():
    if len(sys.argv) < 3:
        print 'Usage: %s TXT NICKNAMES' % os.path.basename(sys.argv[0])
        sys.exit(1)
    filename = sys.argv[1]
    nicks = Nicknames(sys.argv[2])
    country = _country_name(filename)
    outfilename = '%s%s%sPovertyLines.sql' % (
        country.capitalize(), nicks.year(country),
        nicks.questionsVersionText(country, ''))
    with open(outfilename, 'w') as f:
        f.write('\n'.join(inserts(filename, nicks)) + '\n')
Esempio n. 2
0
def main():
    if len(sys.argv) < 3:
        print 'Usage: %s TXT NICKNAMES' % os.path.basename(sys.argv[0])
        sys.exit(1)
    filename = sys.argv[1]
    nicks = Nicknames(sys.argv[2])
    country = _country_name(filename)
    outfilename = '%s%s%sPovertyLines.sql' % (country.capitalize(), nicks.year(country), nicks.questionsVersionText(country, ''))
    with open(outfilename, 'w') as f:
        f.write('\n'.join(inserts(filename, nicks)) + '\n')
Esempio n. 3
0
if __name__ == '__main__':
    if len(sys.argv) < 3:
        print 'Usage: %s TXT NICKNAMES' % os.path.basename(sys.argv[0])
        sys.exit(1)
    filename = sys.argv[1]
    country_name = os.path.basename(filename.split()[0])
    if '.' in country_name:
        country_name = country_name.split('.')[0]
    nicks = Nicknames(sys.argv[2])
    year = nicks.year(country_name)
    title = nicks.questionsTitle(country_name)
    qs = list(parse_questions(filename))

    xml_country_version = country_name.upper() + str(
        year) + nicks.questionsVersionText(country_name, '')

    properties_out = properties(qs, country_name, nicks, title,
                                xml_country_version)
    sql_out = sql(qs, country_name, nicks, title)
    xml_out = xml(qs, country_name, nicks, title)

    tmp_sql_filename = 'generated/scoringEtl/%s%s%sPPIScore.sql' % (
        country_name.capitalize(), year,
        nicks.questionsVersionText(country_name, ''))
    with open(tmp_sql_filename, 'w') as sql_f:
        sql_f.write(sql_out)
    print 'SQL written to ' + tmp_sql_filename

    tmp_properties_filename = 'generated/testData/%s%s%sTesting.properties' % (
        country_name.capitalize(), year,
Esempio n. 4
0
            return

if __name__ == '__main__':
    if len(sys.argv) < 3:
        print 'Usage: %s TXT NICKNAMES' % os.path.basename(sys.argv[0])
        sys.exit(1)
    filename = sys.argv[1]
    country_name = os.path.basename(filename.split()[0])
    if '.' in country_name:
        country_name = country_name.split('.')[0]
    nicks = Nicknames(sys.argv[2])
    year = nicks.year(country_name)
    title = nicks.questionsTitle(country_name)
    qs = list(parse_questions(filename))

    xml_country_version = country_name.upper() + str(year) + nicks.questionsVersionText(country_name,'')

    properties_out = properties(qs, country_name, nicks, title, xml_country_version)
    sql_out = sql(qs, country_name, nicks, title)
    xml_out = xml(qs, country_name, nicks, title)

    tmp_sql_filename = 'generated/scoringEtl/%s%s%sPPIScore.sql' % (country_name.capitalize(), year, nicks.questionsVersionText(country_name,''))
    with open(tmp_sql_filename, 'w') as sql_f:
        sql_f.write(sql_out)
    print 'SQL written to ' + tmp_sql_filename

    tmp_properties_filename = 'generated/testData/%s%s%sTesting.properties' % (country_name.capitalize(), year, nicks.questionsVersionText(country_name,''))
    with open(tmp_properties_filename, 'w') as properties_f:
        properties_f.write(properties_out)
    print 'properties written to ' + tmp_properties_filename