roniorque commited on
Commit
6df648f
·
verified ·
1 Parent(s): 7ad08a5

conversion output (#7)

Browse files

- Refactor SEO and social media data retrieval to use .get() for safer access and improve conversion section output handling (e20eb12f3f23d368c18359ed3fc1abf0c6e975b0)
- Refactor data_field function to include sorting by timestamp for improved data retrieval (d2415b0581d663b9069ac982b8f00c57c4df9b2a)
- Refactor display_outputs function to use data_field for client name and website, and update analyst response retrieval for improved clarity (9935929f462c6c37ba25b59e3755352925822b4d)
- Refactor display_outputs function to remove unnecessary emphasis on client name in overview text for improved readability (de7857094e66711ba63cfe0e8c62b2a019a9d883)
- Merge branch 'main' of https://huggingface.co/spaces/roniorque/df_ai_int into pr/7 (6d66f078d352d2fac48a843f27bd99499c1b8d53)
- Merge branch 'main' of https://huggingface.co/spaces/roniorque/df_ai_int into pr/7 (a7508f87499d43e208f35b7a9e8a893a0565708f)

Files changed (2) hide show
  1. helper/data_field.py +3 -3
  2. pages/output.py +48 -28
helper/data_field.py CHANGED
@@ -5,9 +5,9 @@ def data_field(data_src):
5
  myclient = MongoClient(mongodb_uri)
6
  mydb = myclient.get_database()
7
  mycol = mydb["df_data"]
8
- x = mycol.find_one({"data_field": data_src})
9
- x = x["result"]["question"]
10
- #st.write(x)
11
  return x
12
 
13
  def get_analyst_response(data_src):
 
5
  myclient = MongoClient(mongodb_uri)
6
  mydb = myclient.get_database()
7
  mycol = mydb["df_data"]
8
+ x = mycol.find_one({"data_field": data_src},
9
+ sort=[('timestamp', -1)])
10
+ x = x["result"]
11
  return x
12
 
13
  def get_analyst_response(data_src):
pages/output.py CHANGED
@@ -1,8 +1,8 @@
1
  import json
2
  import os
3
  import streamlit as st
4
- from helper.data_field import get_analyst_response
5
- from helper.telemetry import collect_telemetry
6
 
7
  st.set_page_config(layout="centered")
8
 
@@ -21,21 +21,21 @@ def write_client_footprint():
21
  markdown_table = "| Source/Channel | Current KPI |\n"
22
  markdown_table += "|---|---|\n"
23
  markdown_table += f"| Website Health Score | {result_web['website_overall_health_score']} |\n"
24
- markdown_table += f"| Organic Traffic to the Website | {seo['organic_traffic']} |\n"
25
- markdown_table += f"| Paid Traffic to the Website | {seo['paid_traffic']} |\n"
26
- markdown_table += f"| Referral Traffic to the Website | {seo['referral_traffic']} |\n"
27
  markdown_table += f"| Email Traffic to the Website | N/A |\n"
28
- markdown_table += f"| Direct Traffic to the Website | {seo['direct_traffic']} |\n"
29
  markdown_table += f"| Social Traffic to the Website | N/A |\n"
30
  markdown_table += f"| Display Traffic to the Website | N/A |\n"
31
  markdown_table += f"| Email Database | N/A |\n"
32
- markdown_table += f"| Facebook Followers | {socmed['facebook_followers']} |\n"
33
- markdown_table += f"| Twitter Followers | {socmed['twitter_followers']} |\n"
34
- markdown_table += f"| Instagram Followers | {socmed['instagram_followers']} |\n"
35
- markdown_table += f"| Linkedin Followers | {socmed['linkedin_followers']} |\n"
36
  markdown_table += f"| Google My Business | N/A |\n"
37
- markdown_table += f"| # of Keywords Ranking in Top 10 | {seo['keyword_ranking_in_top_10']} |\n"
38
- markdown_table += f"| # of Keywords Ranking in Top 100 | {seo['keyword_ranking_in_top_100']} |\n"
39
 
40
  return markdown_table
41
 
@@ -147,10 +147,9 @@ def seo_on_page_table(df_data):
147
  # --- End: Loop and display data ---
148
 
149
  def display_outputs():
150
- st.markdown("<div id='top'></div>", unsafe_allow_html=True);
151
- client_name = "RMX Creatives"
152
- client_website = "https://rmxcreatives.com/"
153
- overview = f"""**{client_name}** is a financial services company based in Auckland, New Zealand, specializing in providing quick and flexible loan solutions for businesses and individuals. Represented by Paul Stone, LoansOne has enlisted ShoreMarketing to perform a deep dive into their digital footprint to have a view of the holistic status of their digital properties and determine how each property can play part in implementing a stronger digital marketing plan.\n
154
  The Digital Marketing Footprint consists of deep-dive research by ShoreMarketing specialists to help the business leaders of LoansOne understand the effectiveness of their existing digital initiatives with the view of giving them an insight to developing a strategy and effectively allocating business resources to digital properties that will give them the best results.\n
155
  This document represents the results of our audit of LoansOne’s digital marketing and management practices. Our audit covered reviews of key digital areas: Website and Tools, PPC/SEM, SEO, Social Media, and Market Places."""
156
 
@@ -164,8 +163,7 @@ This document represents the results of our audit of LoansOne’s digital market
164
  st.markdown(f"{overview}")
165
  st.markdown("---")
166
  st.markdown("### Executive Summary")
167
-
168
- st.markdown(f"Simtech LED's digital footprint reveals significant strengths and areas for improvement that can enhance its competitive positioning in the casino, gaming, and entertainment LED market. The analysis highlights the following key findings and recommendations")
169
  st.markdown("---")
170
 
171
  st.markdown("### CLIENT FOOTPRINT")
@@ -329,24 +327,46 @@ We have evaluated the process of content development strategy and existing conte
329
  st.markdown("##### DECISION STAGE")
330
  st.write(None)
331
 
332
- st.markdown("---")
333
  st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
 
 
334
 
 
335
  st.markdown("#### CONVERSION – ACTIVATION OF VISITORS")
336
- st.markdown("##### AWARENESS TO TRAFFIC")
337
- st.write("TBD")
338
- st.markdown("##### TRAFFIC TO LEAD CONVERSION")
339
- st.write("TBD")
340
- st.markdown("##### LEAD TO SALES CONVERSION")
341
- st.write("TBD")
342
- st.markdown("##### CONVERSION TO BRAND LOYALTY")
343
- st.write("TBD")
344
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  st.markdown("##### CONNECTION OF ALL ONLINE AND OFFLINE TOUCH POINTS")
346
- st.write("TBD")
347
 
348
  st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
 
 
349
 
 
350
  if st.button("Back to Dashboard", icon="🏠"):
351
  st.switch_page("pages/home.py")
352
  display_outputs()
 
1
  import json
2
  import os
3
  import streamlit as st
4
+ from helper.data_field import get_analyst_response, data_field
5
+ import time
6
 
7
  st.set_page_config(layout="centered")
8
 
 
21
  markdown_table = "| Source/Channel | Current KPI |\n"
22
  markdown_table += "|---|---|\n"
23
  markdown_table += f"| Website Health Score | {result_web['website_overall_health_score']} |\n"
24
+ markdown_table += f"| Organic Traffic to the Website | {seo.get('organic_traffic', 'N/A')} |\n"
25
+ markdown_table += f"| Paid Traffic to the Website | {seo.get('paid_traffic', 'N/A')} |\n"
26
+ markdown_table += f"| Referral Traffic to the Website | {seo.get('referral_traffic', 'N/A')} |\n"
27
  markdown_table += f"| Email Traffic to the Website | N/A |\n"
28
+ markdown_table += f"| Direct Traffic to the Website | {seo.get('direct_traffic', 'N/A')} |\n"
29
  markdown_table += f"| Social Traffic to the Website | N/A |\n"
30
  markdown_table += f"| Display Traffic to the Website | N/A |\n"
31
  markdown_table += f"| Email Database | N/A |\n"
32
+ markdown_table += f"| Facebook Followers | {socmed.get('facebook_followers', 'N/A')} |\n"
33
+ markdown_table += f"| Twitter Followers | {socmed.get('twitter_followers', 'N/A')} |\n"
34
+ markdown_table += f"| Instagram Followers | {socmed.get('instagram_followers', 'N/A')} |\n"
35
+ markdown_table += f"| Linkedin Followers | {socmed.get('linkedin_followers', 'N/A')} |\n"
36
  markdown_table += f"| Google My Business | N/A |\n"
37
+ markdown_table += f"| # of Keywords Ranking in Top 10 | {seo.get('keyword_ranking_in_top_10', 'N/A')} |\n"
38
+ markdown_table += f"| # of Keywords Ranking in Top 100 | {seo.get('keyword_ranking_in_top_100', 'N/A')} |\n"
39
 
40
  return markdown_table
41
 
 
147
  # --- End: Loop and display data ---
148
 
149
  def display_outputs():
150
+ client_name = data_field("Client Name")
151
+ client_website = data_field("Client Website")
152
+ overview = f"""{client_name} is a financial services company based in Auckland, New Zealand, specializing in providing quick and flexible loan solutions for businesses and individuals. Represented by Paul Stone, LoansOne has enlisted ShoreMarketing to perform a deep dive into their digital footprint to have a view of the holistic status of their digital properties and determine how each property can play part in implementing a stronger digital marketing plan.\n
 
153
  The Digital Marketing Footprint consists of deep-dive research by ShoreMarketing specialists to help the business leaders of LoansOne understand the effectiveness of their existing digital initiatives with the view of giving them an insight to developing a strategy and effectively allocating business resources to digital properties that will give them the best results.\n
154
  This document represents the results of our audit of LoansOne’s digital marketing and management practices. Our audit covered reviews of key digital areas: Website and Tools, PPC/SEM, SEO, Social Media, and Market Places."""
155
 
 
163
  st.markdown(f"{overview}")
164
  st.markdown("---")
165
  st.markdown("### Executive Summary")
166
+ st.markdown(get_analyst_response("Executive Summary Analyst"))
 
167
  st.markdown("---")
168
 
169
  st.markdown("### CLIENT FOOTPRINT")
 
327
  st.markdown("##### DECISION STAGE")
328
  st.write(None)
329
 
330
+
331
  st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
332
+ st.markdown("---")
333
+
334
 
335
+ conversion = get_analyst_response("Conversion Analyst")
336
  st.markdown("#### CONVERSION – ACTIVATION OF VISITORS")
 
 
 
 
 
 
 
 
337
 
338
+ if conversion:
339
+ st.markdown("##### AWARENESS TO TRAFFIC")
340
+ st.write(conversion.get('awareness_to_traffic', 'N/A'))
341
+
342
+ st.markdown("##### TRAFFIC TO LEAD CONVERSION")
343
+ st.write(conversion.get('traffic_to_lead', 'N/A'))
344
+
345
+ st.markdown("##### LEAD TO SALES CONVERSION")
346
+ st.write(conversion.get('lead_to_sales', 'N/A'))
347
+
348
+ st.markdown("##### CONVERSION TO BRAND LOYALTY")
349
+ st.write(conversion.get('conversion_to_brand', 'N/A'))
350
+ else:
351
+ st.markdown("##### AWARENESS TO TRAFFIC")
352
+ st.write(None)
353
+ st.markdown("##### TRAFFIC TO LEAD CONVERSION")
354
+ st.write(None)
355
+ st.markdown("##### LEAD TO SALES CONVERSION")
356
+ st.write(None)
357
+ st.markdown("##### CONVERSION TO BRAND LOYALTY")
358
+ st.write(None)
359
+
360
+
361
+ conversion = get_analyst_response("Connection Analyst")
362
  st.markdown("##### CONNECTION OF ALL ONLINE AND OFFLINE TOUCH POINTS")
363
+ st.write(conversion)
364
 
365
  st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
366
+
367
+
368
 
369
+ st.markdown("<div id='top'></div>", unsafe_allow_html=True);
370
  if st.button("Back to Dashboard", icon="🏠"):
371
  st.switch_page("pages/home.py")
372
  display_outputs()