<commit_before>Diseases = new Meteor.Collection('diseases');

if (Meteor.isServer) {
  // Add access points for `GET`, `POST`, `PUT`, `DELETE`
  HTTP.publish({
    collection: Diseases
  }, function (data) {
    // this.userId, this.query, this.params
    return Diseases.find({});
  });

  Meteor.methods({
    updateAllDiseases: function () {
      var result = HTTP.get(Meteor.settings.bioportal.startUrl, {
        params: {
          apikey: Meteor.settings.bioportal.apiKey
        }
      });

      for (var d in result.data.collection) {
        var disease = result.data.collection[d];
        console.log(disease);
        Diseases.upsert({
          '@id': disease['@id']
        }, disease);
      }

      for (i = result.data.nextPage; i <= result.data.pageCount; i++) {
        console.log(i);
        var result = HTTP.get(Meteor.settings.bioportal.startUrl, {
          params: {
            apikey: Meteor.settings.bioportal.apiKey,
            page: i
          }
        });
        console.log(result);
        for (var d in result.data.collection) {
          var disease = result.data.collection[d];
          console.log(disease);
          Diseases.upsert({
            '@id': disease['@id']
          }, disease);
        }
      }
    },

    getOBO: function(){
      HTTP.get('http://purl.obolibrary.org/obo/doid.obo', function(err, response){
        console.log(err);
        if (response.content){
          var stanzas = response.content.split("\n\n");
          var headerData = stanzas[0].split("\n");
          console.log(headerData);
          var ontologyInfo = {};
          for (var h in headerData) {
            rowSplit = headerData[h].split(":");
            // console.log(rowSplit);
            //anything before the first colon will be the line type
            var key = rowSplit[0];
            //discarding subsetdefs for now, since each disease won't need them
            if (key.toLowerCase() != 'subsetdef') {
              if (key == 'date') {
                var dateArray = rowSplit.slice(1);
                var year = dateArray[2].split(' ')[0];
                // subtract one to get a javascript-style month<commit_msg>removing bioportal function for now; disabling http-publish<commit_after>Diseases = new Meteor.Collection('diseases');

if (Meteor.isServer) {
  // Add access points for `GET`, `POST`, `PUT`, `DELETE`
  // HTTP.publish({
  //   collection: Diseases
  // }, function (data) {
  //   // this.userId, this.query, this.params
  //   return Diseases.find({});
  // });

  Meteor.methods({
    getOBO: function(){
      HTTP.get('http://purl.obolibrary.org/obo/doid.obo', function(err, response){
        console.log(err);
        if (response.content){
          var stanzas = response.content.split("\n\n");
          var headerData = stanzas[0].split("\n");
          console.log(headerData);
          var ontologyInfo = {};
          for (var h in headerData) {
            rowSplit = headerData[h].split(":");
            // console.log(rowSplit);
            //anything before the first colon will be the line type
            var key = rowSplit[0];
            //discarding subsetdefs for now, since each disease won't need them
            if (key.toLowerCase() != 'subsetdef') {
              if (key == 'date') {
                var dateArray = rowSplit.slice(1);
                var year = dateArray[2].split(' ')[0];
                // subtract one to get a javascript-style month
{'fraction_non_alphanumeric': 0.14384548861343327, 'fraction_numerical': 0.0028826751225136927, 'mean_word_length': 1.9607508532423208, 'pattern_counts': {'":': 2, '<': 4, '<?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': '2314236', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1011, 'n_words': 239}