<commit_before>var dataproviderbase = require("../../src/dataproviderbase"),
	util = require("util"),
	http = require("http"),
	path = require("path"),
	fs = require("fs");

var cityBikesNetworksURL = "http://api.citybik.es/networks.json";
var newMapTemplate = "http://www.arcgis.com/home/webmap/viewer.html?url=%s&source=sd";

var networksFields = [
	{"name" : "id", "type" : "esriFieldTypeInteger", "alias" : "ID", "nullable" : "true"},
	{"name" : "name", "type" : "esriFieldTypeString", "alias" : "Name", "length" : "255", "nullable" : "true"},
	{"name" : "apiurl", "type" : "esriFieldTypeString", "alias" : "CityBik.es URL", "length" : null, "nullable" : "true"},
	{"name" : "url", "type" : "esriFieldTypeString", "alias" : "Service URL", "length" : null, "nullable" : "true"},
	{"name" : "agolmap", "type" : "esriFieldTypeString", "alias" : "View In New Map", "length" : null, "nullable" : "true"},
	{"name" : "stations", "type" : "esriFieldTypeInteger", "alias" : "Stations", "nullable" : "true"},
	{"name" : "docks", "type" : "esriFieldTypeInteger", "alias" : "Open Docks", "nullable" : "true"},
	{"name" : "bikes", "type" : "esriFieldTypeInteger", "alias" : "Docked Bikes", "nullable" : "true"},
	{"name" : "citybikesTimeString", "type" : "esriFieldTypeString", "alias" : "CityBikes Time", "length" : "255", "nullable" : "true"},
	{"name" : "utcTime", "type" : "esriFieldTypeDate", "alias" : "UTC Timestamp", "length" : 36, "nullable" : "true"},
	{"name" : "timezone", "type" : "esriFieldTypeString", "alias" : "Timezone Code", "length" : "5", "nullable" : "true"},
	{"name" : "timezoneOffset", "type" : "esriFieldTypeInteger", "alias" : "Timezone Offset", "nullable" : "true"},
	{"name" : "timezoneOffsetString", "type" : "esriFieldTypeString", "alias" : "Timezone Offset String", "length" : "8", "nullable" : "true"},
	{"name" : "localTimeString", "type" : "esriFieldTypeString", "alias" : "Local Time", "length" : "255", "nullable" : "true"},
];


var cityBikesFields = [
	{"name" : "id", "type" : "esriFieldTypeInteger", "alias" : "ID", "nullable" : "true"},
	{"name" : "idx", "type" : "esriFieldTypeInteger", "alias" : "IDX", "nullable" : "true"},
	{"name" : "name", "type" : "esriFieldTypeString", "alias" : "Name", "length" : "255", "nullable" : "true"},
	{"name" : "number", "type" : "esriFieldTypeInteger", "alias" : "Number", "nullable" : "true"},
	{"name" : "free", "type" : "esriFieldTypeInteger", "alias" : "Free", "nullable" : "true"},
	{"name" : "bikes", "type" : "esriFieldTypeInteger", "alias" : "Bikes", "nullable" : "true"},
	{"name" : "bikesClass", "type" : "esriFieldTypeString", "alias" : "Bikes Class", "length" : "255", "nullable" : "true"},
	{"name" : "docksClass", "type" : "esriFieldTypeString", "alias" : "Docks Class", "length" : "255", "nullable" : "true"},
	{"name" : "address", "type" : "esriFieldTypeString", "alias" : "Address", "length" : "255", "nullable" : "true"},
	{"name" : "citybikesTimeString", "type" : "esriFieldTypeString", "alias" : "CityBikes Time", "length" : "255", "nullable" : "true"},
	{"name" : "utcTime", "type" : "esriFieldTypeDate", "alias" : "UTC Timestamp", "length" : 36, "nullable" : "true"},
	{"name" : "timezone", "type" : "esriFieldTypeString", "alias" : "Timezone Code", "length" : "5", "nullable" : "true"},
	{"name" : "timezoneOffset", "type" : "esriFieldTypeInteger", "alias" : "Timezone Offset", "nullable" : "true"},
	{"name" : "timezoneOffsetString", "type" : "esriFieldTypeString", "alias" : "Timezone Offset String", "length" : "8", "nullable" : "true"},
	{"name" : "localTimeString", "type" : "esriFieldTypeString", "alias" : "Local Time", "length" : "255", "nullable" : "true"},
];

var bikeClassificationScheme = {
	"0": { "min": 0, "max": 0, "label": "No bikes" },
	"1": { "min": 1, "max": 1, "label": "1 bike" },
	"few": { "min": 2, "max": 8, "label": "A few bikes" },
	"plenty": { "min": 9, "max": 10000, "label": "Plenty of bikes" }
};
	
var dockClassificationScheme = {
	"0": { "min": 0, "max": 0, "label": "No docks" },
	"1": { "min": 1, "max": 1, "label": "1 dock" },
	"2": { "min": 2, "max": 2, "label": "2 docks" },
	"3": { "min": 3, "max": 3, "label": "3 docks" },
	"4": { "min": 4, "max": 4, "label": "4 docks" },
	"few": { "min": 5, "max": 10, "label": "5-10 docks" },
	"plenty": { "min": 11, "max": 10000, "label": "Plenty of docks" }
};

var drawingInfo = JSON.parse(fs.readFileSync(path.join(path.dirname(module.filename),"resources","templates","layerDefinition-drawingInfo.json"), 'utf8'));

var timezoneAPIKey = "<KEY>";

var timezoneCacheFilename = path.join(path.dirname(module.filename),"data","timezones.json");

var allNetworksServiceId = "world_bikeshares",
	allNetworksServiceName = "World Bikeshares";
	
var states = {
	empty: "empty",
	loading: "loading",
	loaded: "loaded"
};

Object.size = function(obj) {
    var size = 0, key;
    for (key in obj) {
        if (obj.hasOwnProperty(key)) size++;
    }
    return size;
};

CityBikes = function () {
	CityBikes.super_.call(this);

	this._isReady = false;
	this._cachedNetworks = null;
	this._cacheExpirationTime = new Date();
	this._networkCacheStatus = states.empty;
	
	this._networksCacheTime = 30 * 60000;
	this._stationCacheTime = 1 * 60000;
<commit_msg>Comment about getting your own TimezoneDB API Key<commit_after>var dataproviderbase = require("../../src/dataproviderbase"),
	util = require("util"),
	http = require("http"),
	path = require("path"),
	fs = require("fs");

var cityBikesNetworksURL = "http://api.citybik.es/networks.json";
var newMapTemplate = "http://www.arcgis.com/home/webmap/viewer.html?url=%s&source=sd";

var networksFields = [
	{"name" : "id", "type" : "esriFieldTypeInteger", "alias" : "ID", "nullable" : "true"},
	{"name" : "name", "type" : "esriFieldTypeString", "alias" : "Name", "length" : "255", "nullable" : "true"},
	{"name" : "apiurl", "type" : "esriFieldTypeString", "alias" : "CityBik.es URL", "length" : null, "nullable" : "true"},
	{"name" : "url", "type" : "esriFieldTypeString", "alias" : "Service URL", "length" : null, "nullable" : "true"},
	{"name" : "agolmap", "type" : "esriFieldTypeString", "alias" : "View In New Map", "length" : null, "nullable" : "true"},
	{"name" : "stations", "type" : "esriFieldTypeInteger", "alias" : "Stations", "nullable" : "true"},
	{"name" : "docks", "type" : "esriFieldTypeInteger", "alias" : "Open Docks", "nullable" : "true"},
	{"name" : "bikes", "type" : "esriFieldTypeInteger", "alias" : "Docked Bikes", "nullable" : "true"},
	{"name" : "citybikesTimeString", "type" : "esriFieldTypeString", "alias" : "CityBikes Time", "length" : "255", "nullable" : "true"},
	{"name" : "utcTime", "type" : "esriFieldTypeDate", "alias" : "UTC Timestamp", "length" : 36, "nullable" : "true"},
	{"name" : "timezone", "type" : "esriFieldTypeString", "alias" : "Timezone Code", "length" : "5", "nullable" : "true"},
	{"name" : "timezoneOffset", "type" : "esriFieldTypeInteger", "alias" : "Timezone Offset", "nullable" : "true"},
	{"name" : "timezoneOffsetString", "type" : "esriFieldTypeString", "alias" : "Timezone Offset String", "length" : "8", "nullable" : "true"},
	{"name" : "localTimeString", "type" : "esriFieldTypeString", "alias" : "Local Time", "length" : "255", "nullable" : "true"},
];


var cityBikesFields = [
	{"name" : "id", "type" : "esriFieldTypeInteger", "alias" : "ID", "nullable" : "true"},
	{"name" : "idx", "type" : "esriFieldTypeInteger", "alias" : "IDX", "nullable" : "true"},
	{"name" : "name", "type" : "esriFieldTypeString", "alias" : "Name", "length" : "255", "nullable" : "true"},
	{"name" : "number", "type" : "esriFieldTypeInteger", "alias" : "Number", "nullable" : "true"},
	{"name" : "free", "type" : "esriFieldTypeInteger", "alias" : "Free", "nullable" : "true"},
	{"name" : "bikes", "type" : "esriFieldTypeInteger", "alias" : "Bikes", "nullable" : "true"},
	{"name" : "bikesClass", "type" : "esriFieldTypeString", "alias" : "Bikes Class", "length" : "255", "nullable" : "true"},
	{"name" : "docksClass", "type" : "esriFieldTypeString", "alias" : "Docks Class", "length" : "255", "nullable" : "true"},
	{"name" : "address", "type" : "esriFieldTypeString", "alias" : "Address", "length" : "255", "nullable" : "true"},
	{"name" : "citybikesTimeString", "type" : "esriFieldTypeString", "alias" : "CityBikes Time", "length" : "255", "nullable" : "true"},
	{"name" : "utcTime", "type" : "esriFieldTypeDate", "alias" : "UTC Timestamp", "length" : 36, "nullable" : "true"},
	{"name" : "timezone", "type" : "esriFieldTypeString", "alias" : "Timezone Code", "length" : "5", "nullable" : "true"},
	{"name" : "timezoneOffset", "type" : "esriFieldTypeInteger", "alias" : "Timezone Offset", "nullable" : "true"},
	{"name" : "timezoneOffsetString", "type" : "esriFieldTypeString", "alias" : "Timezone Offset String", "length" : "8", "nullable" : "true"},
	{"name" : "localTimeString", "type" : "esriFieldTypeString", "alias" : "Local Time", "length" : "255", "nullable" : "true"},
];

var bikeClassificationScheme = {
	"0": { "min": 0, "max": 0, "label": "No bikes" },
	"1": { "min": 1, "max": 1, "label": "1 bike" },
	"few": { "min": 2, "max": 8, "label": "A few bikes" },
	"plenty": { "min": 9, "max": 10000, "label": "Plenty of bikes" }
};
	
var dockClassificationScheme = {
	"0": { "min": 0, "max": 0, "label": "No docks" },
	"1": { "min": 1, "max": 1, "label": "1 dock" },
	"2": { "min": 2, "max": 2, "label": "2 docks" },
	"3": { "min": 3, "max": 3, "label": "3 docks" },
	"4": { "min": 4, "max": 4, "label": "4 docks" },
	"few": { "min": 5, "max": 10, "label": "5-10 docks" },
	"plenty": { "min": 11, "max": 10000, "label": "Plenty of docks" }
};

var drawingInfo = JSON.parse(fs.readFileSync(path.join(path.dirname(module.filename),"resources","templates","layerDefinition-drawingInfo.json"), 'utf8'));

var timezoneAPIKey = "<KEY>"; // Replace this with your own key from timezonedb.com

var timezoneCacheFilename = path.join(path.dirname(module.filename),"data","timezones.json");

var allNetworksServiceId = "world_bikeshares",
	allNetworksServiceName = "World Bikeshares";
	
var states = {
	empty: "empty",
	loading: "loading",
	loaded: "loaded"
};

Object.size = function(obj) {
    var size = 0, key;
    for (key in obj) {
        if (obj.hasOwnProperty(key)) size++;
    }
    return size;
};

CityBikes = function () {
	CityBikes.super_.call(this);

	this._isReady = false;
	this._cachedNetworks = null;
	this._cacheExpirationTime = new Date();
	this._networkCacheStatus = states.empty;
	
	this._networksCacheTime = 30 * 60000;
	this._stationCacheTime = 1 * 60000;

{'fraction_non_alphanumeric': 0.24245014245014246, 'fraction_numerical': 0.01842355175688509, 'mean_word_length': 5.452818627450981, 'pattern_counts': {'":': 88, '<': 5, '<?xml version=': 0, '>': 5, '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': '5501007', 'n_tokens_mistral': 4037, 'n_tokens_neox': 3933, 'n_words': 943}