Example #1
0
 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
Example #2
0
 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)
     )
Example #3
0
 def four_column_row(self, q1, a1, q2, a2, default=""):
     return u"""
         <tr>
             <td>{}</td><td>{}</td>
             <td>{}</td><td>{}</td>
         </tr>
     """.format(
         q1,
         answer(a1, default=default),
         q2,
         answer(a2, default=default),
     )
Example #4
0
 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
Example #5
0
    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
Example #6
0
 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
Example #7
0
 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
Example #8
0
 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
Example #9
0
 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
Example #10
0
 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
Example #11
0
 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
Example #12
0
 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
Example #13
0
 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
Example #14
0
    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
Example #15
0
 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
Example #16
0
 def get_task_html(self):
     return self.get_standard_clinician_block() + u"""
         <table class="taskdetail">
             <tr class="subheading"><td>Description</td></tr>
             <tr><td>{}</td></tr>
             <tr class="subheading"><td>Photo</td></tr>
             <tr><td>{}</td></tr>
         </table>
     """.format(
         answer(ws.webify(self.description), default="(No description)",
                default_for_blank_strings=True),
         # ... xhtml2pdf crashes if the contents are empty...
         self.get_blob_png_html(self.photo_blobid, self.rotation)
     )
Example #17
0
 def get_task_html(self):
     # Avoid tables - PDF generator crashes if text is too long.
     h = self.get_standard_clinician_block() + u"""
         <div class="heading">
             {heading_location}
         </div>
         <div>
             {location}
         </div>
         <div class="heading">
             {heading_note}
         </div>
         <div>
             {note}
         </div>
     """.format(
         heading_location=WSTRING("location"),
         location=answer(ws.webify(self.location),
                         default_for_blank_strings=True),
         heading_note=WSTRING("progressnote_note"),
         note=answer(ws.webify(self.note), default_for_blank_strings=True),
     )
     return h
Example #18
0
 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
Example #19
0
 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
Example #20
0
 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
Example #21
0
    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
Example #22
0
 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
Example #23
0
 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
Example #24
0
 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
Example #25
0
 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
Example #26
0
 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
Example #27
0
 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
Example #28
0
 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, &lt;4 none.
         </div>
     """
     return h
Example #29
0
def a(x):
    """Answer formatting for this task."""
    return answer(x, formatter_answer=identity, default="")
Example #30
0
 def get_task_html(self):
     tasktype = self.TASK_TYPE
     score = self.total_score()
     num_symptomatic = self.num_symptomatic()
     num_symptomatic_B = self.num_symptomatic_B()
     num_symptomatic_C = self.num_symptomatic_C()
     num_symptomatic_D = self.num_symptomatic_D()
     ptsd = self.ptsd()
     ANSWER_DICT = {None: None}
     for option in range(1, 6):
         ANSWER_DICT[option] = str(option) + u" – " + \
             WSTRING("pcl_option" + str(option))
     h = u"""
         <div class="summary">
             <table class="summary">
     """
     h += self.get_is_complete_tr()
     h += tr_qa(u"{} (17–85)".format(WSTRING("total_score")),
                score)
     h += tr("Number symptomatic <sup>[1]</sup>: B, C, D (total)",
             answer(num_symptomatic_B)
             + ", "
             + answer(num_symptomatic_C)
             + ", "
             + answer(num_symptomatic_D)
             + " ("
             + answer(num_symptomatic)
             + ")")
     h += tr_qa(WSTRING("pcl_dsm_criteria_met") + " <sup>[2]</sup>",
                get_yes_no(ptsd))
     h += u"""
             </table>
         </div>
         <table class="taskdetail">
             <tr>
                 <th width="70%">Question</th>
                 <th width="30%">Answer</th>
             </tr>
     """
     if tasktype == "S":
         h += tr_qa(WSTRING("pcl_s_event_s"), self.event)
         h += tr_qa(WSTRING("pcl_s_eventdate_s"), self.eventdate)
     for q in range(1, PclCommon.NQUESTIONS + 1):
         if q == 1 or q == 6 or q == 13:
             section = "B" if q == 1 else ("C" if q == 6 else "D")
             h += subheading_spanning_two_columns(
                 "DSM section {}".format(section)
             )
         h += tr_qa(
             WSTRING("pcl_q" + str(q) + "_s"),
             get_from_dict(ANSWER_DICT, getattr(self, "q" + str(q)))
         )
     h += u"""
         </table>
         <div class="footnotes">
             [1] Questions with scores ≥3 are considered symptomatic.
             [2] ≥1 ‘B’ symptoms and ≥3 ‘C’ symptoms and
                 ≥2 ‘D’ symptoms.
         </div>
     """
     return h