Пример #1
0
def ws_38_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    topic = [t for t in MAJOR_TOPICS if t[0] == row[1]][0][1]
    writer.writerow({
        'Topic': clean_title(topic),
        'Answer': row[0],
        'Year': settings.REPORTS_CURRENT_YEAR,
        'Geography': GLOBAL_GEOGRAPHY,
        'Count': counts_list[row]
    })
Пример #2
0
def ws_41_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    all_topics = [y for x in TOPICS for y in x[1]]
    topic = [x[1] for x in all_topics if x[0] == row[1]][0]
    writer.writerow({
        'Topic': clean_title(topic),
        'Answer': row[0],
        'Year': settings.REPORTS_CURRENT_YEAR,
        'Geography': GLOBAL_GEOGRAPHY,
        'Count': counts_list[row]
    })
Пример #3
0
def ws_09_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    topic = [y for x in TOPICS for y in x[1] if y[0] == row[1]][0][1]
    gender = get_gender(row[0])

    writer.writerow({
        'Topic': clean_title(topic),
        'Gender': gender,
        'Year': settings.REPORTS_CURRENT_YEAR,
        'Geography': GLOBAL_GEOGRAPHY,
        'Count': counts_list[row]
    })
Пример #4
0
def ws_30_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    for reporter in counts_list[row]:
        gender = get_gender(reporter[0])
        topic = [t for t in MAJOR_TOPICS if t[0] == reporter[1]][0][1]
        writer.writerow({
            'Topic': clean_title(topic),
            'Gender': gender,
            'Year': settings.REPORTS_CURRENT_YEAR,
            'Geography': GLOBAL_GEOGRAPHY,
            'Count': counts_list[row][reporter]
        })
Пример #5
0
def ws_102_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    agree_disagree, topic = row
    topic = [t for t in MAJOR_TOPICS if t[0] == topic][0][1]
    agree_disagree = 'Agree' if agree_disagree == 1 else 'Disagree'
    count = counts_list[row]
    writer.writerow({
        'Topic': clean_title(topic),
        'Agree/Disagree': agree_disagree,
        'Year': settings.REPORTS_CURRENT_YEAR,
        'Geography': GLOBAL_GEOGRAPHY,
        'Count': count
    })
Пример #6
0
def ws_101_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    gender, topic = row
    gender = get_gender(gender)
    topic = [t for t in MAJOR_TOPICS if t[0] == topic][0][1]
    count = counts_list[row]
    writer.writerow({
        'Topic': clean_title(topic),
        'Gender': gender,
        'Year': settings.REPORTS_CURRENT_YEAR,
        'Geography': GLOBAL_GEOGRAPHY,
        'Count': count
    })
Пример #7
0
def ws_92_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    topic, agree_disagree = row
    count = counts_list[row]
    topic = [t for t in MAJOR_TOPICS if t[0] == topic][0][1]
    agree_disagree = 'Agree' if agree_disagree == 1 else 'Disagree'
    writer.writerow({
        'Topic': clean_title(topic),
        'Answer': agree_disagree,
        'Year': settings.REPORTS_CURRENT_YEAR,
        'Geography': regions_code[region],
        'Count': count
    })
Пример #8
0
def ws_48_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    topic = [t for t in MAJOR_TOPICS if t[0] == row[1]][0][1]
    answer = 'Agree' if row[0] == 1 else 'Disagree'
    gender = get_gender(kwargs['gender'])
    writer.writerow({
        'Topic': clean_title(topic),
        'Gender': gender,
        'Answer': answer,
        'Year': settings.REPORTS_CURRENT_YEAR,
        'Geography': GLOBAL_GEOGRAPHY,
        'Count': counts_list[row]
    })
Пример #9
0
def ws_93_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    topic, yes_no = row
    count = counts_list[row]
    region = kwargs['region']
    topic = [t for t in MAJOR_TOPICS if t[0] == topic][0][1]
    yes_no = 'Yes' if yes_no == 'Y' else 'No'
    writer.writerow({
        'Topic': clean_title(topic),
        'Answer': yes_no,
        'Year': settings.REPORTS_CURRENT_YEAR,
        'Geography': regions_code[region],
        'Count': count
    })
Пример #10
0
def ws_100_dataset(writer, counts_list, row, **kwargs):
    from reports.report_builder import clean_title

    for answer_topic in counts_list[row]:
        answer, topic = answer_topic
        yes_no = 'Yes' if answer == 'Y' else 'No'
        topic = [t for t in MAJOR_TOPICS if t[0] == topic][0][1]
        count = counts_list[row][answer_topic]
        writer.writerow({
            'Topic': clean_title(topic),
            'Medium': row,
            'Yes/No': yes_no,
            'Year': settings.REPORTS_CURRENT_YEAR,
            'Geography': GLOBAL_GEOGRAPHY,
            'Count': count
        })
Пример #11
0
def clear_function(text):
    from reports.report_builder import clean_title

    text = clean_title(text)
    return text[text.find(']') + 1:].lstrip()
Пример #12
0
def get_gender(gender_id):
    from reports.report_builder import clean_title

    gender = [x[1] for x in GENDER if x[0] == gender_id][0]
    return clean_title(gender)