From 43fd7016682e03fe3b5dad4b4f3fd00369fdb22a Mon Sep 17 00:00:00 2001 From: Thomas Gassmann Date: Sun, 11 Nov 2018 00:51:41 +0100 Subject: [PATCH] add basic setup for new anomaly detection indicator --- db/init/06-indicator-type.sql | 3 ++- scripts/init/anomaly_detection.py | 13 +++++++++++++ scripts/init/batch.py | 1 + scripts/init/constants.py | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 scripts/init/anomaly_detection.py diff --git a/db/init/06-indicator-type.sql b/db/init/06-indicator-type.sql index b6eddc20..06ae52a9 100644 --- a/db/init/06-indicator-type.sql +++ b/db/init/06-indicator-type.sql @@ -38,4 +38,5 @@ INSERT INTO base.indicator_type (name, module, class, method) VALUES ('Completeness', 'completeness', 'Completeness', 'execute') , ('Freshness', 'freshness', 'Freshness', 'execute') , ('Latency', 'latency', 'Latency', 'execute') -, ('Validity', 'validity', 'Validity', 'execute'); +, ('Validity', 'validity', 'Validity', 'execute') +, ('Anomaly Detection', 'anomaly_detection', 'AnomalyDetection', 'execute'); diff --git a/scripts/init/anomaly_detection.py b/scripts/init/anomaly_detection.py new file mode 100644 index 00000000..960af268 --- /dev/null +++ b/scripts/init/anomaly_detection.py @@ -0,0 +1,13 @@ +"""Manage class and methods for data anomaly indicators.""" +import logging +from indicator import Indicator + +# Load logging configuration +log = logging.getLogger(__name__) + + +class AnomalyDetection(Indicator): + """Class used to compute indicators of type anomaly detection.""" + + def execute(self, session: dict): + pass diff --git a/scripts/init/batch.py b/scripts/init/batch.py index 7d2cd978..57012a2b 100644 --- a/scripts/init/batch.py +++ b/scripts/init/batch.py @@ -7,6 +7,7 @@ import freshness # Called dynamically with getattr pylint: disable=W0611 import latency # Called dynamically with getattr pylint: disable=W0611 import validity # Called dynamically with getattr pylint: disable=W0611 +import anomaly_detection # Called dynamically with getattr pylint: disable=W0611 import utils from session import update_session_status diff --git a/scripts/init/constants.py b/scripts/init/constants.py index b5b8fa44..82266082 100644 --- a/scripts/init/constants.py +++ b/scripts/init/constants.py @@ -21,3 +21,4 @@ class IndicatorType: FRESHNESS = 2 LATENCY = 3 VALIDITY = 4 + ANOMALY_DETECTION = 5