feat: Add PageGenerator class for generating report pages with patient data
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
class PageGenerator:
|
||||
def __init__(self, pnoe_df, seca_df, spirometry_df, patient_info):
|
||||
self.pnoe_df = pnoe_df
|
||||
self.seca_df = seca_df
|
||||
self.spirometry_df = spirometry_df
|
||||
self.patient_info = patient_info
|
||||
|
||||
|
||||
def page_1_context(self):
|
||||
# Extract patient information
|
||||
patient_name = self.patient_info.get("patient_name", "N/A")
|
||||
age = self.patient_info.get("age", "N/A")
|
||||
height = self.patient_info.get("height", "N/A")
|
||||
weight = self.patient_info.get("weight", "N/A")
|
||||
focus = self.patient_info.get("focus", "N/A")
|
||||
session_id = self.patient_info.get("session_id", "N/A")
|
||||
|
||||
# Extract PNOE data
|
||||
pnoe_summary = self.pnoe_df.describe().to_dict()
|
||||
|
||||
# Extract SECA data
|
||||
seca_summary = self.seca_df.describe().to_dict()
|
||||
|
||||
# Extract Spirometry data
|
||||
spirometry_summary = self.spirometry_df.describe().to_dict()
|
||||
|
||||
context = {
|
||||
"patient_name": patient_name,
|
||||
"age": age,
|
||||
"height": height,
|
||||
"weight": weight,
|
||||
"focus": focus,
|
||||
"session_id": session_id,
|
||||
"pnoe_summary": pnoe_summary,
|
||||
"seca_summary": seca_summary,
|
||||
"spirometry_summary": spirometry_summary,
|
||||
}
|
||||
|
||||
return context
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ class ReportGeneratorService:
|
||||
seca_excel_path: Path to SECA Excel file
|
||||
patient_info: Dictionary containing patient information
|
||||
output_filename: Optional custom output filename
|
||||
|
||||
n
|
||||
Returns:
|
||||
Dictionary containing report path, graphs generated, and analysis data
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user