Browse Source

Analytic types upgrade (#600)

* move DataBucket from __init__

* python3 fixes for DataBucket & rm class field
pull/1/head
Alexey Velikiy 6 years ago committed by GitHub
parent
commit
dee1edc966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      analytics/analytics/analytic_types/__init__.py
  2. 4
      analytics/analytics/analytic_types/data_bucket.py
  3. 2
      analytics/analytics/detectors/pattern_detector.py

5
analytics/analytics/analytic_types/__init__.py

@ -1,6 +1,6 @@
""" """
It is the place where we put all classes and types It is the place where we put all classes and types
which is common for all of the code. common for all analytics code
For example, if you write someting which is used For example, if you write someting which is used
in analytic_unit_manager, it should be here. in analytic_unit_manager, it should be here.
@ -8,11 +8,10 @@ in analytic_unit_manager, it should be here.
If you create something spicific which is used only in one place, If you create something spicific which is used only in one place,
like PatternDetectionCache, then it should not be here. like PatternDetectionCache, then it should not be here.
""" """
import pandas as pd import pandas as pd
from typing import Union, List from typing import Union, List
from analytic_types.data_bucket import DataBucket
AnalyticUnitId = str AnalyticUnitId = str

4
analytics/analytics/analytic_types/data_bucket.py

@ -1,9 +1,7 @@
import pandas as pd import pandas as pd
class DataBucket(object): class DataBucket:
data: pd.DataFrame
def __init__(self): def __init__(self):
self.data = pd.DataFrame([], columns=['timestamp', 'value']) self.data = pd.DataFrame([], columns=['timestamp', 'value'])

2
analytics/analytics/detectors/pattern_detector.py

@ -8,7 +8,7 @@ import pandas as pd
from typing import Optional, Generator, List from typing import Optional, Generator, List
from detectors import Detector from detectors import Detector
from analytic_types import DataBucket from analytic_types.data_bucket import DataBucket
from models import ModelCache from models import ModelCache
from utils import convert_pd_timestamp_to_ms from utils import convert_pd_timestamp_to_ms
from analytic_types import AnalyticUnitId from analytic_types import AnalyticUnitId

Loading…
Cancel
Save