<commit_before><?php

require_once 'ServerIO.php';
require_once 'Gump.php';
require_once 'SumaGump.php';

// Suppress Error Reporting
error_reporting(0);
ini_set('display_errors', 0);

/**
 * Data - Class to process data for display in a variety of charts.
 *
 * @author  <NAME> <<EMAIL>>
 */
class Data
{
    /**
     * Define day names
     *
     * @var array
     * @access  private
     */
    private $daysScaffold = array('mo' => 'Monday', 'tu' => 'Tuesday', 'we' => 'Wednesday', 'th' => 'Thursday', 'fr' => 'Friday', 'sa' => 'Saturday', 'su' => 'Sunday');
    /**
     * Main hash to store data as it is retrieved from the server
     *
     * @var array
     * @access  private
     */
    private $countHash = array();
    /**
     * Stores location ids for filtering
     *
     * @var NULL
     * @access  private
     */
    private $locListIds = array();
    /**
     * Stores activity ids for filtering
     *
     * @var array
     * @access  private
     */
    private $actListIds = array();
    /**
     * Stores scaffold array for csvArray
     * @var array
     * @access private
     */
    private $actHash = array();
    private $locHash = array();
    private $actGrpHash = array();
    private $csvScaffold = NULL;
    private $hourSumScaffold = NULL;
    /**
     * Method to populate $csvScaffold, used for csv count collection
     * @param  array $locListIds
     * @param  array $actListIds
     * @return array
     */
    private function buildCSVScaffold ($actDict, $locDict, $actGrpDict)
    {
        $scaffoldArray = array(
                'date' => NULL,
                'total' => NULL,
                'locations' => array(),
                'activities' => array()
            );

        if (empty($this->actGrpHash))
        {
           foreach($actGrpDict as $grp)
           {
               $this->actGrpHash[$grp['id']] = $grp['title'];
           }
        }

        if(empty($this->actHash))
        {
            foreach($actDict as $act)
            {
                $this->actHash[$act['id']] = $this->actGrpHash[$act['activityGroup']] . "-" . $act['title'];
            }
        }

        if(empty($this->locHash))
        {
            foreach($locDict as $loc)
            {
                $this->locHash[$loc['id']] = $loc['title'];
            }
        }

        if (empty($this->actListIds))
        {
            foreach($actDict as $act)
            {
                $name = $this->actGrpHash[$act['activityGroup']] . "-" . $act['title'];
                $scaffoldArray['activities'][$name] = NULL;
            }
        }
        else
        {
            foreach($this->actListIds as $act)
            {
                $name = $this->actGrpHash[$act['activityGroup']] . "-" . $act['title'];
                $scaffoldArray['activities'][$name] = NULL;
            }
        }

        if(empty($this->locListIds))
        {
            foreach($locDict as $loc)
            {
                $scaffoldArray['locations'][$loc['title']] = NULL;
            }
        }
        else
        {
            foreach($this->locListIds as $loc)
            {
                $name = $this->locHash[$loc];
                $scaffoldArray['locations'][$name] = NULL;
            }
        }<commit_msg>change delimiter in activity label to colon<commit_after><?php

require_once 'ServerIO.php';
require_once 'Gump.php';
require_once 'SumaGump.php';

// Suppress Error Reporting
error_reporting(0);
ini_set('display_errors', 0);

/**
 * Data - Class to process data for display in a variety of charts.
 *
 * @author  <NAME> <<EMAIL>>
 */
class Data
{
    /**
     * Define day names
     *
     * @var array
     * @access  private
     */
    private $daysScaffold = array('mo' => 'Monday', 'tu' => 'Tuesday', 'we' => 'Wednesday', 'th' => 'Thursday', 'fr' => 'Friday', 'sa' => 'Saturday', 'su' => 'Sunday');
    /**
     * Main hash to store data as it is retrieved from the server
     *
     * @var array
     * @access  private
     */
    private $countHash = array();
    /**
     * Stores location ids for filtering
     *
     * @var NULL
     * @access  private
     */
    private $locListIds = array();
    /**
     * Stores activity ids for filtering
     *
     * @var array
     * @access  private
     */
    private $actListIds = array();
    /**
     * Stores scaffold array for csvArray
     * @var array
     * @access private
     */
    private $actHash = array();
    private $locHash = array();
    private $actGrpHash = array();
    private $csvScaffold = NULL;
    private $hourSumScaffold = NULL;
    /**
     * Method to populate $csvScaffold, used for csv count collection
     * @param  array $locListIds
     * @param  array $actListIds
     * @return array
     */
    private function buildCSVScaffold ($actDict, $locDict, $actGrpDict)
    {
        $scaffoldArray = array(
                'date' => NULL,
                'total' => NULL,
                'locations' => array(),
                'activities' => array()
            );

        if (empty($this->actGrpHash))
        {
           foreach($actGrpDict as $grp)
           {
               $this->actGrpHash[$grp['id']] = $grp['title'];
           }
        }

        if(empty($this->actHash))
        {
            foreach($actDict as $act)
            {
                $this->actHash[$act['id']] = $this->actGrpHash[$act['activityGroup']] . ": " . $act['title'];
            }
        }

        if(empty($this->locHash))
        {
            foreach($locDict as $loc)
            {
                $this->locHash[$loc['id']] = $loc['title'];
            }
        }

        if (empty($this->actListIds))
        {
            foreach($actDict as $act)
            {
                $name = $this->actGrpHash[$act['activityGroup']] . ": " . $act['title'];
                $scaffoldArray['activities'][$name] = NULL;
            }
        }
        else
        {
            foreach($this->actListIds as $act)
            {
                $name = $this->actGrpHash[$act['activityGroup']] . ": " . $act['title'];
                $scaffoldArray['activities'][$name] = NULL;
            }
        }

        if(empty($this->locListIds))
        {
            foreach($locDict as $loc)
            {
                $scaffoldArray['locations'][$loc['title']] = NULL;
            }
        }
        else
        {
            foreach($this->locListIds as $loc)
            {
                $name = $this->locHash[$loc];
                $scaffoldArray['locations'][$name] = NULL;
            }
        }
{'fraction_non_alphanumeric': 0.15276719012044518, 'fraction_numerical': 0.0006098490623570666, 'mean_word_length': 1.6083499005964215, 'pattern_counts': {'":': 3, '<': 11, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5298019', 'n_tokens_mistral': 2028, 'n_tokens_neox': 1944, 'n_words': 418}