simulated_patient / annotation_questions.py
Varvara-Gumirova's picture
Update annotation_questions.py
7f9e35b verified
raw
history blame
20.6 kB
# annotation_questions.py
from dataclasses import dataclass, field
from typing import List, Optional, Dict
# ========== Dataclass shared with app.py ==========
@dataclass
class Field:
type: str
title: str
name: str = None
mandatory: bool = True
following_mandatory_values: list = False
skip_mandatory: bool = False
help: Optional[str] = None
children: Optional[List['Field']] = None
other_params: Optional[Dict[str, object]] = field(default_factory=lambda: {})
# ========== Constants one can edit ==========
COLS_TO_SAVE = ['dialogue_id','dialogue_name','generatedPatient']
agreement_labels = ['strongly disagree', 'disagree', 'neither agree no disagree', 'agree', 'strongly agree']
mentioned_y_n = ['yes, explicitly', 'yes, implicitly', 'no', 'not sure', 'other']
degree_labels = ['not at all', 'slightly', 'moderately', 'very much', 'extremely']
quality_labels = ['very poor', 'poor', 'acceptable', 'good', 'very good']
priority_labels = ['not a priority', 'low priority', 'neutral', 'moderate priority', 'high priority']
yes_no_labels = ['no','yes', 'other']
yes_no_other_labels = ['no','yes','other']
default_labels = agreement_labels
consent_text = '''
## Consent Form
You will be asked to take part in a research study. Before you decide to take part in this study, it is important that you understand why the study is being done and what it involves. Please read the following information carefully.
________________________________________________________________________________________
Project title: [...]\\
Researchers: [...]\\
Institute: Institute for Machine Speech Processing (IMS)\\
University: University of Stuttgart\\
Contact: eva-maria.vecchi@ims.uni-stuttgart.de
_________________________________________________________________________________________
### Description of the research study
In this study, we investigate [...]
The intended use of the results of this study includes [...]
**Time required:** Your participation will take up to an estimated [...] hours. The time required may vary on an individual basis.
**Risks and benefits:** The risks to your participation in this online survey are those associated with basic computer tasks, including boredom, fatigue, mild stress, or breach of confidentiality. Some of the topics discussed in the online posts to be annotated may include violence, suicide or rape. The only benefit to you is the learning experience from participating in a research study. The benefit to society is the contribution to scientific knowledge
**Compensation:** You will be compensated for participating in this study. If you are interested, we will also be more than happy to share more information about our research with you.
**Voluntary participation:** Your participation in this study is voluntary. It is your decision whether or not to participate in this study. If you decide to participate in this study, you will be asked to confirm this consent form ("I agree."). Even after signing the consent form, you can withdraw from participation at any time and without giving any reason. Partial data will not be analysed.
**Confidentiality:** Your responses to this experiment will be anonymous. Please do not share any
Information that can be used to identify you. The researcher(s) will make every effort to maintain your confidentiality.
**Contact:** If at any time you have questions about this study or would like to report any adverse effects due to this study, please contact the researcher(s).
**Trigger Warning:** [...]
### Consent:
Please indicate, in the box below, that you are at least 18 years old, have read and understood this consent form, are comfortable using the English and German languages to complete the survey, and you agree to participate in this online research survey.
- *I am age 18 or older.*
- *I have read this consent form or had it read to me.*
- *I am comfortable using the English language to participate in this survey.*
- *I agree to participate in this research and I want to continue with the survey.*
'''
fields0: List[Field] = [
Field(type="markdown", title="", mandatory=False, other_params={
"instruction_content": True,
"content": "### 1. Annotation of Therapy Session\n ##### Instructions: Please read the transcript of the therapy session carefully, then answer the questions below.\n ###### *link to guidelines*\n \n \n"
},),
Field(name="patient", type="input_col", title=" "),
Field(type="markdown", title="", mandatory=False, other_params={"use_dialogue_name": True}),
####--- EDIT MARKER: Session-specific properties
Field(type="markdown", title="", mandatory=False, other_params={
"instruction_content": True,
"content": "### Overview of Patient in Therapy Session"
},),
Field(type="container", title="##### Presentation of Patient's Psychological State", children=[
Field(name="symptom", type="y_n_radio",
title="Does the patient explicitly mention **symptoms** related to their psychological state?", other_params={'labels': yes_no_other_labels}, mandatory=True),
Field(name="symptom_desc", type="text", title="If so, which symptoms?", mandatory=False),
Field(name="stressor", type="y_n_radio",
title="Does the patient talk about specific things that are adding psychological pressure or making their mental state worse?",
other_params={'labels': yes_no_other_labels}, mandatory=True),
Field(name="stressor_desc", type="text", title="If so, list stressors:", mandatory=False),
Field(name="trigger", type="y_n_radio",
title="Does the patient describe a particular event or circumstance (e.g., an argument, job loss, injury, crisis) that led them to come to this appointment?",
other_params={'labels': yes_no_other_labels}, mandatory=True),
Field(name="trigger_desc", type="text", title="If so, describe:", mandatory=False),
]),
Field(type="container", title="##### Conversational Style", children=[
Field(name="conciseness", type="likert_radio",
title="Are the patient's responses concise? To what degree?", other_params={"labels": degree_labels}, mandatory=True),
# Field(name="symptom_desc1", type="text", title="If so, which symptoms?", mandatory=False),
Field(name="colloquial", type="likert_radio",
title="Does the patient use the colloquial speach? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="detailedness", type="likert_radio",
title="Does the patient describe specific details to help the therapist understand the situation better? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="self-awareness", type="likert_radio",
title="Does the patient show low self-awareness and expresses thoughts in an disorganized way? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
]),
Field(type="container", title="##### Behavioral & Pragmatic Properties", children=[
Field(name="openness", type="likert_radio",
title="Does the patient appear willing to engage in the therapeutic process and work on their concerns? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="sarcasm", type="likert_radio",
title="Does the patient use sarcasm in their responses to the therapist? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="agression", type="likert_radio",
title="Does the patient express verbal aggression (e.g., hostile tone, blaming, threatening language)? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="controlling", type="likert_radio",
title="Does the patient attempt to control the direction, pace, or content of the session (e.g., interrupting, redirecting, dismissing the therapist’s input)? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="defiant", type="likert_radio",
title="Does the patient openly resist, challenge, or reject the therapist’s suggestions, interpretations, or authority? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="aviodant", type="likert_radio",
title="Does the patient avoid discussing certain topics, emotions, or questions? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="hesitant", type="likert_radio",
title="Does the patient show any signs of mistrust and hesitation with the idea of seeking help? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="self-awareness", type="likert_radio",
title="Is the patient more focused on seeking out solutions rather than just sharing thoughts and feelings? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="humor", type="likert_radio",
title="Does the patient use humor, jokes, or lighthearted comments (not sarcasm) to communicate or cope? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="empathetic", type="likert_radio",
title="Does the patient show understanding, concern, or emotional attunement—either toward the therapist or others mentioned in the session? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="distracted", type="likert_radio",
title="Does the patient seem mentally disengaged, lose track of the conversation, or struggle to stay focused? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="responsive", type="likert_radio",
title="Does the patient directly address the therapist’s questions, comments, or interventions in a relevant way? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="engaged", type="likert_radio",
title="Does the patient appear actively engaged when the therapist is speaking? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="defensive", type="likert_radio",
title="Does the patient react protectively or justify themselves when faced with feedback, interpretations, or questions about their behavior? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="self-critical", type="likert_radio",
title="Does the patient make negative or harsh judgments about themselves (e.g., “I’m worthless,” “It’s all my fault”)? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="blaming", type="likert_radio",
title="Does the patient attribute their problems or emotions to other people or external circumstances? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="insightful", type="likert_radio",
title="Does the patient demonstrate awareness of their own patterns, motivations, or emotions? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
Field(name="expressive", type="likert_radio",
title="Does the patient openly convey emotions? To what degree?",
other_params={"labels": degree_labels}, mandatory=True),
]),
####--- END EDIT MARKER
]
fields1: List[Field] = [
Field(name="patient", type="input_col", title=" "),
Field(type="markdown", title="", mandatory=False, other_params={"use_roledesc_name": True}),
Field(type="expander", title="**Session Transcription:** *(expand)*", children=[
Field(name="dialogue_name", type="input_col", title=""),
]),
Field(type="markdown", title="", mandatory=False, other_params={
"instruction_content": True,
"content": "### Overview of Patient in Therapy Session"
},),
####--- EDIT MARKER: True-To-Patient Properties
# Field(type="container", title="##### Overlap with role description", children=[
# Field(name="emotion", type="likert_radio",
# title="To what extent did the simulated patient’s emotional expressions (e.g., frustration, sadness, guardedness) align with those expected for this role?",
# other_params={"labels": degree_labels}, mandatory=True),
# Field(name="conversationalStyle", type="likert_radio",
# title="How well did the patient consistently exhibit the conversational style they were assigned, and did this feel realistic compared to actual patients with this style?",
# other_params={"labels": degree_labels}, mandatory=True),
# Field(name="maladaptive", type="likert_radio",
# title="How accurately did the patient’s statements reflect distorted thoughts consistent with the underlying cognitive model?",
# other_params={"labels": degree_labels}, mandatory=True),
# Field(name="fidelity", type="likert_radio",
# title="Overall, how closely did the patient reflect real patients in terms of realism, variability, and challenge during the session?",
# other_params={"labels": degree_labels}, mandatory=True),
# ]),
# FIDELITY:
Field(type="container", title="##### Resemblance to real patients/Realism of patient portrayal", children=[
Field(name="resemblence", type="y_n_radio",
title="The simulated patient (SP) resembled a real patient", other_params={"labels": degree_labels}, mandatory=True),
Field(name="reaction", type="y_n_radio",
title="The SP reacted naturally during the consultation", other_params={"labels": degree_labels}, mandatory=True),
Field(name="authenticity", type="y_n_radio",
title="SP appears authentic", other_params={"labels": degree_labels}, mandatory=True),
Field(name="questions", type="y_n_radio",
title="SP answers questions in a natural manner", other_params={"labels": degree_labels}, mandatory=True),
Field(name="physical_complaints", type="y_n_radio",
title="SP simulates physical complaints realistically", other_params={"labels": degree_labels}, mandatory=True),
Field(name="emotional_complaints", type="y_n_radio",
title="The SP simulates psychological/emotional complaints realistically", other_params={"labels": degree_labels}, mandatory=True),
]),
# ACCURACY
Field(type="container", title="##### Overlap with role description", children=[
Field(name="played_well", type="y_n_radio",
title="The SP played the role well", other_params={"labels": degree_labels}, mandatory=True),
Field(name="knew_well", type="y_n_radio",
title="The SP knew his or her role well", other_params={"labels": degree_labels}, mandatory=True), # Kinda the same as ‘The SP played the role well’. Remove?
Field(name="withhold", type="y_n_radio",
title="The SP seemed to withhold information unnecessarily", other_params={"labels": degree_labels}, mandatory=True),
Field(name="stayed_in_role_well", type="y_n_radio",
title="The SP stayed in role very well during consultation ", other_params={"labels": degree_labels}, mandatory=True), # Kinda the same as ‘The SP played the role well’.
Field(name="stayed_in_role_always", type="y_n_radio",
title="SP stays in his/her role all the time", other_params={"labels": degree_labels}, mandatory=True),
]),
####--- END EDIT MARKER
####--- EDIT MARKER: Interpersonal therapeutic competence
# Field(type="container", title="#### Interpersonal therapeutic competence", children=[
# Field(name="v_expressiveness", type="likert_radio",
# title="**Verbal expressiveness.** How fluent, clear, and confident is the person’s verbal communication (regardless of content)?",
# other_params={'labels': ['Very unclear','Unclear','Average','Clear','Very Clear']},
# mandatory=True, following_mandatory_values=[1]),
# Field(name="hope", type="likert_radio",
# title="**Hope and positive expectation.** To what extent does the person convey optimism, confidence, and positive expectations for the patient’s future or therapy?",
# other_params={'labels': ['Hopeless','Discouraging','Neutral','Hopeful','Very hopeful']},
# mandatory=True, following_mandatory_values=[1]),
# Field(name="credible", type="likert_radio",
# title="**Ability to be credible and convincing.** How credible and convincing is the person when presenting a new perspective or interpretation to the patient?",
# other_params={'labels': ['Unconvincing','Weak','Neutral','Convincing','Very convincing']},
# mandatory=True, following_mandatory_values=[1]),
# Field(name="e_expressiveness", type="likert_radio",
# title="**Emotional expressiveness.** How well does the person’s voice and manner convey emotional engagement and intensity (without being hostile)?",
# other_params={'labels': ['Flat','Low','Moderate','Expressive','Very expressive']},
# mandatory=True, following_mandatory_values=[1]),
# Field(name="acceptance", type="likert_radio",
# title="**Acceptance, understanding, and warmth.** To what extent does the person show care, acceptance, and warmth toward the patient (without judgment)?",
# other_params={'labels': ['Cold','Limited','Neutral','Warm','Very warm']},
# mandatory=True, following_mandatory_values=[1]),
# Field(name="empathy", type="likert_radio",
# title="**Empathy.** How well does the person demonstrate an accurate, deeper understanding of the patient’s subjective experience?",
# other_params={'labels': ['Distorted','Superficial','Partial','Accurate','Deep']},
# mandatory=True, following_mandatory_values=[1]),
# Field(name="alliance", type="likert_radio",
# title="**Ability to form alliances.** How effectively does the person create a collaborative “working together” atmosphere with the patient?",
# other_params={'labels': ['Blocking','Weak','Moderate','Cooperative','Strong']},
# mandatory=True, following_mandatory_values=[1]),
# Field(name="tensions", type="likert_radio",
# title="**Addressing tensions and crises.** How effectively does the person acknowledge and work through interpersonal tensions or crises in the interaction?",
# other_params={'labels': ['Avoiding','Poor','Partial','Productive','Resolving']},
# mandatory=True, following_mandatory_values=[1]),
# ]),
####--- END EDIT MARKER
Field(type="container", title="##### Additional Comments *(optional)*", children=[
Field(name="other_comments", type="text", title="Please provide any additional details or information:", mandatory=False),
]),
]
STEPS: List[List[Field]] = [fields0, fields1]
INPUT_FIELD_DEFAULT_VALUES = {
'slider': 0,
'text': '',
'textarea': '',
'checkbox': False,
'radio': None,
'select_slider': 0,
'multiselect': [],
'likert_radio': None,
'y_n_radio': None
}
SHOW_HELP_ICON = False
SHOW_VALIDATION_ERROR_MESSAGE = True
# Optional convenience functions, if you really want to "call" them:
def get_steps() -> List[List[Field]]:
"""Return the list of pages to show."""
return STEPS
def get_input_defaults() -> dict:
return INPUT_FIELD_DEFAULT_VALUES