<commit_before>var pkg = require('../package.json'); //Application Settings
var fs = require('fs');
var db;
var collection; //Twitter Collection
var summaryLength = 2;
var summary = {}; //Tweets by country, total tweets, total smiley face matches
summary.name="<NAME>";
var countries;
//Heat map coloring
//Provide a range minimum and maximum along with the target value
//Returns a CSS ready RGB value
var rgb = function(heats, value) {
	var index = Math.floor(heats.length/6);
	var colors = ['rgb(254,235,226)','rgb(252,197,192)',
				  'rgb(250,159,181)','rgb(247,104,161)',
				  'rgb(197,27,138)' ,'rgb(122,1,119)'];
	if( value < heats[index]){
		return colors[0];
	}else if ( value <= heats[index*2]){
		return colors[1];
	}else if ( value <= heats[index*3]){
		return colors[2];
	}else if ( value <= heats[index*4]){
		return colors[3];
	}else if ( value <= heats[index*5]){
		return colors[4];
	}else{
		return colors[5];
	}
};

var createSummary = function() {
	console.log("Starting createSummary");
	collection.distinct("properties.country", function(err, docs) {
		if (err) {
			console.error("Error - distinct countries: " + err.message);
		} else {
			countries = docs;
			summaryLength += (countries.length * 2);
			for (var x = 0; x < countries.length; x++) {
				countries[x] = countries[x].replace(/\./g,'_');
				countrySum(countries[x]);
			}
		}
		wrapIt();
	});
};

var countrySum = function(country) {
	
	summary[country] = {};
	collection.count({
		"properties.country": country
	}, {}, function(err, count) {
		if (err) {
			console.error("Error - summary[" + country + "].total: " + err.message);
		} else {
			summary[country].total = count;
		}<commit_msg>added a couple more colors to the heat map spectrum to imporve range<commit_after>var pkg = require('../package.json'); //Application Settings
var fs = require('fs');
var db;
var collection; //Twitter Collection
var summaryLength = 2;
var summary = {}; //Tweets by country, total tweets, total smiley face matches
summary.name="World Text";
var countries;
//Heat map coloring
//Provide a range minimum and maximum along with the target value
//Returns a CSS ready RGB value
var rgb = function(heats, value) {
	var index = Math.floor(heats.length/9);
	var colors = ['rgb(247,244,249)','rgb(231,225,239)','rgb(212,185,218)',
				  'rgb(201,148,199)','rgb(223,101,176)','rgb(231,41,138)',
				  'rgb(206,18,86)','rgb(152,0,67)','rgb(103,0,31)'];
	if( value < heats[index]){
		return colors[0];
	}else if ( value <= heats[index*2]){
		return colors[1];
	}else if ( value <= heats[index*3]){
		return colors[2];
	}else if ( value <= heats[index*4]){
		return colors[3];
	}else if ( value <= heats[index*5]){
		return colors[4];
	}else if ( value <= heats[index*6]){
		return colors[5];
	}else if ( value <= heats[index*7]){
		return colors[6];
	}else if ( value <= heats[index*8]){
		return colors[7];
	}else{
		return colors[8];
	}
};

var createSummary = function() {
	console.log("Starting createSummary");
	collection.distinct("properties.country", function(err, docs) {
		if (err) {
			console.error("Error - distinct countries: " + err.message);
		} else {
			countries = docs;
			summaryLength += (countries.length * 2);
			for (var x = 0; x < countries.length; x++) {
				countries[x] = countries[x].replace(/\./g,'_');
				countrySum(countries[x]);
			}
		}
		wrapIt();
	});
};

var countrySum = function(country) {
	
	summary[country] = {};
	collection.count({
		"properties.country": country
	}, {}, function(err, count) {
		if (err) {
			console.error("Error - summary[" + country + "].total: " + err.message);
		} else {
			summary[country].total = count;
		}
{'fraction_non_alphanumeric': 0.1848808545603944, 'fraction_numerical': 0.04300191728293618, 'mean_word_length': 4.172804532577904, 'pattern_counts': {'":': 2, '<': 19, '<?xml version=': 0, '>': 4, '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': '5082594', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1246, 'n_words': 322}