Spaces:
Sleeping
Sleeping
Update app_web.py
Browse files- app_web.py +42 -4
app_web.py
CHANGED
|
@@ -635,13 +635,51 @@ def render_chat():
|
|
| 635 |
|
| 636 |
def render_db():
|
| 637 |
# rows = st.columns((5,5), gap='medium')
|
| 638 |
-
row0 = st.
|
| 639 |
row1 = st.columns((2,6), gap='medium')
|
| 640 |
row2 = st.container()
|
| 641 |
row3 = st.container()
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 645 |
# column_order=("states", "population"),
|
| 646 |
hide_index=True,
|
| 647 |
width='stretch',
|
|
|
|
| 635 |
|
| 636 |
def render_db():
|
| 637 |
# rows = st.columns((5,5), gap='medium')
|
| 638 |
+
row0 = st.columns((4,4), gap='medium')
|
| 639 |
row1 = st.columns((2,6), gap='medium')
|
| 640 |
row2 = st.container()
|
| 641 |
row3 = st.container()
|
| 642 |
+
|
| 643 |
+
with row0[0]:
|
| 644 |
+
st.markdown(f"#### Pillar 1: Value Chain Alignemnt with Political Incentives")
|
| 645 |
+
score_cols = ["value_chain", "trend", "strategic_importance_score",
|
| 646 |
+
"institutional_committment_score", "trend_normalized",
|
| 647 |
+
"strategic_importance_normalized", "institutional_commitment_normalized"]
|
| 648 |
+
|
| 649 |
+
vc_rename_cols = {
|
| 650 |
+
"noremalized_scores":"Distribution of Beneficiaries",
|
| 651 |
+
"committment_to_vc":"Commitment to Value Chain"
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
vc_alignment = st.session_state.beneficiaries_var.merge(st.session_state.c2vc_results[score_cols], on="value_chain", how="outer")
|
| 655 |
+
vc_alignment["committment_to_vc"] = vc_alignment[["strategic_importance_normalized", "institutional_commitment_normalized"]].mean(axis=1)
|
| 656 |
+
vc_alignment["Alignment"] = vc_alignment[["noremalized_scores", "committment_to_vc"]].mean(axis=1)
|
| 657 |
+
|
| 658 |
+
st.dataframe(vc_alignment[["noremalized_scores", "committment_to_vc", "Alignment"]].rename(columns=vc_rename_cols),
|
| 659 |
+
# column_order=("states", "population"),
|
| 660 |
+
hide_index=True,
|
| 661 |
+
width='stretch',
|
| 662 |
+
# column_config={
|
| 663 |
+
# "states": st.column_config.TextColumn(
|
| 664 |
+
# "States",
|
| 665 |
+
# ),
|
| 666 |
+
# "population": st.column_config.ProgressColumn(
|
| 667 |
+
# "Population",
|
| 668 |
+
# format="%f",
|
| 669 |
+
# min_value=0,
|
| 670 |
+
# max_value=max(st.session_state.beneficiaries_var.population),
|
| 671 |
+
# )}
|
| 672 |
+
)
|
| 673 |
+
with row0[1]:
|
| 674 |
+
st.markdown(f"#### Pillar 1: Investment Alignemnt with Political Incentives")
|
| 675 |
+
investment_rename_cols = {
|
| 676 |
+
"investments":"Investment",
|
| 677 |
+
"time_to_impact":"Time to Impact",
|
| 678 |
+
"targetability":"Targetability",
|
| 679 |
+
"visibility":"Visibility",
|
| 680 |
+
"agg_score":"Investment",
|
| 681 |
+
}
|
| 682 |
+
st.dataframe(st.session_state.investments_var[["investments","time_to_impact", "targetability", "visibility"]].rename(columns=investment_rename_cols),
|
| 683 |
# column_order=("states", "population"),
|
| 684 |
hide_index=True,
|
| 685 |
width='stretch',
|