<commit_before><?php

$building = $_REQUEST['building'];
$json = file_get_contents('https://itsapps.unc.edu/energy/rest/buildings/' . $building);
$response = json_decode($json);
header('Content-Type: application/json');
echo json_encode($response);<commit_msg>Upgrades to the PHP script<commit_after><?php

// Empty fallthrough response
$response = jason_encode("{}");

switch(array_keys($_REQUEST)[0])
{
	case 'building':
		if ($_REQUEST['building'] > 0 && $_REQUEST['building'] < 1000)
		{
			if (array_key_exists('live', $_REQUEST) && $_REQUEST['live'] == true)
				// Only live data
				$response = file_get_contents('https://itsapps.unc.edu/energy/rest/buildings/' . $_REQUEST['building'] . '/live');
			else
				// Live and historical data
				$response = file_get_contents('https://itsapps.unc.edu/energy/rest/buildings/' . $_REQUEST['building']);
		}
		break;
	case 'campus':
		// Aggregate data
		$response = file_get_contents('https://itsapps.unc.edu/energy/rest/campus');
		break;
}
// Return
header('Content-Type: application/json');
echo($response);

?>
{'fraction_non_alphanumeric': 0.1894934333958724, 'fraction_numerical': 0.005628517823639775, 'mean_word_length': 4.960893854748603, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '147903', 'n_tokens_mistral': 369, 'n_tokens_neox': 341, 'n_words': 61}