feat: Enhance context generation with new table images for VO2 Max and Heart Rate Zones

- Added functionality to generate VO2 Max and Heart Rate Zones tables in the context_generator.py.
- Integrated graph_generator to create table images with specified data and styles.
- Updated report_generator.py to pass graph_generator to context generation.
- Introduced a new method in graph_generator.py to generate table images with customizable options.
- Created test scripts for Page 5 (RMR and NEAT calculations) and Page 6 (Meal Plan calculations) using actual patient data.
- Updated Jupyter notebook metadata for better environment identification.
This commit is contained in:
bolade
2025-11-21 11:38:43 +01:00
parent 9d51b006c0
commit 47f0c6f3fb
8 changed files with 825 additions and 294 deletions
+7 -98
View File
@@ -127,104 +127,13 @@
Resting Heart Rate - {{ resting_heart_rate | default('53bpm') }}
</h3>
<table class="w-full border-collapse text-xs">
<thead>
<tr>
<th
class="bg-cyan-300 border border-gray-400 p-2 text-black font-bold"
>
Age (F)
</th>
<th
class="bg-cyan-300 border border-gray-400 p-2 text-black font-bold"
>
Poor
</th>
<th
class="bg-cyan-300 border border-gray-400 p-2 text-black font-bold"
>
Below Average
</th>
<th
class="bg-cyan-300 border border-gray-400 p-2 text-black font-bold"
>
Average
</th>
<th
class="bg-cyan-300 border border-gray-400 p-2 text-black font-bold"
>
Above Average
</th>
<th
class="bg-cyan-300 border border-gray-400 p-2 text-black font-bold"
>
Good
</th>
<th
class="bg-cyan-300 border border-gray-400 p-2 text-black font-bold"
>
Excellent
</th>
<th
class="bg-cyan-300 border border-gray-400 p-2 text-black font-bold relative"
>
Athlete
<!-- Arrow indicator -->
<div
class="absolute -bottom-3 left-1/2 transform -translate-x-1/2"
>
<div
class="w-0 h-0 border-l-3 border-r-3 border-t-6 border-transparent border-t-black"
></div>
</div>
</th>
</tr>
</thead>
<tbody>
<tr>
<td
class="bg-cyan-200 border border-gray-400 p-2 text-black font-semibold text-center"
>
{{ hr_age_range | default('26-35') }}
</td>
<td
class="bg-gray-100 border border-gray-400 p-2 text-black text-center"
>
{{ hr_poor | default('82bpm +') }}
</td>
<td
class="bg-gray-100 border border-gray-400 p-2 text-black text-center"
>
{{ hr_below_avg | default('75-81bpm') }}
</td>
<td
class="bg-gray-100 border border-gray-400 p-2 text-black text-center"
>
{{ hr_average | default('71-74bpm') }}
</td>
<td
class="bg-gray-100 border border-gray-400 p-2 text-black text-center"
>
{{ hr_above_avg | default('66-70bpm') }}
</td>
<td
class="bg-gray-100 border border-gray-400 p-2 text-black text-center"
>
{{ hr_good | default('62-65bpm') }}
</td>
<td
class="bg-gray-100 border border-gray-400 p-2 text-black text-center"
>
{{ hr_excellent | default('55-61bpm') }}
</td>
<td
class="bg-green-200 border border-gray-400 p-2 text-black text-center font-bold"
>
{{ hr_athlete | default('44-54bpm') }}
</td>
</tr>
</tbody>
</table>
<div class="flex justify-center">
<img
src="data:image/png;base64, {{ rhr_table }}"
alt="Resting Heart Rate Table"
class="w-full max-w-4xl h-auto object-contain"
/>
</div>
</div>
</div>