Added filter for DISMISSED
Browse files
app.py
CHANGED
|
@@ -129,12 +129,12 @@ def get_unavailabilities(usr_start_date, usr_end_date):
|
|
| 129 |
# Current year/month/day/hour/minute/second is calculated for the last call to the API. For instance, if today is 05/05/2023,
|
| 130 |
# the last call of the API will be from 01/05/2023 to 05/05/2023 (+current hour,minute,second).
|
| 131 |
current_datetime = datetime.datetime.now()
|
| 132 |
-
current_year = current_datetime.strftime('%Y')
|
| 133 |
-
current_month = current_datetime.strftime('%m')
|
| 134 |
-
current_day = current_datetime.strftime('%d')
|
| 135 |
-
current_hour = current_datetime.strftime('%H')
|
| 136 |
-
current_minute = current_datetime.strftime('%M')
|
| 137 |
-
current_second = current_datetime.strftime('%S')
|
| 138 |
|
| 139 |
# Headers for the HTTP request
|
| 140 |
headers = {'Host': 'digital.iservices.rte-france.com',
|
|
@@ -343,6 +343,13 @@ def nuc_monitor(usr_start_date, usr_end_date, past_date, mongo_db_data, rte_data
|
|
| 343 |
# This filter should take all the dates with unavs that include days with unavs in the range of the start and end date
|
| 344 |
|
| 345 |
filtered_df = filtered_id_df.copy()[(filtered_id_df.copy()['start_date'] <= end_date_str) & (filtered_id_df.copy()['end_date'] >= start_date_str)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
|
| 347 |
# Standardize datetime in dataframe
|
| 348 |
filtered_df2 = filtered_df.copy() # This code will just standardize datetime stuff
|
|
|
|
| 129 |
# Current year/month/day/hour/minute/second is calculated for the last call to the API. For instance, if today is 05/05/2023,
|
| 130 |
# the last call of the API will be from 01/05/2023 to 05/05/2023 (+current hour,minute,second).
|
| 131 |
current_datetime = datetime.datetime.now()
|
| 132 |
+
# current_year = current_datetime.strftime('%Y')
|
| 133 |
+
# current_month = current_datetime.strftime('%m')
|
| 134 |
+
# current_day = current_datetime.strftime('%d')
|
| 135 |
+
# current_hour = current_datetime.strftime('%H')
|
| 136 |
+
# current_minute = current_datetime.strftime('%M')
|
| 137 |
+
# current_second = current_datetime.strftime('%S')
|
| 138 |
|
| 139 |
# Headers for the HTTP request
|
| 140 |
headers = {'Host': 'digital.iservices.rte-france.com',
|
|
|
|
| 343 |
# This filter should take all the dates with unavs that include days with unavs in the range of the start and end date
|
| 344 |
|
| 345 |
filtered_df = filtered_id_df.copy()[(filtered_id_df.copy()['start_date'] <= end_date_str) & (filtered_id_df.copy()['end_date'] >= start_date_str)]
|
| 346 |
+
# Create a boolean mask to identify rows where status is "Dismissed"
|
| 347 |
+
mask = filtered_df["status"] == "DISMISSED"
|
| 348 |
+
print(filtered_df["status"])
|
| 349 |
+
print(filtered_df[mask])
|
| 350 |
+
|
| 351 |
+
# Update available_capacity where the condition is True
|
| 352 |
+
filtered_df.loc[mask, "available_capacity"] = filtered_df.loc[mask, "installed_capacity"]
|
| 353 |
|
| 354 |
# Standardize datetime in dataframe
|
| 355 |
filtered_df2 = filtered_df.copy() # This code will just standardize datetime stuff
|