@webapi.route('/index.json')
@log_application_errors
def app_index_json():
    with db_connect(current_app.config['DATABASE_URL']) as conn:
        with db_cursor(conn) as db:
            zips = load_collection_zips_dict(db)
    
    collections = {}
    licenses = {'': 'Freely Shareable', 'sa': 'Share-Alike Required'}
    
    for ((collection, license), zip) in zips.items():
        if zip.content_length < 1024:
            # too small, probably empty
            continue

        if collection not in collections:
            collections[collection] = dict()
        
        if license not in collections[collection]:
            collections[collection][license] = dict()
        
        d = dict(url=nice_domain(zip.url), content_length=zip.content_length)
        d['license'] = licenses[license]
        collections[collection][license] = d
    
    return jsonify({
        'run_states_url': urljoin(request.url, u'/state.txt'),
        'latest_run_processed_url': urljoin(request.url, u'/latest/run/{source}.zip'),
        'licenses_url': urljoin(request.url, u'/latest/licenses.json'),
        'collections': collections
        })
dataset/ETHPy150Open openaddresses/machine/openaddr/ci/webapi.py/app_index_json/original