ScoreQuestionnaire
ComplexOrders and notes
<co-score-questionnaire>ScoreQuestionnaire runs GAD-7 or PHQ-9 with a live total and severity band, and flags a positive PHQ-9 item 9.
import { ScoreQuestionnaire } from 'health-components';
Examples
GAD7 In Progress
PHQ9 Item9 Positive
Unanswered
Usage
<ScoreQuestionnaire instrument="PHQ-9" questions={PHQ9_ITEMS} answers={saved} />
When to use
- Behavioral health screening at intake or in the portal.
When not to use
- Unscored forms: a normal form.
Variants and states
| Variant | What it is |
|---|---|
| GAD-7 | Bands 0-4, 5-9, 10-14, 15-21. |
| PHQ-9 | Bands to 27; item 9 alert. |
Accessibility
- Each item is a radiogroup; score is aria-live.
Do and don't
- Do: Say a score is a screen.
- Don't: Hide item 9 results from the provider.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
instrument * | ScoreInstrument | — | 'GAD-7' | 'PHQ-9'. Required |
questions * | string[] | — | The items, in order (string[]). Required |
answers | ScoreAnswer[] | [] | Initial answers, 0 to 3 per item, null for unanswered (uncontrolled) |
value | ScoreAnswer[] | undefined (uncontrolled) | Controlled answers |
onChange | (answers: ScoreAnswer[]) => void | none | Called with all answers after one changes |
title | string | "" | Title after the instrument name ("Generalized anxiety") |
Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-score-questionnaire>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.
Angular template
<co-score-questionnaire instrument="…" title="…" [questions]="questions" (co-change)="onChange($event.detail)"></co-score-questionnaire>
| Kind | Name | Description |
|---|---|---|
| attribute | instrument | 'GAD-7' | 'PHQ-9'. Required |
| property / JSON attribute | questions | The items, in order (string[]). Required |
| property / JSON attribute | answers | Initial answers, 0 to 3 per item, null for unanswered (uncontrolled); default [] |
| property / JSON attribute | value | Controlled answers; default undefined (uncontrolled) |
| attribute | title | Title after the instrument name ("Generalized anxiety"); default "" |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-change | Called with all answers after one changes; default none (React: onChange) |