feat: Remove deprecated body fat percentage chart and integrate master chart for report generation
- Deleted the old body fat percentage chart image. - Updated report generation to load the new body fat percentage master chart for improved accuracy and consistency. - Refactored context generation to reference the new chart in the report structure.
This commit is contained in:
@@ -404,6 +404,23 @@ class ReportGeneratorService:
|
||||
print(f"Warning: Could not generate body fat percent chart: {e}")
|
||||
graphs_dict["body_fat_percent"] = ""
|
||||
|
||||
# Load static body fat percentage master chart for page 18
|
||||
master_chart_path = Path("app/body_fat_percentage_master_chart.png")
|
||||
if master_chart_path.exists():
|
||||
try:
|
||||
with open(master_chart_path, "rb") as f:
|
||||
graphs_dict["body_fat_percentage_master_chart"] = base64.b64encode(
|
||||
f.read()
|
||||
).decode("utf-8")
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not load body fat percentage master chart: {e}")
|
||||
graphs_dict["body_fat_percentage_master_chart"] = ""
|
||||
else:
|
||||
print(
|
||||
f"Warning: Body fat percentage master chart not found at {master_chart_path}"
|
||||
)
|
||||
graphs_dict["body_fat_percentage_master_chart"] = ""
|
||||
|
||||
# Generate spirometry chart
|
||||
print("Step 4: Generating spirometry chart...")
|
||||
try:
|
||||
@@ -419,6 +436,7 @@ class ReportGeneratorService:
|
||||
print("Spirometry chart generated successfully")
|
||||
except Exception as e:
|
||||
import traceback
|
||||
|
||||
error_details = traceback.format_exc()
|
||||
print(f"Warning: Could not generate spirometry chart: {e}")
|
||||
print(f"Error details: {error_details}")
|
||||
|
||||
Reference in New Issue
Block a user