<commit_before>// adapted from http://www.bennadel.com/blog/1504-Ask-Ben-Parsing-CSV-Strings-With-Javascript-Exec-Regular-Expression-Command.htm
function csvToArray(strData, strDelimiter){
  strDelimiter = (strDelimiter || ",");
  var objPattern = new RegExp((
      "(\\" + strDelimiter + "|\\r?\\n|\\r|^)" +
      "(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|" +
      "([^\"\\" + strDelimiter + "\\r\\n]*))"
    ), "gi");
  var arrData = [[]];
  var arrMatches = null;
  while(arrMatches = objPattern.exec(strData)){
    var strMatchedDelimiter = arrMatches[1];
    if(strMatchedDelimiter.length && (strMatchedDelimiter != strDelimiter)){
      arrData.push([]);
    }
    if(arrMatches[2]){
      var strMatchedValue = arrMatches[2].replace(new RegExp("\"\"", "g"),
        "\"");
    }
    else{
      var strMatchedValue = arrMatches[3];
    }
    arrData[arrData.length - 1].push(strMatchedValue);
  }
  return(arrData);
}
var schools = {};
var dataZones = {};

function School(data){
  this.email = data[0];
  this.name = data[4];
  this.latLong = new google.maps.LatLng(parseFloat(data[1]),
    parseFloat(data[2]));
  this.size = parseInt(data[3]);
  this.type = data[5];
  this.conns = [];
}

School.prototype.draw = function(){
  if(this.ui)
    return;
  var options = {
    strokeColor: '#FF0000',
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: '#FF0000',
    fillOpacity: 0.25,
    map: map,
    center: this.latLong,
    radius: (this.size * 0.5)
  };
  
  var circ = new google.maps.Circle(options);
  this.ui = {
    'circle': circ,
    'infowindow': new google.maps.InfoWindow({
      content: '<p><b><u>' + this.name + "</u><br>Students: " + this.size +  '</b></p>',
      position: circ.center
    })
  };
  
  var this_ = this;
  google.maps.event.addListener(this.ui.circle, 'mouseover', function() {
    if(openInfoWindow != null) {
      openInfoWindow.close();
    }
    
    if(map.getZoom() > 8){
      openInfoWindow = this_.ui.infowindow;
      openInfoWindow.open(map);
    }
  });<commit_msg>added lat and lng to the school object added more information to the info bubble<commit_after>// adapted from http://www.bennadel.com/blog/1504-Ask-Ben-Parsing-CSV-Strings-With-Javascript-Exec-Regular-Expression-Command.htm
function csvToArray(strData, strDelimiter){
  strDelimiter = (strDelimiter || ",");
  var objPattern = new RegExp((
      "(\\" + strDelimiter + "|\\r?\\n|\\r|^)" +
      "(?:\"([^\"]*(?:\"\"[^\"]*)*)\"|" +
      "([^\"\\" + strDelimiter + "\\r\\n]*))"
    ), "gi");
  var arrData = [[]];
  var arrMatches = null;
  while(arrMatches = objPattern.exec(strData)){
    var strMatchedDelimiter = arrMatches[1];
    if(strMatchedDelimiter.length && (strMatchedDelimiter != strDelimiter)){
      arrData.push([]);
    }
    if(arrMatches[2]){
      var strMatchedValue = arrMatches[2].replace(new RegExp("\"\"", "g"),
        "\"");
    }
    else{
      var strMatchedValue = arrMatches[3];
    }
    arrData[arrData.length - 1].push(strMatchedValue);
  }
  return(arrData);
}
var schools = {};
var dataZones = {};
var typePrefix = "http://data.opendatascotland.org/def/concept/education/stages-of-education/";

function School(data){
  this.email = data[0];
  this.name = data[4];
  this.lat = parseFloat(data[1]);
  this.lng = parseFloat(data[2]);
  this.latLong = new google.maps.LatLng(lat, lng);
  this.size = parseInt(data[3]);
  this.type = data[5].replace(typePrefix, "");
  this.conns = [];
}

School.prototype.draw = function(){
  if(this.ui)
    return;
  var options = {
    strokeColor: '#FF0000',
    strokeOpacity: 0.8,
    strokeWeight: 2,
    fillColor: '#FF0000',
    fillOpacity: 0.25,
    map: map,
    center: this.latLong,
    radius: (this.size * 0.5)
  };
  
  var circ = new google.maps.Circle(options);
  this.ui = {
    'circle': circ,
    'infowindow': new google.maps.InfoWindow({
      content: '<p><b><u>' + this.name + "</u>" + 
	  "<br>Type: " + this.type + 
	  "<br>Students: " + this.size + '</b></p>',
      position: circ.center
    })
  };
  
  var this_ = this;
  google.maps.event.addListener(this.ui.circle, 'mouseover', function() {
    if(openInfoWindow != null) {
      openInfoWindow.close();
    }
    
    if(map.getZoom() > 8){
      openInfoWindow = this_.ui.infowindow;
      openInfoWindow.open(map);
    }
  });
{'fraction_non_alphanumeric': 0.19809568044588946, 'fraction_numerical': 0.014862981885740827, 'mean_word_length': 3.0214752567693743, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '541524', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1594, 'n_words': 262}