Significant Progress

This commit is contained in:
bolade
2025-11-24 19:56:02 +01:00
parent 8e8280bcb0
commit 47e6e69eb7
18 changed files with 2228 additions and 2204 deletions
+29 -20
View File
@@ -1303,9 +1303,18 @@ class ContextGenerator:
"fat_metabolism_chart": graphs.get("fat_metabolism", ""),
}
# Page 10 - VO2 Pulse and VO2 Breath
vo2_drop_metrics = self._calculate_vo2_drop_points(pnoe_metrics)
# Page 10 - Fuelling Analysis (new page with flowchart and carb storage table)
contexts["page_10"] = {
"patient_name": self.patient_info["name"],
"page_number": 10,
"fuelling_analysis_flowchart": graphs.get(
"fuelling_analysis_flowchart", ""
),
}
# Page 11 - VO2 Pulse and VO2 Breath (previously page 10)
vo2_drop_metrics = self._calculate_vo2_drop_points(pnoe_metrics)
contexts["page_11"] = {
"vo2_pulse_chart": graphs.get("vo2_pulse", ""),
"vo2_breath_chart": graphs.get("vo2_breath", ""),
"vo2_pulse_drop_bpm": f"{vo2_drop_metrics['vo2_pulse_drop_bpm']} bpm",
@@ -1314,12 +1323,12 @@ class ContextGenerator:
"vo2_breath_drop_zone": vo2_drop_metrics["vo2_breath_drop_zone"],
}
# Page 11 - Fat Metabolism and Recovery
# Page 12 - Fat Metabolism and Recovery (previously page 11)
fat_metabolism_metrics = self._calculate_fat_metabolism_metrics(pnoe_metrics)
recovery_metrics = self._calculate_recovery_metrics()
resting_hr_metrics = self._calculate_resting_heart_rate_metrics()
contexts["page_11"] = {
contexts["page_12"] = {
"fat_metabolism_chart": graphs.get("fat_metabolism", ""),
"recovery_chart": graphs.get("recovery", ""),
**fat_metabolism_metrics,
@@ -1328,7 +1337,7 @@ class ContextGenerator:
}
if graph_generator:
# Page 11 Resting Heart Rate Table
# Page 12 Resting Heart Rate Table (previously page 11)
rhr_table_info = self._calculate_rhr_table_data(
self.patient_info["age"], self.patient_info["gender"]
)
@@ -1372,7 +1381,7 @@ class ContextGenerator:
]
]
contexts["page_11"]["rhr_table"] = (
contexts["page_12"]["rhr_table"] = (
graph_generator.generate_resting_heart_rate_table(
data=rhr_data,
columns=rhr_columns,
@@ -1382,10 +1391,10 @@ class ContextGenerator:
)
)
# Page 12 - Muscle Oxygenation
contexts["page_12"] = {
# Page 13 - Muscle Oxygenation (previously page 12)
contexts["page_13"] = {
"patient_name": self.patient_info["name"],
"page_number": 12,
"page_number": 13,
}
# Generate muscle oxygenation chart if data is available
@@ -1394,31 +1403,31 @@ class ContextGenerator:
chart_str, metrics = graph_generator.generate_muscle_oxygenation_chart(
self.oxygenation_df, save_as_base64=True
)
contexts["page_12"]["muscle_oxygenation_chart"] = chart_str
contexts["page_12"].update(metrics)
contexts["page_13"]["muscle_oxygenation_chart"] = chart_str
contexts["page_13"].update(metrics)
except Exception as e:
print(f"Warning: Could not generate muscle oxygenation chart: {e}")
# Pages 13-17
# Pages 14-18 (previously 13-17)
for i in range(1, 6):
contexts[f"page_{i + 12}"] = {
contexts[f"page_{i + 13}"] = {
"patient_name": self.patient_info["name"],
"page_number": i + 12,
"page_number": i + 13,
}
# Page 18 - Glossary with Body Fat Percentage Master Chart
contexts["page_18"] = {
# Page 19 - Glossary with Body Fat Percentage Master Chart (previously page 18)
contexts["page_19"] = {
"patient_name": self.patient_info["name"],
"page_number": 18,
"page_number": 19,
"body_fat_percentage_chart": graphs.get(
"body_fat_percentage_master_chart", ""
),
}
# Page 19
contexts["page_19"] = {
# Page 20 (previously page 19)
contexts["page_20"] = {
"patient_name": self.patient_info["name"],
"page_number": 19,
"page_number": 20,
}
return contexts