RathodHarish commited on
Commit
c47d8d2
·
verified ·
1 Parent(s): 930cafd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -557,7 +557,7 @@ async def process_logs(file_obj, lab_site_filter, equipment_type_filter, date_ra
557
  # Handle mixed timestamp formats with ISO8601 and coerce errors
558
  df["timestamp"] = pd.to_datetime(df["timestamp"], format='ISO8601', errors='coerce')
559
  # Apply UTC timezone if not present, then convert to IST
560
- df["timestamp"] = df["timestamp"].dt.tz_localize('UTC', ambiguous='raise', nonexistent='shift').dt.tz_convert('Asia/Kolkata')
561
  df["amc_date"] = pd.to_datetime(df["amc_date"], format='%m/%d/%Y', errors='coerce').dt.tz_localize('UTC').dt.tz_convert('Asia/Kolkata')
562
  if df.empty:
563
  return "No data available.", "<p>No data available.</p>", None, '<p>No device cards available.</p>', None, None, None, None, "", "", "", None, df, current_modified_time
@@ -628,7 +628,7 @@ async def process_logs(file_obj, lab_site_filter, equipment_type_filter, date_ra
628
  if elapsed_time > 3:
629
  logging.warning(f"Processing time exceeded 3 seconds: {elapsed_time:.2f} seconds")
630
 
631
- return (summary, preview_html, usage_chart, device_cards, daily_log_chart, weekly_uptime_output, anomaly_alerts_output, downtime_chart, anomalies, amc_reminders, insights, None, df, current_modified_time)
632
  except Exception as e:
633
  logging.error(f"Failed to process file: {str(e)}")
634
  return f"Error: {str(e)}", "<p>Error processing data.</p>", None, '<p>Error processing data.</p>', None, None, None, None, "", "", "", None, cached_df_state, last_modified_state
 
557
  # Handle mixed timestamp formats with ISO8601 and coerce errors
558
  df["timestamp"] = pd.to_datetime(df["timestamp"], format='ISO8601', errors='coerce')
559
  # Apply UTC timezone if not present, then convert to IST
560
+ df["timestamp"] = df["timestamp"].dt.tz_localize('UTC', ambiguous='raise', nonexistent='shift_forward').dt.tz_convert('Asia/Kolkata')
561
  df["amc_date"] = pd.to_datetime(df["amc_date"], format='%m/%d/%Y', errors='coerce').dt.tz_localize('UTC').dt.tz_convert('Asia/Kolkata')
562
  if df.empty:
563
  return "No data available.", "<p>No data available.</p>", None, '<p>No device cards available.</p>', None, None, None, None, "", "", "", None, df, current_modified_time
 
628
  if elapsed_time > 3:
629
  logging.warning(f"Processing time exceeded 3 seconds: {elapsed_time:.2f} seconds")
630
 
631
+ return (summary, preview_html, usage_chart, device_cards, daily_log_chart, weekly_uptime_chart, anomaly_alerts_chart, downtime_chart, anomalies, amc_reminders, insights, None, df, current_modified_time)
632
  except Exception as e:
633
  logging.error(f"Failed to process file: {str(e)}")
634
  return f"Error: {str(e)}", "<p>Error processing data.</p>", None, '<p>Error processing data.</p>', None, None, None, None, "", "", "", None, cached_df_state, last_modified_state