MohanadAfiffy commited on
Commit
e97fb87
·
verified ·
1 Parent(s): 0c2708b

style update

Browse files
Files changed (1) hide show
  1. clients.py +10 -9
clients.py CHANGED
@@ -1,9 +1,3 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- """
4
- Created on Mon Jan 1 11:20:18 2024
5
- @author: mohanadafiffy
6
- """
7
  import os
8
  import streamlit as st
9
  import pandas as pd
@@ -383,7 +377,7 @@ def fetch_analytics_data(host, start_date=None, end_date=None):
383
  records.append({
384
  'email_receiver': email_receiver,
385
  'timestamp': pd.to_datetime(timestamp),
386
- 'count': count
387
  })
388
 
389
  df = pd.DataFrame(records)
@@ -408,6 +402,8 @@ def fetch_analytics_data(host, start_date=None, end_date=None):
408
 
409
  return df
410
 
 
 
411
  def display_analytics():
412
  """
413
  Displays the analytics data with a time filter.
@@ -416,10 +412,15 @@ def display_analytics():
416
  rengagement_host = os.getenv("rengagement_host")
417
  hook_host = os.getenv("hook_host")
418
 
 
 
 
 
 
419
  # Time filter inputs
420
  st.html('<h1 class="title">Analytics</h1>')
421
- start_date = st.date_input("Start Date", value=pd.to_datetime("2024-10-01"))
422
- end_date = st.date_input("End Date", value=pd.to_datetime("today"))
423
 
424
  cold_df = fetch_analytics_data(cold_host, start_date, end_date)
425
  rengagement_df = fetch_analytics_data(rengagement_host, start_date, end_date)
 
 
 
 
 
 
 
1
  import os
2
  import streamlit as st
3
  import pandas as pd
 
377
  records.append({
378
  'email_receiver': email_receiver,
379
  'timestamp': pd.to_datetime(timestamp),
380
+ 'Total Companies/Executives engaged': count
381
  })
382
 
383
  df = pd.DataFrame(records)
 
402
 
403
  return df
404
 
405
+
406
+
407
  def display_analytics():
408
  """
409
  Displays the analytics data with a time filter.
 
412
  rengagement_host = os.getenv("rengagement_host")
413
  hook_host = os.getenv("hook_host")
414
 
415
+ # Calculate the start and end of the current week
416
+ today = datetime.date.today()
417
+ start_of_week = today - datetime.timedelta(days=today.weekday()) # Monday
418
+ end_of_week = start_of_week + datetime.timedelta(days=6) # Sunday
419
+
420
  # Time filter inputs
421
  st.html('<h1 class="title">Analytics</h1>')
422
+ start_date = st.date_input("Start Date", value=start_of_week)
423
+ end_date = st.date_input("End Date", value=end_of_week)
424
 
425
  cold_df = fetch_analytics_data(cold_host, start_date, end_date)
426
  rengagement_df = fetch_analytics_data(rengagement_host, start_date, end_date)