feat: Enhance medical report generation with new features and improved data handling

- Added body fat percentage input and optional muscle oxygenation CSV upload in the upload form.
- Implemented TSI chart generation based on muscle oxygenation data.
- Updated report generation to include metabolism and fuel source charts.
- Refactored context generation to eliminate reliance on SECA data, using patient info directly instead.
- Improved error handling and logging for graph generation processes.
- Enhanced HTML templates for better user experience and functionality.
This commit is contained in:
bolade
2025-11-18 16:57:39 +01:00
parent 83f50882e2
commit 7e985c497e
12 changed files with 1256 additions and 262 deletions
+3 -9
View File
@@ -18,13 +18,12 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"id": "da5ac3c1",
"metadata": {},
"outputs": [],
"source": [
"pnoe_df = pd.read_csv('data/pnoe_data.csv', delimiter=';')\n",
"patients_info = pd.read_excel('data/patients_data.xlsx')\n",
"spirometry_df = pd.read_csv('data/spirometry_data.csv')"
]
},
@@ -254,7 +253,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"id": "2fa8ff13",
"metadata": {},
"outputs": [
@@ -270,15 +269,10 @@
}
],
"source": [
"def body_composition_chart(first_name='Keirstyn', last_name='Moran'):\n",
"def body_composition_chart(fat_percentage=22.4, weight_kg=70):\n",
"\n",
" \n",
" #=========================== Body Composition Donut Chart ========================#\n",
" patient_data = patients_info[(patients_info['FirstName'].str.contains(first_name, case=False, na=False)) & \n",
" (patients_info['LastName'].str.contains(last_name, case=False, na=False))]\n",
"# Get the fat mass percentage for Keirstyn\n",
" fat_percentage = patient_data['Adult_FMP'].iloc[0]\n",
" weight_kg = patient_data['Weight'].iloc[0]\n",
" lean_percentage = 100 - fat_percentage\n",
"\n",
"# Create donut chart\n",