Spaces:
Build error
Build error
Romeo David commited on
Commit ·
e20eb12
1
Parent(s): 78f7d67
Refactor SEO and social media data retrieval to use .get() for safer access and improve conversion section output handling
Browse files- pages/output.py +42 -22
pages/output.py
CHANGED
|
@@ -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
|
| 25 |
-
markdown_table += f"| Paid Traffic to the Website | {seo
|
| 26 |
-
markdown_table += f"| Referral Traffic to the Website | {seo
|
| 27 |
markdown_table += f"| Email Traffic to the Website | N/A |\n"
|
| 28 |
-
markdown_table += f"| Direct Traffic to the Website | {seo
|
| 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
|
| 33 |
-
markdown_table += f"| Twitter Followers | {socmed
|
| 34 |
-
markdown_table += f"| Instagram Followers | {socmed
|
| 35 |
-
markdown_table += f"| Linkedin Followers | {socmed
|
| 36 |
markdown_table += f"| Google My Business | N/A |\n"
|
| 37 |
-
markdown_table += f"| # of Keywords Ranking in Top 10 | {seo
|
| 38 |
-
markdown_table += f"| # of Keywords Ranking in Top 100 | {seo
|
| 39 |
|
| 40 |
return markdown_table
|
| 41 |
|
|
@@ -149,7 +149,6 @@ def seo_on_page_table(df_data):
|
|
| 149 |
|
| 150 |
|
| 151 |
def display_outputs():
|
| 152 |
-
st.markdown("<div id='top'></div>", unsafe_allow_html=True);
|
| 153 |
client_name = "RMX Creatives"
|
| 154 |
client_website = "https://rmxcreatives.com/"
|
| 155 |
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
|
|
@@ -328,25 +327,46 @@ We have evaluated the process of content development strategy and existing conte
|
|
| 328 |
st.markdown("##### DECISION STAGE")
|
| 329 |
st.write(None)
|
| 330 |
|
| 331 |
-
|
| 332 |
st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
|
|
|
|
| 333 |
|
|
|
|
|
|
|
| 334 |
st.markdown("#### CONVERSION – ACTIVATION OF VISITORS")
|
| 335 |
-
st.markdown("##### AWARENESS TO TRAFFIC")
|
| 336 |
-
st.write("TBD")
|
| 337 |
-
st.markdown("##### TRAFFIC TO LEAD CONVERSION")
|
| 338 |
-
st.write("TBD")
|
| 339 |
-
st.markdown("##### LEAD TO SALES CONVERSION")
|
| 340 |
-
st.write("TBD")
|
| 341 |
-
st.markdown("##### CONVERSION TO BRAND LOYALTY")
|
| 342 |
-
st.write("TBD")
|
| 343 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
st.markdown("##### CONNECTION OF ALL ONLINE AND OFFLINE TOUCH POINTS")
|
| 345 |
-
st.write(
|
| 346 |
|
| 347 |
st.markdown("<a href='#top'>Go to top</a>", unsafe_allow_html=True)
|
| 348 |
|
| 349 |
-
|
|
|
|
|
|
|
| 350 |
if st.button("Back to Dashboard", icon="🏠"):
|
| 351 |
st.switch_page("pages/home.py")
|
| 352 |
display_outputs()
|
|
|
|
| 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 |
|
|
|
|
| 149 |
|
| 150 |
|
| 151 |
def display_outputs():
|
|
|
|
| 152 |
client_name = "RMX Creatives"
|
| 153 |
client_website = "https://rmxcreatives.com/"
|
| 154 |
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
|
|
|
|
| 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("CConnection 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()
|