def get_common_task_html(self, rating_q, good_q, bad_q): if self.rating is not None: r = u"{}. {}".format(self.rating, self.get_rating_text()) else: r = None h = u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() + u""" </table> </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer</th> </tr> """ h += tr_qa(WSTRING("service_being_rated"), self.service) h += tr_qa(u"{} {}?".format(rating_q, self.service), r) h += tr_qa(good_q, self.good) h += tr_qa(bad_q, self.bad) h += u""" </table> """ return h
def get_task_html(self): h = self.get_standard_clinician_block(True, self.comments) + u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr_qa(WSTRING("date_pertains_to"), format_datetime_string(self.date_pertains_to, DATEFORMAT.LONG_DATE, default=None)) h += tr_qa(WSTRING("meets_criteria"), get_yes_no_none(self.meets_criteria())) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="80%">Question</th> <th width="20%">Answer</th> </tr> """ h += self.text_row("icd10schizotypal_a") for i in range(1, Icd10Schizotypal.N_A + 1): h += self.get_twocol_bool_row_true_false( "a" + str(i), WSTRING("icd10schizotypal_a" + str(i))) h += self.get_twocol_bool_row_true_false( "b", WSTRING("icd10schizotypal_b")) h += u""" </table> """ + ICD10_COPYRIGHT_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) + " / 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): 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 = self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() h += tr_qa("Total errors", self.n_errors()) h += tr_qa("Predicted full-scale IQ <sup>[1]</sup>", self.fsiq()) h += tr_qa("Predicted verbal IQ <sup>[2]</sup>", self.viq()) h += tr_qa("Predicted performance IQ <sup>[3]</sup>", self.piq()) h += u""" </table> </div> <div class="explanation"> Estimates premorbid IQ by pronunciation of irregular words. </div> <table class="taskdetail"> <tr> <th width="16%">Word</th><th width="16%">Correct?</th> <th width="16%">Word</th><th width="16%">Correct?</th> <th width="16%">Word</th><th width="16%">Correct?</th> </tr> """ nwords = len(WORDLIST) ncolumns = 3 nrows = int(math.ceil(float(nwords)/float(ncolumns))) column = 0 row = 0 # x: word index (shown in top-to-bottom then left-to-right sequence) for unused_loopvar in range(nwords): x = (column * nrows) + row if column == 0: # first column h += u"<tr>" h += td(ACCENTED_WORDLIST[x]) h += td(answer(getattr(self, WORDLIST[x]))) if column == (ncolumns - 1): # last column h += u"</tr>" row += 1 column = (column + 1) % ncolumns h += u""" </table> <div class="footnotes"> [1] Full-scale IQ ≈ 127.7 – 0.826 × errors. [2] Verbal IQ ≈ 129.0 – 0.919 × errors. [3] Performance IQ ≈ 123.5 – 0.645 × errors. </div> <div class="copyright"> NART: Copyright © Hazel E. Nelson. Used with permission. </div> """ 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_task_html(self): h = u""" <div class="summary"> <table class="summary"> """ h += self.get_is_complete_tr() h += tr_qa(u"Overall distress (0–10)", self.distress) h += u""" </table> </div> <div class="explanation"> All questions relate to distress/problems “in the past week, including today” (yes = problem, no = no problem). </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer</th> </tr> """ h += tr_qa(u"Distress (0 no distress – 10 extreme distress)", self.distress) h += subheading_spanning_two_columns("Practical problems") for i in range(1, 5 + 1): h += tr_qa( u"{}. {}".format(i, WSTRING("distressthermometer_q" + str(i))), get_yes_no_none(getattr(self, "q" + str(i))) ) h += subheading_spanning_two_columns("Family problems") for i in range(6, 8 + 1): h += tr_qa( u"{}. {}".format(i, WSTRING("distressthermometer_q" + str(i))), get_yes_no_none(getattr(self, "q" + str(i))) ) h += subheading_spanning_two_columns("Emotional problems") for i in range(9, 14 + 1): h += tr_qa( u"{}. {}".format(i, WSTRING("distressthermometer_q" + str(i))), get_yes_no_none(getattr(self, "q" + str(i))) ) h += subheading_spanning_two_columns("Spiritual problems") for i in range(15, 15 + 1): h += tr_qa( u"{}. {}".format(i, WSTRING("distressthermometer_q" + str(i))), get_yes_no_none(getattr(self, "q" + str(i))) ) h += subheading_spanning_two_columns("Physical problems") for i in range(16, DistressThermometer.NQUESTIONS + 1): h += tr_qa( u"{}. {}".format(i, WSTRING("distressthermometer_q" + str(i))), get_yes_no_none(getattr(self, "q" + str(i))) ) h += subheading_spanning_two_columns("Other problems") h += tr_qa(WSTRING("distressthermometer_other_s"), self.other) h += u""" </table> """ 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): 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_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): 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_task_html(self): MIN_SCORE = 0 MAX_SCORE = 3 crippled = not task_extrastrings_exist(self.EXTRASTRING_TASKNAME) a = self.anxiety_score() d = self.depression_score() h = u""" <div class="summary"> <table class="summary"> {is_complete_tr} <tr> <td>{sa}</td><td>{a} / 21</td> </tr> <tr> <td>{sd}</td><td>{d} / 21</td> </tr> </table> </div> <div class="explanation"> All questions are scored from 0–3 (0 least symptomatic, 3 most symptomatic). </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer</th> </tr> """.format( is_complete_tr=self.get_is_complete_tr(), sa=WSTRING("hads_anxiety_score"), a=answer(a), sd=WSTRING("hads_depression_score"), d=answer(d), ) for n in xrange(1, self.NQUESTIONS + 1): if crippled: q = "HADS: Q{}".format(n) else: q = u"Q{}. {}".format( n, WXSTRING(self.EXTRASTRING_TASKNAME, "q" + str(n) + "_stem") ) if n in self.ANXIETY_QUESTIONS: q += " (A)" if n in self.DEPRESSION_QUESTIONS: q += " (D)" v = getattr(self, "q" + str(n)) if crippled or v is None or v < MIN_SCORE or v > MAX_SCORE: a = v else: a = u"{}: {}".format(v, WXSTRING(self.EXTRASTRING_TASKNAME, "q{}_a{}".format(n, v))) h += tr_qa(q, a) h += u""" </table> """ + DATA_COLLECTION_UNLESS_UPGRADED_DIV return h
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 get_drug_frequency_row(self, fieldname): DRUG_FREQUENCY_DICT = { 0: "Did not use", 1: "Occasionally", 2: "Monthly", 3: "Weekly", 4: "Daily" } frequency = DRUG_FREQUENCY_DICT.get(getattr(self, fieldname), None) return tr_qa(fieldname, frequency)
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_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
def get_task_html(self): score = self.total_score() severity = self.severity() ANSWER_DICTS = [] for q in range(1, Hamd7.NQUESTIONS + 1): d = {None: None} for option in range(0, 5): if q == 6 and option > 2: continue d[option] = WSTRING("hamd7_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) + " / 26") h += tr_qa(WSTRING("hamd7_severity") + " <sup>[1]</sup>", severity) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="30%">Question</th> <th width="70%">Answer</th> </tr> """ for q in range(1, Hamd7.NQUESTIONS + 1): h += tr_qa( WSTRING("hamd7_q" + str(q) + "_s"), get_from_dict(ANSWER_DICTS[q - 1], getattr(self, "q" + str(q))) ) h += u""" </table> <div class="footnotes"> [1] ≥20 severe, ≥12 moderate, ≥4 mild, <4 none. </div> """ return h
def get_task_html(self): photos = self.get_photos() html = self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> {is_complete} {num_photos} {description} </table> </div> <table class="taskdetail"> """.format( is_complete=self.get_is_complete_tr(), num_photos=tr_qa("Number of photos", len(photos)), description=tr_qa("Description", self.sequence_description), ) for p in photos: html += p.get_html_table_rows() html += """ </table> """ return html
def get_task_html(self): h = self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> {} </table> </div> <table class="taskdetail"> <col width="25%"> <col width="75%"> """.format( self.get_is_complete_tr(), ) h += tr_qa( WSTRING("cpft_lps_rc_to"), format_datetime_string(self.reset_start_time_to, DATEFORMAT.LONG_DATETIME_WITH_DAY, default=None)) h += tr_qa(WSTRING("cpft_lps_rc_reason"), self.reason) h += u""" </table> """ return h
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() 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): 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): 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_task_html(self): h = self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() + u""" </table> </div> <table class="taskdetail"> <tr> <th width="50%">Question</th> <th width="50%">Answer</th> </tr> """ h += tr_qa(WSTRING("cgi_i_q"), self.get_rating_text()) h += u""" </table> """ return h
def get_task_html(self): p = self.score_p() n = self.score_n() g = self.score_g() composite = self.composite() total = p + n + g ANSWERS = { None: None, 1: WSTRING("panss_option1"), 2: WSTRING("panss_option2"), 3: WSTRING("panss_option3"), 4: WSTRING("panss_option4"), 5: WSTRING("panss_option5"), 6: WSTRING("panss_option6"), 7: WSTRING("panss_option7"), } h = ( self.get_standard_clinician_block() + u""" <div class="summary"> <table class="summary"> """ ) h += self.get_is_complete_tr() h += tr_qa(u"{} (30–210)".format(WSTRING("total_score")), total) h += tr_qa(u"{} (7–49)".format(WSTRING("panss_p")), p) h += tr_qa(u"{} (7–49)".format(WSTRING("panss_n")), n) h += tr_qa(u"{} (16–112)".format(WSTRING("panss_g")), g) h += tr_qa(WSTRING("panss_composite"), composite) h += u""" </table> </div> <table class="taskdetail"> <tr> <th width="40%">Question</th> <th width="60%">Answer</th> </tr> """ for q in Panss.TASK_FIELDS: h += tr_qa(WSTRING("panss_" + q + "_s"), get_from_dict(ANSWERS, getattr(self, q))) h += ( u""" </table> """ + DATA_COLLECTION_ONLY_DIV ) return h
def get_task_html(self): h = u""" <div class="summary"> <table class="summary"> """ + self.get_is_complete_tr() + u""" </table> </div> <table class="taskdetail"> <tr> <th width="70%">Question</th> <th width="30%">Answer</th> </tr> """ for fs in self.TASK_FIELDSPECS: question = fs["comment"] fieldname = fs["name"] value = getattr(self, fieldname) h += tr_qa(question, value) h += u""" </table> """ + DATA_COLLECTION_ONLY_DIV return h
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