<commit_before>(function (roadHopper, $) {

	var measurementRoad;

	roadHopper.initMapCallbacks.push(function () {
		measurementRoad = L.geoJson().addTo(map);
		measurementRoad.options = {
			style: {color: "#00cc33", "weight": 5, "opacity": 0.6} // route color and style
		};
	});


	var $groupList = $('<ul id="measurement-groups" />');
	var $group = $('<ul id="measurement-group" />');

	var measurementGroups = [];


	var playback = new TimeSeriesPlayback();
	var running = false;
	// TODO this callback must not be registered twice!
	playback.registerCallback(function(time) {
		if (!playback.timeSeries.hasTime(time)) {
			return;
		}
		if (!running) {
			// TODO we cannot detect the end of a playback currently
			running = true;
			$('#vehicle-status').show();
		}
		$("#vehicle-status").find('[data-index="speed"]').text(playback.timeSeries.speedForTime(time).toFixed(2));
	});

	var drawMeasurement = function (json) {
		var timeSeries = new TimeSeriesDataSet(json);

		playback.setData(timeSeries);

		var geoJson = {
			"type": "Feature",
			"geometry": {
				"type": "LineString",
				"coordinates": Object.keys(json).map(function (key, index) {
					var measurementDatum = json[key];
					return [measurementDatum["position"]["lon"], measurementDatum["position"]["lat"]];
				})
			}
		};
		console.debug(geoJson);
		measurementRoad.clearLayers();
		measurementRoad.addData(geoJson);
	};

	var renderGroups = function() {
		for (var file in measurementGroups) {
			if (measurementGroups.hasOwnProperty(file)) {
				$groupList.append($('<li data-group="' + file + '">' + file + '</li>'));
			}
		}
		$groupList.show();
		$group.hide();
	};

	var showGroup = function() {
		var groupName = $(this).data('group');

		var measurements = measurementGroups[groupName];

		$group.empty();
		for (var i = 0; i < measurements.length; ++i) {
			$group.append($('<li data-measurement="' + measurements[i] + '">' + measurements[i] + '</li>'));
		}
		$groupList.hide();
		$group.show();
	};

	var loadMeasurement = function (name) {
		console.info("Starting to load data set" + name);
		$('#measurement-file-indicator').text('Loading file ' + name + '…');

		$group.hide();
		$.ajax({
			timeout: 30000,
			url: host + '/roadhopper/measurements?name=' + name,
			success: function (json) {
				$('#measurement-file-indicator').text('Loaded file ' + name);
				var measurements = json["measurements"];
				drawMeasurement(measurements);
			},
			error: function (err) {
				console.error("Error while fetching measurements", err);
			},
			complete: function() {
				$group.hide();
			},
			type: "GET",
			dataType: "json",
			crossDomain: true
		});
	};

	/**
	 * Constructor for the module. Creates the module contents and registers it with the roadhopper module.
	 */
	(function () {
		var $moduleContents = $('<div id="measurement-file-indicator" />').append($groupList).append($group);
		roadHopper.addModule("measurements", "Measurements", $moduleContents);
		$groupList.on('click', 'li', showGroup);
		$group.on('click', 'li', function() {
			loadMeasurement($(this).data('measurement'));
		});
<commit_msg>[TASK] Mark current data set during and after loading<commit_after>(function (roadHopper, $) {

	var measurementRoad;

	roadHopper.initMapCallbacks.push(function () {
		measurementRoad = L.geoJson().addTo(map);
		measurementRoad.options = {
			style: {color: "#00cc33", "weight": 5, "opacity": 0.6} // route color and style
		};
	});


	var $groupList = $('<ul id="measurement-groups" />');
	var $group = $('<ul id="measurement-group" />');

	var measurementGroups = [];


	var playback = new TimeSeriesPlayback();
	var running = false;
	// TODO this callback must not be registered twice!
	playback.registerCallback(function(time) {
		if (!playback.timeSeries.hasTime(time)) {
			return;
		}
		if (!running) {
			// TODO we cannot detect the end of a playback currently
			running = true;
			$('#vehicle-status').show();
		}
		$("#vehicle-status").find('[data-index="speed"]').text(playback.timeSeries.speedForTime(time).toFixed(2));
	});

	var drawMeasurement = function (json) {
		var timeSeries = new TimeSeriesDataSet(json);

		playback.setData(timeSeries);

		var geoJson = {
			"type": "Feature",
			"geometry": {
				"type": "LineString",
				"coordinates": Object.keys(json).map(function (key, index) {
					var measurementDatum = json[key];
					return [measurementDatum["position"]["lon"], measurementDatum["position"]["lat"]];
				})
			}
		};
		console.debug(geoJson);
		measurementRoad.clearLayers();
		measurementRoad.addData(geoJson);
	};

	var renderGroups = function() {
		for (var file in measurementGroups) {
			if (measurementGroups.hasOwnProperty(file)) {
				$groupList.append($('<li data-group="' + file + '">' + file + '</li>'));
			}
		}
		$groupList.show();
		$group.hide();
	};

	var showGroup = function() {
		var groupName = $(this).data('group');

		var measurements = measurementGroups[groupName];

		$group.empty();
		for (var i = 0; i < measurements.length; ++i) {
			$group.append($('<li data-measurement="' + measurements[i] + '">' + measurements[i] + '</li>'));
		}
		$groupList.hide();
		$group.show();
	};

	var loadMeasurement = function (name, $listItem) {
		console.info("Starting to load data set" + name);

		$listItem.css('font-style', 'italic');

		$.ajax({
			timeout: 30000,
			url: host + '/roadhopper/measurements?name=' + name,
			success: function (json) {
				var measurements = json["measurements"];
				drawMeasurement(measurements);
			},
			error: function (err) {
				console.error("Error while fetching measurements", err);
			},
			complete: function() {
				$listItem.siblings('li').css('font-weight', 'normal').css('font-style', 'regular');
				$listItem.css('font-weight', 'bold').css('font-style', 'regular');
			},
			type: "GET",
			dataType: "json",
			crossDomain: true
		});
	};

	/**
	 * Constructor for the module. Creates the module contents and registers it with the roadhopper module.
	 */
	(function () {
		var $moduleContents = $('<div id="measurement-file-indicator" />').append($groupList).append($group);
		roadHopper.addModule("measurements", "Measurements", $moduleContents);
		$groupList.on('click', 'li', showGroup);
		$group.on('click', 'li', function() {
			loadMeasurement($(this).data('measurement'), $(this));
		});

{'fraction_non_alphanumeric': 0.18639240506329113, 'fraction_numerical': 0.004430379746835443, 'mean_word_length': 4.16, 'pattern_counts': {'":': 12, '<': 19, '<?xml version=': 0, '>': 17, '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': '1192942', 'n_tokens_mistral': 2332, 'n_tokens_neox': 2024, 'n_words': 439}