コード例 #1
0
def transform_project_data(item):
    name = clean_string(item.get("project_title"), default=None)
    return {
        "name": name,
        "slug": slugify(name, allow_unicode=True),
        "start_year": parse_int(item.get("project_start_year")),
        "start_month": parse_int(item.get("project_start_month")),
        "start_day": parse_int(item.get("project_start_day")),
        "status": project_status_from_statuses(item.get("project_status")),
        "sources": make_url_list(item.get("sources")),
        "notes": clean_string(item.get("notes")),
        "commencement_year": parse_int(item.get("commencement_year")),
        "commencement_month": parse_int(item.get("commencement_month")),
        "commencement_day": parse_int(item.get("commencement_day")),
        "total_cost": parse_int(item.get("total_project_cost")),
        "total_cost_currency": item.get("total_project_cost_currency"),
        "planned_completion_year": parse_int(item.get("planned_year_of_completion")),
        "planned_completion_month": parse_int(item.get("planned_month_of_completion")),
        "planned_completion_day": parse_int(item.get("planned_day_of_completion")),
        "new": evaluate_project_new_value(item.get("new")),
        "infrastructure_type": infrastructure_type_object(item.get('infrastructure_type')),
        "initiative": initiative_object(item.get('program_initiative')),
        "collection_stage": collection_stage_from_value(item.get('collection_stage')),
        "verified_path": coerce_to_boolean_or_null(item.get('verified_path'))
    }
コード例 #2
0
def transform_initiative_data(item):
    name = clean_string(item.get("program_initiative_name", item.get("program_initiative")))
    return{
        "name": name,
        "slug": slugify(name, allow_unicode=True),
        "initiative_type": initiative_type_object(item.get('initiative_type')),
        "appeared_year": parse_int(item.get('first_appearance_year')),
        "appeared_month": parse_int(item.get('first_appearance_month')),
        "appeared_day": parse_int(item.get('first_appearance_date')),
    }
コード例 #3
0
def transform_initiative_data(item):
    name = clean_string(
        item.get("program_initiative_name", item.get("program_initiative")))
    return {
        "name": name,
        "slug": slugify(name, allow_unicode=True),
        "initiative_type": initiative_type_object(item.get('initiative_type')),
        "appeared_year": parse_int(item.get('first_appearance_year')),
        "appeared_month": parse_int(item.get('first_appearance_month')),
        "appeared_day": parse_int(item.get('first_appearance_date')),
    }
コード例 #4
0
def transform_project_data(item):
    name = clean_string(item.get("project_title"), default=None)
    return {
        "name":
        name,
        "slug":
        slugify(name, allow_unicode=True),
        "start_year":
        parse_int(item.get("project_start_year")),
        "start_month":
        parse_int(item.get("project_start_month")),
        "start_day":
        parse_int(item.get("project_start_day")),
        "status":
        project_status_from_statuses(item.get("project_status")),
        "sources":
        make_url_list(item.get("sources")),
        "notes":
        clean_string(item.get("notes")),
        "commencement_year":
        parse_int(item.get("commencement_year")),
        "commencement_month":
        parse_int(item.get("commencement_month")),
        "commencement_day":
        parse_int(item.get("commencement_day")),
        "total_cost":
        parse_int(item.get("total_project_cost")),
        "total_cost_currency":
        item.get("total_project_cost_currency"),
        "planned_completion_year":
        parse_int(item.get("planned_year_of_completion")),
        "planned_completion_month":
        parse_int(item.get("planned_month_of_completion")),
        "planned_completion_day":
        parse_int(item.get("planned_day_of_completion")),
        "new":
        evaluate_project_new_value(item.get("new")),
        "infrastructure_type":
        infrastructure_type_object(item.get('infrastructure_type')),
        "initiative":
        initiative_object(item.get('program_initiative')),
        "collection_stage":
        collection_stage_from_value(item.get('collection_stage')),
        "verified_path":
        coerce_to_boolean_or_null(item.get('verified_path'))
    }