original_docstring: Validates data and attempts to insert records to user_steps SQL
          table.
          
          Args:
              df (DataFrame): Records to be inserted.
              user_id (str): User ID queried from provided session.
          
          Returns:
              boolean: True if records inserted otherwise returns False
          
docstring: Validates data and attempts to insert records to user_steps SQL
  table.
docstring_tokens: Validates data and attempts to insert records to user_steps SQL table .
code: def handle_user_steps_upload(self, df, user_id):
          """Validates data and attempts to insert records to user_steps SQL
          table.
          
          Args:
              df (DataFrame): Records to be inserted.
              user_id (str): User ID queried from provided session.
          
          Returns:
              boolean: True if records inserted otherwise returns False
          """
          df['user_id'] = user_id
          cols = list(df.columns)
  
          # Veridate mandatory fields
          TABLE_FIELDS = ['user_id', 'date', 'step_count']
          for field in TABLE_FIELDS:
              if field not in cols:
                  print '--- BAD DATA RECEIVED ---'
                  print 'Missing field {}'.format(field)
                  return False
          
          # Catch any bad data inserts
          try:
              # Drop fields not recognized
              df = df[TABLE_FIELDS]
  
              # Insert data records to DB 2000 rows at a time
              df.to_sql('user_steps', db.engine, index=False, chunksize=2000,
                        if_exists='append')
          except Exception as e:
              print '--- FATAL DATA INSERT ERROR ---'
              print e.message
              return False
  
          # Return Ture for successful record inserts
          return True
code_tokens: def handle_user_steps_upload ( self , df , user_id ) : df [ 'user_id' ] = user_id cols = list ( df . columns ) TABLE_FIELDS = [ 'user_id' , 'date' , 'step_count' ] for field in TABLE_FIELDS : if field not in cols : print '--- BAD DATA RECEIVED ---' print 'Missing field {}' . format ( field ) return False try : df = df [ TABLE_FIELDS ] df . to_sql ( 'user_steps' , db . engine , index = False , chunksize = 2000 , if_exists = 'append' ) except Exception as e : print '--- FATAL DATA INSERT ERROR ---' print e . message return False return True
short_docstring: Validates data and attempts to insert records to user_steps SQL
  table.
short_docstring_tokens: Validates data and attempts to insert records to user_steps SQL table .
comment: """Validates data and attempts to insert records to user_steps SQL
          table.
          
          Args:
              df (DataFrame): Records to be inserted.
              user_id (str): User ID queried from provided session.
          
          Returns:
              boolean: True if records inserted otherwise returns False
          """$SEP$# Veridate mandatory fields$SEP$# Catch any bad data inserts$SEP$# Drop fields not recognized$SEP$# Insert data records to DB 2000 rows at a time$SEP$# Return Ture for successful record inserts