def _json_play_events(data):
 temp = list()
 for (playerid, statcats) in data.iteritems():
  for info in statcats:
   if (info['statId'] not in nflgame.statmap.idmap):
    continue
   statvals = nflgame.statmap.values(info['statId'], info['yards'])
   statvals['playerid'] = (None if (playerid == '0') else playerid)
   statvals['playername'] = (info['playerName'] or None)
   statvals['team'] = info['clubcode']
   temp.append((int(info['sequence']), statvals))
 return [t[1] for t in sorted(temp, key=(lambda t: t[0]))]

def _json_play_events ( data ) : temp = list ( ) for ( playerid , statcats ) in data . iteritems ( ) : for info in statcats : if ( info [ 'statId' ] not in nflgame . statmap . idmap ) : continue statvals = nflgame . statmap . values ( info [ 'statId' ] , info [ 'yards' ] ) statvals [ 'playerid' ] = ( None if ( playerid == '0' ) else playerid ) statvals [ 'playername' ] = ( info [ 'playerName' ] or None ) statvals [ 'team' ] = info [ 'clubcode' ] temp . append ( ( int ( info [ 'sequence' ] ) , statvals ) ) return [ t [ 1 ] for t in sorted ( temp , key = ( lambda t : t [ 0 ] ) ) ]
takes a single json play entry and converts it to a list of events .