def compute_map_data(result):
    """Compute rank and percent from map counts."""
    total = sum([r['count'] for r in result])
    return [
        dict(
            count=r['count'],
            map=dict(name=r['name']),
            rank=i + 1,
            percent=r['count']/total
        ) for i, r in enumerate(result)
    ]