<commit_before>var fetcher = require('./api-fetcher.js');
var data = require('./data.js');
var transformer = require('./forecast-transformer.js');

function importForecasts(warningType, lang) {
  if (!lang) {
    lang = 'no';
  }

  console.log(new Date(), 'Import: ' + warningType + ' forecasts - ' + lang);
  return Promise.resolve().then(function() {
    return fetcher.fetchJson(warningType, lang);
  }).then(function(json) {
    if (warningType === 'avalanche') {
      return json;
    } else {
      return json.CountyList;
    }
  }).then(function(json) {
    console.log(new Date(), 'Json fetched');
    return data.saveForecast(warningType, transformer.transformToForecast(json)).then(function() {
      return json;
    });
  }).then(function(json) {
    console.log(new Date(), 'Forecast saved');
    return data.saveAreas(warningType, transformer.transformToAreas(json));
  }).then(function() {
    console.log(new Date(), 'Areas saved');
    console.log(new Date(), 'Import Complete: ' + warningType + ' forecasts - ' + lang);
  }).catch(function(error) {
    console.error(new Date(), 'Import error: ', error);
  });
}

function importAvalancheForecasts() {
  return importForecasts('avalanche', 'en').then(function() {
    return importForecasts('avalanche', 'no');
  });
}

function importFloodForecasts() {
  return importForecasts('flood', 'no');
}

function importLandslideForecasts() {
  return importForecasts('landslide', 'no');
}

module.exports = {
  importAvalancheForecasts: importAvalancheForecasts,
  importFloodForecasts: importFloodForecasts,
  importLandslideForecasts: importLandslideForecasts,
  importAllForecasts: function() {
    return Promise.resolve().then(function() {
      return importAvalancheForecasts();
    }).then(function() {
      return importFloodForecasts();
    }).then(function() {
      return importLandslideForecasts();
    }).then(function() {
      console.log(new Date(), "Imported all forecasts");
      return "Imported all forecasts";
    });
  }
};<commit_msg>Remove import of english avalanche forecasts<commit_after>var fetcher = require('./api-fetcher.js');
var data = require('./data.js');
var transformer = require('./forecast-transformer.js');

function importForecasts(warningType, lang) {
  if (!lang) {
    lang = 'no';
  }

  console.log(new Date(), 'Import: ' + warningType + ' forecasts - ' + lang);
  return Promise.resolve().then(function() {
    return fetcher.fetchJson(warningType, lang);
  }).then(function(json) {
    if (warningType === 'avalanche') {
      return json;
    } else {
      return json.CountyList;
    }
  }).then(function(json) {
    console.log(new Date(), 'Json fetched');
    return data.saveForecast(warningType, transformer.transformToForecast(json)).then(function() {
      return json;
    });
  }).then(function(json) {
    console.log(new Date(), 'Forecast saved');
    return data.saveAreas(warningType, transformer.transformToAreas(json));
  }).then(function() {
    console.log(new Date(), 'Areas saved');
    console.log(new Date(), 'Import Complete: ' + warningType + ' forecasts - ' + lang);
  }).catch(function(error) {
    console.error(new Date(), 'Import error: ', error);
  });
}

function importAvalancheForecasts() {
  return importForecasts('avalanche', 'no');
}

function importFloodForecasts() {
  return importForecasts('flood', 'no');
}

function importLandslideForecasts() {
  return importForecasts('landslide', 'no');
}

module.exports = {
  importAvalancheForecasts: importAvalancheForecasts,
  importFloodForecasts: importFloodForecasts,
  importLandslideForecasts: importLandslideForecasts,
  importAllForecasts: function() {
    return Promise.resolve().then(function() {
      return importAvalancheForecasts();
    }).then(function() {
      return importFloodForecasts();
    }).then(function() {
      return importLandslideForecasts();
    }).then(function() {
      console.log(new Date(), "Imported all forecasts");
      return "Imported all forecasts";
    });
  }
};
{'fraction_non_alphanumeric': 0.15823573386493894, 'fraction_numerical': 0.0, 'mean_word_length': 4.295514511873351, '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': '4976686', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1207, 'n_words': 240}