Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/tools/quality_tracking/dashboard/load_coverage.py @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 1.6 KB
Line 
1#!/usr/bin/env python
2#-*- coding: utf-8 -*-
3#  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
4#
5#  Use of this source code is governed by a BSD-style license
6#  that can be found in the LICENSE file in the root of the source
7#  tree. An additional intellectual property rights grant can be found
8#  in the file PATENTS.  All contributing project authors may
9#  be found in the AUTHORS file in the root of the source tree.
10
11"""Loads coverage data from the database."""
12
13from google.appengine.ext import db
14import gviz_api
15
16
17class CoverageDataLoader:
18  """ Loads coverage data from the database."""
19  @staticmethod
20  def load_coverage_json_data(report_category):
21    coverage_entries = db.GqlQuery('SELECT * '
22                                   'FROM CoverageData '
23                                   'WHERE report_category = :1 '
24                                   'ORDER BY date ASC', report_category)
25    data = []
26    for coverage_entry in coverage_entries:
27      # Note: The date column must be first in alphabetical order since it is
28      # the primary column. This is a bug in the gviz api (or at least it
29      # doesn't make much sense).
30      data.append({'aa_date': coverage_entry.date,
31                   'line_coverage': coverage_entry.line_coverage,
32                   'function_coverage': coverage_entry.function_coverage,
33                  })
34
35    description = {
36        'aa_date': ('datetime', 'Date'),
37        'line_coverage': ('number', 'Line Coverage'),
38        'function_coverage': ('number', 'Function Coverage'),
39    }
40    coverage_data = gviz_api.DataTable(description, data)
41    return coverage_data.ToJSon(order_by='date')
Note: See TracBrowser for help on using the repository browser.