Update order of Dismissed and last message
Browse files
app.py
CHANGED
|
@@ -164,25 +164,9 @@ def nuc_monitor(usr_start_date, usr_end_date, past_date, mongo_db_data):
|
|
| 164 |
current_datetime_str = current_datetime.strftime("%Y-%m-%d")
|
| 165 |
|
| 166 |
# nuclear_unav = mongo_unavs.copy()[(mongo_unavs.copy()["production_type"] == "NUCLEAR") & (mongo_unavs.copy()["updated_date"] <= past_date_str)]
|
| 167 |
-
print(past_date_str)
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
# (mongo_unavs["updated_date"] <= past_date_str) &
|
| 171 |
-
(mongo_unavs["status"] != "DISMISSED")]
|
| 172 |
-
|
| 173 |
-
# if photo_date == True:
|
| 174 |
-
# nuclear_unav = merged_df.copy()[(merged_df.copy()["production_type"] == "NUCLEAR") & (merged_df.copy()["updated_date"] <= past_date_str)]
|
| 175 |
-
# photo_date = True
|
| 176 |
-
# else: # need to add updated_date as a conditional to get the newest for that day
|
| 177 |
-
# nuclear_unav = merged_df.copy()[(merged_df.copy()["production_type"] == "NUCLEAR") & (merged_df.copy()["updated_date"] <= end_date_str)]
|
| 178 |
-
|
| 179 |
-
# --------------------------- HERE IS THE CHANGE TO GET ONLY ACTIVE OR ACTIVE AND INACTIVE --------------------------- #
|
| 180 |
-
|
| 181 |
-
# --------------------- SECOND DATA CLEANING ------------------------ #
|
| 182 |
-
# This filter should take only the most recent id and discard the rest
|
| 183 |
-
|
| 184 |
-
# Sort by updated date
|
| 185 |
-
sorted_df = nuclear_unav.copy().sort_values(by='updated_date')
|
| 186 |
|
| 187 |
sorted_df = sorted_df.copy().reset_index(drop=True)
|
| 188 |
|
|
@@ -200,6 +184,24 @@ def nuc_monitor(usr_start_date, usr_end_date, past_date, mongo_db_data):
|
|
| 200 |
|
| 201 |
filtered_id_df = filtered_id_df.copy().reset_index(drop=True)
|
| 202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
# This filter should take all the dates with unavs that include days with unavs in the range of the start and end date
|
| 204 |
|
| 205 |
|
|
@@ -210,8 +212,6 @@ def nuc_monitor(usr_start_date, usr_end_date, past_date, mongo_db_data):
|
|
| 210 |
# Need to eventually do a filter that takes the most restrictive updated identifier instead of the most recent when there
|
| 211 |
# is an overlap
|
| 212 |
|
| 213 |
-
filtered_df = filtered_id_df.copy()
|
| 214 |
-
|
| 215 |
# Update available_capacity where the condition is True
|
| 216 |
|
| 217 |
# Standardize datetime in dataframe
|
|
|
|
| 164 |
current_datetime_str = current_datetime.strftime("%Y-%m-%d")
|
| 165 |
|
| 166 |
# nuclear_unav = mongo_unavs.copy()[(mongo_unavs.copy()["production_type"] == "NUCLEAR") & (mongo_unavs.copy()["updated_date"] <= past_date_str)]
|
| 167 |
+
# print(past_date_str)
|
| 168 |
+
# Sort by updated date
|
| 169 |
+
sorted_df = mongo_unavs.copy().sort_values(by='updated_date')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
sorted_df = sorted_df.copy().reset_index(drop=True)
|
| 172 |
|
|
|
|
| 184 |
|
| 185 |
filtered_id_df = filtered_id_df.copy().reset_index(drop=True)
|
| 186 |
|
| 187 |
+
filtered_df = filtered_id_df[
|
| 188 |
+
(filtered_id_df["production_type"] == "NUCLEAR") &
|
| 189 |
+
# (mongo_unavs["updated_date"] <= past_date_str) &
|
| 190 |
+
(filtered_id_df["status"] != "DISMISSED")]
|
| 191 |
+
|
| 192 |
+
# if photo_date == True:
|
| 193 |
+
# nuclear_unav = merged_df.copy()[(merged_df.copy()["production_type"] == "NUCLEAR") & (merged_df.copy()["updated_date"] <= past_date_str)]
|
| 194 |
+
# photo_date = True
|
| 195 |
+
# else: # need to add updated_date as a conditional to get the newest for that day
|
| 196 |
+
# nuclear_unav = merged_df.copy()[(merged_df.copy()["production_type"] == "NUCLEAR") & (merged_df.copy()["updated_date"] <= end_date_str)]
|
| 197 |
+
|
| 198 |
+
# --------------------------- HERE IS THE CHANGE TO GET ONLY ACTIVE OR ACTIVE AND INACTIVE --------------------------- #
|
| 199 |
+
|
| 200 |
+
# --------------------- SECOND DATA CLEANING ------------------------ #
|
| 201 |
+
# This filter should take only the most recent id and discard the rest
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
|
| 205 |
# This filter should take all the dates with unavs that include days with unavs in the range of the start and end date
|
| 206 |
|
| 207 |
|
|
|
|
| 212 |
# Need to eventually do a filter that takes the most restrictive updated identifier instead of the most recent when there
|
| 213 |
# is an overlap
|
| 214 |
|
|
|
|
|
|
|
| 215 |
# Update available_capacity where the condition is True
|
| 216 |
|
| 217 |
# Standardize datetime in dataframe
|