def get_exploration_stats(exploration_id, exploration_version):
 exploration = exp_services.get_exploration_by_id(exploration_id)
 exp_stats = stats_jobs_continuous.StatisticsAggregator.get_statistics(exploration_id, exploration_version)
 last_updated = exp_stats['last_updated']
 state_hit_counts = exp_stats['state_hit_counts']
 return {'improvements': get_state_improvements(exploration_id, exploration_version), 'last_updated': last_updated, 'num_completions': exp_stats['complete_exploration_count'], 'num_starts': exp_stats['start_exploration_count'], 'state_stats': {state_name: {'name': state_name, 'firstEntryCount': (state_hit_counts[state_name]['first_entry_count'] if (state_name in state_hit_counts) else 0), 'totalEntryCount': (state_hit_counts[state_name]['total_entry_count'] if (state_name in state_hit_counts) else 0)} for state_name in exploration.states}}

def get_exploration_stats ( exploration_id , exploration_version ) : exploration = exp_services . get_exploration_by_id ( exploration_id ) exp_stats = stats_jobs_continuous . StatisticsAggregator . get_statistics ( exploration_id , exploration_version ) last_updated = exp_stats [ 'last_updated' ] state_hit_counts = exp_stats [ 'state_hit_counts' ] return { 'improvements' : get_state_improvements ( exploration_id , exploration_version ) , 'last_updated' : last_updated , 'num_completions' : exp_stats [ 'complete_exploration_count' ] , 'num_starts' : exp_stats [ 'start_exploration_count' ] , 'state_stats' : { state_name : { 'name' : state_name , 'firstEntryCount' : ( state_hit_counts [ state_name ] [ 'first_entry_count' ] if ( state_name in state_hit_counts ) else 0 ) , 'totalEntryCount' : ( state_hit_counts [ state_name ] [ 'total_entry_count' ] if ( state_name in state_hit_counts ) else 0 ) } for state_name in exploration . states } }
returns a dict with state statistics for the given exploration id .