<commit_before>// populate banks table from Consumer Complaints DB API
var complaintsRequest = require('./utils').complaintsRequest;
var baseComplaints = 'https://data.consumerfinance.gov/resource/jhzv-w97w.json?';

function initIssuesTable(Issue) {
  var promisedIssues = [];
      
  // get all issues
  promisedIssues = promisedIssues.concat(
    complaintsRequest(baseComplaints + '$select=issue&$group=issue')
      .then(function(data) {
        var issues = JSON.parse(data);
        
        var promisedIssues = issues.map(function(issue) {
          return Issue.create({name:issue.issue});
        });
        console.log('Issues initialized.');
        return Promise.all(promisedIssues);
      })
      .catch(function(err) {
        console.log('Issues not initialized properly!');
      })
  );
    
  return Promise.all(promisedIssues);
};

exports.initIssuesTable = initIssuesTable;<commit_msg>(fix) 2/7 issue model build<commit_after>// populate banks table from Consumer Complaints DB API
var complaintsRequest = require('./utils').complaintsRequest;
var baseComplaints = 'https://data.consumerfinance.gov/resource/jhzv-w97w.json?';

function initIssuesTable(Issue) {
      
  // get all issues from consumer complaints DB
  return complaintsRequest(baseComplaints + '$select=issue&$group=issue')
    .then(function(data) {
      var issues = JSON.parse(data);
      
      // create promise chain of issues
      var promisedIssues = issues.map(function(issue) {
        return Issue.create({name:issue.issue});
      });
      console.log('Issues initialized.');
      return Promise.all(promisedIssues);
    })
    .catch(function(err) {
      console.log('Issues not initialized properly!');
    })
    
};

exports.initIssuesTable = initIssuesTable;
{'fraction_non_alphanumeric': 0.12521150592216582, 'fraction_numerical': 0.00338409475465313, 'mean_word_length': 3.380246913580247, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '748420', 'n_tokens_mistral': 523, 'n_tokens_neox': 506, 'n_words': 103}