def l1(id, vdata):
 gtable = db.gis_location
 query = (((gtable.parent == id) & (gtable.level == 'L1')) & (gtable.end_date == None))
 aitable = db.vulnerability_aggregated_indicator
 atable = db.vulnerability_aggregate
 rquery = (((aitable.name == 'Resilience') & (atable.parameter_id == aitable.parameter_id)) & (atable.agg_type == 4))
 rows = db(query).select(gtable.id, gtable.name)
 for row in rows:
  query = (rquery & (atable.location_id == row.id))
  _row = db(query).select(atable.median, orderby=(~ atable.date)).first()
  resilience = 0
  if (_row and (_row.median is not None)):
   resilience = int(round(_row.median, 0))
  vdata[row.id] = dict(r=resilience, n=row.name, l=1, f=id)
 return

def l1 ( id , vdata ) : gtable = db . gis_location query = ( ( ( gtable . parent == id ) & ( gtable . level == 'L1' ) ) & ( gtable . end_date == None ) ) aitable = db . vulnerability_aggregated_indicator atable = db . vulnerability_aggregate rquery = ( ( ( aitable . name == 'Resilience' ) & ( atable . parameter_id == aitable . parameter_id ) ) & ( atable . agg_type == 4 ) ) rows = db ( query ) . select ( gtable . id , gtable . name ) for row in rows : query = ( rquery & ( atable . location_id == row . id ) ) _row = db ( query ) . select ( atable . median , orderby = ( ~ atable . date ) ) . first ( ) resilience = 0 if ( _row and ( _row . median is not None ) ) : resilience = int ( round ( _row . median , 0 ) ) vdata [ row . id ] = dict ( r = resilience , n = row . name , l = 1 , f = id ) return
update summary vdata for all child l1s of the start country - used only by the initial map load .