Esempio n. 1
0
  def post(self):
    user = self.get_user()
    if not user:
      return

    user_email = self.request.get('user_email')
    query_id = self.request.get('query_id')
    csv_data = self.request.get('csv_data')

    user = User.get_by_email(user_email)
    query = Query.get_by_id(query_id)

    for duple in self.parse_csv_data(csv_data):
      timestamp = duple[0]
      text = duple[1]

      # for testing
      self.response.out.write("<p>%s: %s\n</p>" % (timestamp, text))

      dp = DataPoint(
        timestamp = duple[0],
        query = query,
        text = duple[1])
    
      dp.lt_put()

    self.redirect('/data')
Esempio n. 2
0
  def get(self):
    user = self.get_user()
    if not user:
      return
      
    query_id = self.request.get('query_id')
    query = Query.get_by_id(query_id)

    analytics_json = self.get_analytics(query)

    self.response.out.write(analytics_json)
Esempio n. 3
0
  def get(self):
    user = self.get_user()
    if not user:
      return
      
    query_id = self.request.get('query_id')
    query = Query.get_by_id(query_id)
   
    datapoints = DataPoint.get_by_query(query)
    
    frequencies = common_word_frequencies(datapoints)

    self.response.out.write('[' + json.dumps(frequencies) + ']')
Esempio n. 4
0
  def get(self):
    user = self.get_user()
    if not user:
      return

    user_email = self.request.get('user_email')
    query_id = self.request.get('query_id')

    query = Query.get_by_id(query_id)

    datapoints = DataPoint.get_by_query(query)
    
    csv_data = ''
    
    for dp in datapoints:
      csv_data += self.dp_to_csv(dp)

    self.response.out.write(csv_data)
Esempio n. 5
0
  def get(self):
    user = self.get_user()
    if not user:
      return
      
    query_id = self.request.get('query_id')
    query = Query.get_by_id(query_id)

    analytics_html = self.get_analytics(query)

    params = {
      'analytics_rows': analytics_html, 
      'user_email': user.email, 
      'query_name': query.name,
    }

    html = self.render_page('ui/html/analyze.html', params)

    self.response.out.write(html)