41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
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
|
|
|
|
|