Skip to content

Commit 3aa5475

Browse files
sarahmishSara PidoSaraPidoRaymond Pan
authored
Add vibrations entityset (#18)
* add vibrations entityset * add example vibrations * fix lint * modify entityset function * entityset * fix sphinx * add lxml_html_clean to fix nsphinx issue --------- Co-authored-by: Sara Pido <sarapid@dai-desk34.lids.mit.edu> Co-authored-by: SaraPido <sara.pido@mail.polimi.it> Co-authored-by: Raymond Pan <rpan@dai-desk34.lids.mit.edu>
1 parent c08a224 commit 3aa5475

File tree

5 files changed

+99
-2
lines changed

5 files changed

+99
-2
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
#
8181
# This is also used if you do content translation via gettext catalogs.
8282
# Usually you set "language" from the command line for these cases.
83-
language = None
83+
language = 'en'
8484

8585
# List of patterns, relative to source directory, that match files and
8686
# directories to ignore when looking for source files.

notebooks/data/vibrations.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
COD_ELEMENT,signal_id,timestamp,xvalues,yvalues
2+
0,S1,2022-01-02 13:21:01,"[2022-01-02 13:21:01, 2022-01-02 13:41:01, 2022-01-02 14:01:01]","[0.5, 0.4, 0.2]"
3+
0,S2,2022-03-08 11:00:00,"[2022-03-08 11:00:00, 2022-03-08 11:10:00, 2022-03-08 11:20:00]","[10, 10, 9]"
4+
1,S1,2022-01-02 13:21:01,"[2022-01-02 13:21:01, 2022-01-02 13:41:01, 2022-01-02 14:01:01]","[0.9, 0.95, 0.8]"
5+
1,S2,2022-03-08 11:00:00,"[2022-03-08 11:00:00, 2022-03-08 11:10:00, 2022-03-08 11:20:00]","[15, 11, 9]"

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
# docs
5050
'docutils>=0.12,<0.18',
51+
'lxml_html_clean>=0.2.2',
5152
'm2r2>=0.2.5,<0.3',
5253
'nbsphinx>=0.5.0,<0.7',
5354
'Sphinx>=3,<3.3',

zephyr_ml/entityset.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from itertools import chain
2+
13
import featuretools as ft
24

35
from zephyr_ml.metadata import get_mapped_kwargs
@@ -73,10 +75,47 @@ def create_scada_entityset(dfs, new_kwargs_mapping=None):
7375
return es
7476

7577

78+
def create_vibrations_entityset(dfs, new_kwargs_mapping=None):
79+
'''Generate an entityset for Vibrations data datasets
80+
81+
Args:
82+
data_paths (dict): Dictionary mapping entity names ('alarms', 'notifications',
83+
'stoppages', 'work_orders', 'vibrations', 'turbines') to the pandas
84+
dataframe for that entity. Optionally 'pidata' and 'scada' can be included.
85+
'''
86+
entities = ['vibrations']
87+
88+
pidata_kwargs, scada_kwargs = {}, {}
89+
if 'pidata' in dfs:
90+
pidata_kwargs = get_mapped_kwargs('pidata', new_kwargs_mapping)
91+
entities.append('pidata')
92+
if 'scada' in dfs:
93+
pidata_kwargs = get_mapped_kwargs('scada', new_kwargs_mapping)
94+
entities.append('scada')
95+
96+
entity_kwargs = {
97+
**pidata_kwargs,
98+
**scada_kwargs,
99+
**get_mapped_kwargs('vibrations', new_kwargs_mapping),
100+
}
101+
_validate_data(dfs, entities, entity_kwargs)
102+
103+
es = _create_entityset(dfs, 'vibrations', entity_kwargs)
104+
es.id = 'Vibrations data'
105+
106+
return es
107+
108+
76109
def _validate_data(dfs, es_type, es_kwargs):
77110
'''Validate data by checking for required columns in each entity
78111
'''
79-
entities = set(['alarms', 'stoppages', 'work_orders', 'notifications', 'turbines', es_type])
112+
if not isinstance(es_type, list):
113+
es_type = [es_type]
114+
115+
entities = set(chain(
116+
['alarms', 'stoppages', 'work_orders', 'notifications', 'turbines', *es_type]
117+
))
118+
80119
if set(dfs.keys()) != entities:
81120
missing = entities.difference(set(dfs.keys()))
82121
extra = set(dfs.keys()).difference(entities)

zephyr_ml/metadata.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,58 @@
126126
'TIMESTAMP': 'datetime',
127127
'COD_ELEMENT': 'categorical'
128128
}
129+
},
130+
'vibrations': {
131+
'index': '_index',
132+
'make_index': True,
133+
'time_index': 'timestamp',
134+
'logical_types': {
135+
'COD_ELEMENT': 'categorical',
136+
'turbine_id': 'categorical',
137+
'signal_id': 'categorical',
138+
'timestamp': 'datetime',
139+
'sensorName': 'categorical',
140+
'sensorType': 'categorical',
141+
'sensorSerial': 'integer_nullable',
142+
'siteName': 'categorical',
143+
'turbineName': 'categorical',
144+
'turbineSerial': 'integer_nullable',
145+
'configurationName': 'natural_language',
146+
'softwareVersion': 'categorical',
147+
'rpm': 'double',
148+
'rpmStatus': 'natural_language',
149+
'duration': 'natural_language',
150+
'condition': 'categorical',
151+
'maskTime': 'datetime',
152+
'Mask Status': 'natural_language',
153+
'System Serial': 'categorical',
154+
'WPS-ActivePower-Average': 'double',
155+
'WPS-ActivePower-Minimum': 'double',
156+
'WPS-ActivePower-Maximum': 'double',
157+
'WPS-ActivePower-Deviation': 'double',
158+
'WPS-ActivePower-StartTime': 'datetime',
159+
'WPS-ActivePower-StopTime': 'datetime',
160+
'WPS-ActivePower-Counts': 'natural_language',
161+
'Measured RPM': 'double',
162+
'WPS-ActivePower': 'double',
163+
'WPS-Gearoiltemperature': 'double',
164+
'WPS-GeneratorRPM': 'double',
165+
'WPS-PitchReference': 'double',
166+
'WPS-RotorRPM': 'double',
167+
'WPS-Windspeed': 'double',
168+
'WPS-YawAngle': 'double',
169+
'overload warning': 'categorical',
170+
'bias warning': 'categorical',
171+
'bias voltage': 'double',
172+
'xValueOffset': 'double',
173+
'xValueDelta': 'double',
174+
'xValueUnit': 'categorical',
175+
'yValueUnit': 'categorical',
176+
'TotalCount-RPM0': 'double',
177+
'TotalCount-RPM1': 'double',
178+
'TotalCount-RPM2': 'double',
179+
'TotalCount-RPM3': 'double'
180+
}
129181
}
130182
}
131183

0 commit comments

Comments
 (0)