<commit_before>define(['knockout',
				'jquery',
				'text!./FeasibilityIntersectReport.html',
				'databindings/cohortbuilder/populationTreemapBinding',
				'databindings/eventListenerBinding',
			  'css!../css/report.css'
			 ], function (
	ko,
	$,
	template) {

	function bitCounter(bits) {
		counted = 0;
		for (b = 0; b < bits.length; b++) {
			if (bits[b] == '1') {
				counted++;
			}
		}
		return counted;
	}

	function FeasibilityIntersectReport(params) {
		var self = this;

		self.report = params.report;
		self.rectSummary = ko.observable();
		self.pass = ko.observableArray();
		self.fail = ko.observableArray();

		self.describeClear = function () {
			self.rectSummary(null);
			self.pass.removeAll();
			self.fail.removeAll();
		}

		self.describe = function (bits, size) {
			var matched = bitCounter(bits);
			var pass_count = 0;
			var fail_count = 0;
			var passed = [];
			var failed = [];

			for (b = 0; b < bits.length; b++) {
				if (bits[b] == '1') {
					passed.push(self.report().inclusionRuleStats[b]);
					pass_count++;
				} else {
					failed.push(self.report().inclusionRuleStats[b]);
					fail_count++;
				}
			}

			var percentage = 0;
			if (self.report().summary.baseCount > 0) {
				percentage = (size / self.report().summary.baseCount * 100);
			}
			self.pass(passed);
			self.fail(failed);
			// self.rectSummary(size + ' people (' + percentage.toFixed(2) + '%), ' + pass_count + ' criteria passed, ' + fail_count + ' criteria failed.');
			self.rectSummary(ko.i18nformat('components.feasibilityIntersectReport.rectSummary', '<%=size%> people (<%=percentage%>%), <%=passCount%> criteria passed, <%=failCount%> criteria failed.', {size: size, percentage: percentage.toFixed(2), passCount: pass_count, failCount: fail_count  }));
		}

		self.handleCellOver = function (data, context, event) {
			if (event.target.__data__) {
				var treemapDatum = event.target.__data__.data;
				self.describe(treemapDatum.name, treemapDatum.size);
			} else {
				return false;
			}
		}
	}

	var component = {
		viewModel: FeasibilityIntersectReport,
		template: template
	};

	ko.components.register('feasibility-intersect-report', component);

	// return compoonent definition
	return component;

});<commit_msg>Inclusion population visualization shows code as label #2565 (#2566)<commit_after>define(['knockout',
				'jquery',
				'text!./FeasibilityIntersectReport.html',
				'databindings/cohortbuilder/populationTreemapBinding',
				'databindings/eventListenerBinding',
			  'css!../css/report.css'
			 ], function (
	ko,
	$,
	template) {

	function bitCounter(bits) {
		counted = 0;
		for (b = 0; b < bits.length; b++) {
			if (bits[b] == '1') {
				counted++;
			}
		}
		return counted;
	}

	function FeasibilityIntersectReport(params) {
		var self = this;

		self.report = params.report;
		self.rectSummary = ko.observable();
		self.pass = ko.observableArray();
		self.fail = ko.observableArray();

		self.describeClear = function () {
			self.rectSummary(null);
			self.pass.removeAll();
			self.fail.removeAll();
		}

		self.describe = function (bits, size) {
			var matched = bitCounter(bits);
			var pass_count = 0;
			var fail_count = 0;
			var passed = [];
			var failed = [];

			for (b = 0; b < bits.length; b++) {
				if (bits[b] == '1') {
					passed.push(self.report().inclusionRuleStats[b]);
					pass_count++;
				} else {
					failed.push(self.report().inclusionRuleStats[b]);
					fail_count++;
				}
			}

			var percentage = 0;
			if (self.report().summary.baseCount > 0) {
				percentage = (size / self.report().summary.baseCount * 100);
			}
			self.pass(passed);
			self.fail(failed);
			// self.rectSummary(size + ' people (' + percentage.toFixed(2) + '%), ' + pass_count + ' criteria passed, ' + fail_count + ' criteria failed.');
			self.rectSummary(ko.i18nformat('components.feasibilityIntersectReport.rectSummary', '<%=size%> people (<%=percentage%>%), <%=passCount%> criteria passed, <%=failCount%> criteria failed.', {size: size, percentage: percentage.toFixed(2), passCount: pass_count, failCount: fail_count  })());
		}

		self.handleCellOver = function (data, context, event) {
			if (event.target.__data__) {
				var treemapDatum = event.target.__data__.data;
				self.describe(treemapDatum.name, treemapDatum.size);
			} else {
				return false;
			}
		}
	}

	var component = {
		viewModel: FeasibilityIntersectReport,
		template: template
	};

	ko.components.register('feasibility-intersect-report', component);

	// return compoonent definition
	return component;

});
{'fraction_non_alphanumeric': 0.16001763279700243, 'fraction_numerical': 0.008816398501212255, 'mean_word_length': 3.579212916246216, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '4230831', 'n_tokens_mistral': 1818, 'n_tokens_neox': 1495, 'n_words': 290}