Beispiel #1
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
 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
Beispiel #3
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
Beispiel #4
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
Beispiel #5
0
    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("category") + u" <sup>[1,2]</sup>",
                   self.get_description())
        h += tr_qa(WSTRING("icd10manic_psychotic_symptoms")
                   + u" <sup>[2]</sup>",
                   get_present_absent_none(self.psychosis_present()))
        h += u"""
                </table>
            </div>
            <div class="explanation">
        """
        h += WSTRING("icd10_symptomatic_disclaimer")
        h += u"""
            </div>
            <table class="taskdetail">
                <tr>
                    <th width="80%">Question</th>
                    <th width="20%">Answer</th>
                </tr>
        """

        h += self.text_row("icd10manic_core")
        for x in Icd10Manic.CORE_NAMES:
            h += self.row_true_false(x)

        h += self.text_row("icd10manic_hypomania_mania")
        for x in Icd10Manic.HYPOMANIA_MANIA_NAMES:
            h += self.row_true_false(x)

        h += self.text_row("icd10manic_other_mania")
        for x in Icd10Manic.MANIA_NAMES:
            h += self.row_true_false(x)

        h += self.text_row("icd10manic_other_criteria")
        for x in Icd10Manic.OTHER_CRITERIA_NAMES:
            h += self.row_true_false(x)

        h += subheading_spanning_two_columns(WSTRING("icd10manic_psychosis"))
        for x in Icd10Manic.PSYCHOSIS_NAMES:
            h += self.row_true_false(x)

        h += u"""
            </table>
            <div class="footnotes">
                [1] Hypomania:
                    elevated/irritable mood
                    + sustained for ≥4 days
                    + at least 3 of the “other hypomania” symptoms
                    + some interference with functioning.
                Mania:
                    elevated/irritable mood
                    + sustained for ≥7 days or hospital admission required
                    + at least 3 of the “other mania/hypomania” symptoms
                      (4 if mood only irritable)
                    + severe interference with functioning.
                [2] ICD-10 nonpsychotic mania requires mania without
                    hallucinations/delusions.
                ICD-10 psychotic mania requires mania plus
                hallucinations/delusions other than those that are
                “typically schizophrenic”.
                ICD-10 does not clearly categorize mania with only
                schizophreniform psychotic symptoms; however, Schneiderian
                first-rank symptoms can occur in manic psychosis
                (e.g. Conus P et al., 2004, PMID 15337330.).
            </div>
        """ + ICD10_COPYRIGHT_DIV
        return h
Beispiel #6
0
 def get_task_html(self):
     DICTQ1 = {None: None}
     DICTQ3 = {None: None}
     DICTQ4 = {None: None}
     DICTQ5 = {None: None}
     DICTQ11 = {None: None}
     DICTQ12 = {None: None}
     for option in range(1, 5):
         DICTQ1[option] = WSTRING("gmcpq_q1_option" + str(option))
     for option in range(1, 6):
         DICTQ3[option] = WSTRING("gmcpq_q3_option" + str(option))
         DICTQ11[option] = WSTRING("gmcpq_q11_option" + str(option))
     for option in range(0, 6):
         prefix = str(option) + u" – " if option > 0 else ""
         DICTQ4[option] = prefix + WSTRING("gmcpq_q4_option" + str(option))
         DICTQ5[option] = prefix + WSTRING("gmcpq_q5_option" + str(option))
     for option in range(1, 17):
         DICTQ12[option] = WSTRING("gmcpq_ethnicity_option" + str(option))
     h = u"""
         <div class="summary">
             <table class="summary">
                 {}
             </table>
         </div>
         <table class="taskdetail">
             <tr>
                 <th width="60%">Question</th>
                 <th width="40%">Answer</th>
             </tr>
     """.format(self.get_is_complete_tr())
     ell = "&hellip; "  # horizontal ellipsis
     sep_row = subheading_spanning_two_columns("")
     blank_cell = td("", td_class="subheading")
     h += tr_qa(WSTRING("gmcpq_q_doctor"), ws.webify(self.doctor))
     h += sep_row
     h += tr_qa(WSTRING("gmcpq_q1"), get_from_dict(DICTQ1, self.q1))
     h += tr(td(WSTRING("gmcpq_q2")), blank_cell, literal=True)
     h += tr_qa(ell + WSTRING("gmcpq_q2_a"), get_yes_no_none(self.q2a))
     h += tr_qa(ell + WSTRING("gmcpq_q2_b"), get_yes_no_none(self.q2b))
     h += tr_qa(ell + WSTRING("gmcpq_q2_c"), get_yes_no_none(self.q2c))
     h += tr_qa(ell + WSTRING("gmcpq_q2_d"), get_yes_no_none(self.q2d))
     h += tr_qa(ell + WSTRING("gmcpq_q2_e"), get_yes_no_none(self.q2e))
     h += tr_qa(ell + WSTRING("gmcpq_q2_f"), get_yes_no_none(self.q2f))
     h += tr_qa(ell + ell + WSTRING("gmcpq_q2f_s"),
                ws.webify(self.q2f_details))
     h += tr_qa(WSTRING("gmcpq_q3"), get_from_dict(DICTQ3, self.q3))
     h += tr(td(WSTRING("gmcpq_q4")), blank_cell, literal=True)
     h += tr_qa(ell + WSTRING("gmcpq_q4_a"),
                get_from_dict(DICTQ4, self.q4a))
     h += tr_qa(ell + WSTRING("gmcpq_q4_b"),
                get_from_dict(DICTQ4, self.q4b))
     h += tr_qa(ell + WSTRING("gmcpq_q4_c"),
                get_from_dict(DICTQ4, self.q4c))
     h += tr_qa(ell + WSTRING("gmcpq_q4_d"),
                get_from_dict(DICTQ4, self.q4d))
     h += tr_qa(ell + WSTRING("gmcpq_q4_e"),
                get_from_dict(DICTQ4, self.q4e))
     h += tr_qa(ell + WSTRING("gmcpq_q4_f"),
                get_from_dict(DICTQ4, self.q4f))
     h += tr_qa(ell + WSTRING("gmcpq_q4_g"),
                get_from_dict(DICTQ4, self.q4g))
     h += tr(td(WSTRING("gmcpq_q5")), blank_cell, literal=True)
     h += tr_qa(ell + WSTRING("gmcpq_q5_a"),
                get_from_dict(DICTQ5, self.q5a))
     h += tr_qa(ell + WSTRING("gmcpq_q5_b"),
                get_from_dict(DICTQ5, self.q5b))
     h += tr_qa(WSTRING("gmcpq_q6"), get_yes_no_none(self.q6))
     h += tr_qa(WSTRING("gmcpq_q7"), get_yes_no_none(self.q7))
     h += tr_qa(WSTRING("gmcpq_q8"), get_yes_no_none(self.q8))
     h += tr_qa(WSTRING("gmcpq_q9_s"), ws.webify(self.q9))
     h += sep_row
     h += tr_qa(WSTRING("sex"), ws.webify(self.q10))
     h += tr_qa(WSTRING("gmcpq_q11"), get_from_dict(DICTQ11, self.q11))
     h += tr_qa(WSTRING("gmcpq_q12"), get_from_dict(DICTQ12, self.q12))
     h += tr_qa(ell + WSTRING("gmcpq_ethnicity_other_s"),
                ws.webify(self.q12_details))
     h += u"""
         </table>
     """
     return h
Beispiel #7
0
    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("icd10pd_meets_general_criteria"),
                   get_yes_no_none(self.hasPD()))
        h += tr_qa(WSTRING("icd10_paranoid_pd_title"),
                   get_yes_no_none(self.hasParanoidPD()))
        h += tr_qa(WSTRING("icd10_schizoid_pd_title"),
                   get_yes_no_none(self.hasSchizoidPD()))
        h += tr_qa(WSTRING("icd10_dissocial_pd_title"),
                   get_yes_no_none(self.hasDissocialPD()))
        h += tr_qa(WSTRING("icd10_eu_pd_i_title"),
                   get_yes_no_none(self.hasEUPD_I()))
        h += tr_qa(WSTRING("icd10_eu_pd_b_title"),
                   get_yes_no_none(self.hasEUPD_B()))
        h += tr_qa(WSTRING("icd10_histrionic_pd_title"),
                   get_yes_no_none(self.hasHistrionicPD()))
        h += tr_qa(WSTRING("icd10_anankastic_pd_title"),
                   get_yes_no_none(self.hasAnankasticPD()))
        h += tr_qa(WSTRING("icd10_anxious_pd_title"),
                   get_yes_no_none(self.hasAnxiousPD()))
        h += tr_qa(WSTRING("icd10_dependent_pd_title"),
                   get_yes_no_none(self.hasDependentPD()))

        h += u"""
                </table>
            </div>
            <div>
                <p><i>Vignette:</i></p>
                <p>{}</p>
            </div>
            <table class="taskdetail">
                <tr>
                    <th width="80%">Question</th>
                    <th width="20%">Answer</th>
                </tr>
        """.format(
            answer(ws.webify(self.vignette), default_for_blank_strings=True)
        )

        # General
        h += subheading_spanning_two_columns(WSTRING("icd10pd_general"))
        h += self.get_twocol_bool_row_true_false("g1", WSTRING("icd10pd_G1"))
        h += self.pd_b_text("icd10pd_G1b")
        for i in range(1, Icd10SpecPD.N_GENERAL_1 + 1):
            h += self.get_twocol_bool_row_true_false(
                "g1_" + str(i), WSTRING("icd10pd_G1_" + str(i)))
        for i in range(2, Icd10SpecPD.N_GENERAL + 1):
            h += self.get_twocol_bool_row_true_false(
                "g" + str(i), WSTRING("icd10pd_G" + str(i)))

        # Paranoid, etc.
        h += self.standard_pd_html("paranoid", Icd10SpecPD.N_PARANOID)
        h += self.standard_pd_html("schizoid", Icd10SpecPD.N_SCHIZOID)
        h += self.standard_pd_html("dissocial", Icd10SpecPD.N_DISSOCIAL)

        # EUPD is special
        h += self.pd_heading("icd10_eu_pd_title")
        h += self.pd_skiprow("eu")
        h += self.pd_general_criteria_bits()
        h += self.pd_subheading("icd10_eu_pd_i_title")
        h += self.pd_b_text("icd10_eu_pd_i_B")
        for i in range(1, Icd10SpecPD.N_EUPD_I + 1):
            h += self.pd_basic_row("eu", i)
        h += self.pd_subheading("icd10_eu_pd_b_title")
        h += self.pd_b_text("icd10_eu_pd_b_B")
        for i in range(Icd10SpecPD.N_EUPD_I + 1, Icd10SpecPD.N_EU + 1):
            h += self.pd_basic_row("eu", i)

        # Back to plain ones
        h += self.standard_pd_html("histrionic", Icd10SpecPD.N_HISTRIONIC)
        h += self.standard_pd_html("anankastic", Icd10SpecPD.N_ANANKASTIC)
        h += self.standard_pd_html("anxious", Icd10SpecPD.N_ANXIOUS)
        h += self.standard_pd_html("dependent", Icd10SpecPD.N_DEPENDENT)

        # Done
        h += u"""
            </table>
        """ + ICD10_COPYRIGHT_DIV
        return h
 def text_row(self, wstringname):
     return subheading_spanning_two_columns(WSTRING(wstringname))
Beispiel #9
0
    def get_task_html(self):
        vsp = self.score_vsp()
        naming = self.score_naming()
        attention = self.score_attention()
        language = self.score_language()
        abstraction = self.score_abstraction()
        memory = self.score_memory()
        orientation = self.score_orientation()
        totalscore = self.total_score()
        category = self.category()

        h = self.get_standard_clinician_block(True, self.comments) + u"""
            <div class="summary">
                <table class="summary">
        """ + self.get_is_complete_tr()
        h += tr(WSTRING("total_score"), answer(totalscore) + " / 30")
        h += tr_qa(WSTRING("moca_category") + " <sup>[1]</sup>",
                   category)
        h += u"""
                </table>
            </div>
            <table class="taskdetail">
                <tr>
                    <th width="69%">Question</th>
                    <th width="31%">Score</th>
                </tr>
        """

        h += tr(WSTRING("moca_subscore_visuospatial"),
                answer(vsp) + " / 5",
                tr_class="subheading")
        h += tr("Path, cube, clock/contour, clock/numbers, clock/hands",
                ", ".join([answer(x) for x in [self.q1, self.q2, self.q3,
                                               self.q4, self.q5]]))

        h += tr(WSTRING("moca_subscore_naming"),
                answer(naming) + " / 3",
                tr_class="subheading")
        h += tr("Lion, rhino, camel",
                ", ".join([answer(x) for x in [self.q6, self.q7, self.q8]]))

        h += tr(WSTRING("moca_subscore_attention"),
                answer(attention) + " / 6",
                tr_class="subheading")
        h += tr("5 digits forwards, 3 digits backwards, tapping, serial 7s "
                "[<i>scores 3</i>]",
                ", ".join([answer(x) for x in [self.q9, self.q10, self.q11,
                                               self.q12]]))

        h += tr(WSTRING("moca_subscore_language"),
                answer(language) + " / 3",
                tr_class="subheading")
        h += tr(u"Repeat sentence 1, repeat sentence 2, fluency to letter ‘F’",
                ", ".join([answer(x) for x in [self.q13, self.q14, self.q15]]))

        h += tr(WSTRING("moca_subscore_abstraction"),
                answer(abstraction) + " / 2",
                tr_class="subheading")
        h += tr("Means of transportation, measuring instruments",
                ", ".join([answer(x) for x in [self.q16, self.q17]]))

        h += tr(WSTRING("moca_subscore_memory"),
                answer(memory) + " / 5",
                tr_class="subheading")
        h += tr(
            "Registered on first trial [<i>not scored</i>]",
            ", ".join([
                answer(x, formatter_answer=italic)
                for x in [
                    self.register_trial1_1,
                    self.register_trial1_2,
                    self.register_trial1_3,
                    self.register_trial1_4,
                    self.register_trial1_5
                ]
            ])
        )
        h += tr(
            "Registered on second trial [<i>not scored</i>]",
            ", ".join([
                answer(x, formatter_answer=italic)
                for x in [
                    self.register_trial2_1,
                    self.register_trial2_2,
                    self.register_trial2_3,
                    self.register_trial2_4,
                    self.register_trial2_5
                ]
            ])
        )
        h += tr(
            "Recall FACE, VELVET, CHURCH, DAISY, RED with no cue",
            ", ".join([
                answer(x) for x in [
                    self.q18, self.q19, self.q20, self.q21, self.q22
                ]
            ])
        )
        h += tr(
            "Recall with category cue [<i>not scored</i>]",
            ", ".join([
                answer(x, formatter_answer=italic)
                for x in [
                    self.recall_category_cue_1,
                    self.recall_category_cue_2,
                    self.recall_category_cue_3,
                    self.recall_category_cue_4,
                    self.recall_category_cue_5
                ]
            ])
        )
        h += tr(
            "Recall with multiple-choice cue [<i>not scored</i>]",
            ", ".join([
                answer(x, formatter_answer=italic)
                for x in [
                    self.recall_mc_cue_1,
                    self.recall_mc_cue_2,
                    self.recall_mc_cue_3,
                    self.recall_mc_cue_4,
                    self.recall_mc_cue_5
                ]
            ])
        )

        h += tr(WSTRING("moca_subscore_orientation"),
                answer(orientation) + " / 6",
                tr_class="subheading")
        h += tr(
            "Date, month, year, day, place, city",
            ", ".join([
                answer(x) for x in [
                    self.q23, self.q24, self.q25, self.q26, self.q27, self.q28
                ]
            ])
        )

        h += subheading_spanning_two_columns(WSTRING("moca_education_s"))
        h += tr_qa(u"≤12 years’ education?", self.education12y_or_less)
        h += u"""
            </table>
            <table class="taskdetail">
        """
        h += subheading_spanning_two_columns(
            "Images of tests: trail, cube, clock",
            th_not_td=True)
        h += tr(
            td(self.get_blob_png_html(self.trailpicture_blobid),
               td_class="photo", td_width="50%"),
            td(self.get_blob_png_html(self.cubepicture_blobid),
               td_class="photo", td_width="50%"),
            literal=True,
        )
        h += tr(
            td(self.get_blob_png_html(self.trailpicture_blobid),
               td_class="photo", td_width="50%"),
            td("", td_class="subheading"),
            literal=True,
        )
        h += u"""
            </table>
            <div class="footnotes">
                [1] Normal is ≥26 (Nasreddine et al. 2005, PubMed ID 15817019).
            </div>
            <div class="copyright">
                MoCA: Copyright © Ziad Nasreddine.
                May be reproduced without permission for CLINICAL and
                EDUCATIONAL use. You must obtain permission from the copyright
                holder for any other use.
            </div>
        """
        return h
Beispiel #10
0
    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="40%">
                <col width="60%">
        """.format(
            self.get_is_complete_tr(),
        )
        h += tr_qa(WSTRING("cpft_lps_dis_discharge_date"),
                   format_datetime_string(self.discharge_date,
                                          DATEFORMAT.LONG_DATE_WITH_DAY,
                                          default=None), "")
        h += tr_qa(WSTRING("cpft_lps_dis_discharge_reason"),
                   self.get_discharge_reason(), "")
        h += tr_qa(
            WSTRING("cpft_lps_dis_leaflet_or_discharge_card_given"),
            get_yes_no_none(self.leaflet_or_discharge_card_given), "")
        h += tr_qa(WSTRING("cpft_lps_dis_frequent_attender"),
                   get_yes_no_none(self.frequent_attender), "")
        h += tr_qa(
            WSTRING("cpft_lps_dis_patient_wanted_copy_of_letter"),
            self.patient_wanted_copy_of_letter, "")
        h += tr_qa(WSTRING("cpft_lps_dis_gaf_at_first_assessment"),
                   self.gaf_at_first_assessment, "")
        h += tr_qa(WSTRING("cpft_lps_dis_gaf_at_discharge"),
                   self.gaf_at_discharge, "")

        h += subheading_spanning_two_columns(
            WSTRING("cpft_lps_dis_referral_reason_t"))
        h += tr_span_col(answer(", ".join(self.get_referral_reasons())),
                         cols=2)
        h += tr_qa(
            WSTRING("cpft_lps_dis_referral_reason_transplant_organ"),
            self.referral_reason_transplant_organ, "")
        h += tr_qa(
            WSTRING("cpft_lps_dis_referral_reason_other_detail"),
            self.referral_reason_other_detail, "")

        h += subheading_spanning_two_columns(
            WSTRING("cpft_lps_dis_diagnoses_t"))
        h += tr_qa(WSTRING("cpft_lps_dis_psychiatric_t"),
                   "<br>".join(self.get_psychiatric_diagnoses()), "")
        h += tr_qa(WSTRING("cpft_lps_dis_medical_t"),
                   "<br>".join(self.get_medical_diagnoses()), "")

        h += subheading_spanning_two_columns(
            WSTRING("cpft_lps_dis_management_t"))
        h += tr_span_col(answer(", ".join(self.get_managements())), cols=2)
        h += tr_qa(WSTRING("cpft_lps_dis_management_other_detail"),
                   self.management_other_detail, "")

        h += subheading_spanning_two_columns(WSTRING("cpft_lps_dis_outcome_t"))
        h += tr_qa(WSTRING("cpft_lps_dis_outcome_t"),
                   self.outcome, "")
        h += tr_qa(
            WSTRING("cpft_lps_dis_outcome_hospital_transfer_detail"),
            self.outcome_hospital_transfer_detail, "")
        h += tr_qa(WSTRING("cpft_lps_dis_outcome_other_detail"),
                   self.outcome_other_detail, "")

        h += u"""
            </table>
        """
        return h
Beispiel #11
0
 def get_task_html(self):
     SEVERITY_DICT = {
         None: None,
         1: WSTRING("cgisch_i_option1"),
         2: WSTRING("cgisch_i_option2"),
         3: WSTRING("cgisch_i_option3"),
         4: WSTRING("cgisch_i_option4"),
         5: WSTRING("cgisch_i_option5"),
         6: WSTRING("cgisch_i_option6"),
         7: WSTRING("cgisch_i_option7"),
     }
     CHANGE_DICT = {
         None: None,
         1: WSTRING("cgisch_ii_option1"),
         2: WSTRING("cgisch_ii_option2"),
         3: WSTRING("cgisch_ii_option3"),
         4: WSTRING("cgisch_ii_option4"),
         5: WSTRING("cgisch_ii_option5"),
         6: WSTRING("cgisch_ii_option6"),
         7: WSTRING("cgisch_ii_option7"),
         9: WSTRING("cgisch_ii_option9"),
     }
     h = self.get_standard_clinician_block() + u"""
         <div class="summary">
             <table class="summary">
                 {}
             </table>
         </div>
         <table class="taskdetail">
             <tr>
                 <th width="70%">Question</th>
                 <th width="30%">Answer <sup>[1]</sup></th>
             </tr>
     """.format(self.get_is_complete_tr())
     h += subheading_spanning_two_columns(WSTRING("cgisch_i_title"))
     h += tr_span_col(WSTRING("cgisch_i_question"), cols=2)
     h += tr_qa(WSTRING("cgisch_q1"),
                get_from_dict(SEVERITY_DICT, self.severity1))
     h += tr_qa(WSTRING("cgisch_q2"),
                get_from_dict(SEVERITY_DICT, self.severity2))
     h += tr_qa(WSTRING("cgisch_q3"),
                get_from_dict(SEVERITY_DICT, self.severity3))
     h += tr_qa(WSTRING("cgisch_q4"),
                get_from_dict(SEVERITY_DICT, self.severity4))
     h += tr_qa(WSTRING("cgisch_q5"),
                get_from_dict(SEVERITY_DICT, self.severity5))
     h += subheading_spanning_two_columns(WSTRING("cgisch_ii_title"))
     h += tr_span_col(WSTRING("cgisch_ii_question"), cols=2)
     h += tr_qa(WSTRING("cgisch_q1"),
                get_from_dict(CHANGE_DICT, self.change1))
     h += tr_qa(WSTRING("cgisch_q2"),
                get_from_dict(CHANGE_DICT, self.change2))
     h += tr_qa(WSTRING("cgisch_q3"),
                get_from_dict(CHANGE_DICT, self.change3))
     h += tr_qa(WSTRING("cgisch_q4"),
                get_from_dict(CHANGE_DICT, self.change4))
     h += tr_qa(WSTRING("cgisch_q5"),
                get_from_dict(CHANGE_DICT, self.change5))
     h += u"""
         </table>
         <div class="footnotes">
             [1] All questions are scored 1–7, or 9 (not applicable, for
             change questions).
             {postscript}
         </div>
     """.format(
         postscript=WSTRING("cgisch_ii_postscript"),
     )
     return h
Beispiel #12
0
    def get_task_html(self):
        a = self.attn_score()
        m = self.mem_score()
        f = self.fluency_score()
        l = self.lang_score()
        v = self.vsp_score()
        t = a + m + f + l + v
        figurehtml = ""
        if self.is_complete():
            FIGSIZE = (FULLWIDTH_PLOT_WIDTH/3, FULLWIDTH_PLOT_WIDTH/4)
            WIDTH = 0.9
            fig = plt.figure(figsize=FIGSIZE)
            ax = fig.add_subplot(1, 1, 1)
            scores = numpy.array([a, m, f, l, v])
            maxima = numpy.array([18, 26, 14, 26, 16])
            y = 100 * scores/maxima
            x_labels = ["Attn", "Mem", "Flu", "Lang", "VSp"]
            N = len(y)
            xvar = numpy.arange(N)
            ax.bar(xvar, y, WIDTH, color="b")
            ax.set_ylabel("%")
            ax.set_xticks(xvar + WIDTH/2)
            ax.set_xticklabels(x_labels)
            ax.set_xlim(0 - (1 - WIDTH), len(scores))
            plt.tight_layout()  # or the ylabel drops off the figure
            # fig.autofmt_xdate()
            figurehtml = get_html_from_pyplot_figure(fig)
        return (
            self.get_standard_clinician_block(True, self.comments)
            + u"""
                <div class="summary">
                    <table class="summary">
                        <tr>
                            {is_complete}
                            <td class="figure" rowspan="7">{figure}</td>
                        </td>
            """.format(is_complete=self.get_is_complete_td_pair(),
                       figure=figurehtml)
            + tr("Total ACE-III score <sup>[1]</sup>", answer(t) + " / 100")
            + tr("Attention", answer(a) + " / 18 ({}%)".format(100*a/18))
            + tr("Memory", answer(m) + " / 26 ({}%)".format(100*m/26))
            + tr("Fluency", answer(f) + " / 14 ({}%)".format(100*f/14))
            + tr("Language", answer(l) + " / 26 ({}%)".format(100*l/26))
            + tr("Visuospatial", answer(v) + " / 16 ({}%)".format(100*v/16))
            + u"""
                    </table>
                </div>
                <table class="taskdetail">
                    <tr>
                        <th width="75%">Question</th>
                        <th width="25%">Answer/score</td>
                    </tr>
            """
            + tr_qa("Age on leaving full-time education",
                    self.age_at_leaving_full_time_education)
            + tr_qa("Occupation", ws.webify(self.occupation))
            + tr_qa("Handedness", ws.webify(self.handedness))

            + subheading_spanning_two_columns("Attention")
            + tr("Day? Date? Month? Year? Season?",
                 u", ".join([answer(x) for x in [self.attn_time1,
                                                 self.attn_time2,
                                                 self.attn_time3,
                                                 self.attn_time4,
                                                 self.attn_time5]]))
            + tr("House number/floor? Street/hospital? Town? County? Country?",
                 u", ".join([answer(x) for x in [self.attn_place1,
                                                 self.attn_place2,
                                                 self.attn_place3,
                                                 self.attn_place4,
                                                 self.attn_place5]]))
            + tr("Repeat: Lemon? Key? Ball?",
                 u", ".join([answer(x) for x in [self.attn_repeat_word1,
                                                 self.attn_repeat_word2,
                                                 self.attn_repeat_word3]]))
            + tr("Repetition: number of trials <i>(not scored)</i>",
                 answer(self.attn_num_registration_trials,
                        formatter_answer=italic))
            + tr(
                "Serial subtractions: First correct? Second? Third? Fourth? "
                "Fifth?",
                u", ".join([answer(x) for x in [
                    self.attn_serial7_subtraction1,
                    self.attn_serial7_subtraction2,
                    self.attn_serial7_subtraction3,
                    self.attn_serial7_subtraction4,
                    self.attn_serial7_subtraction5]]))

            + subheading_spanning_two_columns("Memory (1)")
            + tr("Recall: Lemon? Key? Ball?",
                 u", ".join([answer(x) for x in [self.mem_recall_word1,
                                                 self.mem_recall_word2,
                                                 self.mem_recall_word3]]))

            + subheading_spanning_two_columns("Fluency")
            + tr(u"Score for words beginning with ‘P’ <i>(≥18 scores 7, 14–17 "
                 u"scores 6, 11–13 scores 5, 8–10 scores 4, 6–7 scores 3, "
                 u"4–5 scores 2, 2–3 scores 1, 0–1 scores 0)</i>",
                 answer(self.fluency_letters_score) + " / 7")
            + tr(u"Score for animals <i>(≥22 scores 7, 17–21 scores 6, "
                 u"14–16 scores 5, 11–13 scores 4, 9–10 scores 3, "
                 u"7–8 scores 2, 5–6 scores 1, &lt;5 scores 0)</i>",
                 answer(self.fluency_animals_score) + " / 7")

            + subheading_spanning_two_columns("Memory (2)")
            + tr(
                "Third trial of address registration: Harry? Barnes? 73? "
                "Orchard? Close? Kingsbridge? Devon?",
                u", ".join([answer(x) for x in [
                    self.mem_repeat_address_trial3_1,
                    self.mem_repeat_address_trial3_2,
                    self.mem_repeat_address_trial3_3,
                    self.mem_repeat_address_trial3_4,
                    self.mem_repeat_address_trial3_5,
                    self.mem_repeat_address_trial3_6,
                    self.mem_repeat_address_trial3_7]]))
            + tr("Current PM? Woman who was PM? USA president? USA president "
                 "assassinated in 1960s?",
                 u", ".join([answer(x) for x in [self.mem_famous1,
                                                 self.mem_famous2,
                                                 self.mem_famous3,
                                                 self.mem_famous4]]))

            + subheading_spanning_two_columns("Language")
            + tr(u"<i>Practice trial (“Pick up the pencil and then the "
                 u"paper”)</i>",
                 answer(self.lang_follow_command_practice,
                        formatter_answer=italic))
            + tr_qa(u"“Place the paper on top of the pencil”",
                    self.lang_follow_command1)
            + tr_qa(u"“Pick up the pencil but not the paper”",
                    self.lang_follow_command2)
            + tr_qa(u"“Pass me the pencil after touching the paper”",
                    self.lang_follow_command3)
            + tr(
                u"Sentence-writing: point for ≥2 complete sentences about "
                u"the one topic? Point for correct grammar and spelling?",
                u", ".join([answer(x) for x in [
                    self.lang_write_sentences_point1,
                    self.lang_write_sentences_point2]]))
            + tr(
                u"Repeat: caterpillar? eccentricity? unintelligible? "
                u"statistician? <i>(score 2 if all correct, 1 if 3 correct, "
                u"0 if ≤2 correct)</i>",
                u"<i>{}, {}, {}, {}</i> (score <b>{}</b> / 2)".format(
                    answer(self.lang_repeat_word1, formatter_answer=italic),
                    answer(self.lang_repeat_word2, formatter_answer=italic),
                    answer(self.lang_repeat_word3, formatter_answer=italic),
                    answer(self.lang_repeat_word4, formatter_answer=italic),
                    self.get_repeat_word_score(),
                ))
            + tr_qa(u"Repeat: “All that glitters is not gold”?",
                    self.lang_repeat_sentence1)
            + tr_qa(u"Repeat: “A stitch in time saves nine”?",
                    self.lang_repeat_sentence2)
            + tr("Name pictures: spoon, book, kangaroo/wallaby",
                 u", ".join([answer(x) for x in [self.lang_name_picture1,
                                                 self.lang_name_picture2,
                                                 self.lang_name_picture3]]))
            + tr("Name pictures: penguin, anchor, camel/dromedary",
                 u", ".join([answer(x) for x in [self.lang_name_picture4,
                                                 self.lang_name_picture5,
                                                 self.lang_name_picture6]]))
            + tr("Name pictures: harp, rhinoceros/rhino, barrel/keg/tub",
                 u", ".join([answer(x) for x in [self.lang_name_picture7,
                                                 self.lang_name_picture8,
                                                 self.lang_name_picture9]]))
            + tr("Name pictures: crown, alligator/crocodile, "
                 "accordion/piano accordion/squeeze box",
                 u", ".join([answer(x) for x in [self.lang_name_picture10,
                                                 self.lang_name_picture11,
                                                 self.lang_name_picture12]]))
            + tr(
                "Identify pictures: monarchy? marsupial? Antarctic? nautical?",
                u", ".join([answer(x) for x in [self.lang_identify_concept1,
                                                self.lang_identify_concept2,
                                                self.lang_identify_concept3,
                                                self.lang_identify_concept4]]))
            + tr_qa("Read all successfully: sew, pint, soot, dough, height",
                    self.lang_read_words_aloud)

            + subheading_spanning_two_columns("Visuospatial")
            + tr("Copy infinity", answer(self.vsp_copy_infinity) + " / 1")
            + tr("Copy cube", answer(self.vsp_copy_cube) + " / 2")
            + tr("Draw clock with numbers and hands at 5:10",
                 answer(self.vsp_draw_clock) + " / 5")
            + tr("Count dots: 8, 10, 7, 9",
                 u", ".join([answer(x) for x in [self.vsp_count_dots1,
                                                 self.vsp_count_dots2,
                                                 self.vsp_count_dots3,
                                                 self.vsp_count_dots4]]))
            + tr("Identify letters: K, M, A, T",
                 u", ".join([answer(x) for x in [self.vsp_identify_letter1,
                                                 self.vsp_identify_letter2,
                                                 self.vsp_identify_letter3,
                                                 self.vsp_identify_letter4]]))

            + subheading_spanning_two_columns("Memory (3)")
            + tr("Recall address: Harry? Barnes? 73? Orchard? Close? "
                 "Kingsbridge? Devon?",
                 u", ".join([answer(x) for x in [self.mem_recall_address1,
                                                 self.mem_recall_address2,
                                                 self.mem_recall_address3,
                                                 self.mem_recall_address4,
                                                 self.mem_recall_address5,
                                                 self.mem_recall_address6,
                                                 self.mem_recall_address7]]))
            + tr("Recognize address: Jerry Barnes/Harry Barnes/Harry "
                 "Bradford?",
                 self.get_recog_text((self.mem_recall_address1 == 1
                                      and self.mem_recall_address2 == 1),
                                     self.mem_recognize_address1))
            + tr("Recognize address: 37/73/76?",
                 self.get_recog_text((self.mem_recall_address3 == 1),
                                     self.mem_recognize_address2))
            + tr(
                "Recognize address: Orchard Place/Oak Close/Orchard "
                "Close?",
                self.get_recog_text(
                    (self.mem_recall_address4 == 1
                     and self.mem_recall_address5 == 1),
                    self.mem_recognize_address3))
            + tr("Recognize address: Oakhampton/Kingsbridge/Dartington?",
                 self.get_recog_text((self.mem_recall_address6 == 1),
                                     self.mem_recognize_address4))
            + tr("Recognize address: Devon/Dorset/Somerset?",
                 self.get_recog_text((self.mem_recall_address7 == 1),
                                     self.mem_recognize_address5))

            + subheading_spanning_two_columns("Photos of test sheet")
            + tr_span_col(self.get_blob_png_html(self.picture1_blobid,
                                                 self.picture1_rotation),
                          td_class="photo")
            + tr_span_col(self.get_blob_png_html(self.picture2_blobid,
                                                 self.picture2_rotation),
                          td_class="photo")
            + u"""
                </table>
                <div class="footnotes">
                    [1] In the ACE-R (the predecessor of the ACE-III),
                    scores ≤82 had sensitivity 0.84 and specificity 1.0 for
                    dementia, and scores ≤88 had sensitivity 0.94 and
                    specificity 0.89 for dementia, in a context of patients
                    with AlzD, FTD, LBD, MCI, and controls
                    (Mioshi et al., 2006, PMID 16977673).
                </div>
                <div class="copyright">
                    ACE-III: Copyright © 2012, John Hodges.
                    “The ACE-III is available for free. The copyright is held
                    by Professor John Hodges who is happy for the test to be
                    used in clinical practice and research projects. There is
                    no need to contact us if you wish to use the ACE-III in
                    clinical practice.”
                    (ACE-III FAQ, 7 July 2013, www.neura.edu.au).
                </div>
            """
        )
Beispiel #13
0
 def get_task_html(self):
     score = self.total_score()
     category = self.category()
     h = self.get_standard_clinician_block(True, self.comments) + u"""
         <div class="summary">
             <table class="summary">
     """ + self.get_is_complete_tr()
     h += tr(WSTRING("total_score"), answer(score) + " / 30")
     h += tr_qa(WSTRING("category") + " <sup>[1]</sup>", category)
     h += u"""
             </table>
         </div>
         <table class="taskdetail">
             <tr>
                 <th width="80%">Question</th>
                 <th width="20%">Score</th>
             </tr>
     """
     h += tr_qa(WSTRING("slums_alert_s"), get_yes_no_none(self.alert))
     h += tr_qa(WSTRING("slums_highschool_s"),
                get_yes_no_none(self.highschooleducation))
     h += tr_qa(WSTRING("slums_q1_s"), self.q1)
     h += tr_qa(WSTRING("slums_q2_s"), self.q2)
     h += tr_qa(WSTRING("slums_q3_s"), self.q3)
     h += tr(u"Q5 <sup>[2]</sup> (money spent, money left "
             u"[<i>scores 2</i>]",
             u", ".join([answer(x) for x in [self.q5a, self.q5b]]))
     h += tr_qa(u"Q6 (animal fluency) [<i>≥15 scores 3, 10–14 scores 2, "
                u"5–9 scores 1, 0–4 scores 0</i>]",
                self.q6)
     h += tr(u"Q7 (recall: apple, pen, tie, house, car)",
             u", ".join([answer(x) for x in [self.q7a, self.q7b, self.q7c,
                                             self.q7d, self.q7e]]))
     h += tr(u"Q8 (backwards: 648, 8537)",
             u", ".join([answer(x) for x in [self.q8b, self.q8c]]))
     h += tr(u"Q9 (clock: hour markers, time [<i>score 2 each</i>]",
             u", ".join([answer(x) for x in [self.q9a, self.q9b]]))
     h += tr(u"Q10 (X in triangle; which is biggest?)",
             u", ".join([answer(x) for x in [self.q10a, self.q10b]]))
     h += tr(u"Q11 (story: Female’s name? Job? When back to work? "
             u"State she lived in? [<i>score 2 each</i>])",
             u", ".join([answer(x) for x in [self.q11a, self.q11b,
                                             self.q11c, self.q11d]]))
     h += u"""
         </table>
         <table class="taskdetail">
     """
     h += subheading_spanning_two_columns("Images of tests: clock, shapes")
     h += tr(
         td(self.get_blob_png_html(self.clockpicture_blobid),
            td_width="50%", td_class="photo"),
         td(self.get_blob_png_html(self.shapespicture_blobid),
            td_width="50%", td_class="photo"),
         literal=True
     )
     h += u"""
         </table>
         <div class="footnotes">
             [1] With high school education:
             ≥27 normal, ≥21 MCI, ≤20 dementia.
             Without high school education:
             ≥25 normal, ≥20 MCI, ≤19 dementia.
             (Tariq et al. 2006, PubMed ID 17068312.)
             [2] Q4 (learning the five words) isn’t scored.
         </div>
     """
     return h