Lars Masanneck Paula-ZE commited on
Commit
a3309b8
·
1 Parent(s): ee7a14d

Adding explanaotry notes to app and exports

Browse files

Co-Authored-By: Paula-ZE <209988446+paula-ze@users.noreply.github.com>

Z-Score_Calculator.py CHANGED
@@ -178,6 +178,26 @@ def main():
178
  f"Sample size: {res['n']}**."
179
  )
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  # Detailed statistics table
182
  st.subheader("Detailed Statistics")
183
  stats_df = pd.DataFrame(
 
178
  f"Sample size: {res['n']}**."
179
  )
180
 
181
+ # Z-Score Classification Guide
182
+ with st.expander("📊 Z-Score Classification Guide"):
183
+ st.markdown("""
184
+ **How to interpret your Z-Score:**
185
+
186
+ | Z-Score Range | Classification | Percentile Range |
187
+ |:-------------:|:--------------:|:----------------:|
188
+ | z < -2.0 | Very Low | < 2.3% |
189
+ | -2.0 ≤ z < -0.5 | Below Average | 2.3% - 30.9% |
190
+ | **-0.5 ≤ z < 0.5** | **Average** | **30.9% - 69.1%** |
191
+ | 0.5 ≤ z < 2.0 | Above Average | 69.1% - 97.7% |
192
+ | z ≥ 2.0 | Very High | > 97.7% |
193
+
194
+ **Context matters:**
195
+ - For **steps, sleep duration, and active minutes**: Higher values are generally better ✓
196
+ - For **heart rate**: Lower resting values are generally better ✓
197
+
198
+ *A z-score of 0 means you are exactly at the population average for your demographic group.*
199
+ """)
200
+
201
  # Detailed statistics table
202
  st.subheader("Detailed Statistics")
203
  stats_df = pd.DataFrame(
batch_utils.py CHANGED
@@ -398,7 +398,45 @@ def generate_pdf_report(patient_info: dict, measurements: dict, z_scores: dict =
398
  f"({patient_info.get('gender', 'N/A')}), age group, and BMI category."
399
  )
400
  elements.append(Paragraph(cohort_text, normal_style))
401
- elements.append(Spacer(1, 0.3*inch))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
402
 
403
  # Disclaimer
404
  disclaimer = Paragraph(
 
398
  f"({patient_info.get('gender', 'N/A')}), age group, and BMI category."
399
  )
400
  elements.append(Paragraph(cohort_text, normal_style))
401
+ elements.append(Spacer(1, 0.2*inch))
402
+
403
+ # Z-Score Classification Guide
404
+ elements.append(Paragraph("Z-Score Classification Guide", heading_style))
405
+
406
+ classification_data = [
407
+ ["Z-Score Range", "Classification", "Percentile"],
408
+ ["z < -2.0", "Very Low", "< 2.3%"],
409
+ ["-2.0 ≤ z < -0.5", "Below Average", "2.3% - 30.9%"],
410
+ ["-0.5 ≤ z < 0.5", "Average", "30.9% - 69.1%"],
411
+ ["0.5 ≤ z < 2.0", "Above Average", "69.1% - 97.7%"],
412
+ ["z ≥ 2.0", "Very High", "> 97.7%"],
413
+ ]
414
+
415
+ class_table = Table(classification_data, colWidths=[1.8*inch, 1.5*inch, 1.5*inch])
416
+ class_table.setStyle(TableStyle([
417
+ ('BACKGROUND', (0, 0), (-1, 0), colors.HexColor('#e67e22')),
418
+ ('TEXTCOLOR', (0, 0), (-1, 0), colors.whitesmoke),
419
+ ('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
420
+ ('FONTSIZE', (0, 0), (-1, -1), 9),
421
+ ('ALIGN', (0, 0), (-1, -1), 'CENTER'),
422
+ ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
423
+ ('GRID', (0, 0), (-1, -1), 0.5, colors.grey),
424
+ ('BOTTOMPADDING', (0, 0), (-1, -1), 6),
425
+ ('TOPPADDING', (0, 0), (-1, -1), 6),
426
+ # Highlight the "Average" row
427
+ ('BACKGROUND', (0, 3), (-1, 3), colors.HexColor('#fef9e7')),
428
+ ]))
429
+ elements.append(class_table)
430
+ elements.append(Spacer(1, 0.1*inch))
431
+
432
+ context_note = Paragraph(
433
+ "<b>Context:</b> For steps, sleep, and activity - higher is better. "
434
+ "For heart rate - lower resting values are better. "
435
+ "A z-score of 0 = population average for your demographic group.",
436
+ ParagraphStyle('ContextNote', parent=normal_style, fontSize=8, textColor=colors.HexColor('#555555'))
437
+ )
438
+ elements.append(context_note)
439
+ elements.append(Spacer(1, 0.2*inch))
440
 
441
  # Disclaimer
442
  disclaimer = Paragraph(
pages/1_Batch_Analysis.py CHANGED
@@ -256,6 +256,27 @@ if uploaded_file is not None and 'df' in dir() and df is not None and normative_
256
  "Please ensure your columns match the template format."
257
  )
258
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  # Footer
260
  st.markdown("---")
261
  st.markdown(
 
256
  "Please ensure your columns match the template format."
257
  )
258
 
259
+ # Z-Score Classification Guide
260
+ st.markdown("---")
261
+ with st.expander("📊 Z-Score Classification Guide"):
262
+ st.markdown("""
263
+ **How to interpret Z-Scores:**
264
+
265
+ | Z-Score Range | Classification | Percentile Range |
266
+ |:-------------:|:--------------:|:----------------:|
267
+ | z < -2.0 | Very Low | < 2.3% |
268
+ | -2.0 ≤ z < -0.5 | Below Average | 2.3% - 30.9% |
269
+ | **-0.5 ≤ z < 0.5** | **Average** | **30.9% - 69.1%** |
270
+ | 0.5 ≤ z < 2.0 | Above Average | 69.1% - 97.7% |
271
+ | z ≥ 2.0 | Very High | > 97.7% |
272
+
273
+ **Context matters:**
274
+ - For **steps, sleep duration, and active minutes**: Higher values are generally better ✓
275
+ - For **heart rate**: Lower resting values are generally better ✓
276
+
277
+ *A z-score of 0 means you are exactly at the population average for your demographic group.*
278
+ """)
279
+
280
  # Footer
281
  st.markdown("---")
282
  st.markdown(
pages/2_PDF_Report.py CHANGED
@@ -288,10 +288,31 @@ The generated PDF report includes:
288
  - Visual gauge charts showing position in distribution
289
  - Interpretation (Very Low → Average → Very High)
290
  4. **Reference Population Info** - Details about the comparison cohort
 
291
 
292
  *All reports include a disclaimer noting educational/research purpose.*
293
  """)
294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  # Footer
296
  st.markdown("---")
297
  st.markdown(
 
288
  - Visual gauge charts showing position in distribution
289
  - Interpretation (Very Low → Average → Very High)
290
  4. **Reference Population Info** - Details about the comparison cohort
291
+ 5. **Classification Guide** - Explanation of z-score interpretation
292
 
293
  *All reports include a disclaimer noting educational/research purpose.*
294
  """)
295
 
296
+ # Z-Score Classification Guide
297
+ with st.expander("📊 Z-Score Classification Guide"):
298
+ st.markdown("""
299
+ **How to interpret Z-Scores:**
300
+
301
+ | Z-Score Range | Classification | Percentile Range |
302
+ |:-------------:|:--------------:|:----------------:|
303
+ | z < -2.0 | Very Low | < 2.3% |
304
+ | -2.0 ≤ z < -0.5 | Below Average | 2.3% - 30.9% |
305
+ | **-0.5 ≤ z < 0.5** | **Average** | **30.9% - 69.1%** |
306
+ | 0.5 ≤ z < 2.0 | Above Average | 69.1% - 97.7% |
307
+ | z ≥ 2.0 | Very High | > 97.7% |
308
+
309
+ **Context matters:**
310
+ - For **steps, sleep duration, and active minutes**: Higher values are generally better ✓
311
+ - For **heart rate**: Lower resting values are generally better ✓
312
+
313
+ *A z-score of 0 means you are exactly at the population average for your demographic group.*
314
+ """)
315
+
316
  # Footer
317
  st.markdown("---")
318
  st.markdown(