Spaces:
Build error
Build error
Ronio Jerico Roque commited on
Commit ·
ffcaafd
1
Parent(s): ff45211
Refactor output handling in content analysis to use safe_value for improved error handling and clarity
Browse files- pages/output.py +14 -8
pages/output.py
CHANGED
|
@@ -399,15 +399,21 @@ Regardless, it is still a great channel worth investing to improve a business’
|
|
| 399 |
st.write(f"""Content is king in digital marketing. People log into the internet to look for and consume information in different formats: text-based, video, audio, or image. Content is what help businesses establish their expertise in the industry, convert leads into customers, guide their customers through their sales funnel, and build relationships with their customers. \n
|
| 400 |
We have evaluated the process of content development strategy and existing content assets of {client_name} based on how they serve clients throughout the customer journey. """)
|
| 401 |
|
| 402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
pna_data = get_analyst_response("Content - Process and Assets Analyst")
|
| 404 |
if pna_data:
|
| 405 |
st.markdown("##### AWARENESS STAGE")
|
| 406 |
-
st.write(
|
| 407 |
st.markdown("##### CONSIDERATION STAGE")
|
| 408 |
-
st.write(
|
| 409 |
st.markdown("##### DECISION STAGE")
|
| 410 |
-
st.write(
|
| 411 |
|
| 412 |
else:
|
| 413 |
st.markdown("##### AWARENESS STAGE")
|
|
@@ -427,16 +433,16 @@ We have evaluated the process of content development strategy and existing conte
|
|
| 427 |
|
| 428 |
if conversion:
|
| 429 |
st.markdown("##### AWARENESS TO TRAFFIC")
|
| 430 |
-
st.write(
|
| 431 |
|
| 432 |
st.markdown("##### TRAFFIC TO LEAD CONVERSION")
|
| 433 |
-
st.write(
|
| 434 |
|
| 435 |
st.markdown("##### LEAD TO SALES CONVERSION")
|
| 436 |
-
st.write(
|
| 437 |
|
| 438 |
st.markdown("##### CONVERSION TO BRAND LOYALTY")
|
| 439 |
-
st.write(
|
| 440 |
else:
|
| 441 |
st.markdown("##### AWARENESS TO TRAFFIC")
|
| 442 |
st.write(None)
|
|
|
|
| 399 |
st.write(f"""Content is king in digital marketing. People log into the internet to look for and consume information in different formats: text-based, video, audio, or image. Content is what help businesses establish their expertise in the industry, convert leads into customers, guide their customers through their sales funnel, and build relationships with their customers. \n
|
| 400 |
We have evaluated the process of content development strategy and existing content assets of {client_name} based on how they serve clients throughout the customer journey. """)
|
| 401 |
|
| 402 |
+
def safe_value(data: dict, key: str) -> str:
|
| 403 |
+
try:
|
| 404 |
+
value = data.get(key)
|
| 405 |
+
return value if value else "N/A"
|
| 406 |
+
except Exception:
|
| 407 |
+
return "N/A"
|
| 408 |
+
|
| 409 |
pna_data = get_analyst_response("Content - Process and Assets Analyst")
|
| 410 |
if pna_data:
|
| 411 |
st.markdown("##### AWARENESS STAGE")
|
| 412 |
+
st.write(safe_value(pna_data, 'awareness_stage'))
|
| 413 |
st.markdown("##### CONSIDERATION STAGE")
|
| 414 |
+
st.write(safe_value(pna_data, 'consideration_stage'))
|
| 415 |
st.markdown("##### DECISION STAGE")
|
| 416 |
+
st.write(safe_value(pna_data, 'decision_stage'))
|
| 417 |
|
| 418 |
else:
|
| 419 |
st.markdown("##### AWARENESS STAGE")
|
|
|
|
| 433 |
|
| 434 |
if conversion:
|
| 435 |
st.markdown("##### AWARENESS TO TRAFFIC")
|
| 436 |
+
st.write(safe_value(conversion, 'awareness_to_traffic'))
|
| 437 |
|
| 438 |
st.markdown("##### TRAFFIC TO LEAD CONVERSION")
|
| 439 |
+
st.write(safe_value(conversion, 'traffic_to_lead'))
|
| 440 |
|
| 441 |
st.markdown("##### LEAD TO SALES CONVERSION")
|
| 442 |
+
st.write(safe_value(conversion, 'lead_to_sales'))
|
| 443 |
|
| 444 |
st.markdown("##### CONVERSION TO BRAND LOYALTY")
|
| 445 |
+
st.write(safe_value(conversion, 'conversion_to_brand'))
|
| 446 |
else:
|
| 447 |
st.markdown("##### AWARENESS TO TRAFFIC")
|
| 448 |
st.write(None)
|