<commit_before>// construct query string
var params = d3.select("#api_key");
if (!params.empty()) {
  var api_key = params.attr('data-api_key');
  var uid_type = params.attr('data-uid_type');
  var uid = params.attr('data-uid');
  var query = encodeURI("/api/v5/articles?api_key=" + api_key + "&ids=" + uid + "&type=" + uid_type + "&info=detail");
}

// load the data from the Lagotto API
if (query) {
  d3.json(query, function(error, json) {
    if (error) { return console.warn(error); }
    var data = json.data;

    eventViz(data);
  });
}

// add data to page
function eventViz(data) {
  d3.select("#loading-events").remove();

  var data = data[0]['sources'];
  data = data.map( function(d) { return d.events_csl });
  data = d3.merge(data);

  if (data.length == 0) {
    d3.select("#content").text("")
      .insert("div")
      .attr("class", "alert alert-info")
      .text("No events found");
    return;
  }

  d3.select("#content").insert("div")<commit_msg>Changed message when no event was found. Closes #163.<commit_after>// construct query string
var params = d3.select("#api_key");
if (!params.empty()) {
  var api_key = params.attr('data-api_key');
  var uid_type = params.attr('data-uid_type');
  var uid = params.attr('data-uid');
  var query = encodeURI("/api/v5/articles?api_key=" + api_key + "&ids=" + uid + "&type=" + uid_type + "&info=detail");
}

// load the data from the Lagotto API
if (query) {
  d3.json(query, function(error, json) {
    if (error) { return console.warn(error); }
    var data = json.data;

    eventViz(data);
  });
}

// add data to page
function eventViz(data) {
  d3.select("#loading-events").remove();

  var data = data[0]['sources'];
  data = data.map( function(d) { return d.events_csl });
  data = d3.merge(data);

  if (data.length == 0) {
    d3.select("#content").text("")
      .insert("div")
      .attr("class", "alert alert-info")
      .text("No formatted events found");
    return;
  }

  d3.select("#content").insert("div")
{'fraction_non_alphanumeric': 0.19528112449799198, 'fraction_numerical': 0.010542168674698794, 'mean_word_length': 3.5711009174311927, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7574817', 'n_tokens_mistral': 712, 'n_tokens_neox': 696, 'n_words': 162}