psytools 0.3.2 → 0.5.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 (227) hide show
  1. package/README.md +54 -17
  2. package/SOURCES.md +5 -1
  3. package/dist/cjs/assessment.d.ts +6 -4
  4. package/dist/cjs/assessment.js +10 -6
  5. package/dist/cjs/errors.d.ts +4 -2
  6. package/dist/cjs/evaluation.d.ts +10 -5
  7. package/dist/cjs/evaluation.js +68 -31
  8. package/dist/cjs/i18n.d.ts +22 -2
  9. package/dist/cjs/i18n.js +138 -2
  10. package/dist/cjs/index.d.ts +6 -2
  11. package/dist/cjs/index.js +20 -15
  12. package/dist/cjs/inventories/aq10.js +5 -35
  13. package/dist/cjs/inventories/asrs6.js +6 -28
  14. package/dist/cjs/inventories/audit.js +39 -56
  15. package/dist/cjs/inventories/common.js +0 -10
  16. package/dist/cjs/inventories/dass21.js +19 -75
  17. package/dist/cjs/inventories/gad7.js +5 -23
  18. package/dist/cjs/inventories/index.d.ts +11 -2
  19. package/dist/cjs/inventories/index.js +22 -3
  20. package/dist/cjs/inventories/mini-ipip.js +25 -59
  21. package/dist/cjs/inventories/phq9.js +6 -30
  22. package/dist/cjs/inventories/who5.js +5 -31
  23. package/dist/cjs/locales/de/aq10.d.ts +4 -0
  24. package/dist/cjs/locales/de/aq10.js +53 -0
  25. package/dist/cjs/locales/de/asrs6.d.ts +4 -0
  26. package/dist/cjs/locales/de/asrs6.js +42 -0
  27. package/dist/cjs/locales/de/audit.d.ts +4 -0
  28. package/dist/cjs/locales/de/audit.js +80 -0
  29. package/dist/cjs/locales/de/dass21.d.ts +4 -0
  30. package/dist/cjs/locales/de/dass21.js +114 -0
  31. package/dist/cjs/locales/de/gad7.d.ts +4 -0
  32. package/dist/cjs/locales/de/gad7.js +46 -0
  33. package/dist/cjs/locales/de/mini-ipip.d.ts +4 -0
  34. package/dist/cjs/locales/de/mini-ipip.js +97 -0
  35. package/dist/cjs/locales/de/phq9.d.ts +4 -0
  36. package/dist/cjs/locales/de/phq9.js +56 -0
  37. package/dist/cjs/locales/de/who5.d.ts +4 -0
  38. package/dist/cjs/locales/de/who5.js +41 -0
  39. package/dist/cjs/locales/es/aq10.d.ts +4 -0
  40. package/dist/cjs/locales/es/aq10.js +53 -0
  41. package/dist/cjs/locales/es/asrs6.d.ts +4 -0
  42. package/dist/cjs/locales/es/asrs6.js +42 -0
  43. package/dist/cjs/locales/es/audit.d.ts +4 -0
  44. package/dist/cjs/locales/es/audit.js +80 -0
  45. package/dist/cjs/locales/es/dass21.d.ts +4 -0
  46. package/dist/cjs/locales/es/dass21.js +114 -0
  47. package/dist/cjs/locales/es/gad7.d.ts +4 -0
  48. package/dist/cjs/locales/es/gad7.js +46 -0
  49. package/dist/cjs/locales/es/mini-ipip.d.ts +4 -0
  50. package/dist/cjs/locales/es/mini-ipip.js +97 -0
  51. package/dist/cjs/locales/es/phq9.d.ts +4 -0
  52. package/dist/cjs/locales/es/phq9.js +56 -0
  53. package/dist/cjs/locales/es/who5.d.ts +4 -0
  54. package/dist/cjs/locales/es/who5.js +41 -0
  55. package/dist/cjs/locales/index.d.ts +12 -0
  56. package/dist/cjs/locales/index.js +63 -0
  57. package/dist/cjs/locales/tr/aq10.d.ts +4 -0
  58. package/dist/cjs/locales/tr/aq10.js +53 -0
  59. package/dist/cjs/locales/tr/asrs6.d.ts +4 -0
  60. package/dist/cjs/locales/tr/asrs6.js +42 -0
  61. package/dist/cjs/locales/tr/audit.d.ts +4 -0
  62. package/dist/cjs/locales/tr/audit.js +80 -0
  63. package/dist/cjs/locales/tr/dass21.d.ts +4 -0
  64. package/dist/cjs/locales/tr/dass21.js +114 -0
  65. package/dist/cjs/locales/tr/gad7.d.ts +4 -0
  66. package/dist/cjs/locales/tr/gad7.js +46 -0
  67. package/dist/cjs/locales/tr/mini-ipip.d.ts +4 -0
  68. package/dist/cjs/locales/tr/mini-ipip.js +97 -0
  69. package/dist/cjs/locales/tr/phq9.d.ts +4 -0
  70. package/dist/cjs/locales/tr/phq9.js +56 -0
  71. package/dist/cjs/locales/tr/who5.d.ts +4 -0
  72. package/dist/cjs/locales/tr/who5.js +41 -0
  73. package/dist/cjs/locales/zh/aq10.d.ts +4 -0
  74. package/dist/cjs/locales/zh/aq10.js +53 -0
  75. package/dist/cjs/locales/zh/asrs6.d.ts +4 -0
  76. package/dist/cjs/locales/zh/asrs6.js +42 -0
  77. package/dist/cjs/locales/zh/audit.d.ts +4 -0
  78. package/dist/cjs/locales/zh/audit.js +80 -0
  79. package/dist/cjs/locales/zh/dass21.d.ts +4 -0
  80. package/dist/cjs/locales/zh/dass21.js +114 -0
  81. package/dist/cjs/locales/zh/gad7.d.ts +4 -0
  82. package/dist/cjs/locales/zh/gad7.js +46 -0
  83. package/dist/cjs/locales/zh/mini-ipip.d.ts +4 -0
  84. package/dist/cjs/locales/zh/mini-ipip.js +97 -0
  85. package/dist/cjs/locales/zh/phq9.d.ts +4 -0
  86. package/dist/cjs/locales/zh/phq9.js +56 -0
  87. package/dist/cjs/locales/zh/who5.d.ts +4 -0
  88. package/dist/cjs/locales/zh/who5.js +41 -0
  89. package/dist/cjs/types.d.ts +60 -1
  90. package/dist/esm/assessment.d.ts +6 -4
  91. package/dist/esm/assessment.js +11 -7
  92. package/dist/esm/errors.d.ts +4 -2
  93. package/dist/esm/evaluation.d.ts +10 -5
  94. package/dist/esm/evaluation.js +68 -31
  95. package/dist/esm/i18n.d.ts +22 -2
  96. package/dist/esm/i18n.js +135 -1
  97. package/dist/esm/index.d.ts +6 -2
  98. package/dist/esm/index.js +2 -1
  99. package/dist/esm/inventories/aq10.js +5 -35
  100. package/dist/esm/inventories/asrs6.js +6 -28
  101. package/dist/esm/inventories/audit.js +39 -56
  102. package/dist/esm/inventories/common.js +0 -10
  103. package/dist/esm/inventories/dass21.js +19 -75
  104. package/dist/esm/inventories/gad7.js +5 -23
  105. package/dist/esm/inventories/index.d.ts +11 -2
  106. package/dist/esm/inventories/index.js +22 -3
  107. package/dist/esm/inventories/mini-ipip.js +25 -59
  108. package/dist/esm/inventories/phq9.js +6 -30
  109. package/dist/esm/inventories/who5.js +5 -31
  110. package/dist/esm/locales/de/aq10.d.ts +4 -0
  111. package/dist/esm/locales/de/aq10.js +51 -0
  112. package/dist/esm/locales/de/asrs6.d.ts +4 -0
  113. package/dist/esm/locales/de/asrs6.js +40 -0
  114. package/dist/esm/locales/de/audit.d.ts +4 -0
  115. package/dist/esm/locales/de/audit.js +78 -0
  116. package/dist/esm/locales/de/dass21.d.ts +4 -0
  117. package/dist/esm/locales/de/dass21.js +112 -0
  118. package/dist/esm/locales/de/gad7.d.ts +4 -0
  119. package/dist/esm/locales/de/gad7.js +44 -0
  120. package/dist/esm/locales/de/mini-ipip.d.ts +4 -0
  121. package/dist/esm/locales/de/mini-ipip.js +95 -0
  122. package/dist/esm/locales/de/phq9.d.ts +4 -0
  123. package/dist/esm/locales/de/phq9.js +54 -0
  124. package/dist/esm/locales/de/who5.d.ts +4 -0
  125. package/dist/esm/locales/de/who5.js +39 -0
  126. package/dist/esm/locales/es/aq10.d.ts +4 -0
  127. package/dist/esm/locales/es/aq10.js +51 -0
  128. package/dist/esm/locales/es/asrs6.d.ts +4 -0
  129. package/dist/esm/locales/es/asrs6.js +40 -0
  130. package/dist/esm/locales/es/audit.d.ts +4 -0
  131. package/dist/esm/locales/es/audit.js +78 -0
  132. package/dist/esm/locales/es/dass21.d.ts +4 -0
  133. package/dist/esm/locales/es/dass21.js +112 -0
  134. package/dist/esm/locales/es/gad7.d.ts +4 -0
  135. package/dist/esm/locales/es/gad7.js +44 -0
  136. package/dist/esm/locales/es/mini-ipip.d.ts +4 -0
  137. package/dist/esm/locales/es/mini-ipip.js +95 -0
  138. package/dist/esm/locales/es/phq9.d.ts +4 -0
  139. package/dist/esm/locales/es/phq9.js +54 -0
  140. package/dist/esm/locales/es/who5.d.ts +4 -0
  141. package/dist/esm/locales/es/who5.js +39 -0
  142. package/dist/esm/locales/index.d.ts +12 -0
  143. package/dist/esm/locales/index.js +59 -0
  144. package/dist/esm/locales/tr/aq10.d.ts +4 -0
  145. package/dist/esm/locales/tr/aq10.js +51 -0
  146. package/dist/esm/locales/tr/asrs6.d.ts +4 -0
  147. package/dist/esm/locales/tr/asrs6.js +40 -0
  148. package/dist/esm/locales/tr/audit.d.ts +4 -0
  149. package/dist/esm/locales/tr/audit.js +78 -0
  150. package/dist/esm/locales/tr/dass21.d.ts +4 -0
  151. package/dist/esm/locales/tr/dass21.js +112 -0
  152. package/dist/esm/locales/tr/gad7.d.ts +4 -0
  153. package/dist/esm/locales/tr/gad7.js +44 -0
  154. package/dist/esm/locales/tr/mini-ipip.d.ts +4 -0
  155. package/dist/esm/locales/tr/mini-ipip.js +95 -0
  156. package/dist/esm/locales/tr/phq9.d.ts +4 -0
  157. package/dist/esm/locales/tr/phq9.js +54 -0
  158. package/dist/esm/locales/tr/who5.d.ts +4 -0
  159. package/dist/esm/locales/tr/who5.js +39 -0
  160. package/dist/esm/locales/zh/aq10.d.ts +4 -0
  161. package/dist/esm/locales/zh/aq10.js +51 -0
  162. package/dist/esm/locales/zh/asrs6.d.ts +4 -0
  163. package/dist/esm/locales/zh/asrs6.js +40 -0
  164. package/dist/esm/locales/zh/audit.d.ts +4 -0
  165. package/dist/esm/locales/zh/audit.js +78 -0
  166. package/dist/esm/locales/zh/dass21.d.ts +4 -0
  167. package/dist/esm/locales/zh/dass21.js +112 -0
  168. package/dist/esm/locales/zh/gad7.d.ts +4 -0
  169. package/dist/esm/locales/zh/gad7.js +44 -0
  170. package/dist/esm/locales/zh/mini-ipip.d.ts +4 -0
  171. package/dist/esm/locales/zh/mini-ipip.js +95 -0
  172. package/dist/esm/locales/zh/phq9.d.ts +4 -0
  173. package/dist/esm/locales/zh/phq9.js +54 -0
  174. package/dist/esm/locales/zh/who5.d.ts +4 -0
  175. package/dist/esm/locales/zh/who5.js +39 -0
  176. package/dist/esm/types.d.ts +60 -1
  177. package/package.json +21 -1
  178. package/schema/assessment-definition.schema.json +15 -3
  179. package/src/assessment.ts +15 -9
  180. package/src/errors.ts +26 -2
  181. package/src/evaluation.ts +103 -30
  182. package/src/i18n.ts +177 -2
  183. package/src/index.ts +9 -1
  184. package/src/inventories/aq10.ts +5 -35
  185. package/src/inventories/asrs6.ts +6 -28
  186. package/src/inventories/audit.ts +39 -56
  187. package/src/inventories/common.ts +0 -10
  188. package/src/inventories/dass21.ts +19 -75
  189. package/src/inventories/gad7.ts +5 -23
  190. package/src/inventories/index.ts +27 -3
  191. package/src/inventories/mini-ipip.ts +25 -59
  192. package/src/inventories/phq9.ts +6 -30
  193. package/src/inventories/who5.ts +5 -31
  194. package/src/locales/de/aq10.ts +54 -0
  195. package/src/locales/de/asrs6.ts +43 -0
  196. package/src/locales/de/audit.ts +81 -0
  197. package/src/locales/de/dass21.ts +115 -0
  198. package/src/locales/de/gad7.ts +47 -0
  199. package/src/locales/de/mini-ipip.ts +98 -0
  200. package/src/locales/de/phq9.ts +57 -0
  201. package/src/locales/de/who5.ts +42 -0
  202. package/src/locales/es/aq10.ts +54 -0
  203. package/src/locales/es/asrs6.ts +43 -0
  204. package/src/locales/es/audit.ts +81 -0
  205. package/src/locales/es/dass21.ts +115 -0
  206. package/src/locales/es/gad7.ts +47 -0
  207. package/src/locales/es/mini-ipip.ts +98 -0
  208. package/src/locales/es/phq9.ts +57 -0
  209. package/src/locales/es/who5.ts +42 -0
  210. package/src/locales/index.ts +64 -0
  211. package/src/locales/tr/aq10.ts +54 -0
  212. package/src/locales/tr/asrs6.ts +43 -0
  213. package/src/locales/tr/audit.ts +81 -0
  214. package/src/locales/tr/dass21.ts +115 -0
  215. package/src/locales/tr/gad7.ts +47 -0
  216. package/src/locales/tr/mini-ipip.ts +98 -0
  217. package/src/locales/tr/phq9.ts +57 -0
  218. package/src/locales/tr/who5.ts +42 -0
  219. package/src/locales/zh/aq10.ts +54 -0
  220. package/src/locales/zh/asrs6.ts +43 -0
  221. package/src/locales/zh/audit.ts +81 -0
  222. package/src/locales/zh/dass21.ts +115 -0
  223. package/src/locales/zh/gad7.ts +47 -0
  224. package/src/locales/zh/mini-ipip.ts +98 -0
  225. package/src/locales/zh/phq9.ts +57 -0
  226. package/src/locales/zh/who5.ts +42 -0
  227. package/src/types.ts +63 -6
@@ -3,16 +3,20 @@ import { PsytoolsError } from "./errors.js";
3
3
  * Evaluates answers against an assessment definition.
4
4
  *
5
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.
6
+ * exist and the value must belong to its option scale. Then
7
+ * `options.evaluator` is used when given; otherwise the definition's
8
+ * declarative `scoring` (`sum`, `subscales`, or `count`) applies, honoring
9
+ * its missing-data policy.
9
10
  *
10
- * @throws PsytoolsError `unknown_question` | `invalid_value` | `no_scoring`
11
+ * @throws PsytoolsError `unknown_question` | `invalid_value` | `incomplete_response` | `no_scoring`
11
12
  */
12
- export function evaluate(definition, answers, evaluator) {
13
+ export function evaluate(definition, answers, options) {
14
+ if (typeof options === "function") {
15
+ throw new PsytoolsError("invalid_argument", "Pass the evaluator as an option: evaluate(definition, answers, { evaluator })");
16
+ }
13
17
  assertValidAnswers(definition, answers);
14
- if (evaluator)
15
- return evaluator(definition, answers);
18
+ if (options?.evaluator)
19
+ return options.evaluator(definition, answers);
16
20
  const scoring = definition.scoring;
17
21
  if (!scoring) {
18
22
  throw new PsytoolsError("no_scoring", `Assessment "${definition.id}" has no scoring definition; pass a custom evaluator`);
@@ -21,19 +25,22 @@ export function evaluate(definition, answers, evaluator) {
21
25
  case "sum":
22
26
  return evaluateSum(definition, answers, scoring);
23
27
  case "count": {
24
- let score = 0;
28
+ const questions = scoring.items.map((item) => requireQuestion(definition, item.questionId));
29
+ const answered = enforceMissing(questions, answers, scoring.missing);
30
+ let positives = 0;
25
31
  for (const item of scoring.items) {
26
32
  const question = requireQuestion(definition, item.questionId);
27
- const answered = answers[question.id];
28
- if (answered === undefined)
33
+ const value = answers[question.id];
34
+ if (value === undefined)
29
35
  continue;
30
36
  const values = (question.options ?? definition.options).map((o) => o.value);
31
37
  const effective = question.reverseScored
32
- ? Math.max(...values) + Math.min(...values) - answered
33
- : answered;
38
+ ? Math.max(...values) + Math.min(...values) - value
39
+ : value;
34
40
  if (effective >= item.minValue)
35
- score += 1;
41
+ positives += 1;
36
42
  }
43
+ const score = prorate(positives, answered, questions.length, scoring.missing);
37
44
  return {
38
45
  kind: "scale",
39
46
  score,
@@ -46,15 +53,12 @@ export function evaluate(definition, answers, evaluator) {
46
53
  case "subscales": {
47
54
  const scales = scoring.subscales.map((subscale) => {
48
55
  const questions = subscale.questionIds.map((id) => requireQuestion(definition, id));
49
- const multiplier = subscale.multiplier ?? 1;
50
- const { score, min, max } = sumQuestions(definition, questions, answers, multiplier);
56
+ const scored = scoreQuestionSet(definition, questions, answers, subscale.multiplier ?? 1, scoring.missing, subscale.id);
51
57
  return {
52
58
  id: subscale.id,
53
59
  label: subscale.label,
54
- score,
55
- min,
56
- max,
57
- ...bandOf(score, subscale.bands),
60
+ ...scored,
61
+ ...bandOf(scored.score, subscale.bands),
58
62
  };
59
63
  });
60
64
  return {
@@ -82,19 +86,21 @@ function assertValidAnswers(definition, answers) {
82
86
  }
83
87
  }
84
88
  function evaluateSum(definition, answers, scoring) {
85
- const multiplier = scoring.multiplier ?? 1;
86
- const { score, min, max } = sumQuestions(definition, definition.questions, answers, multiplier);
89
+ const result = scoreQuestionSet(definition, definition.questions, answers, scoring.multiplier ?? 1, scoring.missing);
87
90
  return {
88
91
  kind: "scale",
89
- score,
90
- min,
91
- max,
92
- ...bandOf(score, scoring.bands),
92
+ ...result,
93
+ ...bandOf(result.score, scoring.bands),
93
94
  flags: triggeredFlags(answers, scoring.flags),
94
95
  };
95
96
  }
96
- function sumQuestions(definition, questions, answers, multiplier) {
97
- let score = 0;
97
+ /**
98
+ * Sums one set of questions (the whole assessment or one subscale),
99
+ * applying reverse scoring, the missing-data policy, and the multiplier.
100
+ */
101
+ function scoreQuestionSet(definition, questions, answers, multiplier, missing, scaleId) {
102
+ const answered = enforceMissing(questions, answers, missing, scaleId);
103
+ let raw = 0;
98
104
  let min = 0;
99
105
  let max = 0;
100
106
  for (const question of questions) {
@@ -103,12 +109,43 @@ function sumQuestions(definition, questions, answers, multiplier) {
103
109
  const highest = Math.max(...values);
104
110
  min += lowest;
105
111
  max += highest;
106
- const answered = answers[question.id];
107
- if (answered === undefined)
112
+ const value = answers[question.id];
113
+ if (value === undefined)
108
114
  continue;
109
- score += question.reverseScored ? highest + lowest - answered : answered;
115
+ raw += question.reverseScored ? highest + lowest - value : value;
110
116
  }
111
- return { score: score * multiplier, min: min * multiplier, max: max * multiplier };
117
+ raw = prorate(raw, answered, questions.length, missing);
118
+ return { score: raw * multiplier, min: min * multiplier, max: max * multiplier };
119
+ }
120
+ /**
121
+ * Enforces the missing-data policy over one set of contributing questions
122
+ * and returns how many of them are answered.
123
+ *
124
+ * `require-complete` only demands questions that are not marked `optional`.
125
+ */
126
+ function enforceMissing(questions, answers, missing, scaleId) {
127
+ const strategy = missing?.strategy ?? "ignore";
128
+ const minAnswered = missing?.minAnswered ?? (strategy === "prorate" ? 1 : 0);
129
+ const scope = scaleId ? ` in subscale "${scaleId}"` : "";
130
+ const answered = questions.filter((q) => answers[q.id] !== undefined).length;
131
+ if (strategy === "require-complete") {
132
+ const unanswered = questions
133
+ .filter((q) => !(q.optional ?? false) && answers[q.id] === undefined)
134
+ .map((q) => q.id);
135
+ if (unanswered.length > 0) {
136
+ throw new PsytoolsError("incomplete_response", `Scoring requires complete answers${scope}; unanswered: ${unanswered.join(", ")}`);
137
+ }
138
+ }
139
+ if (answered < minAnswered) {
140
+ throw new PsytoolsError("incomplete_response", `Scoring requires at least ${minAnswered} answered item(s)${scope}, got ${answered}`);
141
+ }
142
+ return answered;
143
+ }
144
+ /** Scales a partial raw score up to the full item count (rounded). */
145
+ function prorate(raw, answered, total, missing) {
146
+ if (missing?.strategy !== "prorate" || answered === 0 || answered === total)
147
+ return raw;
148
+ return Math.round((raw * total) / answered);
112
149
  }
113
150
  function bandOf(score, bands) {
114
151
  const match = bands?.find((band) => score >= band.min && score <= band.max);
@@ -1,10 +1,30 @@
1
- import type { LocalizedText } from "./types.ts";
1
+ import type { AssessmentDefinition, InventoryLocalePack, LocalizedText } from "./types.ts";
2
2
  /**
3
3
  * Resolves a `LocalizedText` to a string for the given locale.
4
4
  *
5
5
  * Resolution order: exact locale -> base language of the locale
6
6
  * (`"de-AT"` -> `"de"`) -> `fallbackLocale` -> first available entry.
7
7
  */
8
- export declare function localize(text: LocalizedText, locale: string, fallbackLocale?: string): string;
8
+ export declare function localizeText(text: LocalizedText, locale: string, fallbackLocale?: string): string;
9
+ /**
10
+ * Merges a locale pack into a definition, returning a new definition that
11
+ * additionally carries the pack's language in every localized text. The
12
+ * original definition and the pack are not modified.
13
+ *
14
+ * Packs may be partial (untranslated entries keep their existing locales),
15
+ * but entries referencing unknown question/band/flag/subscale ids or
16
+ * mismatched option counts throw `invalid_argument`.
17
+ */
18
+ export declare function applyLocale(definition: AssessmentDefinition, pack: InventoryLocalePack): AssessmentDefinition;
19
+ /**
20
+ * Returns a copy of a definition containing only the given locales in every
21
+ * localized text (questions, options, bands, flags, subscales). The
22
+ * definition's `defaultLocale` is always kept as the fallback.
23
+ *
24
+ * Use this at the server boundary to avoid shipping unused languages to a
25
+ * client: `res.json(pickLocales(phq9, [userLocale]))`. The original
26
+ * definition is not modified.
27
+ */
28
+ export declare function pickLocales(definition: AssessmentDefinition, locales: string[]): AssessmentDefinition;
9
29
  /** Collects the union of locales present in a set of localized texts. */
10
30
  export declare function collectLocales(texts: Array<LocalizedText | undefined>): string[];
package/dist/esm/i18n.js CHANGED
@@ -1,10 +1,11 @@
1
+ import { PsytoolsError } from "./errors.js";
1
2
  /**
2
3
  * Resolves a `LocalizedText` to a string for the given locale.
3
4
  *
4
5
  * Resolution order: exact locale -> base language of the locale
5
6
  * (`"de-AT"` -> `"de"`) -> `fallbackLocale` -> first available entry.
6
7
  */
7
- export function localize(text, locale, fallbackLocale) {
8
+ export function localizeText(text, locale, fallbackLocale) {
8
9
  const exact = text[locale];
9
10
  if (exact !== undefined)
10
11
  return exact;
@@ -18,6 +19,139 @@ export function localize(text, locale, fallbackLocale) {
18
19
  const first = Object.values(text)[0];
19
20
  return first ?? "";
20
21
  }
22
+ /**
23
+ * Merges a locale pack into a definition, returning a new definition that
24
+ * additionally carries the pack's language in every localized text. The
25
+ * original definition and the pack are not modified.
26
+ *
27
+ * Packs may be partial (untranslated entries keep their existing locales),
28
+ * but entries referencing unknown question/band/flag/subscale ids or
29
+ * mismatched option counts throw `invalid_argument`.
30
+ */
31
+ export function applyLocale(definition, pack) {
32
+ if (pack.id !== definition.id) {
33
+ throw new PsytoolsError("invalid_argument", `Locale pack "${pack.id}" (${pack.locale}) does not belong to assessment "${definition.id}"`);
34
+ }
35
+ const set = (text, value) => value === undefined ? text : { ...text, [pack.locale]: value };
36
+ const setOptions = (options, labels, where) => {
37
+ if (!labels)
38
+ return options;
39
+ if (labels.length !== options.length) {
40
+ throw new PsytoolsError("invalid_argument", `Locale pack "${pack.id}/${pack.locale}": ${where} has ${labels.length} labels for ${options.length} options`);
41
+ }
42
+ return options.map((option, i) => ({ ...option, label: set(option.label, labels[i]) }));
43
+ };
44
+ const setBands = (bands, packBands) => bands?.map((band) => ({ ...band, label: set(band.label, packBands?.[band.id]) }));
45
+ const setFlags = (flags, packFlags) => flags?.map((flag) => ({ ...flag, label: set(flag.label, packFlags?.[flag.id]) }));
46
+ for (const questionId of Object.keys(pack.questions)) {
47
+ if (!definition.questions.some((q) => q.id === questionId)) {
48
+ throw new PsytoolsError("invalid_argument", `Locale pack "${pack.id}/${pack.locale}" references unknown question "${questionId}"`);
49
+ }
50
+ }
51
+ let scoring;
52
+ if (definition.scoring) {
53
+ const s = definition.scoring;
54
+ if (s.kind === "subscales") {
55
+ scoring = {
56
+ ...s,
57
+ subscales: s.subscales.map((subscale) => {
58
+ const entry = pack.subscales?.[subscale.id];
59
+ return {
60
+ ...subscale,
61
+ label: set(subscale.label, entry?.label),
62
+ ...(subscale.bands ? { bands: setBands(subscale.bands, entry?.bands) } : {}),
63
+ };
64
+ }),
65
+ ...(s.flags ? { flags: setFlags(s.flags, pack.flags) } : {}),
66
+ };
67
+ }
68
+ else {
69
+ scoring = {
70
+ ...s,
71
+ ...(s.bands ? { bands: setBands(s.bands, pack.bands) } : {}),
72
+ ...(s.flags ? { flags: setFlags(s.flags, pack.flags) } : {}),
73
+ };
74
+ }
75
+ }
76
+ return {
77
+ ...definition,
78
+ title: set(definition.title, pack.title),
79
+ ...(definition.description ? { description: set(definition.description, pack.description) } : {}),
80
+ ...(definition.instructions ? { instructions: set(definition.instructions, pack.instructions) } : {}),
81
+ options: setOptions(definition.options, pack.options, "options"),
82
+ questions: definition.questions.map((question) => {
83
+ const entry = pack.questions[question.id];
84
+ if (!entry)
85
+ return question;
86
+ return {
87
+ ...question,
88
+ text: set(question.text, entry.text),
89
+ ...(question.options
90
+ ? { options: setOptions(question.options, entry.options, `question "${question.id}"`) }
91
+ : {}),
92
+ };
93
+ }),
94
+ ...(scoring ? { scoring } : {}),
95
+ };
96
+ }
97
+ /**
98
+ * Returns a copy of a definition containing only the given locales in every
99
+ * localized text (questions, options, bands, flags, subscales). The
100
+ * definition's `defaultLocale` is always kept as the fallback.
101
+ *
102
+ * Use this at the server boundary to avoid shipping unused languages to a
103
+ * client: `res.json(pickLocales(phq9, [userLocale]))`. The original
104
+ * definition is not modified.
105
+ */
106
+ export function pickLocales(definition, locales) {
107
+ const keep = new Set([...locales, definition.defaultLocale]);
108
+ const pick = (text) => {
109
+ const out = {};
110
+ for (const [locale, value] of Object.entries(text)) {
111
+ if (keep.has(locale))
112
+ out[locale] = value;
113
+ }
114
+ return out;
115
+ };
116
+ const pickOptions = (options) => options.map((option) => ({ ...option, label: pick(option.label) }));
117
+ const pickBands = (bands) => bands.map((band) => ({ ...band, label: pick(band.label) }));
118
+ const pickFlags = (flags) => flags.map((flag) => ({ ...flag, label: pick(flag.label) }));
119
+ let scoring;
120
+ if (definition.scoring) {
121
+ const s = definition.scoring;
122
+ if (s.kind === "subscales") {
123
+ scoring = {
124
+ ...s,
125
+ subscales: s.subscales.map((subscale) => ({
126
+ ...subscale,
127
+ label: pick(subscale.label),
128
+ ...(subscale.bands ? { bands: pickBands(subscale.bands) } : {}),
129
+ })),
130
+ ...(s.flags ? { flags: pickFlags(s.flags) } : {}),
131
+ };
132
+ }
133
+ else {
134
+ scoring = {
135
+ ...s,
136
+ ...(s.bands ? { bands: pickBands(s.bands) } : {}),
137
+ ...(s.flags ? { flags: pickFlags(s.flags) } : {}),
138
+ };
139
+ }
140
+ }
141
+ return {
142
+ ...definition,
143
+ title: pick(definition.title),
144
+ ...(definition.description ? { description: pick(definition.description) } : {}),
145
+ ...(definition.instructions ? { instructions: pick(definition.instructions) } : {}),
146
+ options: pickOptions(definition.options),
147
+ questions: definition.questions.map((question) => ({
148
+ ...question,
149
+ text: pick(question.text),
150
+ ...(question.options ? { options: pickOptions(question.options) } : {}),
151
+ })),
152
+ ...(scoring ? { scoring } : {}),
153
+ };
154
+ }
21
155
  /** Collects the union of locales present in a set of localized texts. */
22
156
  export function collectLocales(texts) {
23
157
  const locales = new Set();
@@ -1,8 +1,12 @@
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";
1
+ export type { LocalizedText, AssessmentOption, AssessmentQuestion, AssessmentDefinition, ScoreBand, ScoreFlag, SumScoring, SubscaleDefinition, SubscaleScoring, CountScoringItem, CountScoring, MissingDataPolicy, MissingDataStrategy, ScoringDefinition, ValidationIssueCode, AnswerMap, InventoryLocalePack, 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
- export { localize, collectLocales } from "./i18n.ts";
3
+ export type { PsytoolsErrorCode } from "./errors.ts";
4
+ export { localizeText, collectLocales, pickLocales, applyLocale } from "./i18n.ts";
5
+ export { localePacks, availableLocales } from "./locales/index.ts";
6
+ export type { LocalePackLoader } from "./locales/index.ts";
4
7
  export { Assessment, validateDefinition } from "./assessment.ts";
5
8
  export { AssessmentResponse } from "./response.ts";
6
9
  export { evaluate } from "./evaluation.ts";
10
+ export type { EvaluateOptions } from "./evaluation.ts";
7
11
  export { phq9, gad7, dass21, who5, asrs6, aq10, audit, miniIpip, inventories, loadInventory, twoWeekFrequencyOptions, twoWeekInstructions, } from "./inventories/index.ts";
8
12
  export type { InventoryId } from "./inventories/index.ts";
package/dist/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { PsytoolsError } from "./errors.js";
2
- export { localize, collectLocales } from "./i18n.js";
2
+ export { localizeText, collectLocales, pickLocales, applyLocale } from "./i18n.js";
3
+ export { localePacks, availableLocales } from "./locales/index.js";
3
4
  export { Assessment, validateDefinition } from "./assessment.js";
4
5
  export { AssessmentResponse } from "./response.js";
5
6
  export { evaluate } from "./evaluation.js";
@@ -13,36 +13,30 @@ export const aq10 = {
13
13
  version: "1.0.0",
14
14
  title: {
15
15
  en: "Autism Spectrum Quotient (AQ-10) — Adult",
16
- tr: "Otizm Spektrum Anketi (AQ-10) — Yetişkin",
17
- de: "Autismus-Spektrum-Quotient (AQ-10) — Erwachsene",
18
16
  },
19
17
  description: {
20
18
  en: "A 10-item screening questionnaire for autistic traits in adults, condensed from the 50-item Autism Spectrum Quotient.",
21
- tr: "50 maddelik Otizm Spektrum Anketi'nden kısaltılmış, yetişkinlerde otistik özellikleri taramak için 10 maddelik bir ölçek.",
22
- de: "Ein 10-Item-Screeningfragebogen für autistische Merkmale bei Erwachsenen, verkürzt aus dem 50-Item-Autismus-Spektrum-Quotienten.",
23
19
  },
24
20
  instructions: {
25
21
  en: "For each statement, select the answer that best describes you.",
26
- tr: "Her ifade için sizi en iyi tanımlayan yanıtı işaretleyin.",
27
- de: "Wählen Sie zu jeder Aussage die Antwort, die Sie am besten beschreibt.",
28
22
  },
29
23
  defaultLocale: "en",
30
24
  options: [
31
25
  {
32
26
  value: 0,
33
- label: { en: "Definitely disagree", tr: "Kesinlikle katılmıyorum", de: "Stimme überhaupt nicht zu" },
27
+ label: { en: "Definitely disagree" },
34
28
  },
35
29
  {
36
30
  value: 1,
37
- label: { en: "Slightly disagree", tr: "Biraz katılmıyorum", de: "Stimme eher nicht zu" },
31
+ label: { en: "Slightly disagree" },
38
32
  },
39
33
  {
40
34
  value: 2,
41
- label: { en: "Slightly agree", tr: "Biraz katılıyorum", de: "Stimme eher zu" },
35
+ label: { en: "Slightly agree" },
42
36
  },
43
37
  {
44
38
  value: 3,
45
- label: { en: "Definitely agree", tr: "Kesinlikle katılıyorum", de: "Stimme voll und ganz zu" },
39
+ label: { en: "Definitely agree" },
46
40
  },
47
41
  ],
48
42
  questions: [
@@ -50,16 +44,12 @@ export const aq10 = {
50
44
  id: "aq10-1",
51
45
  text: {
52
46
  en: "I often notice small sounds when others do not",
53
- tr: "Başkalarının fark etmediği küçük sesleri sıklıkla fark ederim",
54
- de: "Ich nehme oft leise Geräusche wahr, die andere nicht bemerken",
55
47
  },
56
48
  },
57
49
  {
58
50
  id: "aq10-2",
59
51
  text: {
60
52
  en: "I usually concentrate more on the whole picture, rather than the small details",
61
- tr: "Genellikle küçük ayrıntılardan çok resmin bütününe odaklanırım",
62
- de: "Ich konzentriere mich meist mehr auf das Gesamtbild als auf die kleinen Details",
63
53
  },
64
54
  reverseScored: true,
65
55
  },
@@ -67,8 +57,6 @@ export const aq10 = {
67
57
  id: "aq10-3",
68
58
  text: {
69
59
  en: "I find it easy to do more than one thing at once",
70
- tr: "Aynı anda birden fazla iş yapmak benim için kolaydır",
71
- de: "Es fällt mir leicht, mehrere Dinge gleichzeitig zu tun",
72
60
  },
73
61
  reverseScored: true,
74
62
  },
@@ -76,8 +64,6 @@ export const aq10 = {
76
64
  id: "aq10-4",
77
65
  text: {
78
66
  en: "If there is an interruption, I can switch back to what I was doing very quickly",
79
- tr: "Bir kesinti olursa, yapmakta olduğum işe çok hızlı bir şekilde geri dönebilirim",
80
- de: "Wenn ich unterbrochen werde, kann ich sehr schnell zu meiner Tätigkeit zurückkehren",
81
67
  },
82
68
  reverseScored: true,
83
69
  },
@@ -85,8 +71,6 @@ export const aq10 = {
85
71
  id: "aq10-5",
86
72
  text: {
87
73
  en: "I find it easy to 'read between the lines' when someone is talking to me",
88
- tr: "Biri benimle konuşurken 'satır aralarını okumak' benim için kolaydır",
89
- de: "Es fällt mir leicht, 'zwischen den Zeilen zu lesen', wenn jemand mit mir spricht",
90
74
  },
91
75
  reverseScored: true,
92
76
  },
@@ -94,8 +78,6 @@ export const aq10 = {
94
78
  id: "aq10-6",
95
79
  text: {
96
80
  en: "I know how to tell if someone listening to me is getting bored",
97
- tr: "Beni dinleyen birinin sıkılmaya başladığını nasıl anlayacağımı bilirim",
98
- de: "Ich erkenne, ob jemand, der mir zuhört, sich zu langweilen beginnt",
99
81
  },
100
82
  reverseScored: true,
101
83
  },
@@ -103,24 +85,18 @@ export const aq10 = {
103
85
  id: "aq10-7",
104
86
  text: {
105
87
  en: "When I'm reading a story I find it difficult to work out the characters' intentions",
106
- tr: "Bir öykü okurken karakterlerin niyetlerini anlamakta zorlanırım",
107
- de: "Wenn ich eine Geschichte lese, fällt es mir schwer, die Absichten der Figuren zu erkennen",
108
88
  },
109
89
  },
110
90
  {
111
91
  id: "aq10-8",
112
92
  text: {
113
93
  en: "I like to collect information about categories of things (e.g. types of car, types of bird, types of train, types of plant etc)",
114
- tr: "Belirli kategorilerdeki şeyler hakkında bilgi toplamayı severim (örneğin araba türleri, kuş türleri, tren türleri, bitki türleri vb.)",
115
- de: "Ich sammle gern Informationen über Kategorien von Dingen (z. B. Auto-, Vogel-, Zug- oder Pflanzenarten)",
116
94
  },
117
95
  },
118
96
  {
119
97
  id: "aq10-9",
120
98
  text: {
121
99
  en: "I find it easy to work out what someone is thinking or feeling just by looking at their face",
122
- tr: "Sadece yüzüne bakarak birinin ne düşündüğünü ya da hissettiğini anlamak benim için kolaydır",
123
- de: "Es fällt mir leicht, allein am Gesicht abzulesen, was jemand denkt oder fühlt",
124
100
  },
125
101
  reverseScored: true,
126
102
  },
@@ -128,8 +104,6 @@ export const aq10 = {
128
104
  id: "aq10-10",
129
105
  text: {
130
106
  en: "I find it difficult to work out people's intentions",
131
- tr: "İnsanların niyetlerini anlamakta zorlanırım",
132
- de: "Es fällt mir schwer, die Absichten anderer Menschen zu erkennen",
133
107
  },
134
108
  },
135
109
  ],
@@ -154,8 +128,6 @@ export const aq10 = {
154
128
  max: 5,
155
129
  label: {
156
130
  en: "Below screening threshold",
157
- tr: "Tarama eşiğinin altında",
158
- de: "Unterhalb der Screening-Schwelle",
159
131
  },
160
132
  },
161
133
  {
@@ -164,8 +136,6 @@ export const aq10 = {
164
136
  max: 10,
165
137
  label: {
166
138
  en: "At or above threshold — consider referral for a specialist autism assessment",
167
- tr: "Eşikte ya da üzerinde — uzman otizm değerlendirmesine yönlendirme düşünülmelidir",
168
- de: "An oder über der Schwelle — Überweisung zu einer spezialisierten Autismus-Diagnostik erwägen",
169
139
  },
170
140
  },
171
141
  ],
@@ -174,7 +144,7 @@ export const aq10 = {
174
144
  reference: "Allison, C., Auyeung, B., & Baron-Cohen, S. (2012). Toward brief \"Red Flags\" for autism screening: The Short Autism Spectrum Quotient and the Short Quantitative Checklist in 1,000 cases and 3,000 controls. Journal of the American Academy of Child & Adolescent Psychiatry, 51(2), 202-212.",
175
145
  license: "Free with conditions — (c) Autism Research Centre, University of Cambridge; distributed free of charge, NICE-recommended for clinical screening. Verify licensing with ARC before embedding in commercial products.",
176
146
  licenseFlag: "free-with-conditions",
177
- translationProvenance: "en: reproduced from the original. tr/de: AI translation (Anthropic Claude, claude-fable-5) from the original English; official translations were not consulted and the texts are unverified. See SOURCES.md.",
147
+ translationProvenance: "en: reproduced from the original. Other locales (tr, de, zh, es): AI translation (Anthropic Claude, claude-fable-5) from the original English; official translations were not consulted and the texts are unverified. See SOURCES.md.",
178
148
  note: "Each item scores 1 point in the trait direction; disagree-scored items are modeled as reverseScored.",
179
149
  },
180
150
  };
@@ -12,74 +12,56 @@ export const asrs6 = {
12
12
  version: "1.0.0",
13
13
  title: {
14
14
  en: "Adult ADHD Self-Report Scale (ASRS-v1.1) Screener",
15
- tr: "Erişkin DEHB Kendi Bildirim Ölçeği (ASRS-v1.1) Tarama Formu",
16
- de: "Selbstbeurteilungsskala für ADHS bei Erwachsenen (ASRS-v1.1) Screener",
17
15
  },
18
16
  description: {
19
17
  en: "A 6-item screener for adult attention-deficit/hyperactivity disorder, drawn from the WHO's full 18-item ASRS.",
20
- 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ı.",
21
- de: "Ein 6-Item-Screener für Aufmerksamkeitsdefizit-/Hyperaktivitätsstörung bei Erwachsenen, abgeleitet aus der vollständigen 18-Item-ASRS der WHO.",
22
18
  },
23
19
  instructions: {
24
20
  en: "As you answer each question, select the option that best describes how you have felt and conducted yourself over the past 6 months.",
25
- 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.",
26
- 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.",
27
21
  },
28
22
  defaultLocale: "en",
29
23
  options: [
30
- { value: 0, label: { en: "Never", tr: "Hiçbir zaman", de: "Nie" } },
31
- { value: 1, label: { en: "Rarely", tr: "Nadiren", de: "Selten" } },
32
- { value: 2, label: { en: "Sometimes", tr: "Bazen", de: "Manchmal" } },
33
- { value: 3, label: { en: "Often", tr: "Sık sık", de: "Oft" } },
34
- { value: 4, label: { en: "Very often", tr: "Çok sık", de: "Sehr oft" } },
24
+ { value: 0, label: { en: "Never" } },
25
+ { value: 1, label: { en: "Rarely" } },
26
+ { value: 2, label: { en: "Sometimes" } },
27
+ { value: 3, label: { en: "Often" } },
28
+ { value: 4, label: { en: "Very often" } },
35
29
  ],
36
30
  questions: [
37
31
  {
38
32
  id: "asrs6-1",
39
33
  text: {
40
34
  en: "How often do you have trouble wrapping up the final details of a project, once the challenging parts have been done?",
41
- 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?",
42
- de: "Wie oft haben Sie Schwierigkeiten, die letzten Details eines Projekts abzuschließen, nachdem die schwierigen Teile erledigt sind?",
43
35
  },
44
36
  },
45
37
  {
46
38
  id: "asrs6-2",
47
39
  text: {
48
40
  en: "How often do you have difficulty getting things in order when you have to do a task that requires organization?",
49
- tr: "Organizasyon gerektiren bir iş yapmanız gerektiğinde, işleri sıraya koymakta ne sıklıkla güçlük çekersiniz?",
50
- de: "Wie oft haben Sie Schwierigkeiten, Ordnung in Dinge zu bringen, wenn Sie eine Aufgabe erledigen müssen, die Organisation erfordert?",
51
41
  },
52
42
  },
53
43
  {
54
44
  id: "asrs6-3",
55
45
  text: {
56
46
  en: "How often do you have problems remembering appointments or obligations?",
57
- tr: "Randevularınızı ya da yükümlülüklerinizi hatırlamakta ne sıklıkla güçlük çekersiniz?",
58
- de: "Wie oft haben Sie Probleme, sich an Termine oder Verpflichtungen zu erinnern?",
59
47
  },
60
48
  },
61
49
  {
62
50
  id: "asrs6-4",
63
51
  text: {
64
52
  en: "When you have a task that requires a lot of thought, how often do you avoid or delay getting started?",
65
- 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?",
66
- de: "Wie oft vermeiden oder verzögern Sie den Beginn einer Aufgabe, die viel Nachdenken erfordert?",
67
53
  },
68
54
  },
69
55
  {
70
56
  id: "asrs6-5",
71
57
  text: {
72
58
  en: "How often do you fidget or squirm with your hands or feet when you have to sit down for a long time?",
73
- 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?",
74
- de: "Wie oft zappeln Sie mit Händen oder Füßen, wenn Sie längere Zeit sitzen müssen?",
75
59
  },
76
60
  },
77
61
  {
78
62
  id: "asrs6-6",
79
63
  text: {
80
64
  en: "How often do you feel overly active and compelled to do things, like you were driven by a motor?",
81
- 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?",
82
- de: "Wie oft fühlen Sie sich übermäßig aktiv und getrieben, Dinge zu tun, als würden Sie von einem Motor angetrieben?",
83
65
  },
84
66
  },
85
67
  ],
@@ -100,8 +82,6 @@ export const asrs6 = {
100
82
  max: 3,
101
83
  label: {
102
84
  en: "Symptoms not consistent with adult ADHD",
103
- tr: "Belirtiler erişkin DEHB ile uyumlu değil",
104
- de: "Symptome nicht mit ADHS im Erwachsenenalter vereinbar",
105
85
  },
106
86
  },
107
87
  {
@@ -110,8 +90,6 @@ export const asrs6 = {
110
90
  max: 6,
111
91
  label: {
112
92
  en: "Symptoms highly consistent with adult ADHD — further investigation warranted",
113
- tr: "Belirtiler erişkin DEHB ile yüksek düzeyde uyumlu — ileri değerlendirme gerekir",
114
- de: "Symptome in hohem Maße mit ADHS im Erwachsenenalter vereinbar — weitere Abklärung angezeigt",
115
93
  },
116
94
  },
117
95
  ],
@@ -120,7 +98,7 @@ export const asrs6 = {
120
98
  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.",
121
99
  license: "Free with conditions — (c) WHO / Workgroup on Adult ADHD; free for clinical and research use. Verify licensing with the rights holders before embedding in commercial products.",
122
100
  licenseFlag: "free-with-conditions",
123
- translationProvenance: "en: reproduced from the original. tr/de: AI translation (Anthropic Claude, claude-fable-5) from the original English; official translations were not consulted and the texts are unverified. See SOURCES.md.",
101
+ translationProvenance: "en: reproduced from the original. Other locales (tr, de, zh, es): AI translation (Anthropic Claude, claude-fable-5) from the original English; official translations were not consulted and the texts are unverified. See SOURCES.md.",
124
102
  timeframe: "past 6 months",
125
103
  note: "The score counts screen-positive items, not symptom severity.",
126
104
  },