psytools 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -16
- package/SOURCES.md +53 -0
- package/dist/cjs/assessment.d.ts +3 -2
- package/dist/cjs/assessment.js +13 -3
- package/dist/cjs/evaluation.d.ts +5 -3
- package/dist/cjs/evaluation.js +49 -8
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/inventories/aq10.d.ts +12 -0
- package/dist/cjs/inventories/aq10.js +181 -0
- package/dist/cjs/inventories/asrs6.d.ts +11 -0
- package/dist/cjs/inventories/asrs6.js +128 -0
- package/dist/cjs/inventories/index.d.ts +5 -2
- package/dist/cjs/inventories/index.js +10 -1
- package/dist/cjs/inventories/who5.d.ts +11 -0
- package/dist/cjs/inventories/who5.js +150 -0
- package/dist/cjs/types.d.ts +24 -2
- package/dist/esm/assessment.d.ts +3 -2
- package/dist/esm/assessment.js +13 -3
- package/dist/esm/evaluation.d.ts +5 -3
- package/dist/esm/evaluation.js +49 -8
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/inventories/aq10.d.ts +12 -0
- package/dist/esm/inventories/aq10.js +178 -0
- package/dist/esm/inventories/asrs6.d.ts +11 -0
- package/dist/esm/inventories/asrs6.js +125 -0
- package/dist/esm/inventories/index.d.ts +5 -2
- package/dist/esm/inventories/index.js +7 -1
- package/dist/esm/inventories/who5.d.ts +11 -0
- package/dist/esm/inventories/who5.js +147 -0
- package/dist/esm/types.d.ts +24 -2
- package/package.json +10 -3
- package/schema/assessment-definition.schema.json +27 -1
- package/src/assessment.ts +14 -3
- package/src/evaluation.ts +55 -9
- package/src/index.ts +5 -0
- package/src/inventories/aq10.ts +181 -0
- package/src/inventories/asrs6.ts +128 -0
- package/src/inventories/index.ts +8 -2
- package/src/inventories/who5.ts +150 -0
- package/src/types.ts +26 -2
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.asrs6 = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* ASRS v1.1 — Adult ADHD Self-Report Scale, 6-item screener (Part A).
|
|
6
|
+
*
|
|
7
|
+
* Developed by the WHO and the Workgroup on Adult ADHD (Harvard Medical
|
|
8
|
+
* School / NYU). Items 1–3 count as screen-positive from "Sometimes" and
|
|
9
|
+
* items 4–6 from "Often"; four or more positive items indicate symptoms
|
|
10
|
+
* highly consistent with adult ADHD and warrant further investigation
|
|
11
|
+
* (Kessler et al., 2005). Free to distribute and score.
|
|
12
|
+
*/
|
|
13
|
+
exports.asrs6 = {
|
|
14
|
+
id: "asrs6",
|
|
15
|
+
version: "1.0.0",
|
|
16
|
+
title: {
|
|
17
|
+
en: "Adult ADHD Self-Report Scale (ASRS-v1.1) Screener",
|
|
18
|
+
tr: "Erişkin DEHB Kendi Bildirim Ölçeği (ASRS-v1.1) Tarama Formu",
|
|
19
|
+
de: "Selbstbeurteilungsskala für ADHS bei Erwachsenen (ASRS-v1.1) Screener",
|
|
20
|
+
},
|
|
21
|
+
description: {
|
|
22
|
+
en: "A 6-item screener for adult attention-deficit/hyperactivity disorder, drawn from the WHO's full 18-item ASRS.",
|
|
23
|
+
tr: "DSÖ'nün 18 maddelik tam ASRS ölçeğinden türetilmiş, erişkin dikkat eksikliği/hiperaktivite bozukluğu için 6 maddelik bir tarama aracı.",
|
|
24
|
+
de: "Ein 6-Item-Screener für Aufmerksamkeitsdefizit-/Hyperaktivitätsstörung bei Erwachsenen, abgeleitet aus der vollständigen 18-Item-ASRS der WHO.",
|
|
25
|
+
},
|
|
26
|
+
instructions: {
|
|
27
|
+
en: "As you answer each question, select the option that best describes how you have felt and conducted yourself over the past 6 months.",
|
|
28
|
+
tr: "Her soruyu yanıtlarken, son 6 ay içinde kendinizi nasıl hissettiğinizi ve nasıl davrandığınızı en iyi tanımlayan seçeneği işaretleyin.",
|
|
29
|
+
de: "Wählen Sie bei jeder Frage die Option, die am besten beschreibt, wie Sie sich in den letzten 6 Monaten gefühlt und verhalten haben.",
|
|
30
|
+
},
|
|
31
|
+
defaultLocale: "en",
|
|
32
|
+
options: [
|
|
33
|
+
{ value: 0, label: { en: "Never", tr: "Hiçbir zaman", de: "Nie" } },
|
|
34
|
+
{ value: 1, label: { en: "Rarely", tr: "Nadiren", de: "Selten" } },
|
|
35
|
+
{ value: 2, label: { en: "Sometimes", tr: "Bazen", de: "Manchmal" } },
|
|
36
|
+
{ value: 3, label: { en: "Often", tr: "Sık sık", de: "Oft" } },
|
|
37
|
+
{ value: 4, label: { en: "Very often", tr: "Çok sık", de: "Sehr oft" } },
|
|
38
|
+
],
|
|
39
|
+
questions: [
|
|
40
|
+
{
|
|
41
|
+
id: "asrs6-1",
|
|
42
|
+
text: {
|
|
43
|
+
en: "How often do you have trouble wrapping up the final details of a project, once the challenging parts have been done?",
|
|
44
|
+
tr: "Bir işin zor kısımlarını tamamladıktan sonra, son ayrıntıları toparlayıp işi bitirmekte ne sıklıkla güçlük yaşarsınız?",
|
|
45
|
+
de: "Wie oft haben Sie Schwierigkeiten, die letzten Details eines Projekts abzuschließen, nachdem die schwierigen Teile erledigt sind?",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "asrs6-2",
|
|
50
|
+
text: {
|
|
51
|
+
en: "How often do you have difficulty getting things in order when you have to do a task that requires organization?",
|
|
52
|
+
tr: "Organizasyon gerektiren bir iş yapmanız gerektiğinde, işleri sıraya koymakta ne sıklıkla güçlük çekersiniz?",
|
|
53
|
+
de: "Wie oft haben Sie Schwierigkeiten, Ordnung in Dinge zu bringen, wenn Sie eine Aufgabe erledigen müssen, die Organisation erfordert?",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: "asrs6-3",
|
|
58
|
+
text: {
|
|
59
|
+
en: "How often do you have problems remembering appointments or obligations?",
|
|
60
|
+
tr: "Randevularınızı ya da yükümlülüklerinizi hatırlamakta ne sıklıkla güçlük çekersiniz?",
|
|
61
|
+
de: "Wie oft haben Sie Probleme, sich an Termine oder Verpflichtungen zu erinnern?",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "asrs6-4",
|
|
66
|
+
text: {
|
|
67
|
+
en: "When you have a task that requires a lot of thought, how often do you avoid or delay getting started?",
|
|
68
|
+
tr: "Çok fazla düşünmeyi gerektiren bir işiniz olduğunda, başlamayı ne sıklıkla erteler ya da başlamaktan kaçınırsınız?",
|
|
69
|
+
de: "Wie oft vermeiden oder verzögern Sie den Beginn einer Aufgabe, die viel Nachdenken erfordert?",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "asrs6-5",
|
|
74
|
+
text: {
|
|
75
|
+
en: "How often do you fidget or squirm with your hands or feet when you have to sit down for a long time?",
|
|
76
|
+
tr: "Uzun süre oturmanız gerektiğinde, ne sıklıkla ellerinizi ya da ayaklarınızı kıpırdatır veya yerinizde kımıldanırsınız?",
|
|
77
|
+
de: "Wie oft zappeln Sie mit Händen oder Füßen, wenn Sie längere Zeit sitzen müssen?",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "asrs6-6",
|
|
82
|
+
text: {
|
|
83
|
+
en: "How often do you feel overly active and compelled to do things, like you were driven by a motor?",
|
|
84
|
+
tr: "Ne sıklıkla, sanki bir motor tarafından sürülüyormuşçasına kendinizi aşırı hareketli ve bir şeyler yapmaya zorlanmış hissedersiniz?",
|
|
85
|
+
de: "Wie oft fühlen Sie sich übermäßig aktiv und getrieben, Dinge zu tun, als würden Sie von einem Motor angetrieben?",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
scoring: {
|
|
90
|
+
kind: "count",
|
|
91
|
+
items: [
|
|
92
|
+
{ questionId: "asrs6-1", minValue: 2 },
|
|
93
|
+
{ questionId: "asrs6-2", minValue: 2 },
|
|
94
|
+
{ questionId: "asrs6-3", minValue: 2 },
|
|
95
|
+
{ questionId: "asrs6-4", minValue: 3 },
|
|
96
|
+
{ questionId: "asrs6-5", minValue: 3 },
|
|
97
|
+
{ questionId: "asrs6-6", minValue: 3 },
|
|
98
|
+
],
|
|
99
|
+
bands: [
|
|
100
|
+
{
|
|
101
|
+
id: "negative",
|
|
102
|
+
min: 0,
|
|
103
|
+
max: 3,
|
|
104
|
+
label: {
|
|
105
|
+
en: "Symptoms not consistent with adult ADHD",
|
|
106
|
+
tr: "Belirtiler erişkin DEHB ile uyumlu değil",
|
|
107
|
+
de: "Symptome nicht mit ADHS im Erwachsenenalter vereinbar",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: "positive",
|
|
112
|
+
min: 4,
|
|
113
|
+
max: 6,
|
|
114
|
+
label: {
|
|
115
|
+
en: "Symptoms highly consistent with adult ADHD — further investigation warranted",
|
|
116
|
+
tr: "Belirtiler erişkin DEHB ile yüksek düzeyde uyumlu — ileri değerlendirme gerekir",
|
|
117
|
+
de: "Symptome in hohem Maße mit ADHS im Erwachsenenalter vereinbar — weitere Abklärung angezeigt",
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
meta: {
|
|
123
|
+
reference: "Kessler, R. C., Adler, L., Ames, M., Demler, O., Faraone, S., Hiripi, E., et al. (2005). The World Health Organization Adult ADHD Self-Report Scale (ASRS): a short screening scale for use in the general population. Psychological Medicine, 35(2), 245-256.",
|
|
124
|
+
license: "Free to distribute and score (WHO / Workgroup on Adult ADHD)",
|
|
125
|
+
timeframe: "past 6 months",
|
|
126
|
+
note: "The score counts screen-positive items, not symptom severity.",
|
|
127
|
+
},
|
|
128
|
+
};
|
|
@@ -3,11 +3,14 @@ import { Assessment } from "../assessment.ts";
|
|
|
3
3
|
import { phq9 } from "./phq9.ts";
|
|
4
4
|
import { gad7 } from "./gad7.ts";
|
|
5
5
|
import { dass21 } from "./dass21.ts";
|
|
6
|
-
|
|
6
|
+
import { who5 } from "./who5.ts";
|
|
7
|
+
import { asrs6 } from "./asrs6.ts";
|
|
8
|
+
import { aq10 } from "./aq10.ts";
|
|
9
|
+
export { phq9, gad7, dass21, who5, asrs6, aq10 };
|
|
7
10
|
export { twoWeekFrequencyOptions, twoWeekInstructions } from "./common.ts";
|
|
8
11
|
/** All predefined inventory definitions shipped with psytools, by id. */
|
|
9
12
|
export declare const inventories: Readonly<Record<string, AssessmentDefinition>>;
|
|
10
|
-
export type InventoryId = "phq9" | "gad7" | "dass21";
|
|
13
|
+
export type InventoryId = "phq9" | "gad7" | "dass21" | "who5" | "asrs6" | "aq10";
|
|
11
14
|
/**
|
|
12
15
|
* Instantiates a predefined inventory as an `Assessment`.
|
|
13
16
|
* @throws PsytoolsError `unknown_inventory`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.inventories = exports.twoWeekInstructions = exports.twoWeekFrequencyOptions = exports.dass21 = exports.gad7 = exports.phq9 = void 0;
|
|
3
|
+
exports.inventories = exports.twoWeekInstructions = exports.twoWeekFrequencyOptions = exports.aq10 = exports.asrs6 = exports.who5 = exports.dass21 = exports.gad7 = exports.phq9 = void 0;
|
|
4
4
|
exports.loadInventory = loadInventory;
|
|
5
5
|
const assessment_ts_1 = require("../assessment.js");
|
|
6
6
|
const errors_ts_1 = require("../errors.js");
|
|
@@ -10,6 +10,12 @@ const gad7_ts_1 = require("./gad7.js");
|
|
|
10
10
|
Object.defineProperty(exports, "gad7", { enumerable: true, get: function () { return gad7_ts_1.gad7; } });
|
|
11
11
|
const dass21_ts_1 = require("./dass21.js");
|
|
12
12
|
Object.defineProperty(exports, "dass21", { enumerable: true, get: function () { return dass21_ts_1.dass21; } });
|
|
13
|
+
const who5_ts_1 = require("./who5.js");
|
|
14
|
+
Object.defineProperty(exports, "who5", { enumerable: true, get: function () { return who5_ts_1.who5; } });
|
|
15
|
+
const asrs6_ts_1 = require("./asrs6.js");
|
|
16
|
+
Object.defineProperty(exports, "asrs6", { enumerable: true, get: function () { return asrs6_ts_1.asrs6; } });
|
|
17
|
+
const aq10_ts_1 = require("./aq10.js");
|
|
18
|
+
Object.defineProperty(exports, "aq10", { enumerable: true, get: function () { return aq10_ts_1.aq10; } });
|
|
13
19
|
var common_ts_1 = require("./common.js");
|
|
14
20
|
Object.defineProperty(exports, "twoWeekFrequencyOptions", { enumerable: true, get: function () { return common_ts_1.twoWeekFrequencyOptions; } });
|
|
15
21
|
Object.defineProperty(exports, "twoWeekInstructions", { enumerable: true, get: function () { return common_ts_1.twoWeekInstructions; } });
|
|
@@ -18,6 +24,9 @@ exports.inventories = {
|
|
|
18
24
|
phq9: phq9_ts_1.phq9,
|
|
19
25
|
gad7: gad7_ts_1.gad7,
|
|
20
26
|
dass21: dass21_ts_1.dass21,
|
|
27
|
+
who5: who5_ts_1.who5,
|
|
28
|
+
asrs6: asrs6_ts_1.asrs6,
|
|
29
|
+
aq10: aq10_ts_1.aq10,
|
|
21
30
|
};
|
|
22
31
|
/**
|
|
23
32
|
* Instantiates a predefined inventory as an `Assessment`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AssessmentDefinition } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* WHO-5 — World Health Organization Well-Being Index.
|
|
4
|
+
*
|
|
5
|
+
* 5 positively worded items, 0–5 frequency scale over the past two weeks.
|
|
6
|
+
* The raw sum (0–25) is multiplied by 4 and reported as a 0–100 percentage;
|
|
7
|
+
* higher scores mean better well-being. A score of 50 or below indicates
|
|
8
|
+
* reduced well-being and warrants screening for depression; 28 or below
|
|
9
|
+
* indicates likely depression (Topp et al., 2015). Free to use.
|
|
10
|
+
*/
|
|
11
|
+
export declare const who5: AssessmentDefinition;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.who5 = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* WHO-5 — World Health Organization Well-Being Index.
|
|
6
|
+
*
|
|
7
|
+
* 5 positively worded items, 0–5 frequency scale over the past two weeks.
|
|
8
|
+
* The raw sum (0–25) is multiplied by 4 and reported as a 0–100 percentage;
|
|
9
|
+
* higher scores mean better well-being. A score of 50 or below indicates
|
|
10
|
+
* reduced well-being and warrants screening for depression; 28 or below
|
|
11
|
+
* indicates likely depression (Topp et al., 2015). Free to use.
|
|
12
|
+
*/
|
|
13
|
+
exports.who5 = {
|
|
14
|
+
id: "who5",
|
|
15
|
+
version: "1.0.0",
|
|
16
|
+
title: {
|
|
17
|
+
en: "WHO-5 Well-Being Index",
|
|
18
|
+
tr: "WHO-5 İyilik Hali İndeksi",
|
|
19
|
+
de: "WHO-5-Index zum Wohlbefinden",
|
|
20
|
+
},
|
|
21
|
+
description: {
|
|
22
|
+
en: "A 5-item self-report scale measuring subjective psychological well-being over the past two weeks. Higher scores mean better well-being.",
|
|
23
|
+
tr: "Son iki hafta içindeki öznel psikolojik iyilik halini ölçen 5 maddelik bir öz bildirim ölçeği. Yüksek puan daha iyi bir iyilik haline işaret eder.",
|
|
24
|
+
de: "Eine Selbstbeurteilungsskala mit 5 Items zur Messung des subjektiven psychischen Wohlbefindens in den letzten zwei Wochen. Höhere Werte bedeuten besseres Wohlbefinden.",
|
|
25
|
+
},
|
|
26
|
+
instructions: {
|
|
27
|
+
en: "Please indicate for each of the five statements which is closest to how you have been feeling over the last two weeks.",
|
|
28
|
+
tr: "Lütfen aşağıdaki beş ifadenin her biri için, son iki hafta içinde kendinizi nasıl hissettiğinize en yakın olan seçeneği işaretleyin.",
|
|
29
|
+
de: "Bitte geben Sie für jede der fünf Aussagen an, welche Antwort Ihrem Befinden in den letzten zwei Wochen am nächsten kommt.",
|
|
30
|
+
},
|
|
31
|
+
defaultLocale: "en",
|
|
32
|
+
options: [
|
|
33
|
+
{
|
|
34
|
+
value: 0,
|
|
35
|
+
label: { en: "At no time", tr: "Hiçbir zaman", de: "Zu keinem Zeitpunkt" },
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
value: 1,
|
|
39
|
+
label: { en: "Some of the time", tr: "Bazen", de: "Ab und zu" },
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
value: 2,
|
|
43
|
+
label: {
|
|
44
|
+
en: "Less than half of the time",
|
|
45
|
+
tr: "Zamanın yarısından az",
|
|
46
|
+
de: "Etwas weniger als die Hälfte der Zeit",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
value: 3,
|
|
51
|
+
label: {
|
|
52
|
+
en: "More than half of the time",
|
|
53
|
+
tr: "Zamanın yarısından çok",
|
|
54
|
+
de: "Etwas mehr als die Hälfte der Zeit",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
value: 4,
|
|
59
|
+
label: { en: "Most of the time", tr: "Çoğu zaman", de: "Meistens" },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
value: 5,
|
|
63
|
+
label: { en: "All of the time", tr: "Her zaman", de: "Die ganze Zeit" },
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
questions: [
|
|
67
|
+
{
|
|
68
|
+
id: "who5-1",
|
|
69
|
+
text: {
|
|
70
|
+
en: "I have felt cheerful and in good spirits",
|
|
71
|
+
tr: "Kendimi neşeli ve keyifli hissettim",
|
|
72
|
+
de: "Ich war froh und guter Laune",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "who5-2",
|
|
77
|
+
text: {
|
|
78
|
+
en: "I have felt calm and relaxed",
|
|
79
|
+
tr: "Kendimi sakin ve rahatlamış hissettim",
|
|
80
|
+
de: "Ich habe mich ruhig und entspannt gefühlt",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "who5-3",
|
|
85
|
+
text: {
|
|
86
|
+
en: "I have felt active and vigorous",
|
|
87
|
+
tr: "Kendimi aktif ve dinç hissettim",
|
|
88
|
+
de: "Ich habe mich energisch und aktiv gefühlt",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "who5-4",
|
|
93
|
+
text: {
|
|
94
|
+
en: "I woke up feeling fresh and rested",
|
|
95
|
+
tr: "Uyandığımda kendimi dinlenmiş ve zinde hissettim",
|
|
96
|
+
de: "Ich habe mich beim Aufwachen frisch und ausgeruht gefühlt",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "who5-5",
|
|
101
|
+
text: {
|
|
102
|
+
en: "My daily life has been filled with things that interest me",
|
|
103
|
+
tr: "Günlük yaşamım ilgimi çeken şeylerle doluydu",
|
|
104
|
+
de: "Mein Alltag war voller Dinge, die mich interessieren",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
scoring: {
|
|
109
|
+
kind: "sum",
|
|
110
|
+
multiplier: 4,
|
|
111
|
+
bands: [
|
|
112
|
+
{
|
|
113
|
+
id: "low",
|
|
114
|
+
min: 0,
|
|
115
|
+
max: 28,
|
|
116
|
+
label: {
|
|
117
|
+
en: "Low well-being — indicates likely depression, assessment recommended",
|
|
118
|
+
tr: "Düşük iyilik hali — olası depresyona işaret eder, değerlendirme önerilir",
|
|
119
|
+
de: "Niedriges Wohlbefinden — Hinweis auf wahrscheinliche Depression, Abklärung empfohlen",
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "reduced",
|
|
124
|
+
min: 29,
|
|
125
|
+
max: 50,
|
|
126
|
+
label: {
|
|
127
|
+
en: "Reduced well-being — screening for depression recommended",
|
|
128
|
+
tr: "Azalmış iyilik hali — depresyon taraması önerilir",
|
|
129
|
+
de: "Vermindertes Wohlbefinden — Depressionsscreening empfohlen",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: "good",
|
|
134
|
+
min: 51,
|
|
135
|
+
max: 100,
|
|
136
|
+
label: {
|
|
137
|
+
en: "Good well-being",
|
|
138
|
+
tr: "İyi düzeyde iyilik hali",
|
|
139
|
+
de: "Gutes Wohlbefinden",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
meta: {
|
|
145
|
+
reference: "Topp, C. W., Østergaard, S. D., Søndergaard, S., & Bech, P. (2015). The WHO-5 Well-Being Index: a systematic review of the literature. Psychotherapy and Psychosomatics, 84(3), 167-176.",
|
|
146
|
+
license: "Free to use (WHO Regional Office for Europe / Psychiatric Research Unit, Hillerød)",
|
|
147
|
+
timeframe: "past 2 weeks",
|
|
148
|
+
note: "Positively worded: higher scores mean better well-being.",
|
|
149
|
+
},
|
|
150
|
+
};
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -60,7 +60,9 @@ export interface ScoreFlag {
|
|
|
60
60
|
/** Sums all answers into a single total score (PHQ-9, GAD-7, ...). */
|
|
61
61
|
export interface SumScoring {
|
|
62
62
|
kind: "sum";
|
|
63
|
-
/**
|
|
63
|
+
/** Multiplier applied to the raw sum (WHO-5 reports raw x 4 as 0-100). */
|
|
64
|
+
multiplier?: number;
|
|
65
|
+
/** Severity bands the (multiplied) total is matched against. */
|
|
64
66
|
bands?: ScoreBand[];
|
|
65
67
|
flags?: ScoreFlag[];
|
|
66
68
|
}
|
|
@@ -81,8 +83,28 @@ export interface SubscaleScoring {
|
|
|
81
83
|
subscales: SubscaleDefinition[];
|
|
82
84
|
flags?: ScoreFlag[];
|
|
83
85
|
}
|
|
86
|
+
/** One item of a `count` scoring: when it counts as screen-positive. */
|
|
87
|
+
export interface CountScoringItem {
|
|
88
|
+
questionId: string;
|
|
89
|
+
/**
|
|
90
|
+
* The item counts as positive when its answer value is >= this.
|
|
91
|
+
* `reverseScored` questions are inverted against their scale first.
|
|
92
|
+
*/
|
|
93
|
+
minValue: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Counts how many items cross their per-item threshold (ASRS v1.1,
|
|
97
|
+
* AQ-10, ...). The score is the number of positive items.
|
|
98
|
+
*/
|
|
99
|
+
export interface CountScoring {
|
|
100
|
+
kind: "count";
|
|
101
|
+
items: CountScoringItem[];
|
|
102
|
+
/** Bands the positive-item count is matched against. */
|
|
103
|
+
bands?: ScoreBand[];
|
|
104
|
+
flags?: ScoreFlag[];
|
|
105
|
+
}
|
|
84
106
|
/** Declarative, serializable scoring rules built into psytools. */
|
|
85
|
-
export type ScoringDefinition = SumScoring | SubscaleScoring;
|
|
107
|
+
export type ScoringDefinition = SumScoring | SubscaleScoring | CountScoring;
|
|
86
108
|
/**
|
|
87
109
|
* The complete, serializable description of an assessment.
|
|
88
110
|
*
|
package/dist/esm/assessment.d.ts
CHANGED
|
@@ -38,9 +38,10 @@ export declare class Assessment {
|
|
|
38
38
|
*
|
|
39
39
|
* When given an `AssessmentResponse`, its status must be `complete` or
|
|
40
40
|
* `submitted` — pass `allowIncomplete` to score partial responses anyway.
|
|
41
|
-
* Raw answer maps
|
|
41
|
+
* Raw answer maps skip the completeness check, but their values are
|
|
42
|
+
* still validated against the option scales.
|
|
42
43
|
*
|
|
43
|
-
* @throws PsytoolsError `incomplete_response` | `no_scoring`
|
|
44
|
+
* @throws PsytoolsError `incomplete_response` | `unknown_question` | `invalid_value` | `no_scoring`
|
|
44
45
|
*/
|
|
45
46
|
evaluate(response: AssessmentResponse | Record<string, number>, evaluator?: Evaluator, options?: {
|
|
46
47
|
allowIncomplete?: boolean;
|
package/dist/esm/assessment.js
CHANGED
|
@@ -73,7 +73,16 @@ export function validateDefinition(input) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
if (scoring.kind === "count" && Array.isArray(scoring.items)) {
|
|
77
|
+
for (const item of scoring.items) {
|
|
78
|
+
if (!seen.has(item.questionId)) {
|
|
79
|
+
issues.push({ code: "unknown_question", message: `count scoring references unknown question "${item.questionId}"`, questionId: item.questionId });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const flags = scoring.kind === "sum" || scoring.kind === "subscales" || scoring.kind === "count"
|
|
84
|
+
? scoring.flags ?? []
|
|
85
|
+
: [];
|
|
77
86
|
for (const flag of flags) {
|
|
78
87
|
if (!seen.has(flag.questionId)) {
|
|
79
88
|
issues.push({ code: "unknown_question", message: `flag "${flag.id}" references unknown question "${flag.questionId}"`, questionId: flag.questionId });
|
|
@@ -182,9 +191,10 @@ export class Assessment {
|
|
|
182
191
|
*
|
|
183
192
|
* When given an `AssessmentResponse`, its status must be `complete` or
|
|
184
193
|
* `submitted` — pass `allowIncomplete` to score partial responses anyway.
|
|
185
|
-
* Raw answer maps
|
|
194
|
+
* Raw answer maps skip the completeness check, but their values are
|
|
195
|
+
* still validated against the option scales.
|
|
186
196
|
*
|
|
187
|
-
* @throws PsytoolsError `incomplete_response` | `no_scoring`
|
|
197
|
+
* @throws PsytoolsError `incomplete_response` | `unknown_question` | `invalid_value` | `no_scoring`
|
|
188
198
|
*/
|
|
189
199
|
evaluate(response, evaluator, options) {
|
|
190
200
|
if (response instanceof AssessmentResponse) {
|
package/dist/esm/evaluation.d.ts
CHANGED
|
@@ -2,9 +2,11 @@ import type { AnswerMap, AssessmentDefinition, EvaluationResult, Evaluator } fro
|
|
|
2
2
|
/**
|
|
3
3
|
* Evaluates answers against an assessment definition.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Every answer is first validated against the assessment: the question must
|
|
6
|
+
* exist and the value must belong to its option scale. Then `evaluator` is
|
|
7
|
+
* used when given; otherwise the definition's declarative `scoring`
|
|
8
|
+
* (`sum` or `subscales`) applies.
|
|
7
9
|
*
|
|
8
|
-
* @throws PsytoolsError `
|
|
10
|
+
* @throws PsytoolsError `unknown_question` | `invalid_value` | `no_scoring`
|
|
9
11
|
*/
|
|
10
12
|
export declare function evaluate(definition: AssessmentDefinition, answers: AnswerMap, evaluator?: Evaluator): EvaluationResult;
|
package/dist/esm/evaluation.js
CHANGED
|
@@ -2,12 +2,15 @@ import { PsytoolsError } from "./errors.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Evaluates answers against an assessment definition.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Every answer is first validated against the assessment: the question must
|
|
6
|
+
* exist and the value must belong to its option scale. Then `evaluator` is
|
|
7
|
+
* used when given; otherwise the definition's declarative `scoring`
|
|
8
|
+
* (`sum` or `subscales`) applies.
|
|
7
9
|
*
|
|
8
|
-
* @throws PsytoolsError `
|
|
10
|
+
* @throws PsytoolsError `unknown_question` | `invalid_value` | `no_scoring`
|
|
9
11
|
*/
|
|
10
12
|
export function evaluate(definition, answers, evaluator) {
|
|
13
|
+
assertValidAnswers(definition, answers);
|
|
11
14
|
if (evaluator)
|
|
12
15
|
return evaluator(definition, answers);
|
|
13
16
|
const scoring = definition.scoring;
|
|
@@ -16,7 +19,30 @@ export function evaluate(definition, answers, evaluator) {
|
|
|
16
19
|
}
|
|
17
20
|
switch (scoring.kind) {
|
|
18
21
|
case "sum":
|
|
19
|
-
return evaluateSum(definition, answers, scoring
|
|
22
|
+
return evaluateSum(definition, answers, scoring);
|
|
23
|
+
case "count": {
|
|
24
|
+
let score = 0;
|
|
25
|
+
for (const item of scoring.items) {
|
|
26
|
+
const question = requireQuestion(definition, item.questionId);
|
|
27
|
+
const answered = answers[question.id];
|
|
28
|
+
if (answered === undefined)
|
|
29
|
+
continue;
|
|
30
|
+
const values = (question.options ?? definition.options).map((o) => o.value);
|
|
31
|
+
const effective = question.reverseScored
|
|
32
|
+
? Math.max(...values) + Math.min(...values) - answered
|
|
33
|
+
: answered;
|
|
34
|
+
if (effective >= item.minValue)
|
|
35
|
+
score += 1;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
kind: "scale",
|
|
39
|
+
score,
|
|
40
|
+
min: 0,
|
|
41
|
+
max: scoring.items.length,
|
|
42
|
+
...bandOf(score, scoring.bands),
|
|
43
|
+
flags: triggeredFlags(answers, scoring.flags),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
20
46
|
case "subscales": {
|
|
21
47
|
const scales = scoring.subscales.map((subscale) => {
|
|
22
48
|
const questions = subscale.questionIds.map((id) => requireQuestion(definition, id));
|
|
@@ -41,15 +67,30 @@ export function evaluate(definition, answers, evaluator) {
|
|
|
41
67
|
throw new PsytoolsError("no_scoring", `Unsupported scoring kind "${scoring.kind}"`);
|
|
42
68
|
}
|
|
43
69
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
70
|
+
function assertValidAnswers(definition, answers) {
|
|
71
|
+
const questions = new Map(definition.questions.map((q) => [q.id, q]));
|
|
72
|
+
for (const [questionId, value] of Object.entries(answers)) {
|
|
73
|
+
const question = questions.get(questionId);
|
|
74
|
+
if (!question) {
|
|
75
|
+
throw new PsytoolsError("unknown_question", `Answers reference unknown question "${questionId}" in assessment "${definition.id}"`);
|
|
76
|
+
}
|
|
77
|
+
const options = question.options ?? definition.options;
|
|
78
|
+
if (!options.some((option) => option.value === value)) {
|
|
79
|
+
const allowed = options.map((option) => option.value).join(", ");
|
|
80
|
+
throw new PsytoolsError("invalid_value", `Value ${value} is not a valid option for question "${questionId}" (allowed: ${allowed})`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function evaluateSum(definition, answers, scoring) {
|
|
85
|
+
const multiplier = scoring.multiplier ?? 1;
|
|
86
|
+
const { score, min, max } = sumQuestions(definition, definition.questions, answers, multiplier);
|
|
46
87
|
return {
|
|
47
88
|
kind: "scale",
|
|
48
89
|
score,
|
|
49
90
|
min,
|
|
50
91
|
max,
|
|
51
|
-
...bandOf(score, bands),
|
|
52
|
-
flags: triggeredFlags(answers, flags),
|
|
92
|
+
...bandOf(score, scoring.bands),
|
|
93
|
+
flags: triggeredFlags(answers, scoring.flags),
|
|
53
94
|
};
|
|
54
95
|
}
|
|
55
96
|
function sumQuestions(definition, questions, answers, multiplier) {
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type { LocalizedText, AssessmentOption, AssessmentQuestion, AssessmentDefinition, ScoreBand, ScoreFlag, SumScoring, SubscaleDefinition, SubscaleScoring, ScoringDefinition, AnswerMap, ResponseStatus, ResponseData, ValidationIssue, ValidationResult, BandResult, TriggeredFlag, ScaleScore, ScaleResult, MultiScaleResult, CategoricalResult, CustomResult, EvaluationResult, Evaluator, LocalizedAssessmentView, } from "./types.ts";
|
|
1
|
+
export type { LocalizedText, AssessmentOption, AssessmentQuestion, AssessmentDefinition, ScoreBand, ScoreFlag, SumScoring, SubscaleDefinition, SubscaleScoring, CountScoringItem, CountScoring, ScoringDefinition, AnswerMap, ResponseStatus, ResponseData, ValidationIssue, ValidationResult, BandResult, TriggeredFlag, ScaleScore, ScaleResult, MultiScaleResult, CategoricalResult, CustomResult, EvaluationResult, Evaluator, LocalizedAssessmentView, } from "./types.ts";
|
|
2
2
|
export { PsytoolsError } from "./errors.ts";
|
|
3
3
|
export { localize, collectLocales } from "./i18n.ts";
|
|
4
4
|
export { Assessment, validateDefinition } from "./assessment.ts";
|
|
5
5
|
export { AssessmentResponse } from "./response.ts";
|
|
6
6
|
export { evaluate } from "./evaluation.ts";
|
|
7
|
-
export { phq9, gad7, dass21, inventories, loadInventory, twoWeekFrequencyOptions, twoWeekInstructions, } from "./inventories/index.ts";
|
|
7
|
+
export { phq9, gad7, dass21, who5, asrs6, aq10, inventories, loadInventory, twoWeekFrequencyOptions, twoWeekInstructions, } from "./inventories/index.ts";
|
|
8
8
|
export type { InventoryId } from "./inventories/index.ts";
|
package/dist/esm/index.js
CHANGED
|
@@ -3,4 +3,4 @@ export { localize, collectLocales } from "./i18n.js";
|
|
|
3
3
|
export { Assessment, validateDefinition } from "./assessment.js";
|
|
4
4
|
export { AssessmentResponse } from "./response.js";
|
|
5
5
|
export { evaluate } from "./evaluation.js";
|
|
6
|
-
export { phq9, gad7, dass21, inventories, loadInventory, twoWeekFrequencyOptions, twoWeekInstructions, } from "./inventories/index.js";
|
|
6
|
+
export { phq9, gad7, dass21, who5, asrs6, aq10, inventories, loadInventory, twoWeekFrequencyOptions, twoWeekInstructions, } from "./inventories/index.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AssessmentDefinition } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* AQ-10 — Autism Spectrum Quotient, 10-item version (adults).
|
|
4
|
+
*
|
|
5
|
+
* Recommended by NICE (UK) for quick screening of autistic traits in
|
|
6
|
+
* adults. Each item is answered on a 4-point agree/disagree scale but
|
|
7
|
+
* scores binary: one point per item answered in the trait direction
|
|
8
|
+
* ("agree" on items 1, 7, 8, 10; "disagree" on the rest, modeled here as
|
|
9
|
+
* `reverseScored`). A total of 6 or more suggests referral for a
|
|
10
|
+
* specialist autism assessment (Allison et al., 2012). Free to use.
|
|
11
|
+
*/
|
|
12
|
+
export declare const aq10: AssessmentDefinition;
|