Update my_pages/information_loss.py
Browse files- my_pages/information_loss.py +21 -17
my_pages/information_loss.py
CHANGED
|
@@ -3,15 +3,15 @@ import streamlit as st
|
|
| 3 |
from utils import add_navigation, add_instruction_text
|
| 4 |
|
| 5 |
ALL_FEATURES = [
|
| 6 |
-
("Liquid Assets", "Liquid Assets", "Added"),
|
| 7 |
-
("Illiquid Assets", "Property appraisals, Insurance valuations, etc.",
|
| 8 |
"Sorry, it is not possible to get the precise value of illiquid assets. We will use some approximate alternatives instead."),
|
| 9 |
-
("Current Debts", "Current Debts", "Added"),
|
| 10 |
-
("Income Stability", "Past Income Stability",
|
| 11 |
"Sorry, it is not possible to know precisely how stable someone's income will be in future. Until someone invents a time machine (we're hopeful!), we will instead use past income stability."),
|
| 12 |
-
("Health Trajectory", "Current Health Indicators",
|
| 13 |
"Sorry, it is not possible to know precisely how will someone's health change in the future. Until someone invents a time machine (we're hopeful!), we will instead use current health indicators."),
|
| 14 |
-
("Financial Discipline", "Credit Score",
|
| 15 |
"Sorry, financial discipline is not a directly measurable quality. We will use credit score as an approximation instead.")
|
| 16 |
]
|
| 17 |
|
|
@@ -63,7 +63,7 @@ def render():
|
|
| 63 |
_ = st.button(feature[0], type="tertiary")
|
| 64 |
else:
|
| 65 |
if st.button(feature[0]):
|
| 66 |
-
st.session_state.selected_features.
|
| 67 |
st.session_state.show_message = feature[2]
|
| 68 |
st.rerun()
|
| 69 |
|
|
@@ -74,13 +74,17 @@ def render():
|
|
| 74 |
)
|
| 75 |
del st.session_state.show_message
|
| 76 |
|
| 77 |
-
#
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from utils import add_navigation, add_instruction_text
|
| 4 |
|
| 5 |
ALL_FEATURES = [
|
| 6 |
+
("Liquid Assets", ["Liquid Assets"], "Added"),
|
| 7 |
+
("Illiquid Assets", ["Property appraisals, Insurance valuations, etc."],
|
| 8 |
"Sorry, it is not possible to get the precise value of illiquid assets. We will use some approximate alternatives instead."),
|
| 9 |
+
("Current Debts", ["Current Debts"], "Added"),
|
| 10 |
+
("Income Stability", ["Past Income Stability"],
|
| 11 |
"Sorry, it is not possible to know precisely how stable someone's income will be in future. Until someone invents a time machine (we're hopeful!), we will instead use past income stability."),
|
| 12 |
+
("Health Trajectory", ["Current Health Indicators"],
|
| 13 |
"Sorry, it is not possible to know precisely how will someone's health change in the future. Until someone invents a time machine (we're hopeful!), we will instead use current health indicators."),
|
| 14 |
+
("Financial Discipline", ["Credit Score"],
|
| 15 |
"Sorry, financial discipline is not a directly measurable quality. We will use credit score as an approximation instead.")
|
| 16 |
]
|
| 17 |
|
|
|
|
| 63 |
_ = st.button(feature[0], type="tertiary")
|
| 64 |
else:
|
| 65 |
if st.button(feature[0]):
|
| 66 |
+
st.session_state.selected_features.extend(feature[1])
|
| 67 |
st.session_state.show_message = feature[2]
|
| 68 |
st.rerun()
|
| 69 |
|
|
|
|
| 74 |
)
|
| 75 |
del st.session_state.show_message
|
| 76 |
|
| 77 |
+
#### Selected features shown at the bottom
|
| 78 |
+
st.markdown("---")
|
| 79 |
+
|
| 80 |
+
st.markdown("### Set of Selected Features:")
|
| 81 |
+
if st.session_state.selected_features:
|
| 82 |
+
col1, col2 = st.columns(2)
|
| 83 |
+
|
| 84 |
+
for i, item in enumerate(st.session_state.selected_features):
|
| 85 |
+
if i % 2 == 0:
|
| 86 |
+
col1.markdown(f"- {item}")
|
| 87 |
+
else:
|
| 88 |
+
col2.markdown(f"- {item}")
|
| 89 |
+
else:
|
| 90 |
+
st.info("No features added yet. Click a feature above to add it to the dataset.")
|