psytools 0.3.0

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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +189 -0
  3. package/dist/cjs/assessment.d.ts +58 -0
  4. package/dist/cjs/assessment.js +233 -0
  5. package/dist/cjs/errors.d.ts +5 -0
  6. package/dist/cjs/errors.js +13 -0
  7. package/dist/cjs/evaluation.d.ts +10 -0
  8. package/dist/cjs/evaluation.js +102 -0
  9. package/dist/cjs/i18n.d.ts +10 -0
  10. package/dist/cjs/i18n.js +35 -0
  11. package/dist/cjs/index.d.ts +8 -0
  12. package/dist/cjs/index.js +23 -0
  13. package/dist/cjs/inventories/common.d.ts +8 -0
  14. package/dist/cjs/inventories/common.js +47 -0
  15. package/dist/cjs/inventories/dass21.d.ts +11 -0
  16. package/dist/cjs/inventories/dass21.js +288 -0
  17. package/dist/cjs/inventories/gad7.d.ts +10 -0
  18. package/dist/cjs/inventories/gad7.js +121 -0
  19. package/dist/cjs/inventories/index.d.ts +15 -0
  20. package/dist/cjs/inventories/index.js +33 -0
  21. package/dist/cjs/inventories/phq9.d.ts +11 -0
  22. package/dist/cjs/inventories/phq9.js +156 -0
  23. package/dist/cjs/package.json +3 -0
  24. package/dist/cjs/response.d.ts +77 -0
  25. package/dist/cjs/response.js +231 -0
  26. package/dist/cjs/types.d.ts +219 -0
  27. package/dist/cjs/types.js +10 -0
  28. package/dist/esm/assessment.d.ts +58 -0
  29. package/dist/esm/assessment.js +228 -0
  30. package/dist/esm/errors.d.ts +5 -0
  31. package/dist/esm/errors.js +9 -0
  32. package/dist/esm/evaluation.d.ts +10 -0
  33. package/dist/esm/evaluation.js +99 -0
  34. package/dist/esm/i18n.d.ts +10 -0
  35. package/dist/esm/i18n.js +31 -0
  36. package/dist/esm/index.d.ts +8 -0
  37. package/dist/esm/index.js +6 -0
  38. package/dist/esm/inventories/common.d.ts +8 -0
  39. package/dist/esm/inventories/common.js +44 -0
  40. package/dist/esm/inventories/dass21.d.ts +11 -0
  41. package/dist/esm/inventories/dass21.js +285 -0
  42. package/dist/esm/inventories/gad7.d.ts +10 -0
  43. package/dist/esm/inventories/gad7.js +118 -0
  44. package/dist/esm/inventories/index.d.ts +15 -0
  45. package/dist/esm/inventories/index.js +25 -0
  46. package/dist/esm/inventories/phq9.d.ts +11 -0
  47. package/dist/esm/inventories/phq9.js +153 -0
  48. package/dist/esm/response.d.ts +77 -0
  49. package/dist/esm/response.js +227 -0
  50. package/dist/esm/types.d.ts +219 -0
  51. package/dist/esm/types.js +9 -0
  52. package/package.json +64 -0
  53. package/schema/assessment-definition.schema.json +129 -0
  54. package/src/assessment.ts +266 -0
  55. package/src/errors.ts +10 -0
  56. package/src/evaluation.ts +140 -0
  57. package/src/i18n.ts +40 -0
  58. package/src/index.ts +43 -0
  59. package/src/inventories/common.ts +47 -0
  60. package/src/inventories/dass21.ts +291 -0
  61. package/src/inventories/gad7.ts +121 -0
  62. package/src/inventories/index.ts +31 -0
  63. package/src/inventories/phq9.ts +156 -0
  64. package/src/response.ts +263 -0
  65. package/src/types.ts +250 -0
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.localize = localize;
4
+ exports.collectLocales = collectLocales;
5
+ /**
6
+ * Resolves a `LocalizedText` to a string for the given locale.
7
+ *
8
+ * Resolution order: exact locale -> base language of the locale
9
+ * (`"de-AT"` -> `"de"`) -> `fallbackLocale` -> first available entry.
10
+ */
11
+ function localize(text, locale, fallbackLocale) {
12
+ const exact = text[locale];
13
+ if (exact !== undefined)
14
+ return exact;
15
+ const base = locale.split("-")[0];
16
+ if (base !== undefined && base !== locale && text[base] !== undefined) {
17
+ return text[base];
18
+ }
19
+ if (fallbackLocale !== undefined && text[fallbackLocale] !== undefined) {
20
+ return text[fallbackLocale];
21
+ }
22
+ const first = Object.values(text)[0];
23
+ return first ?? "";
24
+ }
25
+ /** Collects the union of locales present in a set of localized texts. */
26
+ function collectLocales(texts) {
27
+ const locales = new Set();
28
+ for (const text of texts) {
29
+ if (!text)
30
+ continue;
31
+ for (const locale of Object.keys(text))
32
+ locales.add(locale);
33
+ }
34
+ return [...locales].sort();
35
+ }
@@ -0,0 +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";
2
+ export { PsytoolsError } from "./errors.ts";
3
+ export { localize, collectLocales } from "./i18n.ts";
4
+ export { Assessment, validateDefinition } from "./assessment.ts";
5
+ export { AssessmentResponse } from "./response.ts";
6
+ export { evaluate } from "./evaluation.ts";
7
+ export { phq9, gad7, dass21, inventories, loadInventory, twoWeekFrequencyOptions, twoWeekInstructions, } from "./inventories/index.ts";
8
+ export type { InventoryId } from "./inventories/index.ts";
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.twoWeekInstructions = exports.twoWeekFrequencyOptions = exports.loadInventory = exports.inventories = exports.dass21 = exports.gad7 = exports.phq9 = exports.evaluate = exports.AssessmentResponse = exports.validateDefinition = exports.Assessment = exports.collectLocales = exports.localize = exports.PsytoolsError = void 0;
4
+ var errors_ts_1 = require("./errors.js");
5
+ Object.defineProperty(exports, "PsytoolsError", { enumerable: true, get: function () { return errors_ts_1.PsytoolsError; } });
6
+ var i18n_ts_1 = require("./i18n.js");
7
+ Object.defineProperty(exports, "localize", { enumerable: true, get: function () { return i18n_ts_1.localize; } });
8
+ Object.defineProperty(exports, "collectLocales", { enumerable: true, get: function () { return i18n_ts_1.collectLocales; } });
9
+ var assessment_ts_1 = require("./assessment.js");
10
+ Object.defineProperty(exports, "Assessment", { enumerable: true, get: function () { return assessment_ts_1.Assessment; } });
11
+ Object.defineProperty(exports, "validateDefinition", { enumerable: true, get: function () { return assessment_ts_1.validateDefinition; } });
12
+ var response_ts_1 = require("./response.js");
13
+ Object.defineProperty(exports, "AssessmentResponse", { enumerable: true, get: function () { return response_ts_1.AssessmentResponse; } });
14
+ var evaluation_ts_1 = require("./evaluation.js");
15
+ Object.defineProperty(exports, "evaluate", { enumerable: true, get: function () { return evaluation_ts_1.evaluate; } });
16
+ var index_ts_1 = require("./inventories/index.js");
17
+ Object.defineProperty(exports, "phq9", { enumerable: true, get: function () { return index_ts_1.phq9; } });
18
+ Object.defineProperty(exports, "gad7", { enumerable: true, get: function () { return index_ts_1.gad7; } });
19
+ Object.defineProperty(exports, "dass21", { enumerable: true, get: function () { return index_ts_1.dass21; } });
20
+ Object.defineProperty(exports, "inventories", { enumerable: true, get: function () { return index_ts_1.inventories; } });
21
+ Object.defineProperty(exports, "loadInventory", { enumerable: true, get: function () { return index_ts_1.loadInventory; } });
22
+ Object.defineProperty(exports, "twoWeekFrequencyOptions", { enumerable: true, get: function () { return index_ts_1.twoWeekFrequencyOptions; } });
23
+ Object.defineProperty(exports, "twoWeekInstructions", { enumerable: true, get: function () { return index_ts_1.twoWeekInstructions; } });
@@ -0,0 +1,8 @@
1
+ import type { AssessmentOption, LocalizedText } from "../types.ts";
2
+ /**
3
+ * The 0–3 frequency scale ("over the last 2 weeks") shared by PHQ-9 and
4
+ * GAD-7.
5
+ */
6
+ export declare const twoWeekFrequencyOptions: AssessmentOption[];
7
+ /** Instructions shared by PHQ-9 and GAD-7. */
8
+ export declare const twoWeekInstructions: LocalizedText;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.twoWeekInstructions = exports.twoWeekFrequencyOptions = void 0;
4
+ /**
5
+ * The 0–3 frequency scale ("over the last 2 weeks") shared by PHQ-9 and
6
+ * GAD-7.
7
+ */
8
+ exports.twoWeekFrequencyOptions = [
9
+ {
10
+ value: 0,
11
+ label: {
12
+ en: "Not at all",
13
+ tr: "Hiç",
14
+ de: "Überhaupt nicht",
15
+ },
16
+ },
17
+ {
18
+ value: 1,
19
+ label: {
20
+ en: "Several days",
21
+ tr: "Birkaç gün",
22
+ de: "An einzelnen Tagen",
23
+ },
24
+ },
25
+ {
26
+ value: 2,
27
+ label: {
28
+ en: "More than half the days",
29
+ tr: "Günlerin yarısından fazlasında",
30
+ de: "An mehr als der Hälfte der Tage",
31
+ },
32
+ },
33
+ {
34
+ value: 3,
35
+ label: {
36
+ en: "Nearly every day",
37
+ tr: "Hemen hemen her gün",
38
+ de: "Beinahe jeden Tag",
39
+ },
40
+ },
41
+ ];
42
+ /** Instructions shared by PHQ-9 and GAD-7. */
43
+ exports.twoWeekInstructions = {
44
+ en: "Over the last 2 weeks, how often have you been bothered by any of the following problems?",
45
+ tr: "Son 2 hafta içinde, aşağıdaki sorunlardan herhangi biri sizi ne sıklıkta rahatsız etti?",
46
+ de: "Wie oft fühlten Sie sich im Verlauf der letzten 2 Wochen durch die folgenden Beschwerden beeinträchtigt?",
47
+ };
@@ -0,0 +1,11 @@
1
+ import type { AssessmentDefinition } from "../types.ts";
2
+ /**
3
+ * DASS-21 — Depression Anxiety Stress Scales, short form.
4
+ *
5
+ * 21 items, 0–3 applicability scale, three subscales (depression, anxiety,
6
+ * stress) of 7 items each. Subscale sums are multiplied by 2 so severity
7
+ * cutoffs match the full DASS-42. The DASS is in the public domain
8
+ * (Lovibond & Lovibond, 1995). Translations follow published validated
9
+ * versions — verify against the official wording before clinical use.
10
+ */
11
+ export declare const dass21: AssessmentDefinition;
@@ -0,0 +1,288 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dass21 = void 0;
4
+ const depressionBands = [
5
+ { id: "normal", min: 0, max: 9, label: { en: "Normal", tr: "Normal", de: "Normal" } },
6
+ { id: "mild", min: 10, max: 13, label: { en: "Mild", tr: "Hafif", de: "Leicht" } },
7
+ { id: "moderate", min: 14, max: 20, label: { en: "Moderate", tr: "Orta", de: "Moderat" } },
8
+ { id: "severe", min: 21, max: 27, label: { en: "Severe", tr: "Şiddetli", de: "Schwer" } },
9
+ { id: "extremely-severe", min: 28, max: 42, label: { en: "Extremely severe", tr: "Çok şiddetli", de: "Sehr schwer" } },
10
+ ];
11
+ const anxietyBands = [
12
+ { id: "normal", min: 0, max: 7, label: { en: "Normal", tr: "Normal", de: "Normal" } },
13
+ { id: "mild", min: 8, max: 9, label: { en: "Mild", tr: "Hafif", de: "Leicht" } },
14
+ { id: "moderate", min: 10, max: 14, label: { en: "Moderate", tr: "Orta", de: "Moderat" } },
15
+ { id: "severe", min: 15, max: 19, label: { en: "Severe", tr: "Şiddetli", de: "Schwer" } },
16
+ { id: "extremely-severe", min: 20, max: 42, label: { en: "Extremely severe", tr: "Çok şiddetli", de: "Sehr schwer" } },
17
+ ];
18
+ const stressBands = [
19
+ { id: "normal", min: 0, max: 14, label: { en: "Normal", tr: "Normal", de: "Normal" } },
20
+ { id: "mild", min: 15, max: 18, label: { en: "Mild", tr: "Hafif", de: "Leicht" } },
21
+ { id: "moderate", min: 19, max: 25, label: { en: "Moderate", tr: "Orta", de: "Moderat" } },
22
+ { id: "severe", min: 26, max: 33, label: { en: "Severe", tr: "Şiddetli", de: "Schwer" } },
23
+ { id: "extremely-severe", min: 34, max: 42, label: { en: "Extremely severe", tr: "Çok şiddetli", de: "Sehr schwer" } },
24
+ ];
25
+ /**
26
+ * DASS-21 — Depression Anxiety Stress Scales, short form.
27
+ *
28
+ * 21 items, 0–3 applicability scale, three subscales (depression, anxiety,
29
+ * stress) of 7 items each. Subscale sums are multiplied by 2 so severity
30
+ * cutoffs match the full DASS-42. The DASS is in the public domain
31
+ * (Lovibond & Lovibond, 1995). Translations follow published validated
32
+ * versions — verify against the official wording before clinical use.
33
+ */
34
+ exports.dass21 = {
35
+ id: "dass21",
36
+ version: "1.0.0",
37
+ title: {
38
+ en: "Depression Anxiety Stress Scales (DASS-21)",
39
+ tr: "Depresyon Anksiyete Stres Ölçeği (DASS-21)",
40
+ de: "Depressions-Angst-Stress-Skalen (DASS-21)",
41
+ },
42
+ description: {
43
+ en: "A 21-item self-report questionnaire measuring depression, anxiety, and stress over the past week.",
44
+ tr: "Geçtiğimiz hafta boyunca depresyon, anksiyete ve stresi ölçen 21 maddelik bir öz bildirim ölçeği.",
45
+ de: "Ein Selbstbeurteilungsfragebogen mit 21 Items zur Messung von Depression, Angst und Stress in der vergangenen Woche.",
46
+ },
47
+ instructions: {
48
+ en: "Please read each statement and select the option which indicates how much the statement applied to you over the past week. There are no right or wrong answers. Do not spend too much time on any statement.",
49
+ tr: "Lütfen her ifadeyi okuyun ve geçtiğimiz hafta boyunca ifadenin size ne kadar uyduğunu gösteren seçeneği işaretleyin. Doğru ya da yanlış cevap yoktur. Herhangi bir ifade üzerinde çok fazla zaman harcamayın.",
50
+ de: "Bitte lesen Sie jede Aussage und wählen Sie die Option, die angibt, wie sehr die Aussage in der vergangenen Woche auf Sie zutraf. Es gibt keine richtigen oder falschen Antworten. Verbringen Sie nicht zu viel Zeit mit einer Aussage.",
51
+ },
52
+ defaultLocale: "en",
53
+ options: [
54
+ {
55
+ value: 0,
56
+ label: {
57
+ en: "Did not apply to me at all",
58
+ tr: "Bana hiç uymadı",
59
+ de: "Traf gar nicht auf mich zu",
60
+ },
61
+ },
62
+ {
63
+ value: 1,
64
+ label: {
65
+ en: "Applied to me to some degree, or some of the time",
66
+ tr: "Bana biraz uydu ya da zaman zaman uydu",
67
+ de: "Traf bis zu einem gewissen Grad oder manchmal auf mich zu",
68
+ },
69
+ },
70
+ {
71
+ value: 2,
72
+ label: {
73
+ en: "Applied to me to a considerable degree, or a good part of the time",
74
+ tr: "Bana oldukça uydu ya da zamanın büyük bölümünde uydu",
75
+ de: "Traf in beträchtlichem Maße oder einen guten Teil der Zeit auf mich zu",
76
+ },
77
+ },
78
+ {
79
+ value: 3,
80
+ label: {
81
+ en: "Applied to me very much, or most of the time",
82
+ tr: "Bana çok uydu ya da hemen hemen her zaman uydu",
83
+ de: "Traf sehr stark oder die meiste Zeit auf mich zu",
84
+ },
85
+ },
86
+ ],
87
+ questions: [
88
+ {
89
+ id: "dass21-1",
90
+ text: {
91
+ en: "I found it hard to wind down",
92
+ tr: "Sakinleşip yatışmakta zorlandım",
93
+ de: "Ich fand es schwer, mich zu beruhigen",
94
+ },
95
+ },
96
+ {
97
+ id: "dass21-2",
98
+ text: {
99
+ en: "I was aware of dryness of my mouth",
100
+ tr: "Ağzımın kuruduğunu fark ettim",
101
+ de: "Ich bemerkte, dass mein Mund trocken war",
102
+ },
103
+ },
104
+ {
105
+ id: "dass21-3",
106
+ text: {
107
+ en: "I couldn't seem to experience any positive feeling at all",
108
+ tr: "Hiç olumlu duygu yaşayamadığımı fark ettim",
109
+ de: "Ich konnte überhaupt keine positiven Gefühle mehr erleben",
110
+ },
111
+ },
112
+ {
113
+ id: "dass21-4",
114
+ text: {
115
+ en: "I experienced breathing difficulty (e.g. excessively rapid breathing, breathlessness in the absence of physical exertion)",
116
+ tr: "Nefes almada zorluk yaşadım (örneğin, fiziksel çaba göstermediğim hâlde aşırı hızlı nefes alma, nefessiz kalma)",
117
+ de: "Ich hatte Atemprobleme (z. B. übermäßig schnelle Atmung, Atemlosigkeit ohne körperliche Anstrengung)",
118
+ },
119
+ },
120
+ {
121
+ id: "dass21-5",
122
+ text: {
123
+ en: "I found it difficult to work up the initiative to do things",
124
+ tr: "Bir işe başlamak için gereken isteği kendimde bulmakta zorlandım",
125
+ de: "Es fiel mir schwer, die Initiative zu ergreifen, um Dinge zu erledigen",
126
+ },
127
+ },
128
+ {
129
+ id: "dass21-6",
130
+ text: {
131
+ en: "I tended to over-react to situations",
132
+ tr: "Olaylara aşırı tepki verme eğiliminde oldum",
133
+ de: "Ich neigte dazu, auf Situationen überzureagieren",
134
+ },
135
+ },
136
+ {
137
+ id: "dass21-7",
138
+ text: {
139
+ en: "I experienced trembling (e.g. in the hands)",
140
+ tr: "Titreme yaşadım (örneğin ellerde)",
141
+ de: "Ich hatte Zittern (z. B. in den Händen)",
142
+ },
143
+ },
144
+ {
145
+ id: "dass21-8",
146
+ text: {
147
+ en: "I felt that I was using a lot of nervous energy",
148
+ tr: "Sinirsel enerjimin çok fazla olduğunu hissettim",
149
+ de: "Ich fühlte, dass ich viel nervöse Energie verbrauchte",
150
+ },
151
+ },
152
+ {
153
+ id: "dass21-9",
154
+ text: {
155
+ en: "I was worried about situations in which I might panic and make a fool of myself",
156
+ tr: "Panikleyip kendimi gülünç duruma düşürebileceğim durumlar nedeniyle endişelendim",
157
+ de: "Ich machte mir Sorgen über Situationen, in denen ich in Panik geraten und mich blamieren könnte",
158
+ },
159
+ },
160
+ {
161
+ id: "dass21-10",
162
+ text: {
163
+ en: "I felt that I had nothing to look forward to",
164
+ tr: "Dört gözle beklediğim hiçbir şey olmadığını hissettim",
165
+ de: "Ich hatte das Gefühl, mich auf nichts mehr freuen zu können",
166
+ },
167
+ },
168
+ {
169
+ id: "dass21-11",
170
+ text: {
171
+ en: "I found myself getting agitated",
172
+ tr: "Giderek huzursuzlandığımı fark ettim",
173
+ de: "Ich merkte, dass ich unruhig wurde",
174
+ },
175
+ },
176
+ {
177
+ id: "dass21-12",
178
+ text: {
179
+ en: "I found it difficult to relax",
180
+ tr: "Gevşeyip rahatlamakta zorlandım",
181
+ de: "Es fiel mir schwer, mich zu entspannen",
182
+ },
183
+ },
184
+ {
185
+ id: "dass21-13",
186
+ text: {
187
+ en: "I felt down-hearted and blue",
188
+ tr: "Kendimi üzgün ve karamsar hissettim",
189
+ de: "Ich fühlte mich niedergeschlagen und traurig",
190
+ },
191
+ },
192
+ {
193
+ id: "dass21-14",
194
+ text: {
195
+ en: "I was intolerant of anything that kept me from getting on with what I was doing",
196
+ tr: "Yaptığım işi sürdürmeme engel olan şeylere tahammül edemedim",
197
+ de: "Ich konnte es nicht ertragen, von dem, was ich gerade tat, abgehalten zu werden",
198
+ },
199
+ },
200
+ {
201
+ id: "dass21-15",
202
+ text: {
203
+ en: "I felt I was close to panic",
204
+ tr: "Panik olmaya yakın olduğumu hissettim",
205
+ de: "Ich fühlte mich einer Panik nahe",
206
+ },
207
+ },
208
+ {
209
+ id: "dass21-16",
210
+ text: {
211
+ en: "I was unable to become enthusiastic about anything",
212
+ tr: "Hiçbir şeye karşı heves duyamadım",
213
+ de: "Ich konnte mich für nichts mehr begeistern",
214
+ },
215
+ },
216
+ {
217
+ id: "dass21-17",
218
+ text: {
219
+ en: "I felt I wasn't worth much as a person",
220
+ tr: "Kişi olarak fazla bir değerimin olmadığını hissettim",
221
+ de: "Ich hatte das Gefühl, als Person nicht viel wert zu sein",
222
+ },
223
+ },
224
+ {
225
+ id: "dass21-18",
226
+ text: {
227
+ en: "I felt that I was rather touchy",
228
+ tr: "Oldukça alıngan olduğumu hissettim",
229
+ de: "Ich fühlte, dass ich ziemlich empfindlich war",
230
+ },
231
+ },
232
+ {
233
+ id: "dass21-19",
234
+ text: {
235
+ en: "I was aware of the action of my heart in the absence of physical exertion (e.g. sense of heart rate increase, heart missing a beat)",
236
+ tr: "Fiziksel çaba göstermediğim hâlde kalbimin hareketlerini fark ettim (örneğin, kalp atışının hızlanması, kalbin bir atışı atlaması)",
237
+ de: "Ich nahm meinen Herzschlag wahr, ohne mich körperlich angestrengt zu haben (z. B. Gefühl von Herzrasen oder Herzstolpern)",
238
+ },
239
+ },
240
+ {
241
+ id: "dass21-20",
242
+ text: {
243
+ en: "I felt scared without any good reason",
244
+ tr: "Geçerli bir neden olmadığı hâlde korktuğumu hissettim",
245
+ de: "Ich fühlte mich ohne triftigen Grund ängstlich",
246
+ },
247
+ },
248
+ {
249
+ id: "dass21-21",
250
+ text: {
251
+ en: "I felt that life was meaningless",
252
+ tr: "Yaşamın anlamsız olduğunu hissettim",
253
+ de: "Ich hatte das Gefühl, dass das Leben sinnlos ist",
254
+ },
255
+ },
256
+ ],
257
+ scoring: {
258
+ kind: "subscales",
259
+ subscales: [
260
+ {
261
+ id: "depression",
262
+ label: { en: "Depression", tr: "Depresyon", de: "Depression" },
263
+ questionIds: ["dass21-3", "dass21-5", "dass21-10", "dass21-13", "dass21-16", "dass21-17", "dass21-21"],
264
+ multiplier: 2,
265
+ bands: depressionBands,
266
+ },
267
+ {
268
+ id: "anxiety",
269
+ label: { en: "Anxiety", tr: "Anksiyete", de: "Angst" },
270
+ questionIds: ["dass21-2", "dass21-4", "dass21-7", "dass21-9", "dass21-15", "dass21-19", "dass21-20"],
271
+ multiplier: 2,
272
+ bands: anxietyBands,
273
+ },
274
+ {
275
+ id: "stress",
276
+ label: { en: "Stress", tr: "Stres", de: "Stress" },
277
+ questionIds: ["dass21-1", "dass21-6", "dass21-8", "dass21-11", "dass21-12", "dass21-14", "dass21-18"],
278
+ multiplier: 2,
279
+ bands: stressBands,
280
+ },
281
+ ],
282
+ },
283
+ meta: {
284
+ reference: "Lovibond, S. H., & Lovibond, P. F. (1995). Manual for the Depression Anxiety Stress Scales (2nd ed.). Sydney: Psychology Foundation.",
285
+ license: "Public domain",
286
+ timeframe: "past week",
287
+ },
288
+ };
@@ -0,0 +1,10 @@
1
+ import type { AssessmentDefinition } from "../types.ts";
2
+ /**
3
+ * GAD-7 — Generalized Anxiety Disorder-7 (anxiety screening).
4
+ *
5
+ * 7 items, 0–3 frequency scale, total score 0–21. The GAD-7 is in the
6
+ * public domain (Spitzer, Kroenke, Williams & Löwe, 2006; developed with a
7
+ * grant from Pfizer Inc.). Translations follow published validated
8
+ * versions — verify against the official wording before clinical use.
9
+ */
10
+ export declare const gad7: AssessmentDefinition;
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gad7 = void 0;
4
+ const common_ts_1 = require("./common.js");
5
+ /**
6
+ * GAD-7 — Generalized Anxiety Disorder-7 (anxiety screening).
7
+ *
8
+ * 7 items, 0–3 frequency scale, total score 0–21. The GAD-7 is in the
9
+ * public domain (Spitzer, Kroenke, Williams & Löwe, 2006; developed with a
10
+ * grant from Pfizer Inc.). Translations follow published validated
11
+ * versions — verify against the official wording before clinical use.
12
+ */
13
+ exports.gad7 = {
14
+ id: "gad7",
15
+ version: "1.0.0",
16
+ title: {
17
+ en: "Generalized Anxiety Disorder Scale (GAD-7)",
18
+ tr: "Yaygın Anksiyete Bozukluğu Ölçeği (GAD-7)",
19
+ de: "Generalisierte Angststörung Skala (GAD-7)",
20
+ },
21
+ description: {
22
+ en: "A 7-item self-report questionnaire for screening and measuring the severity of generalized anxiety.",
23
+ tr: "Yaygın anksiyeteyi taramak ve şiddetini ölçmek için kullanılan 7 maddelik bir öz bildirim ölçeği.",
24
+ de: "Ein Selbstbeurteilungsfragebogen mit 7 Items zum Screening und zur Schweregradmessung generalisierter Angst.",
25
+ },
26
+ instructions: common_ts_1.twoWeekInstructions,
27
+ defaultLocale: "en",
28
+ options: common_ts_1.twoWeekFrequencyOptions,
29
+ questions: [
30
+ {
31
+ id: "gad7-1",
32
+ text: {
33
+ en: "Feeling nervous, anxious, or on edge",
34
+ tr: "Sinirli, kaygılı ya da çok gergin hissetme",
35
+ de: "Nervosität, Ängstlichkeit oder Anspannung",
36
+ },
37
+ },
38
+ {
39
+ id: "gad7-2",
40
+ text: {
41
+ en: "Not being able to stop or control worrying",
42
+ tr: "Endişelenmeyi durduramama ya da kontrol edememe",
43
+ de: "Nicht in der Lage sein, Sorgen zu stoppen oder zu kontrollieren",
44
+ },
45
+ },
46
+ {
47
+ id: "gad7-3",
48
+ text: {
49
+ en: "Worrying too much about different things",
50
+ tr: "Farklı konular hakkında çok fazla endişelenme",
51
+ de: "Übermäßige Sorgen bezüglich verschiedener Angelegenheiten",
52
+ },
53
+ },
54
+ {
55
+ id: "gad7-4",
56
+ text: {
57
+ en: "Trouble relaxing",
58
+ tr: "Gevşeyip rahatlamada güçlük",
59
+ de: "Schwierigkeiten, sich zu entspannen",
60
+ },
61
+ },
62
+ {
63
+ id: "gad7-5",
64
+ text: {
65
+ en: "Being so restless that it is hard to sit still",
66
+ tr: "Yerinde duramayacak kadar huzursuz olma",
67
+ de: "Rastlosigkeit, sodass das Stillsitzen schwerfällt",
68
+ },
69
+ },
70
+ {
71
+ id: "gad7-6",
72
+ text: {
73
+ en: "Becoming easily annoyed or irritable",
74
+ tr: "Çabuk kızma ya da kolayca sinirlenir olma",
75
+ de: "Schnelle Verärgerung oder Gereiztheit",
76
+ },
77
+ },
78
+ {
79
+ id: "gad7-7",
80
+ text: {
81
+ en: "Feeling afraid, as if something awful might happen",
82
+ tr: "Sanki çok kötü bir şey olacakmış gibi korkuya kapılma",
83
+ de: "Angstgefühl, als könnte etwas Schlimmes passieren",
84
+ },
85
+ },
86
+ ],
87
+ scoring: {
88
+ kind: "sum",
89
+ bands: [
90
+ {
91
+ id: "minimal",
92
+ min: 0,
93
+ max: 4,
94
+ label: { en: "Minimal anxiety", tr: "Minimal anksiyete", de: "Minimale Angst" },
95
+ },
96
+ {
97
+ id: "mild",
98
+ min: 5,
99
+ max: 9,
100
+ label: { en: "Mild anxiety", tr: "Hafif anksiyete", de: "Leichte Angst" },
101
+ },
102
+ {
103
+ id: "moderate",
104
+ min: 10,
105
+ max: 14,
106
+ label: { en: "Moderate anxiety", tr: "Orta düzeyde anksiyete", de: "Mittelgradige Angst" },
107
+ },
108
+ {
109
+ id: "severe",
110
+ min: 15,
111
+ max: 21,
112
+ label: { en: "Severe anxiety", tr: "Şiddetli anksiyete", de: "Schwere Angst" },
113
+ },
114
+ ],
115
+ },
116
+ meta: {
117
+ reference: "Spitzer, R. L., Kroenke, K., Williams, J. B., & Löwe, B. (2006). A brief measure for assessing generalized anxiety disorder: the GAD-7. Archives of Internal Medicine, 166(10), 1092-1097.",
118
+ license: "Public domain",
119
+ timeframe: "past 2 weeks",
120
+ },
121
+ };
@@ -0,0 +1,15 @@
1
+ import type { AssessmentDefinition } from "../types.ts";
2
+ import { Assessment } from "../assessment.ts";
3
+ import { phq9 } from "./phq9.ts";
4
+ import { gad7 } from "./gad7.ts";
5
+ import { dass21 } from "./dass21.ts";
6
+ export { phq9, gad7, dass21 };
7
+ export { twoWeekFrequencyOptions, twoWeekInstructions } from "./common.ts";
8
+ /** All predefined inventory definitions shipped with psytools, by id. */
9
+ export declare const inventories: Readonly<Record<string, AssessmentDefinition>>;
10
+ export type InventoryId = "phq9" | "gad7" | "dass21";
11
+ /**
12
+ * Instantiates a predefined inventory as an `Assessment`.
13
+ * @throws PsytoolsError `unknown_inventory`
14
+ */
15
+ export declare function loadInventory(id: InventoryId | string): Assessment;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.inventories = exports.twoWeekInstructions = exports.twoWeekFrequencyOptions = exports.dass21 = exports.gad7 = exports.phq9 = void 0;
4
+ exports.loadInventory = loadInventory;
5
+ const assessment_ts_1 = require("../assessment.js");
6
+ const errors_ts_1 = require("../errors.js");
7
+ const phq9_ts_1 = require("./phq9.js");
8
+ Object.defineProperty(exports, "phq9", { enumerable: true, get: function () { return phq9_ts_1.phq9; } });
9
+ const gad7_ts_1 = require("./gad7.js");
10
+ Object.defineProperty(exports, "gad7", { enumerable: true, get: function () { return gad7_ts_1.gad7; } });
11
+ const dass21_ts_1 = require("./dass21.js");
12
+ Object.defineProperty(exports, "dass21", { enumerable: true, get: function () { return dass21_ts_1.dass21; } });
13
+ var common_ts_1 = require("./common.js");
14
+ Object.defineProperty(exports, "twoWeekFrequencyOptions", { enumerable: true, get: function () { return common_ts_1.twoWeekFrequencyOptions; } });
15
+ Object.defineProperty(exports, "twoWeekInstructions", { enumerable: true, get: function () { return common_ts_1.twoWeekInstructions; } });
16
+ /** All predefined inventory definitions shipped with psytools, by id. */
17
+ exports.inventories = {
18
+ phq9: phq9_ts_1.phq9,
19
+ gad7: gad7_ts_1.gad7,
20
+ dass21: dass21_ts_1.dass21,
21
+ };
22
+ /**
23
+ * Instantiates a predefined inventory as an `Assessment`.
24
+ * @throws PsytoolsError `unknown_inventory`
25
+ */
26
+ function loadInventory(id) {
27
+ const definition = exports.inventories[id];
28
+ if (!definition) {
29
+ const known = Object.keys(exports.inventories).join(", ");
30
+ throw new errors_ts_1.PsytoolsError("unknown_inventory", `Unknown inventory "${id}" (available: ${known})`);
31
+ }
32
+ return new assessment_ts_1.Assessment(definition);
33
+ }
@@ -0,0 +1,11 @@
1
+ import type { AssessmentDefinition } from "../types.ts";
2
+ /**
3
+ * PHQ-9 — Patient Health Questionnaire-9 (depression screening).
4
+ *
5
+ * 9 items, 0–3 frequency scale, total score 0–27. Item 9 raises a
6
+ * `suicidality` flag when answered above 0. The PHQ-9 is in the public
7
+ * domain (Kroenke, Spitzer & Williams, 2001; developed with a grant from
8
+ * Pfizer Inc.). Translations follow published validated versions — verify
9
+ * against the official wording before clinical use.
10
+ */
11
+ export declare const phq9: AssessmentDefinition;