Skip to content

Instantly share code, notes, and snippets.

@disusered
Created November 17, 2023 22:24
Show Gist options
  • Save disusered/3aa12aa219bbfd93794dd3b089db800f to your computer and use it in GitHub Desktop.
Save disusered/3aa12aa219bbfd93794dd3b089db800f to your computer and use it in GitHub Desktop.
Remove "Open Emails" from dashboard
diff --git a/apps/prx/graphs.py b/apps/prx/graphs.py
index 7e5b29b..8297d4f 100644
--- a/apps/prx/graphs.py
+++ b/apps/prx/graphs.py
@@ -736,10 +736,6 @@ def tracking_email(start_date, end_date, campaign='all'):
rxs_data = {'from_medics_ids': medics_ids_str, "only_count": True}
sent_rxs_data = {'from_medics_ids': medics_ids_str, "only_count": True, "field": ("sent", "=", True)}
- rxs_open_email_data = {
- 'from_medics_ids': medics_ids_str, "only_count": True,
- "field": ("email_open_tracker", ">", 0)
- }
whatsapp_data = {
"only_count": True, "field": ("event_type", "=", "'send_whatsapp'"),
'from_medics_ids': medics_ids_str, "dates": (initial_date, final_date)
@@ -751,10 +747,6 @@ def tracking_email(start_date, end_date, campaign='all'):
else:
rxs_data = {'exclude_medics': "prescrypto.com", "only_count": True}
sent_rxs_data = {'exclude_medics': "prescrypto.com", "only_count": True, "field": ("sent", "=", True)}
- rxs_open_email_data = {
- 'exclude_medics': "prescrypto.com", "only_count": True,
- "field": ("email_open_tracker", ">", 0)
- }
whatsapp_data = {
"only_count": True, "field": ("event_type", "=", "'send_whatsapp'"),
"exclude_medics": "prescrypto.com", "dates": (initial_date, final_date)
@@ -767,8 +759,6 @@ def tracking_email(start_date, end_date, campaign='all'):
rxs = get_prescriptions([], initial_date, final_date, **rxs_data)
# Get the all rxs that have the "sent" field equal True
sent_rxs = get_prescriptions([], initial_date, final_date, **sent_rxs_data)
- # Get all the rx that have the "email_open_tracker" field greater than 0
- rxs_open_email = get_prescriptions([], initial_date, final_date, **rxs_open_email_data)
# Get all drugs that has the field "capaing_open_link" > 0
data = {'include_campaign_open_link': True, "only_count": True}
campaign_open_link = get_medications([], initial_date, final_date, **data)
@@ -783,8 +773,7 @@ def tracking_email(start_date, end_date, campaign='all'):
bought_df = bought_df[bought_df['phxs'] == MATCH_CAMPAIGN_WITH_PHX[campaign]]
# Email data
- email_results = [rxs, sent_rxs, rxs_open_email,
- campaign_open_link, patient_cta, bought_df.shape[0]]
+ email_results = [rxs, sent_rxs, campaign_open_link, patient_cta, bought_df.shape[0]]
# Whatsapp data
whatsapp = get_tracking([], **whatsapp_data)
@@ -805,9 +794,8 @@ def tracking_email(start_date, end_date, campaign='all'):
comparative_data.append(data)
# Define the stage, stage qty and type
- _stage = ["Created", "Sent", "Open Email",
- "Click Drug Button", "Click on CTA", "Bought"]
- stage = int(len(final_data[0])/6) * _stage
+ _stage = ["Created", "Sent", "Click Drug Button", "Click on CTA", "Bought"]
+ stage = int(len(final_data[0])/5) * _stage
_type = len(_stage)*["email"] + len(_stage)*["whatsapp"]
stage_qty = final_data[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment