def get_clinical_text(self, req: CamcopsRequest) -> List[CtvInfo]: if not self.is_complete(): return CTV_INCOMPLETE tto_qol = self.get_tto_qol() rs_qol = self.get_rs_qol() mean_qol = mean([tto_qol, rs_qol]) return [ CtvInfo(content=(f"Quality of life: time trade-off " f"{ws.number_to_dp(tto_qol, DP)}, " f"rating scale {ws.number_to_dp(rs_qol, DP)}, " f"mean {ws.number_to_dp(mean_qol, DP)}.")) ]
def get_task_html(self, req: CamcopsRequest) -> str: tto_qol = self.get_tto_qol() rs_qol = self.get_rs_qol() mean_qol = mean([tto_qol, rs_qol]) h = """ <div class="{CssClass.SUMMARY}"> <table class="{CssClass.SUMMARY}"> {tr_is_complete} {mean_qol} </table> </div> <div class="{CssClass.EXPLANATION}"> Quality of life (QoL) has anchor values of 0 (none) and 1 (perfect health), and can be asked about in several ways. </div> <table class="{CssClass.TASKDETAIL}"> <tr> <th width="33%">Scale</th> <th width="33%">Answer</th> <td width="33%">Implied QoL</th> </tr> {tto} {rs} </table> """.format( CssClass=CssClass, tr_is_complete=self.get_is_complete_tr(req), mean_qol=tr( "Mean QoL", answer( ws.number_to_dp(mean_qol, DP, default=None), formatter_answer=identity, ), ), tto=tr( self.wxstring(req, "tto_q_s"), answer(ws.number_to_dp(self.tto, DP, default=None)), answer( ws.number_to_dp(tto_qol, DP, default=None), formatter_answer=identity, ), ), rs=tr( self.wxstring(req, "rs_q_s"), answer(ws.number_to_dp(self.rs, DP, default=None)), answer( ws.number_to_dp(rs_qol, DP, default=None), formatter_answer=identity, ), ), ) return h
def score_physical_functioning(self) -> Optional[float]: return mean([ self.recode(3), self.recode(4), self.recode(5), self.recode(6), self.recode(7), self.recode(8), self.recode(9), self.recode(10), self.recode(11), self.recode(12) ])
def score_overall(self) -> Optional[float]: values = [] for q in range(1, self.NQUESTIONS + 1): values.append(self.recode(q)) return mean(values)
def score_pain(self) -> Optional[float]: return mean([self.recode(21), self.recode(22)])
def score_social_functioning(self) -> Optional[float]: return mean([self.recode(20), self.recode(32)])
def score_role_limitations_emotional(self) -> Optional[float]: return mean([self.recode(17), self.recode(18), self.recode(19)])