Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vibrations entityset #18

Merged
merged 7 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
5 changes: 5 additions & 0 deletions notebooks/data/vibrations.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
COD_ELEMENT,signal_id,timestamp,xvalues,yvalues
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]"
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]"
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]"
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]"
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

# docs
'docutils>=0.12,<0.18',
'lxml_html_clean>=0.2.2',
'm2r2>=0.2.5,<0.3',
'nbsphinx>=0.5.0,<0.7',
'Sphinx>=3,<3.3',
Expand Down
41 changes: 40 additions & 1 deletion zephyr_ml/entityset.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from itertools import chain

import featuretools as ft

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


def create_vibrations_entityset(dfs, new_kwargs_mapping=None):
'''Generate an entityset for Vibrations data datasets

Args:
data_paths (dict): Dictionary mapping entity names ('alarms', 'notifications',
'stoppages', 'work_orders', 'vibrations', 'turbines') to the pandas
dataframe for that entity. Optionally 'pidata' and 'scada' can be included.
'''
entities = ['vibrations']

pidata_kwargs, scada_kwargs = {}, {}
if 'pidata' in dfs:
pidata_kwargs = get_mapped_kwargs('pidata', new_kwargs_mapping)
entities.append('pidata')
if 'scada' in dfs:
pidata_kwargs = get_mapped_kwargs('scada', new_kwargs_mapping)
entities.append('scada')

entity_kwargs = {
**pidata_kwargs,
**scada_kwargs,
**get_mapped_kwargs('vibrations', new_kwargs_mapping),
}
_validate_data(dfs, entities, entity_kwargs)

es = _create_entityset(dfs, 'vibrations', entity_kwargs)
es.id = 'Vibrations data'

return es


def _validate_data(dfs, es_type, es_kwargs):
'''Validate data by checking for required columns in each entity
'''
entities = set(['alarms', 'stoppages', 'work_orders', 'notifications', 'turbines', es_type])
if not isinstance(es_type, list):
es_type = [es_type]

entities = set(chain(
['alarms', 'stoppages', 'work_orders', 'notifications', 'turbines', *es_type]
))

if set(dfs.keys()) != entities:
missing = entities.difference(set(dfs.keys()))
extra = set(dfs.keys()).difference(entities)
Expand Down
52 changes: 52 additions & 0 deletions zephyr_ml/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,58 @@
'TIMESTAMP': 'datetime',
'COD_ELEMENT': 'categorical'
}
},
'vibrations': {
'index': '_index',
'make_index': True,
'time_index': 'timestamp',
'logical_types': {
'COD_ELEMENT': 'categorical',
'turbine_id': 'categorical',
'signal_id': 'categorical',
'timestamp': 'datetime',
'sensorName': 'categorical',
'sensorType': 'categorical',
'sensorSerial': 'integer_nullable',
'siteName': 'categorical',
'turbineName': 'categorical',
'turbineSerial': 'integer_nullable',
'configurationName': 'natural_language',
'softwareVersion': 'categorical',
'rpm': 'double',
'rpmStatus': 'natural_language',
'duration': 'natural_language',
'condition': 'categorical',
'maskTime': 'datetime',
'Mask Status': 'natural_language',
'System Serial': 'categorical',
'WPS-ActivePower-Average': 'double',
'WPS-ActivePower-Minimum': 'double',
'WPS-ActivePower-Maximum': 'double',
'WPS-ActivePower-Deviation': 'double',
'WPS-ActivePower-StartTime': 'datetime',
'WPS-ActivePower-StopTime': 'datetime',
'WPS-ActivePower-Counts': 'natural_language',
'Measured RPM': 'double',
'WPS-ActivePower': 'double',
'WPS-Gearoiltemperature': 'double',
'WPS-GeneratorRPM': 'double',
'WPS-PitchReference': 'double',
'WPS-RotorRPM': 'double',
'WPS-Windspeed': 'double',
'WPS-YawAngle': 'double',
'overload warning': 'categorical',
'bias warning': 'categorical',
'bias voltage': 'double',
'xValueOffset': 'double',
'xValueDelta': 'double',
'xValueUnit': 'categorical',
'yValueUnit': 'categorical',
'TotalCount-RPM0': 'double',
'TotalCount-RPM1': 'double',
'TotalCount-RPM2': 'double',
'TotalCount-RPM3': 'double'
}
}
}

Expand Down
Loading