You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
924 B
33 lines
924 B
import * as config from '../config' |
|
|
|
import * as nedb from 'nedb'; |
|
import * as fs from 'fs'; |
|
|
|
export const db = { |
|
analyticUnits: new nedb({ filename: config.ANALYTIC_UNITS_DATABASE_PATH, autoload: true }), |
|
metrics: new nedb({ filename: config.METRICS_DATABASE_PATH, autoload: true }), |
|
segments: new nedb({ filename: config.SEGMENTS_DATABASE_PATH, autoload: true }) |
|
}; |
|
|
|
// see analytics/pattern_detection_model.py with folders available |
|
|
|
function maybeCreate(path: string): void { |
|
if(fs.existsSync(path)) { |
|
return; |
|
} |
|
console.log('mkdir: ' + path); |
|
fs.mkdirSync(path); |
|
console.log('exists: ' + fs.existsSync(path)); |
|
} |
|
|
|
export function checkDataFolders(): void { |
|
[ |
|
config.DATA_PATH, |
|
config.DATASETS_PATH, |
|
config.ANALYTIC_UNITS_PATH, |
|
config.MODELS_PATH, |
|
config.METRICS_PATH, |
|
config.SEGMENTS_PATH, |
|
config.ZMQ_IPC_PATH |
|
].forEach(maybeCreate); |
|
}
|
|
|