Update sidebar.py
Browse files- sidebar.py +196 -77
sidebar.py
CHANGED
|
@@ -75,6 +75,110 @@ import streamlit as st
|
|
| 75 |
# st.markdown(user_instructions)
|
| 76 |
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
class Sidebar:
|
| 79 |
def __init__(self):
|
| 80 |
self.main_body_logo = "mimtss.png"
|
|
@@ -97,81 +201,96 @@ class Sidebar:
|
|
| 97 |
""")
|
| 98 |
|
| 99 |
st.divider()
|
| 100 |
-
|
| 101 |
-
st.subheader('Spreadsheet Headers')
|
| 102 |
-
|
| 103 |
-
headers_info = """
|
| 104 |
-
Your spreadsheet must include the following headers for proper analysis:
|
| 105 |
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
# st.markdown(user_instructions)
|
| 76 |
|
| 77 |
|
| 78 |
+
# class Sidebar:
|
| 79 |
+
# def __init__(self):
|
| 80 |
+
# self.main_body_logo = "mimtss.png"
|
| 81 |
+
# self.sidebar_logo = "mtss.ai_small.png"
|
| 82 |
+
# self.image_width = 200
|
| 83 |
+
# self.image_path = "mimtss.png"
|
| 84 |
+
|
| 85 |
+
# def display(self):
|
| 86 |
+
# st.logo(self.sidebar_logo, icon_image=self.main_body_logo, size="large")
|
| 87 |
+
|
| 88 |
+
# with st.sidebar:
|
| 89 |
+
# # Display the image
|
| 90 |
+
# st.image(self.image_path, width=self.image_width)
|
| 91 |
+
|
| 92 |
+
# # Toggle for Help and Report a Bug
|
| 93 |
+
# with st.expander("Powered by MTSS.ai"):
|
| 94 |
+
# st.write("""
|
| 95 |
+
# **Contact**: Cheyne LeVesseur, PhD
|
| 96 |
+
# **Email**: [email protected]
|
| 97 |
+
# """)
|
| 98 |
+
|
| 99 |
+
# st.divider()
|
| 100 |
+
|
| 101 |
+
# st.subheader('Spreadsheet Headers')
|
| 102 |
+
|
| 103 |
+
# headers_info = """
|
| 104 |
+
# Your spreadsheet must include the following headers for proper analysis:
|
| 105 |
+
|
| 106 |
+
# 1. **Date Column**:
|
| 107 |
+
# - "Date of Session" or "Date"
|
| 108 |
+
|
| 109 |
+
# 2. **Intervention Column**:
|
| 110 |
+
# - "Did the intervention happen today?" or
|
| 111 |
+
# - "Did the intervention take place today?"
|
| 112 |
+
|
| 113 |
+
# 3. **Student Attendance Columns**:
|
| 114 |
+
# - Format: "Student Attendance [student name]"
|
| 115 |
+
# - Options: Engaged, Partially Engaged, Not Engaged, Absent
|
| 116 |
+
# - Example: "Student Attendance [Charlie Gordon]"
|
| 117 |
+
|
| 118 |
+
# #### Important Note on Student Names:
|
| 119 |
+
# - For students with the same initials, you must use a unique identifier to distinguish them.
|
| 120 |
+
# - Best practices for unique identifiers:
|
| 121 |
+
# - Add a middle name: "Charlie Gordon" --> "Charlie A. Gordon"
|
| 122 |
+
# - Use a unique identifier: "Charlie Gordon 1" and "Clarissa Gao 2"
|
| 123 |
+
|
| 124 |
+
# This ensures that when names are truncated to initials, each student has a unique identifier.
|
| 125 |
+
# """
|
| 126 |
+
|
| 127 |
+
# st.markdown(headers_info)
|
| 128 |
+
|
| 129 |
+
# st.divider()
|
| 130 |
+
|
| 131 |
+
# st.subheader('User Instructions')
|
| 132 |
+
|
| 133 |
+
# # Existing user instructions
|
| 134 |
+
# user_instructions = """
|
| 135 |
+
# - **Step 1**: Upload your Excel file.
|
| 136 |
+
# - **Step 2**: Anonymization – student names are replaced with initials for privacy.
|
| 137 |
+
# - **Step 3**: Review anonymized data.
|
| 138 |
+
# - **Step 4**: View **intervention session statistics**.
|
| 139 |
+
# - **Step 5**: Review **student attendance and engagement metrics**.
|
| 140 |
+
# - **Step 6**: Review AI-generated **insights and recommendations**.
|
| 141 |
+
# ### **Privacy Assurance**
|
| 142 |
+
# - **No full names** are ever displayed or sent to the AI model—only initials are used.
|
| 143 |
+
# - This ensures that sensitive data remains protected throughout the entire process.
|
| 144 |
+
# ### **Detailed Instructions**
|
| 145 |
+
# #### **1. Upload Your Excel File**
|
| 146 |
+
# - Start by uploading an Excel file that contains intervention data.
|
| 147 |
+
# - Click on the **"Upload your Excel file"** button and select your `.xlsx` file from your computer.
|
| 148 |
+
# **Note**: Your file should have columns like "Did the intervention happen today?" and "Student Attendance [FirstName LastName]" for the analysis to work correctly.
|
| 149 |
+
# #### **2. Automated Name Anonymization**
|
| 150 |
+
# - Once the file is uploaded, the app will **automatically replace student names with initials** in the "Student Attendance" columns.
|
| 151 |
+
# - For example, **"Student Attendance [Cheyne LeVesseur]"** will be displayed as **"Student Attendance [CL]"**.
|
| 152 |
+
# - If the student only has a first name, like **"Student Attendance [Cheyne]"**, it will be displayed as **"Student Attendance [C]"**.
|
| 153 |
+
# - This anonymization helps to **protect student privacy**, ensuring that full names are not visible or sent to the AI language model.
|
| 154 |
+
# #### **3. Review the Uploaded Data**
|
| 155 |
+
# - You will see the entire table of anonymized data to verify that the information has been uploaded correctly and that names have been replaced with initials.
|
| 156 |
+
# #### **4. Intervention Session Statistics**
|
| 157 |
+
# - The app will calculate and display statistics related to intervention sessions, such as:
|
| 158 |
+
# - **Total Number of Days Available**
|
| 159 |
+
# - **Intervention Sessions Held**
|
| 160 |
+
# - **Intervention Sessions Not Held**
|
| 161 |
+
# - **Intervention Frequency (%)**
|
| 162 |
+
# - A **stacked bar chart** will be shown to visualize the number of sessions held versus not held.
|
| 163 |
+
# - If you need to save the visualization, click the **"Download Chart"** button to download it as a `.png` file.
|
| 164 |
+
# #### **5. Student Metrics Analysis**
|
| 165 |
+
# - The app will also calculate metrics for each student:
|
| 166 |
+
# - **Attendance (%)** – The percentage of intervention sessions attended.
|
| 167 |
+
# - **Engagement (%)** – The level of engagement during attended sessions.
|
| 168 |
+
# - These metrics will be presented in a **line graph** that shows attendance and engagement for each student.
|
| 169 |
+
# - You can click the **"Download Chart"** button to download the visualization as a `.png` file.
|
| 170 |
+
# #### **6. Generate AI Analysis and Recommendations**
|
| 171 |
+
# - The app will prepare data from the student metrics to provide notes, key takeaways, and suggestions for improving outcomes using an **AI language model**.
|
| 172 |
+
# - You will see a **spinner** labeled **"Generating AI analysis…"** while the AI processes the data.
|
| 173 |
+
# - This step may take a little longer, but the spinner ensures you know that the system is working.
|
| 174 |
+
# - Once the analysis is complete, the AI's recommendations will be displayed under **"AI Analysis"**.
|
| 175 |
+
# - You can click the **"Download LLM Output"** button to download the AI-generated recommendations as a `.txt` file for future reference.
|
| 176 |
+
# """
|
| 177 |
+
# st.markdown(user_instructions)
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
import streamlit as st
|
| 181 |
+
|
| 182 |
class Sidebar:
|
| 183 |
def __init__(self):
|
| 184 |
self.main_body_logo = "mimtss.png"
|
|
|
|
| 201 |
""")
|
| 202 |
|
| 203 |
st.divider()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
|
| 205 |
+
# Download button for example spreadsheet
|
| 206 |
+
st.download_button(
|
| 207 |
+
label="Download Example Spreadsheet",
|
| 208 |
+
data=open("Example_LIR_Spreadsheet.xlsx", "rb").read(),
|
| 209 |
+
file_name="Example_LIR_Spreadsheet.xlsx",
|
| 210 |
+
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
| 211 |
+
)
|
| 212 |
+
|
| 213 |
+
with st.expander("Spreadsheet Headers"):
|
| 214 |
+
headers_info = """
|
| 215 |
+
Your spreadsheet must include the following headers for proper analysis:
|
| 216 |
+
|
| 217 |
+
1. **Date Column**:
|
| 218 |
+
- "Date of Session" or "Date"
|
| 219 |
+
|
| 220 |
+
2. **Intervention Column**:
|
| 221 |
+
- "Did the intervention happen today?" or
|
| 222 |
+
- "Did the intervention take place today?"
|
| 223 |
+
|
| 224 |
+
3. **Student Attendance Columns**:
|
| 225 |
+
- Format: "Student Attendance [student name]"
|
| 226 |
+
- Options: Engaged, Partially Engaged, Not Engaged, Absent
|
| 227 |
+
- Example: "Student Attendance [Charlie Gordon]"
|
| 228 |
+
|
| 229 |
+
#### Important Note on Student Names:
|
| 230 |
+
- For students with the same initials, you must use a unique identifier to distinguish them.
|
| 231 |
+
- Best practices for unique identifiers:
|
| 232 |
+
- Add a middle name: "Charlie Gordon" --> "Charlie A. Gordon"
|
| 233 |
+
- Use a unique identifier: "Charlie Gordon 1" and "Clarissa Gao 2"
|
| 234 |
+
|
| 235 |
+
This ensures that when names are truncated to initials, each student has a unique identifier.
|
| 236 |
+
"""
|
| 237 |
+
st.markdown(headers_info)
|
| 238 |
+
|
| 239 |
+
with st.expander("Privacy Assurance"):
|
| 240 |
+
privacy_assurance = """
|
| 241 |
+
- **No full names** are ever displayed or sent to the AI model—only initials are used.
|
| 242 |
+
- This ensures that sensitive data remains protected throughout the entire process.
|
| 243 |
+
"""
|
| 244 |
+
st.markdown(privacy_assurance)
|
| 245 |
+
|
| 246 |
+
with st.expander("Instructions"):
|
| 247 |
+
instructions = """
|
| 248 |
+
- **Step 1**: Upload your Excel file.
|
| 249 |
+
- **Step 2**: Anonymization – student names are replaced with initials for privacy.
|
| 250 |
+
- **Step 3**: Review anonymized data.
|
| 251 |
+
- **Step 4**: View **intervention session statistics**.
|
| 252 |
+
- **Step 5**: Review **student attendance and engagement metrics**.
|
| 253 |
+
- **Step 6**: Review AI-generated **insights and recommendations**.
|
| 254 |
+
"""
|
| 255 |
+
st.markdown(instructions)
|
| 256 |
+
|
| 257 |
+
with st.expander("Detailed Instructions"):
|
| 258 |
+
detailed_instructions = """
|
| 259 |
+
#### **1. Upload Your Excel File**
|
| 260 |
+
- Start by uploading an Excel file that contains intervention data.
|
| 261 |
+
- Click on the **"Upload your Excel file"** button and select your `.xlsx` file from your computer.
|
| 262 |
+
**Note**: Your file should have columns like "Did the intervention happen today?" and "Student Attendance [FirstName LastName]" for the analysis to work correctly.
|
| 263 |
+
|
| 264 |
+
#### **2. Automated Name Anonymization**
|
| 265 |
+
- Once the file is uploaded, the app will **automatically replace student names with initials** in the "Student Attendance" columns.
|
| 266 |
+
- For example, **"Student Attendance [Cheyne LeVesseur]"** will be displayed as **"Student Attendance [CL]"**.
|
| 267 |
+
- If the student only has a first name, like **"Student Attendance [Cheyne]"**, it will be displayed as **"Student Attendance [C]"**.
|
| 268 |
+
- This anonymization helps to **protect student privacy**, ensuring that full names are not visible or sent to the AI language model.
|
| 269 |
+
|
| 270 |
+
#### **3. Review the Uploaded Data**
|
| 271 |
+
- You will see the entire table of anonymized data to verify that the information has been uploaded correctly and that names have been replaced with initials.
|
| 272 |
+
|
| 273 |
+
#### **4. Intervention Session Statistics**
|
| 274 |
+
- The app will calculate and display statistics related to intervention sessions, such as:
|
| 275 |
+
- **Total Number of Days Available**
|
| 276 |
+
- **Intervention Sessions Held**
|
| 277 |
+
- **Intervention Sessions Not Held**
|
| 278 |
+
- **Intervention Frequency (%)**
|
| 279 |
+
- A **stacked bar chart** will be shown to visualize the number of sessions held versus not held.
|
| 280 |
+
- If you need to save the visualization, click the **"Download Chart"** button to download it as a `.png` file.
|
| 281 |
+
|
| 282 |
+
#### **5. Student Metrics Analysis**
|
| 283 |
+
- The app will also calculate metrics for each student:
|
| 284 |
+
- **Attendance (%)** – The percentage of intervention sessions attended.
|
| 285 |
+
- **Engagement (%)** – The level of engagement during attended sessions.
|
| 286 |
+
- These metrics will be presented in a **line graph** that shows attendance and engagement for each student.
|
| 287 |
+
- You can click the **"Download Chart"** button to download the visualization as a `.png` file.
|
| 288 |
+
|
| 289 |
+
#### **6. Generate AI Analysis and Recommendations**
|
| 290 |
+
- The app will prepare data from the student metrics to provide notes, key takeaways, and suggestions for improving outcomes using an **AI language model**.
|
| 291 |
+
- You will see a **spinner** labeled **"Generating AI analysis…"** while the AI processes the data.
|
| 292 |
+
- This step may take a little longer, but the spinner ensures you know that the system is working.
|
| 293 |
+
- Once the analysis is complete, the AI's recommendations will be displayed under **"AI Analysis"**.
|
| 294 |
+
- You can click the **"Download LLM Output"** button to download the AI-generated recommendations as a `.txt` file for future reference.
|
| 295 |
+
"""
|
| 296 |
+
st.markdown(detailed_instructions)
|