ecopipeline 0.10.0__py3-none-any.whl → 0.10.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ecopipeline/event_tracking/event_tracking.py +10 -9
- ecopipeline/load/load.py +14 -5
- {ecopipeline-0.10.0.dist-info → ecopipeline-0.10.2.dist-info}/METADATA +1 -1
- {ecopipeline-0.10.0.dist-info → ecopipeline-0.10.2.dist-info}/RECORD +7 -7
- {ecopipeline-0.10.0.dist-info → ecopipeline-0.10.2.dist-info}/WHEEL +0 -0
- {ecopipeline-0.10.0.dist-info → ecopipeline-0.10.2.dist-info}/licenses/LICENSE +0 -0
- {ecopipeline-0.10.0.dist-info → ecopipeline-0.10.2.dist-info}/top_level.txt +0 -0
|
@@ -77,12 +77,12 @@ def flag_abnormal_COP(daily_data: pd.DataFrame, config : ConfigManager, system:
|
|
|
77
77
|
if bound_var in cop_columns:
|
|
78
78
|
for day, day_values in daily_data.iterrows():
|
|
79
79
|
if day_values[bound_var] > bounds['high_alarm'] or day_values[bound_var] < bounds['low_alarm']:
|
|
80
|
-
alarm_str = f"{bounds['pretty_name']} = {round(day_values[bound_var],2)}"
|
|
80
|
+
alarm_str = f"Unexpected COP Value detected: {bounds['pretty_name']} = {round(day_values[bound_var],2)}"
|
|
81
81
|
if day in alarms_dict:
|
|
82
|
-
alarms_dict[day]
|
|
82
|
+
alarms_dict[day].append([bound_var, alarm_str])
|
|
83
83
|
else:
|
|
84
|
-
alarms_dict[day] =
|
|
85
|
-
return _convert_event_type_dict_to_df(alarms_dict)
|
|
84
|
+
alarms_dict[day] = [[bound_var, alarm_str]]
|
|
85
|
+
return _convert_event_type_dict_to_df(alarms_dict, event_type="SILENT_ALARM")
|
|
86
86
|
|
|
87
87
|
def _check_if_during_ongoing_cop_alarm(daily_df : pd.DataFrame, config : ConfigManager, site_name : str = None) -> bool:
|
|
88
88
|
if site_name is None:
|
|
@@ -212,11 +212,12 @@ def _convert_event_type_dict_to_df(alarm_dict : dict, event_type = 'DATA_LOSS_CO
|
|
|
212
212
|
'variable_name' : []
|
|
213
213
|
}
|
|
214
214
|
for key, value in alarm_dict.items():
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
for i in range(len(value)):
|
|
216
|
+
events['start_time_pt'].append(key)
|
|
217
|
+
events['end_time_pt'].append(key)
|
|
218
|
+
events['event_type'].append(event_type)
|
|
219
|
+
events['event_detail'].append(value[i][1])
|
|
220
|
+
events['variable_name'].append(value[i][0])
|
|
220
221
|
|
|
221
222
|
event_df = pd.DataFrame(events)
|
|
222
223
|
event_df.set_index('start_time_pt', inplace=True)
|
ecopipeline/load/load.py
CHANGED
|
@@ -302,6 +302,11 @@ def load_event_table(config : ConfigManager, event_df: pd.DataFrame, site_name :
|
|
|
302
302
|
bool:
|
|
303
303
|
A boolean value indicating if the data was successfully written to the database.
|
|
304
304
|
"""
|
|
305
|
+
# define constants
|
|
306
|
+
proj_cop_filters = ['MV_COMMISSIONED','PLANT_COMMISSIONED','DATA_LOSS_COP','SYSTEM_MAINTENANCE','SYSTEM_TESTING']
|
|
307
|
+
optim_cop_filters = ['MV_COMMISSIONED','PLANT_COMMISSIONED','DATA_LOSS_COP','INSTALLATION_ERROR_COP',
|
|
308
|
+
'PARTIAL_OCCUPANCY','SOO_PERIOD_COP','SYSTEM_TESTING','EQUIPMENT_MALFUNCTION',
|
|
309
|
+
'SYSTEM_MAINTENANCE']
|
|
305
310
|
# Drop empty columns
|
|
306
311
|
event_df = event_df.dropna(axis=1, how='all')
|
|
307
312
|
|
|
@@ -329,7 +334,7 @@ def load_event_table(config : ConfigManager, event_df: pd.DataFrame, site_name :
|
|
|
329
334
|
column_names += "," + column
|
|
330
335
|
|
|
331
336
|
# create SQL statement
|
|
332
|
-
insert_str = "INSERT INTO " + table_name + " (" + column_names + ", variable_name, last_modified_date, last_modified_by) VALUES (%s,%s,%s,%s,%s,%s,'"+datetime.now().strftime('%Y-%m-%d %H:%M:%S')+"','automatic_upload')"
|
|
337
|
+
insert_str = "INSERT INTO " + table_name + " (" + column_names + ", variable_name, summary_filtered, optim_filtered, last_modified_date, last_modified_by) VALUES (%s, %s, %s,%s,%s,%s,%s,%s,'"+datetime.now().strftime('%Y-%m-%d %H:%M:%S')+"','automatic_upload')"
|
|
333
338
|
|
|
334
339
|
if not 'variable_name' in event_df.columns:
|
|
335
340
|
event_df['variable_name'] = None
|
|
@@ -338,11 +343,15 @@ def load_event_table(config : ConfigManager, event_df: pd.DataFrame, site_name :
|
|
|
338
343
|
full_column_names.append('last_modified_date')
|
|
339
344
|
full_column_names.append('last_modified_by')
|
|
340
345
|
full_column_names.append('variable_name')
|
|
346
|
+
full_column_names.append('summary_filtered')
|
|
347
|
+
full_column_names.append('optim_filtered')
|
|
348
|
+
|
|
341
349
|
full_column_types = column_types[1:]
|
|
342
350
|
full_column_types.append('datetime')
|
|
343
351
|
full_column_types.append('varchar(60)')
|
|
344
352
|
full_column_types.append('varchar(70)')
|
|
345
|
-
|
|
353
|
+
full_column_types.append('tinyint(1)')
|
|
354
|
+
full_column_types.append('tinyint(1)')
|
|
346
355
|
|
|
347
356
|
existing_rows = pd.DataFrame({
|
|
348
357
|
'start_time_pt' : [],
|
|
@@ -376,7 +385,7 @@ def load_event_table(config : ConfigManager, event_df: pd.DataFrame, site_name :
|
|
|
376
385
|
ignoredRows = 0
|
|
377
386
|
try:
|
|
378
387
|
for index, row in event_df.iterrows():
|
|
379
|
-
time_data = [index,site_name,row['end_time_pt'],row['event_type'],row['event_detail'],row['variable_name']]
|
|
388
|
+
time_data = [index,site_name,row['end_time_pt'],row['event_type'],row['event_detail'],row['variable_name'], row['event_type'] in proj_cop_filters, row['event_type'] in optim_cop_filters]
|
|
380
389
|
#remove nans and infinites
|
|
381
390
|
time_data = [None if (x is None or pd.isna(x)) else x for x in time_data]
|
|
382
391
|
time_data = [None if (x == float('inf') or x == float('-inf')) else x for x in time_data]
|
|
@@ -436,8 +445,8 @@ def report_data_loss(config : ConfigManager, site_name : str = None):
|
|
|
436
445
|
print(f"logging DATA_LOSS_COP into {table_name}")
|
|
437
446
|
|
|
438
447
|
# create SQL statement
|
|
439
|
-
insert_str = "INSERT INTO " + table_name + " (start_time_pt, site_name, event_detail, event_type, last_modified_date, last_modified_by) VALUES "
|
|
440
|
-
insert_str += f"('{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}','{site_name}','{error_string}','DATA_LOSS_COP','{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}','automatic_upload')"
|
|
448
|
+
insert_str = "INSERT INTO " + table_name + " (start_time_pt, site_name, event_detail, event_type, summary_filtered, optim_filtered, last_modified_date, last_modified_by) VALUES "
|
|
449
|
+
insert_str += f"('{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}','{site_name}','{error_string}','DATA_LOSS_COP', true, true, '{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}','automatic_upload')"
|
|
441
450
|
|
|
442
451
|
existing_rows = pd.DataFrame({
|
|
443
452
|
'id' : []
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
ecopipeline/__init__.py,sha256=d48mO5La6OrQDkRe_qqoY6lUx7x-e8krOH388jmWjwU,218
|
|
2
2
|
ecopipeline/event_tracking/__init__.py,sha256=SV2kkvJgptjeyLQlqHWcDRpQO6-JC433_dRZ3H9-ZNU,131
|
|
3
|
-
ecopipeline/event_tracking/event_tracking.py,sha256=
|
|
3
|
+
ecopipeline/event_tracking/event_tracking.py,sha256=LhL2qffLbEqpRE2PmRvZjj67oUxTKC2MKSqawI4XqEA,23264
|
|
4
4
|
ecopipeline/extract/__init__.py,sha256=gQ3sak6NJ63Gpo-hZXrtZfeKOTHLRyAVXfTgxxRpqPo,675
|
|
5
5
|
ecopipeline/extract/extract.py,sha256=y32feIIzgABwrwfduNQM1hICmkVOU4PYu6-M07zCLpU,51422
|
|
6
6
|
ecopipeline/load/__init__.py,sha256=NLa_efQJZ8aP-J0Y5xx9DP7mtfRH9jY6Jz1ZMZN_BAA,292
|
|
7
|
-
ecopipeline/load/load.py,sha256=
|
|
7
|
+
ecopipeline/load/load.py,sha256=PaSGWOZI0Xg44_SWN7htn2DPIAU_s8mOtCGibXq25tM,24614
|
|
8
8
|
ecopipeline/transform/__init__.py,sha256=YveBLBsNhfI4qZP04doa0NrTbEKvjDAUDEKtEPdFPfU,2545
|
|
9
9
|
ecopipeline/transform/bayview.py,sha256=TP24dnTsUD95X-f6732egPZKjepFLJgDm9ImGr-fppY,17899
|
|
10
10
|
ecopipeline/transform/lbnl.py,sha256=EQ54G4rJXaZ7pwVusKcdK2KBehSdCsNo2ybphtMGs7o,33400
|
|
@@ -12,8 +12,8 @@ ecopipeline/transform/transform.py,sha256=wL4B00XBwLWVlf7goOLSHKgLFmIsXprQNepGLL
|
|
|
12
12
|
ecopipeline/utils/ConfigManager.py,sha256=-g1wtExdvhYO5Y6Q3cRbywa__DxRMFruLrB4YanwaPY,12168
|
|
13
13
|
ecopipeline/utils/__init__.py,sha256=ccWUR0m7gD9DfcgsxBCLOfi4lho6RdYuB2Ugy_g6ZdQ,28
|
|
14
14
|
ecopipeline/utils/unit_convert.py,sha256=VFh1we2Y8KV3u21BeWb-U3TlZJXo83q5vdxxkpgcuME,3064
|
|
15
|
-
ecopipeline-0.10.
|
|
16
|
-
ecopipeline-0.10.
|
|
17
|
-
ecopipeline-0.10.
|
|
18
|
-
ecopipeline-0.10.
|
|
19
|
-
ecopipeline-0.10.
|
|
15
|
+
ecopipeline-0.10.2.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
ecopipeline-0.10.2.dist-info/METADATA,sha256=hKZenaQpTLsiAohHLP92cdWypwupi9yJgRTwZjG4GHM,2330
|
|
17
|
+
ecopipeline-0.10.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
18
|
+
ecopipeline-0.10.2.dist-info/top_level.txt,sha256=WOPFJH2LIgKqm4lk2OnFF5cgVkYibkaBxIxgvLgO7y0,12
|
|
19
|
+
ecopipeline-0.10.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|