Skip to main content

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​

Storybook

PHQ9 Item9 Positive​

Storybook

Unanswered​

Storybook

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​

VariantWhat it is
GAD-7Bands 0-4, 5-9, 10-14, 15-21.
PHQ-9Bands 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​

PropTypeDefaultDescription
instrument *ScoreInstrument—'GAD-7' | 'PHQ-9'. Required
questions *string[]—The items, in order (string[]). Required
answersScoreAnswer[][]Initial answers, 0 to 3 per item, null for unanswered (uncontrolled)
valueScoreAnswer[]undefined (uncontrolled)Controlled answers
onChange(answers: ScoreAnswer[]) => voidnoneCalled with all answers after one changes
titlestring""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>
KindNameDescription
attributeinstrument'GAD-7' | 'PHQ-9'. Required
property / JSON attributequestionsThe items, in order (string[]). Required
property / JSON attributeanswersInitial answers, 0 to 3 per item, null for unanswered (uncontrolled); default []
property / JSON attributevalueControlled answers; default undefined (uncontrolled)
attributetitleTitle after the instrument name ("Generalized anxiety"); default ""
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
eventco-changeCalled with all answers after one changes; default none (React: onChange)