<commit_before>// set the global variable
var Data;
var reducedData= {highestCosting:[]};


function download() {
	$.getJSON('http://abbottmb12.github.io/health.json', function(data){
		Data = data;
		//reducedData = Data.data[1];
		//[17] for total cost column
		//40170
		//alert(Data.data[40169][17]);
		var highestCost = 0;
		for (var i=0,  tot=Data.data.length; i < tot; i++) {
			if (parseInt(Data.data[i][17]) > parseInt(highestCost) ){
				console.log(Data.data[i][17] + ">?" + highestCost);
				reducedData.highestCosting[0] = Data.data[i];
				highestCost = reducedData.highestCosting[0][17];
			}
		}
		var stringified = JSON.stringify(Data, null, 4);
		var blob = new Blob([stringified], {'type': 'application/json'});
		saveAs(blob, "output.json");
	});
}<commit_msg>finished highest and lowest filtering (hard part)<commit_after>// set the global variable
var Data;
var states = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"];
var reducedData= {highestCosting:[], lowestCosting:[], states:[]};


function download() {
	$.getJSON('http://abbottmb12.github.io/health.json', function(data){
		Data = data;

		//initial 5;
		reducedData.highestCosting[0] = Data.data[0];
		for (var i=1; i < 5; i++) {
			for (var j=0; j < reducedData.highestCosting.length && j < 5; j++) {
				if (parseInt(Data.data[i][17]) > parseInt(reducedData.highestCosting[j][17]) ){
					reducedData.highestCosting.splice(j,0,reducedData.highestCosting[j]);
					reducedData.highestCosting[j] = Data.data[i];
					j = 5;
				}
				else if (j == reducedData.highestCosting.length - 1){
					reducedData.highestCosting.push(Data.data[i]);
					j = 5;
				}
			}
		}
		reducedData.lowestCosting[4] = reducedData.highestCosting[0];
		reducedData.lowestCosting[3] = reducedData.highestCosting[1];
		reducedData.lowestCosting[2] = reducedData.highestCosting[2];
		reducedData.lowestCosting[1] = reducedData.highestCosting[3];
		reducedData.lowestCosting[0] = reducedData.highestCosting[4];
		//full list highest and lowest costing
		for (var i=5,  tot=Data.data.length; i < tot; i++) {
			for (var j=0; j < 5; j++) {
				if (parseInt(Data.data[i][17]) > parseInt(reducedData.highestCosting[j][17]) ){
					reducedData.highestCosting.splice(j,0,reducedData.highestCosting[j]);
					reducedData.highestCosting[j] = Data.data[i];
					reducedData.highestCosting.splice(5,1);
					j=5;
				}
			}
			for (var j=0; j < 5; j++) {
				if (parseInt(Data.data[i][17]) < parseInt(reducedData.lowestCosting[j][17]) ){
					reducedData.lowestCosting.splice(j,0,reducedData.lowestCosting[j]);
					reducedData.lowestCosting[j] = Data.data[i];
					reducedData.lowestCosting.splice(5,1);
					j=5;
				}
			}
		}
		
		var stringified = JSON.stringify(reducedData, null, 4);
		var blob = new Blob([stringified], {'type': 'application/json'});
		saveAs(blob, "output.json");
	});
}
{'fraction_non_alphanumeric': 0.20665159832095575, 'fraction_numerical': 0.02486277042298999, 'mean_word_length': 4.250847457627119, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5720323', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1158, 'n_words': 231}