function joinLSRAndInstancesTab($instances, $lsr)
{
    foreach ($instances as $k => $v) {
        $a[$k]["details"] = $v;
        $metrics = getMetrics($a[$k]["details"]['sparql']);
        if (isset($metrics['results']['bindings'][0])) {
            $m = $metrics['results']['bindings'][0];
            $a[$k]['metrics']["triples"] = $m['triples']['value'];
            $a[$k]['metrics']["entities"] = $m['entities']['value'];
            $a[$k]['metrics']["subjects"] = $m['subjects']['value'];
            if (isset($m['date']['value'])) {
                $d = new DateTime($m['date']['value']);
                $a[$k]['metrics']["date"] = date_format($d, 'Y-m-d');
            }
        }
        if (array_key_exists($k, $lsr)) {
            $a[$k]["metrics"] = $v;
            $a[$k]["description"] = $lsr[$k];
        }
    }
    return $a;
}
function getMetricFromRelic($relicKey, $appId, $timePicker)
{
    $errorURL = 'Errors/all&values[]=error_count';
    $countURL = 'HttpDispatcher&values[]=call_count';
    $otherTransactionsURL = 'OtherTransaction/all&values[]=call_count';
    $errorKey = 'error_count';
    $countKey = 'call_count';
    $nowMinus30 = strtotime("-{$timePicker} minutes");
    $startTimeDate = date('Y-m-d', $nowMinus30);
    $startTimeMinutes = date('h:i:s', $nowMinus30);
    $startTimeStr = "{$startTimeDate}T{$startTimeMinutes}+02:00";
    $now = time();
    $endTimeDate = date('Y-m-d', $now);
    $endTimeMinutes = date('h:i:s', $now);
    $endTimeStr = "{$endTimeDate}T{$endTimeMinutes}+02:00";
    $errorCount = getMetrics($relicKey, $errorURL, $appId, $errorKey, $startTimeStr, $endTimeStr);
    $callCount = getMetrics($relicKey, $countURL, $appId, $countKey, $startTimeStr, $endTimeStr);
    $otherTransactionsCount = getMetrics($relicKey, $otherTransactionsURL, $appId, $countKey, $startTimeStr, $endTimeStr);
    echo "Error Count: {$errorCount}<br>";
    echo "Call Count: {$callCount}<br>";
    $errorRate = 100 * $errorCount / ($callCount + $otherTransactionsCount);
    echo "The error rate is: {$errorRate}<br>";
    return $errorRate;
}
Exemplo n.º 3
0
 * 20100525 - Julian - added option 'step_info' => 0 to get_linked_tcversions call
 *                     to improve performance
 * 20090919 - franciscom - added platform info
 *
**/
require '../../config.inc.php';
require_once 'common.php';
require_once 'exttable.class.php';
testlinkInitPage($db, false, false, "checkRights");
$templateCfg = templateConfiguration();
$args = init_args();
$gui = new stdClass();
$gui->tproject_name = $args->tproject_name;
$gui->show_only_active = $args->show_only_active;
$gui->warning_msg = '';
list($gui->tplan_metrics, $gui->show_platforms) = getMetrics($db, $args);
if (count($gui->tplan_metrics) > 0) {
    // Create column headers
    $columns = getColumnsDefinition($gui->show_platforms);
    // Extract the relevant data and build a matrix
    $matrixData = array();
    foreach ($gui->tplan_metrics as $tplan_metrics) {
        foreach ($tplan_metrics as $platform_metric) {
            $rowData = array();
            $rowData[] = strip_tags($platform_metric['tplan_name']);
            if ($gui->show_platforms) {
                $rowData[] = strip_tags($platform_metric['platform_name']);
            }
            $rowData[] = $platform_metric['total'];
            $rowData[] = $platform_metric['active'];
            $rowData[] = $platform_metric['executed'];
Exemplo n.º 4
0
 *  contract, strict liability, or tort (including negligence or otherwise)     *
 *  arising in any way out of the use of this software, even if advised of the  *
 *  possibility of such damage.                                                 *
 *                                                                              *
 ********************************************************************************/
/** Author: Michelle Bachler, KMi, The Open University **/
include_once $_SERVER['DOCUMENT_ROOT'] . '/config.php';
require_once $HUB_FLM->getCodeDirPath("core/io/catalyst/analyticservices.php");
require_once $HUB_FLM->getCodeDirPath("core/io/catalyst/catalyst_jsonld_reader.class.php");
$nodeid = required_param("nodeid", PARAM_ALPHANUMEXT);
$url = $CFG->homeAddress . 'api/views/' . $nodeid;
$data = array();
$jitterArray = array(-0.01, -0.02, -0.03, 0, 0.03, 0.02, 0.01);
// GET METRICS
$metric = 'interest_space_post_coordinates';
$reply = getMetrics($url, $metric);
$replyObj = json_decode($reply);
if (!isset($replyObj[0]->error)) {
    $topicspacedata = $replyObj[0]->data;
    $groups = array();
    foreach ($topicspacedata as $nodearray) {
        $nodeString = $nodearray[0];
        $nodeid = $nodearray[0];
        if (strpos($nodeString, '/') !== FALSE) {
            $bits = explode('/', $nodeString);
            $nodeid = $bits[count($bits) - 1];
            $node = getNode($nodeid);
            if (!$node instanceof Error) {
                $nodeString = $node->name;
                $role = $node->role->name;
                $homepage = "";
    ${'bing' . $i} = array();
    readFromFile(${'bing' . $i}, $bingDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "bing", $query, $queryNumber, ${'bing' . $i});
    ${'blekko' . $i} = array();
    readFromFile(${'blekko' . $i}, $blekkoDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "blekko", $query, $queryNumber, ${'blekko' . $i});
    ${'google' . $i} = array();
    readFromFile(${'google' . $i}, $googleDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "google", $query, $queryNumber, ${'google' . $i});
    ${'aggregated' . $i} = array();
    readFromFile(${'aggregated' . $i}, $aggregatedDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "aggregated", $query, $queryNumber, ${'aggregated' . $i});
    ${'weighted' . $i} = array();
    readFromFile(${'weighted' . $i}, $weightedDirectory, $fileName);
    //getMetrics
    getMetrics($mainMetrics, $goldStandardArr, "weighted", $query, $queryNumber, ${'weighted' . $i});
}
//Call Function to calculate the Mean Average Precision
getMaps($mapScores, $mainMetrics);
//DISPLAY THE RESULTS
displayMetrics($mainMetrics, $mapScores);
//function in metrics.php
//WRITE THE METRICS SCORES TO FILES
writeToFile($mainMetrics, "metrics/evaluationScores", "mainMetrics");
writeToFile($mapScores, "metrics/evaluationScores", "mapScores");
//WRITE THE METRICS TO CSV FILE
writeToCSV($mainMetrics, $mapScores, "metrics/evaluationScores", "combinedMetrics");
}
// Hardcoded Data, use dropdowns in implementation to get actual truck # and GPS ID
// Upon Select Date, pick start and end times for the route, 24 hour period by default
$GPSID = isset($_REQUEST['TruckID']) ? $_REQUEST['TruckID'] : -1;
if ($GPSID != -1) {
    $TruckDriver = GPSMaps::GetTruckDriver($GPSID);
} else {
    $TruckDriver = -1;
}
$StartDate = isset($_REQUEST['Day']) ? $_REQUEST['Day'] : date('Y-m-d');
$FinishDate = isset($_REQUEST['Day']) ? $_REQUEST['Day'] : date('Y-m-d');
if ($StartDate == '') {
    $StartDate = $_POST['Day'];
    $FinishDate = $_POST['Day'];
}
$data = getMetrics($StartDate, $FinishDate, $_SESSION['customerId'], true, true);
$TruckList = GPSMaps::GetTruckDropDown($_SESSION['customerId'], 'yes');
$TList = array();
while ($TL = $TruckList->fetch(PDO::FETCH_OBJ)) {
    if ($TL->TruckDriver == $TruckDriver) {
        $selected = "selected='selected'";
    } else {
        $selected = "";
    }
    $TList[] = "<option value='{$TL->TruckID}' {$selected} >{$TL->TruckName} ({$TL->TruckSerial})</option>";
}
?>

<!DOCTYPE html>
<html>
	<head>
function checkMetrics($mysqli, $metrics, $dataMetricsSource, $dataMetrics)
{
    foreach ($dataMetricsSource as $keyName => $valueData) {
        $id_metric = array_search($keyName, $metrics);
        if ($id_metric == null && $id_metric == '' && $id_metric < 1 || count($metrics) < 1) {
            echo "\nLa métrica NO existente: " . $keyName;
            if (insertMetrics($mysqli, $keyName)) {
                $GLOBALS["metrics"] = getMetrics($mysqli);
                checkMetrics($mysqli, $GLOBALS["metrics"], $dataMetricsSource, $dataMetrics);
            }
        } else {
            if (is_int($valueData) == false) {
                if (is_float($valueData) == false) {
                    $valueData = 'null';
                }
            }
            $dataMetrics = $dataMetrics + array($id_metric => $valueData);
        }
    }
    print_r($dataMetrics);
    return $dataMetrics;
}
Exemplo n.º 8
0
/**
 * Load the data for the Conversation Network with sub-communities metrics.
 * @param url the url for the CIF data to load
 * @param timeout how long (in seconds) to cache the visualisation data
 * before it is considered out of date and should be refetched and recalculated.
 * Defaults to 60 seconds.
 * @param withposts include post data in this visualisation
 * @return a json string of the data loaded from the CIF
 * and converted to the json required by the Circle packing visualisation
 */
function getCommunitiesNetworkData($url, $timeout = 60, $withposts = false)
{
    global $CFG, $LNG, $HUB_CACHE;
    $withhistory = false;
    $withvotes = false;
    $conSet = $HUB_CACHE->getObjData($CFG->VIS_PAGE_COMMUNITIES_NETWORK . $url . $withhistory . $withvotes . $withposts);
    if ($conSet === FALSE) {
        //error_log("DATA not FOUND: getCommunitiesNetworkData");
        $reader = $HUB_CACHE->getObjData('reader' . $url . $withhistory . $withvotes . $withposts);
        if ($reader === FALSE) {
            error_log("READER not FOUND: getCommunitiesNetworkData");
            $reader = new catalyst_jsonld_reader();
            $reader = $reader->load($url, $timeout, $withhistory, $withvotes, $withposts);
            $HUB_CACHE->setObjData('reader' . $url . $withhistory . $withvotes . $withposts, $reader, $timeout);
        } else {
            error_log("READER FOUND: getCommunitiesNetworkData");
        }
        $json = "";
        if (!$reader instanceof Error) {
            $metricarray = array();
            // GET METRICS
            $metric = 'interest_space_post_clusters';
            $reply = getMetrics($url, $metric, $timeout);
            //error_log(print_r($replyObj, true));
            // {warnings: [string,* ], responses: [ result,* ] }
            $replyObj = json_decode($reply);
            $results = $replyObj->responses;
            $communitycount = 0;
            if (!isset($results[0]->error) && isset($results[0]->data)) {
                $metricdata = $results[0]->data;
                $count = count($metricdata);
                $communitycount = $count;
                for ($i = 0; $i < $count; $i++) {
                    $nextcommunity = $metricdata[$i];
                    $countj = count($nextcommunity);
                    for ($j = 0; $j < $countj; $j++) {
                        $nodeid = $nextcommunity[$j];
                        if (!array_key_exists($nodeid, $metricarray) && $nodeid != 'null') {
                            $metricarray[$nodeid] = $i + 1;
                        }
                    }
                }
            }
            //error_log("biggest = ".$biggestsize);
            $conSet = $reader->connectionSet;
            $conSet->communitycount = $communitycount;
            $cons = $conSet->connections;
            $countcons = count($cons);
            for ($i = 0; $i < $countcons; $i++) {
                $con = $cons[$i];
                $from = $con->from;
                $to = $con->to;
                if (isset($metricarray[$to->nodeid])) {
                    $to->community = $metricarray[$to->nodeid];
                } else {
                    $to->community = 0;
                }
                if (isset($metricarray[$from->nodeid])) {
                    $from->community = $metricarray[$from->nodeid];
                } else {
                    $from->community = 0;
                }
            }
        }
        $HUB_CACHE->setObjData($CFG->VIS_PAGE_COMMUNITIES_NETWORK . $url . $withhistory . $withvotes . $withposts, $conSet, $timeout);
    } else {
        //error_log("DATA FOUND: getCommunitiesNetworkData");
    }
    return $conSet;
}
 *
 * @internal revisions
 * @since 1.9.9
 *
 **/
require '../../config.inc.php';
require_once 'common.php';
require_once 'exttable.class.php';
$templateCfg = templateConfiguration();
//testlinkInitPage($db,false,false,"checkRights");
list($args, $gui) = initEnv($db);
$result_cfg = config_get('results');
$show_all_status_details = config_get('metrics_dashboard')->show_test_plan_status;
$round_precision = config_get('dashboard_precision');
$labels = init_labels(array('overall_progress' => null, 'test_plan' => null, 'progress' => null, 'href_metrics_dashboard' => null, 'progress_absolute' => null, 'no_testplans_available' => null, 'not_aplicable' => null, 'platform' => null, 'th_active_tc' => null, 'in_percent' => null));
list($gui->tplan_metrics, $gui->show_platforms, $platforms) = getMetrics($db, $_SESSION['currentUser'], $args, $result_cfg, $labels);
// new dBug($gui->tplan_metrics);
if (count($gui->tplan_metrics) > 0) {
    $statusSetForDisplay = $result_cfg['status_label_for_exec_ui'];
    $gui->warning_msg = '';
    $columns = getColumnsDefinition($gui->show_platforms, $statusSetForDisplay, $labels, $platforms);
    $matrixData = array();
    if (isset($gui->tplan_metrics['testplans'])) {
        foreach ($gui->tplan_metrics['testplans'] as $tplan_metrics) {
            foreach ($tplan_metrics['platforms'] as $key => $platform_metric) {
                //new dBug($platform_metric);
                $rowData = array();
                // if test plan does not use platforms a overall status is not necessary
                $tplan_string = strip_tags($platform_metric['tplan_name']);
                if ($show_all_status_details) {
                    // add information for all exec statuses
Exemplo n.º 10
0
function checkMetrics($connSqlsrv, $metrics, $dataMetricsSource, $dataMetrics)
{
    foreach ($dataMetricsSource as $keyName => $valueData) {
        $id_metric = array_search($keyName, $metrics);
        if ($id_metric == null && $id_metric == '' && $id_metric < 1 || count($metrics) < 1) {
            echo "\nLa métrica NO existente: " . $keyName;
            if (insertMetrics($connSqlsrv, $keyName)) {
                $GLOBALS["metrics"] = getMetrics($connSqlsrv);
                checkMetrics($connSqlsrv, $GLOBALS["metrics"], $dataMetricsSource, $dataMetrics);
            }
        } else {
            if ($valueData == 0) {
                $valueData = 0;
            } elseif (trim($valueData) == "not available") {
                $valueData = 'null';
            } elseif (trim($valueData) == "") {
                $valueData = 'null';
            } elseif (trim($valueData) == " ") {
                $valueData = 'null';
            }
            $dataMetrics = $dataMetrics + array($id_metric => $valueData);
        }
    }
    print_r($dataMetrics);
    return $dataMetrics;
}
<?php

require "inc_header_ps.php";
require "aware_report.php";
require_once "../lib/GPS.php";
mysql_select_db($db_name, $oConn);
// 2014-09-29 Created ^CS
$stm = GPSMaps::GetTruckDropDown($_SESSION['customerId'], 'yes');
// CustomerID and Truck Columns
$Date = date('Y-m-d');
$data = getMetrics($Date, $Date, $_SESSION['customerId'], true, true);
$TruckCount = $stm->RowCount();
?>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<?php 
require "inc_page_head.php";
?>
		<style>
		#newreporting{
			border-radius:10px;
			border: 1px solid #0099FF;
			padding: 10px 10px 10px 20px;
			color:#000;
			font:normal 12px Verdana, Arial, Helvetica, sans-serif;
		}
		.FakeLink{
			text-decoration: underline;