def get_html_table_row(self): return tr( a(self.trial), a(self.block), a(self.group_num), a(self.cue), a(self.raw_cue_number), a(self.target_modality), a(self.target_number), a(self.target_present), a(self.iti_length_s), a(self.pause_given_before_trial), ) + tr( "...", a(self.pause_start_time), a(self.pause_end_time), a(self.trial_start_time), a(self.cue_start_time), a(self.target_start_time), a(self.detection_start_time), a(self.iti_start_time), a(self.iti_end_time), a(self.trial_end_time), tr_class="extradetail2" ) + tr( "...", a(self.responded), a(self.response_time), a(self.response_latency_ms), a(self.rating), a(self.correct), a(self.points), a(self.cumulative_points), tr_class="extradetail2" )
def get_task_html(self): score = self.total_score() severity = self.severity() ANSWER_DICT = {None: None} for option in range(0, 4): ANSWER_DICT[option] = ( str(option) + u" — " + WSTRING("gad7_a" + str(option)) ) h = u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 21") h += tr(WSTRING("gad7_anxiety_severity") + " <sup>[1]</sup>", severity) h += u""" </table> </div> <div class="explanation"> Ratings are over the last 2 weeks. </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer</th> </tr> """ for q in range(1, Gad7.NQUESTIONS + 1): h += tr_qa( WSTRING("gad7_q" + str(q)), get_from_dict(ANSWER_DICT, getattr(self, "q" + str(q))) ) h += u""" </table> <div class="footnotes"> [1] ≥15 severe, ≥10 moderate, ≥5 mild. Score ≥10 identifies: generalized anxiety disorder with sensitivity 89%, specificity 82% (Spitzer et al. 2006, PubMed ID 16717171); panic disorder with sensitivity 74%, specificity 81% (Kroenke et al. 2010, PMID 20633738); social anxiety with sensitivity 72%, specificity 80% (Kroenke et al. 2010); post-traumatic stress disorder with sensitivity 66%, specificity 81% (Kroenke et al. 2010). The majority of evidence contributing to these figures comes from primary care screening studies. </div> """ return h
def get_task_html(self): score = self.total_score() h = u""" <div class="summary"> <table class="summary"> """ h += self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 63") h += u""" </table> </div> <div class="explanation"> All questions are scored from 0–3 (0 free of symptoms, 3 most symptomatic). </div> <table class="taskdetail"> <tr> <th width="70%">Question</th> <th width="30%">Answer</th> </tr> """ h += tr_qa(WSTRING("bdi_which_scale"), ws.webify(self.bdi_scale)) for q in xrange(1, Bdi.NQUESTIONS + 1): h += tr_qa(u"{} {}".format(WSTRING("question"), q), getattr(self, "q" + str(q))) h += ( u""" </table> """ + DATA_COLLECTION_ONLY_DIV ) return h
def get_task_html(self): score = self.total_score() exceeds_cutoff = score >= 2 h = u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 4") h += tr_qa(WSTRING("cage_over_threshold"), get_yes_no(exceeds_cutoff)) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="70%">Question</th> <th width="30%">Answer</th> </tr> """ for q in range(1, Cage.NQUESTIONS + 1): h += tr_qa(str(q) + u" — " + WSTRING("cage_q" + str(q)), get_yes_no_none(getattr(self, "q" + str(q)))) h += u""" </table> """ return h
def get_task_html(self): score = self.total_score() h = u""" <div class="summary"> <table class="summary"> """ h += self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 15") h += u""" </table> </div> <div class="explanation"> Ratings are over the last 1 week. </div> <table class="taskdetail"> <tr> <th width="70%">Question</th> <th width="30%">Answer</th> </tr> """ for q in range(1, self.NQUESTIONS + 1): suffix = u" †" if q in self.SCORE_IF_YES else u" *" h += tr_qa( str(q) + ". " + WSTRING("gds15_q" + str(q)) + suffix, getattr(self, "q" + str(q)) ) h += u""" </table> <div class="footnotes"> (†) ‘Y’ scores 1; ‘N’ scores 0. (*) ‘Y’ scores 0; ‘N’ scores 1. </div> """ return h
def get_html_correct_by_block(self, trialarray): if not trialarray: return div(italic("No trials")) html = """ <table class="extradetail"> <tr> <th>Block</th> <th>P(detected|present)</th> <th>P(detected|absent)</th> <th>c</th> <th>d'</th> </tr> """ for b in range(self.num_blocks): (p_detected_given_present, p_detected_given_absent, c, dprime, n_trials) = self.get_p_detected(trialarray, [b], None) html += tr( b, a(p_detected_given_present), a(p_detected_given_absent), a(c), a(dprime), ) html += """ </table> """ return html
def get_html_correct_by_group(self, trialarray): if not trialarray: return div(italic("No trials")) html = """ <table class="extradetail"> <tr> <th>Group</th> <th>P(detected|present)</th> <th>P(detected|absent)</th> <th>c</th> <th>d'</th> </tr> """ for g in range(N_CUES): (p_detected_given_present, p_detected_given_absent, c, dprime, n_trials) = self.get_p_detected(trialarray, None, [g]) html += tr( g, a(p_detected_given_present), a(p_detected_given_absent), a(c), a(dprime), ) html += """ </table> """ return html
def get_task_html(self): score = self.total_score() severity = self.severity() ANSWER_DICTS_DICT = {} for q in repeat_fieldname("q", 1, Ciwa.NSCOREDQUESTIONS): d = {None: None} for option in range(0, 8): if option > 4 and q == "q10": continue d[option] = WSTRING("ciwa_" + q + "_option" + str(option)) ANSWER_DICTS_DICT[q] = d h = self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 67") h += tr_qa(WSTRING("ciwa_severity") + " <sup>[1]</sup>", severity) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="35%">Question</th> <th width="65%">Answer</th> </tr> """ for q in range(1, Ciwa.NSCOREDQUESTIONS + 1): h += tr_qa( WSTRING("ciwa_q" + str(q) + "_s"), get_from_dict(ANSWER_DICTS_DICT["q" + str(q)], getattr(self, "q" + str(q))) ) h += subheading_spanning_two_columns(WSTRING("ciwa_vitals_title")) h += tr_qa(WSTRING("ciwa_t"), self.t) h += tr_qa(WSTRING("ciwa_hr"), self.hr) h += tr(WSTRING("ciwa_bp"), answer(self.sbp) + " / " + answer(self.dbp)) h += tr_qa(WSTRING("ciwa_rr"), self.rr) h += u""" </table> <div class="footnotes"> [1] Total score ≥15 severe, ≥8 moderate, otherwise mild/minimal. </div> """ return h
def get_html_table_row(self): return tr( a(self.group_num), a(self.cue), a(self.target_modality), a(self.target_number), a(self.n_target), a(self.n_no_target), )
def get_task_html(self): score = self.total_score() exceeds_cutoff_1 = score >= 6 exceeds_cutoff_2 = score >= 11 MAIN_DICT = { None: None, "Y": WSTRING("Yes"), "N": WSTRING("No") } h = u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 28") h += tr_qa(WSTRING("dast_exceeds_standard_cutoff_1"), get_yes_no(exceeds_cutoff_1)) h += tr_qa(WSTRING("dast_exceeds_standard_cutoff_2"), get_yes_no(exceeds_cutoff_2)) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="80%">Question</th> <th width="20%">Answer</th> </tr> """ for q in range(1, Dast.NQUESTIONS + 1): h += tr( WSTRING("dast_q" + str(q)), answer(get_from_dict(MAIN_DICT, getattr(self, "q" + str(q)))) + u" — " + answer(str(self.get_score(q))) ) h += u""" </table> <div class="copyright"> DAST: Copyright © Harvey A. Skinner and the Centre for Addiction and Mental Health, Toronto, Canada. Reproduced here under the permissions granted for NON-COMMERCIAL use only. You must obtain permission from the copyright holder for any other use. </div> """ return h
def answer_row_html(self, q): qtext = WSTRING("rand36_q" + str(q)) v = getattr(self, "q" + str(q)) atext = self.answer_text(q, v) s = self.recode(q) return tr( qtext, answer(v) + u": " + answer(atext), answer(s, formatter_answer=identity) )
def get_task_html(self): score = self.total_score() exceeds_cutoff = score >= 8 Q1_DICT = {None: None} Q2_DICT = {None: None} Q3_TO_8_DICT = {None: None} Q9_TO_10_DICT = {None: None} for option in xrange(0, 5): Q1_DICT[option] = str(option) + u" – " + \ WSTRING("audit_q1_option" + str(option)) Q2_DICT[option] = str(option) + u" – " + \ WSTRING("audit_q2_option" + str(option)) Q3_TO_8_DICT[option] = str(option) + u" – " + \ WSTRING("audit_q3to8_option" + str(option)) if option != 1 and option != 3: Q9_TO_10_DICT[option] = str(option) + u" – " + \ WSTRING("audit_q9to10_option" + str(option)) h = u""" <div class="summary"> <table class="summary"> """ h += self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 40") h += tr_qa(WSTRING("audit_exceeds_standard_cutoff"), get_yes_no(exceeds_cutoff)) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer</th> </tr> """ h += tr_qa(WSTRING("audit_q1_s"), get_from_dict(Q1_DICT, self.q1)) h += tr_qa(WSTRING("audit_q2_s"), get_from_dict(Q2_DICT, self.q2)) for q in xrange(3, 8 + 1): h += tr_qa( WSTRING("audit_q" + str(q) + "_s"), get_from_dict(Q3_TO_8_DICT, getattr(self, "q" + str(q))) ) h += tr_qa(WSTRING("audit_q9_s"), get_from_dict(Q9_TO_10_DICT, self.q9)) h += tr_qa(WSTRING("audit_q10_s"), get_from_dict(Q9_TO_10_DICT, self.q10)) h += u""" </table> <div class="copyright"> AUDIT: Copyright © World Health Organization. Reproduced here under the permissions granted for NON-COMMERCIAL use only. You must obtain permission from the copyright holder for any other use. </div> """ return h
def get_task_html(self): Q8PROBLEMTYPE_DICT = { None: None, "A": WSTRING("honos65_q8problemtype_option_a"), "B": WSTRING("honos65_q8problemtype_option_b"), "C": WSTRING("honos65_q8problemtype_option_c"), "D": WSTRING("honos65_q8problemtype_option_d"), "E": WSTRING("honos65_q8problemtype_option_e"), "F": WSTRING("honos65_q8problemtype_option_f"), "G": WSTRING("honos65_q8problemtype_option_g"), "H": WSTRING("honos65_q8problemtype_option_h"), "I": WSTRING("honos65_q8problemtype_option_i"), "J": WSTRING("honos65_q8problemtype_option_j"), } h = self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(self.total_score()) + " / 48") h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer <sup>[1]</sup></th> </tr> """ h += tr_qa(WSTRING("honos_period_rated"), self.period_rated) for i in range(1, 8 + 1): h += tr_qa( self.get_q(i), self.get_answer(i, getattr(self, "q" + str(i))) ) h += tr_qa(WSTRING("honos65_q8problemtype_s"), get_from_dict(Q8PROBLEMTYPE_DICT, self.q8problemtype)) h += tr_qa(WSTRING("honos65_q8otherproblem_s"), self.q8otherproblem) for i in range(9, Honos.NQUESTIONS + 1): h += tr_qa( self.get_q(i), self.get_answer(i, getattr(self, "q" + str(i))) ) h += u""" </table> <div class="footnotes"> [1] 0 = no problem; 1 = minor problem requiring no action; 2 = mild problem but definitely present; 3 = moderately severe problem; 4 = severe to very severe problem; 9 = not known. </div> """ + Honos.COPYRIGHT_DIV return h
def get_task_html(self): h = u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("gaf_score"), answer(self.score)) h += u""" </table> </div> """ + DATA_COLLECTION_ONLY_DIV return h
def get_html_correct_by_half_and_probability(self, trialarray, grouparray): if (not trialarray) or (not grouparray): return div(italic("No trials or no groups")) n_target_highprob = max([x.n_target for x in grouparray]) n_target_lowprob = min([x.n_target for x in grouparray]) groups_highprob = [x.group_num for x in grouparray if x.n_target == n_target_highprob] groups_lowprob = [x.group_num for x in grouparray if x.n_target == n_target_lowprob] html = """ <div><i> High probability groups (cues): {}.\n Low probability groups (cues): {}.\n </i></div> <table class="extradetail"> <tr> <th>Half (0 first, 1 second)</th> <th>Target probability given stimulus (0 low, 1 high)</th> <th>P(detected|present)</th> <th>P(detected|absent)</th> <th>c</th> <th>d'</th> </tr> """.format( ", ".join([str(x) for x in groups_highprob]), ", ".join([str(x) for x in groups_lowprob]) ) for half in [0, 1]: for prob in [0, 1]: blocks = range(half * self.num_blocks/2, self.num_blocks/(2 - half)) groups = groups_lowprob if prob == 0 else groups_highprob (p_detected_given_present, p_detected_given_absent, c, dprime, n_trials) = self.get_p_detected(trialarray, blocks, groups) html += tr( half, a(prob), a(p_detected_given_present), a(p_detected_given_absent), a(c), a(dprime), ) html += """ </table> """ return html
def get_task_html(self): score = self.total_score() likelihood = self.likelihood() MAIN_DICT = { None: None, "Y": WSTRING("Yes"), "N": WSTRING("No") } h = u""" <div class="summary"> <table class="summary"> """ h += self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 13") h += tr_qa(WSTRING("smast_problem_likelihood") + " <sup>[1]</sup>", likelihood) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="80%">Question</th> <th width="20%">Answer</th> </tr> """ for q in range(1, Smast.NQUESTIONS + 1): h += tr( WSTRING("smast_q" + str(q)), answer(get_from_dict(MAIN_DICT, getattr(self, "q" + str(q)))) + u" — " + str(self.get_score(q)) ) h += u""" </table> <div class="footnotes"> [1] Total score ≥3 probable, ≥2 possible, 0–1 unlikely. </div> """ return h
def get_task_html(self): score = self.total_score() exceeds_threshold = self.exceeds_ross_threshold() MAIN_DICT = { None: None, "Y": WSTRING("Yes"), "N": WSTRING("No") } h = u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 53") h += tr_qa(WSTRING("mast_exceeds_threshold"), get_yes_no(exceeds_threshold)) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="80%">Question</th> <th width="20%">Answer</th> </tr> """ for q in range(1, Mast.NQUESTIONS + 1): h += tr( WSTRING("mast_q" + str(q)), ( answer(get_from_dict(MAIN_DICT, getattr(self, "q" + str(q)))) + answer(u" — " + str(self.get_score(q))) ) ) h += u""" </table> """ return h
def get_task_html(self): tto_qol = self.get_tto_qol() rs_qol = self.get_rs_qol() mean_qol = mean([tto_qol, rs_qol]) h = u""" <div class="summary"> <table class="summary"> """ h += self.get_is_complete_tr() h += tr("Mean QoL", answer(ws.number_to_dp(mean_qol, DP, default=None), formatter_answer=identity)) h += u""" </table> </div> <div class="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="taskdetail"> <tr> <th width="33%">Scale</th> <th width="33%">Answer</th> <td width="33%">Implied QoL</th> </tr> """ h += tr(WSTRING("qolbasic_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)) h += tr(WSTRING("qolbasic_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)) h += u""" </table> """ return h
def get_task_html(self): score = self.total_score() Q1_DICT = {None: None} Q2_DICT = {None: None} Q3_DICT = {None: None} for option in xrange(0, 5): Q1_DICT[option] = str(option) + u" – " + \ WSTRING("audit_q1_option" + str(option)) if option == 0: # special! Q2_DICT[option] = str(option) + u" – " + \ WSTRING("audit_c_q2_option0") else: Q2_DICT[option] = str(option) + u" – " + \ WSTRING("audit_q2_option" + str(option)) Q3_DICT[option] = str(option) + u" – " + \ WSTRING("audit_q3to8_option" + str(option)) h = u""" <div class="summary"> <table class="summary"> """ h += self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 12") h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer</th> </tr> """ h += tr_qa(WSTRING("audit_c_q1_question"), get_from_dict(Q1_DICT, self.q1)) h += tr_qa(WSTRING("audit_c_q2_question"), get_from_dict(Q2_DICT, self.q2)) h += tr_qa(WSTRING("audit_c_q3_question"), get_from_dict(Q3_DICT, self.q3)) h += u""" </table> <div class="copyright"> AUDIT: Copyright © World Health Organization. Reproduced here under the permissions granted for NON-COMMERCIAL use only. You must obtain permission from the copyright holder for any other use. AUDIT-C: presumed to have the same restrictions. </div> """ return h
def get_question_rows(first, last): h = u"" for q in xrange(first, last + 1): f = getattr(self, "frequency" + str(q)) d = getattr(self, "distress" + str(q)) fa = (u"{}: {}".format(f, get_from_dict(FREQ_DICT, f)) if f is not None else None) da = (u"{}: {}".format(d, get_from_dict(DISTRESS_DICT, d)) if d is not None else None) h += tr( WSTRING("cbir_q" + str(q)), answer(fa), answer(da), ) return h
def get_task_html(self): score = self.total_score() nsevere = self.num_severe() somatoform_likely = nsevere >= 3 severity = self.severity() ANSWER_DICT = {None: None} for option in range(0, 3): ANSWER_DICT[option] = str(option) + u" – " + \ WSTRING("phq15_a" + str(option)) h = u""" <div class="summary"> <table class="summary"> """ h += self.get_is_complete_tr() h += tr(WSTRING("total_score") + " <sup>[1]</sup>", answer(score) + " / 30") h += tr_qa(WSTRING("phq15_n_severe_symptoms") + " <sup>[2]</sup>", nsevere) h += tr_qa(WSTRING("phq15_exceeds_somatoform_cutoff") + " <sup>[3]</sup>", get_yes_no(somatoform_likely)) h += tr_qa(WSTRING("phq15_symptom_severity") + " <sup>[4]</sup>", severity) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="70%">Question</th> <th width="30%">Answer</th> </tr> """ for q in range(1, Phq15.NQUESTIONS + 1): h += tr_qa( WSTRING("phq15_q" + str(q)), get_from_dict(ANSWER_DICT, getattr(self, "q" + str(q))) ) h += u""" </table> <div class="footnotes"> [1] In males, maximum score is actually 28. [2] Questions with scores ≥2 are considered severe. [3] ≥3 severe symptoms. [4] Total score ≥15 severe, ≥10 moderate, ≥5 mild, otherwise none. </div> """ return h
def get_task_html(self): MAIN_DICT = { None: None, 1: u"1 — " + WSTRING("wemwbs_a1"), 2: u"2 — " + WSTRING("wemwbs_a2"), 3: u"3 — " + WSTRING("wemwbs_a3"), 4: u"4 — " + WSTRING("wemwbs_a4"), 5: u"5 — " + WSTRING("wemwbs_a5") } h = u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr( WSTRING("total_score"), answer(self.total_score()) + u" (range {}–{})".format( Swemwbs.MINTOTALSCORE, Swemwbs.MAXTOTALSCORE ) ) h += u""" </table> </div> <div class="explanation"> Ratings are over the last 2 weeks. </div> <table class="taskdetail"> <tr> <th width="60%">Question</th> <th width="40%">Answer</th> </tr> """ for i in range(1, Swemwbs.N_QUESTIONS + 1): nstr = str(i) h += tr_qa(WSTRING("swemwbs_q" + nstr), get_from_dict(MAIN_DICT, getattr(self, "q" + nstr))) h += u""" </table> <div class="copyright"> SWEMWBS: from Stewart-Brown et al. (2009), <i>Health and Quality of Life Outcomes</i> 7:15, http://www.hqlo.com/content/7/1/15; © 2009 Stewart-Brown et al.; distributed under the terms of the Creative Commons Attribution License. </div> """ return h
def get_task_html(self): OPTION_DICT = {None: None} for a in range(self.MIN_SCORE, self.MAX_SCORE + 1): OPTION_DICT[a] = WSTRING("zbi_a" + str(a)) h = u""" <div class="summary"> <table class="summary"> {complete_tr} <tr> <td>Total score (/ 48)</td> <td>{total}</td> </td> </table> </div> <table class="taskdetail"> {tr_responder} {tr_relationship} </table> <table class="taskdetail"> <tr> <th width="75%">Question</th> <th width="25%">Answer (0–4)</th> </tr> """.format( complete_tr=self.get_is_complete_tr(), total=answer(self.total_score()), tr_responder=tr_qa(u"Responder’s name", self.responder_name), tr_relationship=tr_qa(u"Responder’s relationship to patient", self.responder_relationship), ) for q in xrange(1, self.NQUESTIONS + 1): a = getattr(self, "q" + str(q)) fa = (u"{}: {}".format(a, get_from_dict(OPTION_DICT, a)) if a is not None else None) h += tr( WXSTRING( self.EXTRASTRING_TASKNAME, "q" + str(q), "[ZBI: Q{}]".format(q) ), answer(fa) ) h += u""" </table> """ + DATA_COLLECTION_UNLESS_UPGRADED_DIV return h
def get_task_html(self): MAIN_DICT = { None: None, 0: u"0 — " + WSTRING("bprsold_option0"), 1: u"1 — " + WSTRING("bprsold_option1"), 2: u"2 — " + WSTRING("bprsold_option2"), 3: u"3 — " + WSTRING("bprsold_option3"), 4: u"4 — " + WSTRING("bprsold_option4"), 5: u"5 — " + WSTRING("bprsold_option5"), 6: u"6 — " + WSTRING("bprsold_option6"), 7: u"7 — " + WSTRING("bprsold_option7") } h = self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score") + u" (0–168; 24–168 if all rated)", answer(self.total_score())) h += u""" </table> </div> <div class="explanation"> Each question has specific answer definitions (see e.g. tablet app). </div> <table class="taskdetail"> <tr> <th width="60%">Question</th> <th width="40%">Answer <sup>[1]</sup></th> </tr> """ for i in range(1, Bprse.NQUESTIONS + 1): h += tr_qa( WSTRING("bprse_q" + str(i) + "_s"), get_from_dict(MAIN_DICT, getattr(self, "q" + str(i))) ) h += u""" </table> <div class="footnotes"> [1] All answers are in the range 1–7, or 0 (not assessed, for some). </div> """ return h
def get_html_table_row(self): return tr( a(self.trial), a(self.stage), a(self.correct_location), a(self.incorrect_location), a(self.correct_shape), a(self.correct_colour), a(self.correct_number), a(self.incorrect_shape), a(self.incorrect_colour), a(self.incorrect_number), a(self.trial_start_time), a(self.responded), a(self.response_time), a(self.response_latency_ms), a(self.correct), a(self.incorrect), )
def get_task_html(self): MAIN_DICT = { None: None, 0: u"0 — " + WSTRING("fast_q1to3_option0"), 1: u"1 — " + WSTRING("fast_q1to3_option1"), 2: u"2 — " + WSTRING("fast_q1to3_option2"), 3: u"3 — " + WSTRING("fast_q1to3_option3"), 4: u"4 — " + WSTRING("fast_q1to3_option4"), } Q4_DICT = { None: None, 0: u"0 — " + WSTRING("fast_q4_option0"), 2: u"2 — " + WSTRING("fast_q4_option2"), 4: u"4 — " + WSTRING("fast_q4_option4"), } h = u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(self.total_score()) + " / 16") h += tr_qa(WSTRING("fast_positive") + " <sup>[1]</sup>", get_yes_no(self.is_positive())) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="60%">Question</th> <th width="40%">Answer</th> </tr> """ h += tr_qa(WSTRING("fast_q1"), get_from_dict(MAIN_DICT, self.q1)) h += tr_qa(WSTRING("fast_q2"), get_from_dict(MAIN_DICT, self.q2)) h += tr_qa(WSTRING("fast_q3"), get_from_dict(MAIN_DICT, self.q3)) h += tr_qa(WSTRING("fast_q4"), get_from_dict(Q4_DICT, self.q4)) h += u""" </table> <div class="footnotes"> [1] Negative if Q1 = 0. Positive if Q1 ≥ 3. Otherwise positive if total score ≥ 3. </div> """ return h
def get_task_html(self): h = self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(self.total_score()) + " / 60") h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer <sup>[1]</sup></th> </tr> """ h += tr_qa(WSTRING("honos_period_rated"), self.period_rated) h += subheading_spanning_two_columns( WSTRING("honosca_section_a_title")) for i in range(1, 13 + 1): h += tr_qa( self.get_q(i), self.get_answer(i, getattr(self, "q" + str(i))) ) h += subheading_spanning_two_columns( WSTRING("honosca_section_b_title")) for i in range(14, Honosca.NQUESTIONS + 1): h += tr_qa( self.get_q(i), self.get_answer(i, getattr(self, "q" + str(i))) ) h += u""" </table> <div class="footnotes"> [1] 0 = no problem; 1 = minor problem requiring no action; 2 = mild problem but definitely present; 3 = moderately severe problem; 4 = severe to very severe problem; 9 = not known. </div> """ + Honos.COPYRIGHT_DIV return h
def get_html_table_row(self): return tr( a(self.stage), a(self.stage_name), a(self.relevant_dimension), a(self.correct_exemplar), a(self.incorrect_exemplar), a(self.correct_stimulus_shapes), a(self.correct_stimulus_colours), a(self.correct_stimulus_numbers), a(self.incorrect_stimulus_shapes), a(self.incorrect_stimulus_colours), a(self.incorrect_stimulus_numbers), a(self.first_trial_num), a(self.n_completed_trials), a(self.n_correct), a(self.n_incorrect), a(self.stage_passed), a(self.stage_failed), )
def get_task_html(self): h = ( self.get_standard_clinician_block() + u""" <table class="taskdetail"> <tr> <td width="33%">Location:</td> <td width="67%"><b>{}</b></td> </tr> """.format( ws.webify(self.location) ) ) h += tr_qa("Start:", format_datetime_string(self.start, DATEFORMAT.SHORT_DATETIME, None)) h += tr_qa("End:", format_datetime_string(self.end, DATEFORMAT.SHORT_DATETIME, None)) h += tr(italic("Calculated duration (hours:minutes)"), italic(get_duration_h_m(self.start, self.end))) h += tr_qa("Patient contact?", get_yes_no_none(self.patient_contact)) h += tr_qa("Staff liaison?", get_yes_no_none(self.staff_liaison)) h += tr_qa("Other liaison?", get_yes_no_none(self.other_liaison)) h += tr_qa("Comment:", ws.webify(self.comment)) return h
def get_task_html(self): score = self.total_score() severity = self.severity() ANSWER_DICTS = [] for q in range(1, Hama.NQUESTIONS + 1): d = {None: None} for option in range(0, 4): d[option] = WSTRING("hama_q" + str(q) + "_option" + str(option)) ANSWER_DICTS.append(d) h = self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr(WSTRING("total_score"), answer(score) + " / 56") h += tr_qa(WSTRING("hama_symptom_severity") + " <sup>[1]</sup>", severity) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer</th> </tr> """ for q in range(1, Hama.NQUESTIONS + 1): h += tr_qa( WSTRING("hama_q" + str(q) + "_s") + " " + WSTRING( "hama_q" + str(q) + "_question"), get_from_dict(ANSWER_DICTS[q - 1], getattr(self, "q" + str(q))) ) h += u""" </table> <div class="footnotes"> [1] ≥31 very severe, ≥25 moderate to severe, ≥18 mild to moderate, otherwise mild. </div> """ return h