Browse Source

Support datasource kit interface #176 (#177)

* Fix indentation in drop model

* Update datasource-kit version

* GrafanaMetric -> Metric
pull/1/head
rozetko 6 years ago committed by GitHub
parent
commit
d6d0b9f36a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      analytics/models/drop_model.py
  2. 2
      server/package.json
  3. 6
      server/src/models/analytic_unit_model.ts

2
analytics/models/drop_model.py

@ -172,7 +172,7 @@ class DropModel(Model):
conv = scipy.signal.fftconvolve(convol_data, pattern_data)
if conv[self.state['WINDOW_SIZE']*2] > self.state['convolve_max'] * 1.2 or conv[self.state['WINDOW_SIZE']*2] < self.state['convolve_min'] * 0.8:
delete_list.append(segment)
if max(conv) < self.state['conv_del_max'] * 1.02 and max(conv) > self.state['conv_del_min'] * 0.98:
if max(conv) < self.state['conv_del_max'] * 1.02 and max(conv) > self.state['conv_del_min'] * 0.98:
delete_list.append(segment)
else:
delete_list.append(segment)

2
server/package.json

@ -38,7 +38,7 @@
"es6-promise": "^4.2.4",
"event-stream": "^3.3.4",
"file-loader": "^1.1.11",
"grafana-datasource-kit": "^0.0.3",
"grafana-datasource-kit": "^0.0.7",
"jest": "^23.1.1",
"koa": "^2.0.46",
"koa-bodyparser": "^4.2.0",

6
server/src/models/analytic_unit_model.ts

@ -1,6 +1,6 @@
import { Collection, makeDBQ } from '../services/data_service';
import { GrafanaMetric } from 'grafana-datasource-kit';
import { Metric } from 'grafana-datasource-kit';
let db = makeDBQ(Collection.ANALYTIC_UNITS);
@ -20,7 +20,7 @@ export class AnalyticUnit {
public name: string,
public panelUrl: string,
public type: string,
public metric: GrafanaMetric,
public metric: Metric,
public id?: AnalyticUnitId,
public lastPredictionTime?: number,
public status?: AnalyticUnitStatus,
@ -61,7 +61,7 @@ export class AnalyticUnit {
obj.name,
obj.panelUrl,
obj.type,
GrafanaMetric.fromObject(obj.metric),
Metric.fromObject(obj.metric),
obj._id,
obj.lastPredictionTime,
obj.status as AnalyticUnitStatus,

Loading…
Cancel
Save