def lambda_handler(event, context):
    logger.info('got event{}'.format(event))
    uuid = event['campaign_uuid']
    type_name = event['type']
    type_id = type_name.replace(' ', '_')

    campaign = Campaign(uuid)

    for type_key in campaign.types:
        if campaign.types[type_key]['type'] == type_name:
            typee = campaign.types[type_key]

    query = build_query(
        polygon=campaign.corrected_coordinates(),
        typee=typee)
    
    save_query(
        path=build_query_path(uuid, type_id),
        query=query)

    
    post_request(query, type_id)

    clean_aoi(campaign, type_id)

    save_to_s3(
        path=build_path(uuid, type_id),
        type_id=type_id)

    invoke_process_feature_completeness(uuid, type_name)
    invoke_process_count_feature(uuid, type_name)
    invoke_process_mapper_engagement(uuid, type_name)
Exemple #2
0
def lambda_handler(event, context):
    logger.info('got event{}'.format(event))
    uuid = event['campaign_uuid']
    type_name = event['type']

    campaign = fetch_campaign(campaign_path(uuid))
    for type_key in campaign['types']:
        if campaign['types'][type_key]['type'] == type_name:
            typee = campaign['types'][type_key]

    type_id = typee['type'].replace(' ', '_')
    if 'element_type' in typee:
        element_type = typee['element_type']
    else:
        element_type = None

    elements = []
    if element_type == 'Point':
        elements.append('node')
    elif element_type == 'Polygon':
        elements.append('way')
    elif element_type == 'Line':
        elements.append('way')
    else:
        elements.append('way')
        elements.append('node')

    query = build_query(uuid, type_id, elements)
    post_request(query, type_id)
    save_to_s3(path=build_path(uuid, type_id), type_id=type_id)
Exemple #3
0
def lambda_handler(event, context):
    logger.info('got event{}'.format(event))
    uuid = event['campaign_uuid']
    feature = event['feature']
    date = event['date']

    query = '{diff_query}{query}'.format(diff_query=build_diff_query(date),
                                         query=build_query(uuid, feature))

    post_request(query, feature)

    save_to_s3(path=build_path(uuid, feature), feature=feature)