psytools 0.4.0 → 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 (216) hide show
  1. package/README.md +27 -4
  2. package/SOURCES.md +3 -1
  3. package/dist/cjs/errors.d.ts +1 -1
  4. package/dist/cjs/i18n.d.ts +21 -1
  5. package/dist/cjs/i18n.js +136 -0
  6. package/dist/cjs/index.d.ts +4 -2
  7. package/dist/cjs/index.js +19 -14
  8. package/dist/cjs/inventories/aq10.js +4 -64
  9. package/dist/cjs/inventories/asrs6.js +5 -49
  10. package/dist/cjs/inventories/audit.js +8 -116
  11. package/dist/cjs/inventories/common.js +0 -20
  12. package/dist/cjs/inventories/dass21.js +18 -130
  13. package/dist/cjs/inventories/gad7.js +4 -40
  14. package/dist/cjs/inventories/index.d.ts +11 -2
  15. package/dist/cjs/inventories/index.js +22 -3
  16. package/dist/cjs/inventories/mini-ipip.js +0 -132
  17. package/dist/cjs/inventories/phq9.js +5 -53
  18. package/dist/cjs/inventories/who5.js +4 -56
  19. package/dist/cjs/locales/de/aq10.d.ts +4 -0
  20. package/dist/cjs/locales/de/aq10.js +53 -0
  21. package/dist/cjs/locales/de/asrs6.d.ts +4 -0
  22. package/dist/cjs/locales/de/asrs6.js +42 -0
  23. package/dist/cjs/locales/de/audit.d.ts +4 -0
  24. package/dist/cjs/locales/de/audit.js +80 -0
  25. package/dist/cjs/locales/de/dass21.d.ts +4 -0
  26. package/dist/cjs/locales/de/dass21.js +114 -0
  27. package/dist/cjs/locales/de/gad7.d.ts +4 -0
  28. package/dist/cjs/locales/de/gad7.js +46 -0
  29. package/dist/cjs/locales/de/mini-ipip.d.ts +4 -0
  30. package/dist/cjs/locales/de/mini-ipip.js +97 -0
  31. package/dist/cjs/locales/de/phq9.d.ts +4 -0
  32. package/dist/cjs/locales/de/phq9.js +56 -0
  33. package/dist/cjs/locales/de/who5.d.ts +4 -0
  34. package/dist/cjs/locales/de/who5.js +41 -0
  35. package/dist/cjs/locales/es/aq10.d.ts +4 -0
  36. package/dist/cjs/locales/es/aq10.js +53 -0
  37. package/dist/cjs/locales/es/asrs6.d.ts +4 -0
  38. package/dist/cjs/locales/es/asrs6.js +42 -0
  39. package/dist/cjs/locales/es/audit.d.ts +4 -0
  40. package/dist/cjs/locales/es/audit.js +80 -0
  41. package/dist/cjs/locales/es/dass21.d.ts +4 -0
  42. package/dist/cjs/locales/es/dass21.js +114 -0
  43. package/dist/cjs/locales/es/gad7.d.ts +4 -0
  44. package/dist/cjs/locales/es/gad7.js +46 -0
  45. package/dist/cjs/locales/es/mini-ipip.d.ts +4 -0
  46. package/dist/cjs/locales/es/mini-ipip.js +97 -0
  47. package/dist/cjs/locales/es/phq9.d.ts +4 -0
  48. package/dist/cjs/locales/es/phq9.js +56 -0
  49. package/dist/cjs/locales/es/who5.d.ts +4 -0
  50. package/dist/cjs/locales/es/who5.js +41 -0
  51. package/dist/cjs/locales/index.d.ts +12 -0
  52. package/dist/cjs/locales/index.js +63 -0
  53. package/dist/cjs/locales/tr/aq10.d.ts +4 -0
  54. package/dist/cjs/locales/tr/aq10.js +53 -0
  55. package/dist/cjs/locales/tr/asrs6.d.ts +4 -0
  56. package/dist/cjs/locales/tr/asrs6.js +42 -0
  57. package/dist/cjs/locales/tr/audit.d.ts +4 -0
  58. package/dist/cjs/locales/tr/audit.js +80 -0
  59. package/dist/cjs/locales/tr/dass21.d.ts +4 -0
  60. package/dist/cjs/locales/tr/dass21.js +114 -0
  61. package/dist/cjs/locales/tr/gad7.d.ts +4 -0
  62. package/dist/cjs/locales/tr/gad7.js +46 -0
  63. package/dist/cjs/locales/tr/mini-ipip.d.ts +4 -0
  64. package/dist/cjs/locales/tr/mini-ipip.js +97 -0
  65. package/dist/cjs/locales/tr/phq9.d.ts +4 -0
  66. package/dist/cjs/locales/tr/phq9.js +56 -0
  67. package/dist/cjs/locales/tr/who5.d.ts +4 -0
  68. package/dist/cjs/locales/tr/who5.js +41 -0
  69. package/dist/cjs/locales/zh/aq10.d.ts +4 -0
  70. package/dist/cjs/locales/zh/aq10.js +53 -0
  71. package/dist/cjs/locales/zh/asrs6.d.ts +4 -0
  72. package/dist/cjs/locales/zh/asrs6.js +42 -0
  73. package/dist/cjs/locales/zh/audit.d.ts +4 -0
  74. package/dist/cjs/locales/zh/audit.js +80 -0
  75. package/dist/cjs/locales/zh/dass21.d.ts +4 -0
  76. package/dist/cjs/locales/zh/dass21.js +114 -0
  77. package/dist/cjs/locales/zh/gad7.d.ts +4 -0
  78. package/dist/cjs/locales/zh/gad7.js +46 -0
  79. package/dist/cjs/locales/zh/mini-ipip.d.ts +4 -0
  80. package/dist/cjs/locales/zh/mini-ipip.js +97 -0
  81. package/dist/cjs/locales/zh/phq9.d.ts +4 -0
  82. package/dist/cjs/locales/zh/phq9.js +56 -0
  83. package/dist/cjs/locales/zh/who5.d.ts +4 -0
  84. package/dist/cjs/locales/zh/who5.js +41 -0
  85. package/dist/cjs/types.d.ts +30 -0
  86. package/dist/esm/errors.d.ts +1 -1
  87. package/dist/esm/i18n.d.ts +21 -1
  88. package/dist/esm/i18n.js +134 -0
  89. package/dist/esm/index.d.ts +4 -2
  90. package/dist/esm/index.js +2 -1
  91. package/dist/esm/inventories/aq10.js +4 -64
  92. package/dist/esm/inventories/asrs6.js +5 -49
  93. package/dist/esm/inventories/audit.js +8 -116
  94. package/dist/esm/inventories/common.js +0 -20
  95. package/dist/esm/inventories/dass21.js +18 -130
  96. package/dist/esm/inventories/gad7.js +4 -40
  97. package/dist/esm/inventories/index.d.ts +11 -2
  98. package/dist/esm/inventories/index.js +22 -3
  99. package/dist/esm/inventories/mini-ipip.js +0 -132
  100. package/dist/esm/inventories/phq9.js +5 -53
  101. package/dist/esm/inventories/who5.js +4 -56
  102. package/dist/esm/locales/de/aq10.d.ts +4 -0
  103. package/dist/esm/locales/de/aq10.js +51 -0
  104. package/dist/esm/locales/de/asrs6.d.ts +4 -0
  105. package/dist/esm/locales/de/asrs6.js +40 -0
  106. package/dist/esm/locales/de/audit.d.ts +4 -0
  107. package/dist/esm/locales/de/audit.js +78 -0
  108. package/dist/esm/locales/de/dass21.d.ts +4 -0
  109. package/dist/esm/locales/de/dass21.js +112 -0
  110. package/dist/esm/locales/de/gad7.d.ts +4 -0
  111. package/dist/esm/locales/de/gad7.js +44 -0
  112. package/dist/esm/locales/de/mini-ipip.d.ts +4 -0
  113. package/dist/esm/locales/de/mini-ipip.js +95 -0
  114. package/dist/esm/locales/de/phq9.d.ts +4 -0
  115. package/dist/esm/locales/de/phq9.js +54 -0
  116. package/dist/esm/locales/de/who5.d.ts +4 -0
  117. package/dist/esm/locales/de/who5.js +39 -0
  118. package/dist/esm/locales/es/aq10.d.ts +4 -0
  119. package/dist/esm/locales/es/aq10.js +51 -0
  120. package/dist/esm/locales/es/asrs6.d.ts +4 -0
  121. package/dist/esm/locales/es/asrs6.js +40 -0
  122. package/dist/esm/locales/es/audit.d.ts +4 -0
  123. package/dist/esm/locales/es/audit.js +78 -0
  124. package/dist/esm/locales/es/dass21.d.ts +4 -0
  125. package/dist/esm/locales/es/dass21.js +112 -0
  126. package/dist/esm/locales/es/gad7.d.ts +4 -0
  127. package/dist/esm/locales/es/gad7.js +44 -0
  128. package/dist/esm/locales/es/mini-ipip.d.ts +4 -0
  129. package/dist/esm/locales/es/mini-ipip.js +95 -0
  130. package/dist/esm/locales/es/phq9.d.ts +4 -0
  131. package/dist/esm/locales/es/phq9.js +54 -0
  132. package/dist/esm/locales/es/who5.d.ts +4 -0
  133. package/dist/esm/locales/es/who5.js +39 -0
  134. package/dist/esm/locales/index.d.ts +12 -0
  135. package/dist/esm/locales/index.js +59 -0
  136. package/dist/esm/locales/tr/aq10.d.ts +4 -0
  137. package/dist/esm/locales/tr/aq10.js +51 -0
  138. package/dist/esm/locales/tr/asrs6.d.ts +4 -0
  139. package/dist/esm/locales/tr/asrs6.js +40 -0
  140. package/dist/esm/locales/tr/audit.d.ts +4 -0
  141. package/dist/esm/locales/tr/audit.js +78 -0
  142. package/dist/esm/locales/tr/dass21.d.ts +4 -0
  143. package/dist/esm/locales/tr/dass21.js +112 -0
  144. package/dist/esm/locales/tr/gad7.d.ts +4 -0
  145. package/dist/esm/locales/tr/gad7.js +44 -0
  146. package/dist/esm/locales/tr/mini-ipip.d.ts +4 -0
  147. package/dist/esm/locales/tr/mini-ipip.js +95 -0
  148. package/dist/esm/locales/tr/phq9.d.ts +4 -0
  149. package/dist/esm/locales/tr/phq9.js +54 -0
  150. package/dist/esm/locales/tr/who5.d.ts +4 -0
  151. package/dist/esm/locales/tr/who5.js +39 -0
  152. package/dist/esm/locales/zh/aq10.d.ts +4 -0
  153. package/dist/esm/locales/zh/aq10.js +51 -0
  154. package/dist/esm/locales/zh/asrs6.d.ts +4 -0
  155. package/dist/esm/locales/zh/asrs6.js +40 -0
  156. package/dist/esm/locales/zh/audit.d.ts +4 -0
  157. package/dist/esm/locales/zh/audit.js +78 -0
  158. package/dist/esm/locales/zh/dass21.d.ts +4 -0
  159. package/dist/esm/locales/zh/dass21.js +112 -0
  160. package/dist/esm/locales/zh/gad7.d.ts +4 -0
  161. package/dist/esm/locales/zh/gad7.js +44 -0
  162. package/dist/esm/locales/zh/mini-ipip.d.ts +4 -0
  163. package/dist/esm/locales/zh/mini-ipip.js +95 -0
  164. package/dist/esm/locales/zh/phq9.d.ts +4 -0
  165. package/dist/esm/locales/zh/phq9.js +54 -0
  166. package/dist/esm/locales/zh/who5.d.ts +4 -0
  167. package/dist/esm/locales/zh/who5.js +39 -0
  168. package/dist/esm/types.d.ts +30 -0
  169. package/package.json +21 -1
  170. package/src/errors.ts +1 -0
  171. package/src/i18n.ts +176 -1
  172. package/src/index.ts +4 -1
  173. package/src/inventories/aq10.ts +4 -64
  174. package/src/inventories/asrs6.ts +5 -49
  175. package/src/inventories/audit.ts +8 -116
  176. package/src/inventories/common.ts +0 -20
  177. package/src/inventories/dass21.ts +18 -130
  178. package/src/inventories/gad7.ts +4 -40
  179. package/src/inventories/index.ts +27 -3
  180. package/src/inventories/mini-ipip.ts +0 -132
  181. package/src/inventories/phq9.ts +5 -53
  182. package/src/inventories/who5.ts +4 -56
  183. package/src/locales/de/aq10.ts +54 -0
  184. package/src/locales/de/asrs6.ts +43 -0
  185. package/src/locales/de/audit.ts +81 -0
  186. package/src/locales/de/dass21.ts +115 -0
  187. package/src/locales/de/gad7.ts +47 -0
  188. package/src/locales/de/mini-ipip.ts +98 -0
  189. package/src/locales/de/phq9.ts +57 -0
  190. package/src/locales/de/who5.ts +42 -0
  191. package/src/locales/es/aq10.ts +54 -0
  192. package/src/locales/es/asrs6.ts +43 -0
  193. package/src/locales/es/audit.ts +81 -0
  194. package/src/locales/es/dass21.ts +115 -0
  195. package/src/locales/es/gad7.ts +47 -0
  196. package/src/locales/es/mini-ipip.ts +98 -0
  197. package/src/locales/es/phq9.ts +57 -0
  198. package/src/locales/es/who5.ts +42 -0
  199. package/src/locales/index.ts +64 -0
  200. package/src/locales/tr/aq10.ts +54 -0
  201. package/src/locales/tr/asrs6.ts +43 -0
  202. package/src/locales/tr/audit.ts +81 -0
  203. package/src/locales/tr/dass21.ts +115 -0
  204. package/src/locales/tr/gad7.ts +47 -0
  205. package/src/locales/tr/mini-ipip.ts +98 -0
  206. package/src/locales/tr/phq9.ts +57 -0
  207. package/src/locales/tr/who5.ts +42 -0
  208. package/src/locales/zh/aq10.ts +54 -0
  209. package/src/locales/zh/asrs6.ts +43 -0
  210. package/src/locales/zh/audit.ts +81 -0
  211. package/src/locales/zh/dass21.ts +115 -0
  212. package/src/locales/zh/gad7.ts +47 -0
  213. package/src/locales/zh/mini-ipip.ts +98 -0
  214. package/src/locales/zh/phq9.ts +57 -0
  215. package/src/locales/zh/who5.ts +42 -0
  216. package/src/types.ts +25 -0
package/README.md CHANGED
@@ -5,7 +5,7 @@ Give your app a validated psychological questionnaire — rendered, collected, a
5
5
  ```ts
6
6
  import { loadInventory } from "psytools";
7
7
 
8
- const phq9 = loadInventory("phq9"); // Patient Health Questionnaire-9
8
+ const phq9 = await loadInventory("phq9"); // Patient Health Questionnaire-9
9
9
  phq9.localize("en"); // render-ready questions & options for your UI
10
10
 
11
11
  const response = phq9.createResponse();
@@ -23,6 +23,7 @@ That's a complete depression screening: standardized items, answer validation, p
23
23
  - **Your tests too** — therapists and researchers can define their own instruments as one plain JSON object; psytools validates, localizes, and scores them the same way.
24
24
  - **Everything is plain JSON** — assessments and responses `stringify()`/`parse()` losslessly, so definitions live in your database and travel between backend and frontend. Scoring rules are data, not code, and survive the round trip.
25
25
  - **Safe by default** — every answer is validated against the option scale, incomplete responses can't be scored accidentally, and submitted responses are immutable.
26
+ - **Data minimization by default** — base definitions carry English only; other languages ship as per-inventory locale packs that are lazily imported (and only then enter memory or your bundle) when you request them.
26
27
  - **Runs anywhere** — zero runtime dependencies; Node (>= 18), browsers, and edge runtimes; ESM + CommonJS with full TypeScript declarations.
27
28
 
28
29
  ## Install
@@ -36,7 +37,8 @@ npm install psytools
36
37
  ```ts
37
38
  import { loadInventory } from "psytools";
38
39
 
39
- const phq9 = loadInventory("phq9");
40
+ // Locales are lazy: only the requested packs are loaded.
41
+ const phq9 = await loadInventory("phq9", { locales: ["tr"] });
40
42
 
41
43
  // 1. Render — get a flat, single-locale view for your UI.
42
44
  const view = phq9.localize("tr");
@@ -147,6 +149,26 @@ Questions may also carry their own `options` to override the default scale, and
147
149
 
148
150
  Non-JavaScript backends can validate stored definitions against the published [JSON Schema](schema/assessment-definition.schema.json) (shipped in the npm package under `schema/`).
149
151
 
152
+ ### Data minimization
153
+
154
+ Minimization is the default, at every layer:
155
+
156
+ - **Memory / runtime**: base definitions are English-only. `loadInventory(id, { locales })` dynamically imports just the requested locale packs and merges them — nothing else is ever loaded. `availableLocales(id)` lists what exists.
157
+ - **Bundles**: import a single inventory via `psytools/inventories/<id>` (~2 kB gzipped) and, for static bundling, a specific pack via `psytools/locales/<locale>/<id>`, merged with `applyLocale`:
158
+
159
+ ```ts
160
+ import { phq9 } from "psytools/inventories/phq9"; // en base
161
+ import tr from "psytools/locales/tr/phq9"; // one language pack
162
+ import { Assessment, applyLocale } from "psytools";
163
+
164
+ const assessment = new Assessment(applyLocale(phq9, tr));
165
+ ```
166
+
167
+ Named root imports also tree-shake (`sideEffects: false`).
168
+ - **Payloads**: a loaded definition contains exactly the locales you asked for, so `res.json(assessment.definition)` is already minimal. To slim an existing multi-locale definition (e.g. a stored custom test), use `pickLocales(definition, [userLocale])`.
169
+
170
+ Merged definitions remain one self-contained JSON object — locale loading never breaks the `stringify → DB → parse` round trip.
171
+
150
172
  ### Missing answers
151
173
 
152
174
  Declarative scoring takes an optional missing-data policy governing how incomplete answer sets are scored (they reach the scorer via raw answer maps or `allowIncomplete`):
@@ -200,8 +222,9 @@ const history = rows
200
222
  | `AssessmentResponse` | `answer()`, `answerAll()`, `clearAnswer()`, `status`, `progress()`, `validate()`, `submit()`, `stringify()`/`parse()` |
201
223
  | `evaluate(definition, answers, { evaluator? })` | Standalone scoring (also available as `Assessment#evaluate`) |
202
224
  | `validateDefinition(input)` | Non-throwing structural validation of definitions |
203
- | `loadInventory(id)` / `inventories` | Predefined instruments (definitions also exported by name) |
204
- | `localizeText(text, locale, fallback?)` / `collectLocales(texts)` | Locale helpers |
225
+ | `loadInventory(id, { locales? })` / `inventories` | Predefined instruments (async; English-only base definitions also exported by name) |
226
+ | `applyLocale(definition, pack)` / `availableLocales(id)` / `localePacks` | Lazy per-inventory locale packs |
227
+ | `localizeText(text, locale, fallback?)` / `collectLocales(texts)` / `pickLocales(definition, locales)` | Locale helpers |
205
228
  | `PsytoolsError` | All errors carry a `code` typed as `PsytoolsErrorCode` (e.g. `invalid_value`, `already_submitted`) |
206
229
 
207
230
  ## Development
package/SOURCES.md CHANGED
@@ -24,7 +24,9 @@ The same provenance applies to every bundled inventory. If an inventory ever dev
24
24
  | zh | AI translation (Anthropic Claude, `claude-fable-5`) from the original English | No |
25
25
  | es | AI translation (Anthropic Claude, `claude-fable-5`) from the original English | No |
26
26
 
27
- Official validated translations exist for most of these instruments, but they were **not consulted** in preparing the bundled texts, so they are deliberately not cited as sources. The packaged Turkish and German wording has not been checked against them and has not been psychometrically validated. Validated instruments are only validated for their exact wording — before clinical or research use, obtain the official version for your language and compare or replace the text. Verification contributions from native speakers are very welcome.
27
+ Official validated translations exist for most of these instruments, but they were **not consulted** in preparing the bundled texts, so they are deliberately not cited as sources. The packaged non-English wording has not been checked against them and has not been psychometrically validated. Validated instruments are only validated for their exact wording — before clinical or research use, obtain the official version for your language and compare or replace the text.
28
+
29
+ Non-English texts live as one file per inventory per language under [`src/locales/<locale>/`](src/locales) — exactly the unit a native-speaker reviewer needs. Verification contributions are very welcome.
28
30
 
29
31
  ## PHQ-9 — Patient Health Questionnaire-9 (`phq9`)
30
32
 
@@ -1,5 +1,5 @@
1
1
  /** Every error code psytools can throw, for exhaustive handling. */
2
- export type PsytoolsErrorCode = "malformed" | "duplicate_question" | "invalid_definition" | "unknown_question" | "invalid_value" | "missing_answer" | "already_submitted" | "invalid_response" | "incomplete_response" | "assessment_mismatch" | "no_scoring" | "invalid_json" | "unknown_inventory" | "invalid_argument";
2
+ export type PsytoolsErrorCode = "malformed" | "duplicate_question" | "invalid_definition" | "unknown_question" | "invalid_value" | "missing_answer" | "already_submitted" | "invalid_response" | "incomplete_response" | "assessment_mismatch" | "no_scoring" | "invalid_json" | "unknown_inventory" | "unknown_locale" | "invalid_argument";
3
3
  /** Error thrown by psytools, carrying a stable machine-readable code. */
4
4
  export declare class PsytoolsError extends Error {
5
5
  readonly code: PsytoolsErrorCode;
@@ -1,4 +1,4 @@
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
  *
@@ -6,5 +6,25 @@ import type { LocalizedText } from "./types.ts";
6
6
  * (`"de-AT"` -> `"de"`) -> `fallbackLocale` -> first available entry.
7
7
  */
8
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/cjs/i18n.js CHANGED
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.localizeText = localizeText;
4
+ exports.applyLocale = applyLocale;
5
+ exports.pickLocales = pickLocales;
4
6
  exports.collectLocales = collectLocales;
7
+ const errors_ts_1 = require("./errors.js");
5
8
  /**
6
9
  * Resolves a `LocalizedText` to a string for the given locale.
7
10
  *
@@ -22,6 +25,139 @@ function localizeText(text, locale, fallbackLocale) {
22
25
  const first = Object.values(text)[0];
23
26
  return first ?? "";
24
27
  }
28
+ /**
29
+ * Merges a locale pack into a definition, returning a new definition that
30
+ * additionally carries the pack's language in every localized text. The
31
+ * original definition and the pack are not modified.
32
+ *
33
+ * Packs may be partial (untranslated entries keep their existing locales),
34
+ * but entries referencing unknown question/band/flag/subscale ids or
35
+ * mismatched option counts throw `invalid_argument`.
36
+ */
37
+ function applyLocale(definition, pack) {
38
+ if (pack.id !== definition.id) {
39
+ throw new errors_ts_1.PsytoolsError("invalid_argument", `Locale pack "${pack.id}" (${pack.locale}) does not belong to assessment "${definition.id}"`);
40
+ }
41
+ const set = (text, value) => value === undefined ? text : { ...text, [pack.locale]: value };
42
+ const setOptions = (options, labels, where) => {
43
+ if (!labels)
44
+ return options;
45
+ if (labels.length !== options.length) {
46
+ throw new errors_ts_1.PsytoolsError("invalid_argument", `Locale pack "${pack.id}/${pack.locale}": ${where} has ${labels.length} labels for ${options.length} options`);
47
+ }
48
+ return options.map((option, i) => ({ ...option, label: set(option.label, labels[i]) }));
49
+ };
50
+ const setBands = (bands, packBands) => bands?.map((band) => ({ ...band, label: set(band.label, packBands?.[band.id]) }));
51
+ const setFlags = (flags, packFlags) => flags?.map((flag) => ({ ...flag, label: set(flag.label, packFlags?.[flag.id]) }));
52
+ for (const questionId of Object.keys(pack.questions)) {
53
+ if (!definition.questions.some((q) => q.id === questionId)) {
54
+ throw new errors_ts_1.PsytoolsError("invalid_argument", `Locale pack "${pack.id}/${pack.locale}" references unknown question "${questionId}"`);
55
+ }
56
+ }
57
+ let scoring;
58
+ if (definition.scoring) {
59
+ const s = definition.scoring;
60
+ if (s.kind === "subscales") {
61
+ scoring = {
62
+ ...s,
63
+ subscales: s.subscales.map((subscale) => {
64
+ const entry = pack.subscales?.[subscale.id];
65
+ return {
66
+ ...subscale,
67
+ label: set(subscale.label, entry?.label),
68
+ ...(subscale.bands ? { bands: setBands(subscale.bands, entry?.bands) } : {}),
69
+ };
70
+ }),
71
+ ...(s.flags ? { flags: setFlags(s.flags, pack.flags) } : {}),
72
+ };
73
+ }
74
+ else {
75
+ scoring = {
76
+ ...s,
77
+ ...(s.bands ? { bands: setBands(s.bands, pack.bands) } : {}),
78
+ ...(s.flags ? { flags: setFlags(s.flags, pack.flags) } : {}),
79
+ };
80
+ }
81
+ }
82
+ return {
83
+ ...definition,
84
+ title: set(definition.title, pack.title),
85
+ ...(definition.description ? { description: set(definition.description, pack.description) } : {}),
86
+ ...(definition.instructions ? { instructions: set(definition.instructions, pack.instructions) } : {}),
87
+ options: setOptions(definition.options, pack.options, "options"),
88
+ questions: definition.questions.map((question) => {
89
+ const entry = pack.questions[question.id];
90
+ if (!entry)
91
+ return question;
92
+ return {
93
+ ...question,
94
+ text: set(question.text, entry.text),
95
+ ...(question.options
96
+ ? { options: setOptions(question.options, entry.options, `question "${question.id}"`) }
97
+ : {}),
98
+ };
99
+ }),
100
+ ...(scoring ? { scoring } : {}),
101
+ };
102
+ }
103
+ /**
104
+ * Returns a copy of a definition containing only the given locales in every
105
+ * localized text (questions, options, bands, flags, subscales). The
106
+ * definition's `defaultLocale` is always kept as the fallback.
107
+ *
108
+ * Use this at the server boundary to avoid shipping unused languages to a
109
+ * client: `res.json(pickLocales(phq9, [userLocale]))`. The original
110
+ * definition is not modified.
111
+ */
112
+ function pickLocales(definition, locales) {
113
+ const keep = new Set([...locales, definition.defaultLocale]);
114
+ const pick = (text) => {
115
+ const out = {};
116
+ for (const [locale, value] of Object.entries(text)) {
117
+ if (keep.has(locale))
118
+ out[locale] = value;
119
+ }
120
+ return out;
121
+ };
122
+ const pickOptions = (options) => options.map((option) => ({ ...option, label: pick(option.label) }));
123
+ const pickBands = (bands) => bands.map((band) => ({ ...band, label: pick(band.label) }));
124
+ const pickFlags = (flags) => flags.map((flag) => ({ ...flag, label: pick(flag.label) }));
125
+ let scoring;
126
+ if (definition.scoring) {
127
+ const s = definition.scoring;
128
+ if (s.kind === "subscales") {
129
+ scoring = {
130
+ ...s,
131
+ subscales: s.subscales.map((subscale) => ({
132
+ ...subscale,
133
+ label: pick(subscale.label),
134
+ ...(subscale.bands ? { bands: pickBands(subscale.bands) } : {}),
135
+ })),
136
+ ...(s.flags ? { flags: pickFlags(s.flags) } : {}),
137
+ };
138
+ }
139
+ else {
140
+ scoring = {
141
+ ...s,
142
+ ...(s.bands ? { bands: pickBands(s.bands) } : {}),
143
+ ...(s.flags ? { flags: pickFlags(s.flags) } : {}),
144
+ };
145
+ }
146
+ }
147
+ return {
148
+ ...definition,
149
+ title: pick(definition.title),
150
+ ...(definition.description ? { description: pick(definition.description) } : {}),
151
+ ...(definition.instructions ? { instructions: pick(definition.instructions) } : {}),
152
+ options: pickOptions(definition.options),
153
+ questions: definition.questions.map((question) => ({
154
+ ...question,
155
+ text: pick(question.text),
156
+ ...(question.options ? { options: pickOptions(question.options) } : {}),
157
+ })),
158
+ ...(scoring ? { scoring } : {}),
159
+ };
160
+ }
25
161
  /** Collects the union of locales present in a set of localized texts. */
26
162
  function collectLocales(texts) {
27
163
  const locales = new Set();
@@ -1,7 +1,9 @@
1
- export type { LocalizedText, AssessmentOption, AssessmentQuestion, AssessmentDefinition, ScoreBand, ScoreFlag, SumScoring, SubscaleDefinition, SubscaleScoring, CountScoringItem, CountScoring, MissingDataPolicy, MissingDataStrategy, ScoringDefinition, ValidationIssueCode, 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
3
  export type { PsytoolsErrorCode } from "./errors.ts";
4
- export { localizeText, collectLocales } from "./i18n.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";
5
7
  export { Assessment, validateDefinition } from "./assessment.ts";
6
8
  export { AssessmentResponse } from "./response.ts";
7
9
  export { evaluate } from "./evaluation.ts";
package/dist/cjs/index.js CHANGED
@@ -1,11 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.twoWeekInstructions = exports.twoWeekFrequencyOptions = exports.loadInventory = exports.inventories = exports.miniIpip = exports.audit = exports.aq10 = exports.asrs6 = exports.who5 = exports.dass21 = exports.gad7 = exports.phq9 = exports.evaluate = exports.AssessmentResponse = exports.validateDefinition = exports.Assessment = exports.collectLocales = exports.localizeText = exports.PsytoolsError = void 0;
3
+ exports.twoWeekInstructions = exports.twoWeekFrequencyOptions = exports.loadInventory = exports.inventories = exports.miniIpip = exports.audit = exports.aq10 = exports.asrs6 = exports.who5 = exports.dass21 = exports.gad7 = exports.phq9 = exports.evaluate = exports.AssessmentResponse = exports.validateDefinition = exports.Assessment = exports.availableLocales = exports.localePacks = exports.applyLocale = exports.pickLocales = exports.collectLocales = exports.localizeText = exports.PsytoolsError = void 0;
4
4
  var errors_ts_1 = require("./errors.js");
5
5
  Object.defineProperty(exports, "PsytoolsError", { enumerable: true, get: function () { return errors_ts_1.PsytoolsError; } });
6
6
  var i18n_ts_1 = require("./i18n.js");
7
7
  Object.defineProperty(exports, "localizeText", { enumerable: true, get: function () { return i18n_ts_1.localizeText; } });
8
8
  Object.defineProperty(exports, "collectLocales", { enumerable: true, get: function () { return i18n_ts_1.collectLocales; } });
9
+ Object.defineProperty(exports, "pickLocales", { enumerable: true, get: function () { return i18n_ts_1.pickLocales; } });
10
+ Object.defineProperty(exports, "applyLocale", { enumerable: true, get: function () { return i18n_ts_1.applyLocale; } });
11
+ var index_ts_1 = require("./locales/index.js");
12
+ Object.defineProperty(exports, "localePacks", { enumerable: true, get: function () { return index_ts_1.localePacks; } });
13
+ Object.defineProperty(exports, "availableLocales", { enumerable: true, get: function () { return index_ts_1.availableLocales; } });
9
14
  var assessment_ts_1 = require("./assessment.js");
10
15
  Object.defineProperty(exports, "Assessment", { enumerable: true, get: function () { return assessment_ts_1.Assessment; } });
11
16
  Object.defineProperty(exports, "validateDefinition", { enumerable: true, get: function () { return assessment_ts_1.validateDefinition; } });
@@ -13,16 +18,16 @@ var response_ts_1 = require("./response.js");
13
18
  Object.defineProperty(exports, "AssessmentResponse", { enumerable: true, get: function () { return response_ts_1.AssessmentResponse; } });
14
19
  var evaluation_ts_1 = require("./evaluation.js");
15
20
  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, "who5", { enumerable: true, get: function () { return index_ts_1.who5; } });
21
- Object.defineProperty(exports, "asrs6", { enumerable: true, get: function () { return index_ts_1.asrs6; } });
22
- Object.defineProperty(exports, "aq10", { enumerable: true, get: function () { return index_ts_1.aq10; } });
23
- Object.defineProperty(exports, "audit", { enumerable: true, get: function () { return index_ts_1.audit; } });
24
- Object.defineProperty(exports, "miniIpip", { enumerable: true, get: function () { return index_ts_1.miniIpip; } });
25
- Object.defineProperty(exports, "inventories", { enumerable: true, get: function () { return index_ts_1.inventories; } });
26
- Object.defineProperty(exports, "loadInventory", { enumerable: true, get: function () { return index_ts_1.loadInventory; } });
27
- Object.defineProperty(exports, "twoWeekFrequencyOptions", { enumerable: true, get: function () { return index_ts_1.twoWeekFrequencyOptions; } });
28
- Object.defineProperty(exports, "twoWeekInstructions", { enumerable: true, get: function () { return index_ts_1.twoWeekInstructions; } });
21
+ var index_ts_2 = require("./inventories/index.js");
22
+ Object.defineProperty(exports, "phq9", { enumerable: true, get: function () { return index_ts_2.phq9; } });
23
+ Object.defineProperty(exports, "gad7", { enumerable: true, get: function () { return index_ts_2.gad7; } });
24
+ Object.defineProperty(exports, "dass21", { enumerable: true, get: function () { return index_ts_2.dass21; } });
25
+ Object.defineProperty(exports, "who5", { enumerable: true, get: function () { return index_ts_2.who5; } });
26
+ Object.defineProperty(exports, "asrs6", { enumerable: true, get: function () { return index_ts_2.asrs6; } });
27
+ Object.defineProperty(exports, "aq10", { enumerable: true, get: function () { return index_ts_2.aq10; } });
28
+ Object.defineProperty(exports, "audit", { enumerable: true, get: function () { return index_ts_2.audit; } });
29
+ Object.defineProperty(exports, "miniIpip", { enumerable: true, get: function () { return index_ts_2.miniIpip; } });
30
+ Object.defineProperty(exports, "inventories", { enumerable: true, get: function () { return index_ts_2.inventories; } });
31
+ Object.defineProperty(exports, "loadInventory", { enumerable: true, get: function () { return index_ts_2.loadInventory; } });
32
+ Object.defineProperty(exports, "twoWeekFrequencyOptions", { enumerable: true, get: function () { return index_ts_2.twoWeekFrequencyOptions; } });
33
+ Object.defineProperty(exports, "twoWeekInstructions", { enumerable: true, get: function () { return index_ts_2.twoWeekInstructions; } });
@@ -16,42 +16,30 @@ exports.aq10 = {
16
16
  version: "1.0.0",
17
17
  title: {
18
18
  en: "Autism Spectrum Quotient (AQ-10) — Adult",
19
- tr: "Otizm Spektrum Anketi (AQ-10) — Yetişkin",
20
- de: "Autismus-Spektrum-Quotient (AQ-10) — Erwachsene",
21
- zh: "自闭症谱系商数问卷(AQ-10)— 成人版",
22
- es: "Cociente del Espectro Autista (AQ-10) — Adultos",
23
19
  },
24
20
  description: {
25
21
  en: "A 10-item screening questionnaire for autistic traits in adults, condensed from the 50-item Autism Spectrum Quotient.",
26
- tr: "50 maddelik Otizm Spektrum Anketi'nden kısaltılmış, yetişkinlerde otistik özellikleri taramak için 10 maddelik bir ölçek.",
27
- de: "Ein 10-Item-Screeningfragebogen für autistische Merkmale bei Erwachsenen, verkürzt aus dem 50-Item-Autismus-Spektrum-Quotienten.",
28
- zh: "一份用于筛查成人自闭症特质的10条目问卷,由50条目的自闭症谱系商数量表精简而成。",
29
- es: "Un cuestionario de cribado de 10 ítems para rasgos autistas en adultos, condensado a partir del Cociente del Espectro Autista de 50 ítems.",
30
22
  },
31
23
  instructions: {
32
24
  en: "For each statement, select the answer that best describes you.",
33
- tr: "Her ifade için sizi en iyi tanımlayan yanıtı işaretleyin.",
34
- de: "Wählen Sie zu jeder Aussage die Antwort, die Sie am besten beschreibt.",
35
- zh: "请针对每条陈述,选择最符合您情况的答案。",
36
- es: "Para cada afirmación, seleccione la respuesta que mejor lo describa.",
37
25
  },
38
26
  defaultLocale: "en",
39
27
  options: [
40
28
  {
41
29
  value: 0,
42
- label: { en: "Definitely disagree", tr: "Kesinlikle katılmıyorum", de: "Stimme überhaupt nicht zu", zh: "完全不同意", es: "Totalmente en desacuerdo" },
30
+ label: { en: "Definitely disagree" },
43
31
  },
44
32
  {
45
33
  value: 1,
46
- label: { en: "Slightly disagree", tr: "Biraz katılmıyorum", de: "Stimme eher nicht zu", zh: "有点不同意", es: "Ligeramente en desacuerdo" },
34
+ label: { en: "Slightly disagree" },
47
35
  },
48
36
  {
49
37
  value: 2,
50
- label: { en: "Slightly agree", tr: "Biraz katılıyorum", de: "Stimme eher zu", zh: "有点同意", es: "Ligeramente de acuerdo" },
38
+ label: { en: "Slightly agree" },
51
39
  },
52
40
  {
53
41
  value: 3,
54
- label: { en: "Definitely agree", tr: "Kesinlikle katılıyorum", de: "Stimme voll und ganz zu", zh: "完全同意", es: "Totalmente de acuerdo" },
42
+ label: { en: "Definitely agree" },
55
43
  },
56
44
  ],
57
45
  questions: [
@@ -59,20 +47,12 @@ exports.aq10 = {
59
47
  id: "aq10-1",
60
48
  text: {
61
49
  en: "I often notice small sounds when others do not",
62
- tr: "Başkalarının fark etmediği küçük sesleri sıklıkla fark ederim",
63
- de: "Ich nehme oft leise Geräusche wahr, die andere nicht bemerken",
64
- zh: "我经常注意到别人注意不到的微小声音",
65
- es: "A menudo noto pequeños sonidos que otras personas no perciben",
66
50
  },
67
51
  },
68
52
  {
69
53
  id: "aq10-2",
70
54
  text: {
71
55
  en: "I usually concentrate more on the whole picture, rather than the small details",
72
- tr: "Genellikle küçük ayrıntılardan çok resmin bütününe odaklanırım",
73
- de: "Ich konzentriere mich meist mehr auf das Gesamtbild als auf die kleinen Details",
74
- zh: "我通常更关注事情的整体,而不是小细节",
75
- es: "Normalmente me concentro más en la imagen global que en los pequeños detalles",
76
56
  },
77
57
  reverseScored: true,
78
58
  },
@@ -80,10 +60,6 @@ exports.aq10 = {
80
60
  id: "aq10-3",
81
61
  text: {
82
62
  en: "I find it easy to do more than one thing at once",
83
- tr: "Aynı anda birden fazla iş yapmak benim için kolaydır",
84
- de: "Es fällt mir leicht, mehrere Dinge gleichzeitig zu tun",
85
- zh: "我觉得同时做几件事情很容易",
86
- es: "Me resulta fácil hacer más de una cosa a la vez",
87
63
  },
88
64
  reverseScored: true,
89
65
  },
@@ -91,10 +67,6 @@ exports.aq10 = {
91
67
  id: "aq10-4",
92
68
  text: {
93
69
  en: "If there is an interruption, I can switch back to what I was doing very quickly",
94
- tr: "Bir kesinti olursa, yapmakta olduğum işe çok hızlı bir şekilde geri dönebilirim",
95
- de: "Wenn ich unterbrochen werde, kann ich sehr schnell zu meiner Tätigkeit zurückkehren",
96
- zh: "如果被打断,我能很快回到原来正在做的事情上",
97
- es: "Si hay una interrupción, puedo volver muy rápidamente a lo que estaba haciendo",
98
70
  },
99
71
  reverseScored: true,
100
72
  },
@@ -102,10 +74,6 @@ exports.aq10 = {
102
74
  id: "aq10-5",
103
75
  text: {
104
76
  en: "I find it easy to 'read between the lines' when someone is talking to me",
105
- tr: "Biri benimle konuşurken 'satır aralarını okumak' benim için kolaydır",
106
- de: "Es fällt mir leicht, 'zwischen den Zeilen zu lesen', wenn jemand mit mir spricht",
107
- zh: "当别人和我说话时,我觉得'听出言外之意'很容易",
108
- es: "Me resulta fácil 'leer entre líneas' cuando alguien me está hablando",
109
77
  },
110
78
  reverseScored: true,
111
79
  },
@@ -113,10 +81,6 @@ exports.aq10 = {
113
81
  id: "aq10-6",
114
82
  text: {
115
83
  en: "I know how to tell if someone listening to me is getting bored",
116
- tr: "Beni dinleyen birinin sıkılmaya başladığını nasıl anlayacağımı bilirim",
117
- de: "Ich erkenne, ob jemand, der mir zuhört, sich zu langweilen beginnt",
118
- zh: "我知道如何判断听我说话的人是否开始感到厌烦",
119
- es: "Sé darme cuenta de si la persona que me escucha se está aburriendo",
120
84
  },
121
85
  reverseScored: true,
122
86
  },
@@ -124,30 +88,18 @@ exports.aq10 = {
124
88
  id: "aq10-7",
125
89
  text: {
126
90
  en: "When I'm reading a story I find it difficult to work out the characters' intentions",
127
- tr: "Bir öykü okurken karakterlerin niyetlerini anlamakta zorlanırım",
128
- de: "Wenn ich eine Geschichte lese, fällt es mir schwer, die Absichten der Figuren zu erkennen",
129
- zh: "读故事时,我很难弄清人物的意图",
130
- es: "Cuando leo una historia, me resulta difícil deducir las intenciones de los personajes",
131
91
  },
132
92
  },
133
93
  {
134
94
  id: "aq10-8",
135
95
  text: {
136
96
  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)",
137
- tr: "Belirli kategorilerdeki şeyler hakkında bilgi toplamayı severim (örneğin araba türleri, kuş türleri, tren türleri, bitki türleri vb.)",
138
- de: "Ich sammle gern Informationen über Kategorien von Dingen (z. B. Auto-, Vogel-, Zug- oder Pflanzenarten)",
139
- zh: "我喜欢收集各类事物的信息(例如汽车的类型、鸟的种类、火车的类型、植物的种类等)",
140
- es: "Me gusta recopilar información sobre categorías de cosas (p. ej., tipos de coches, de aves, de trenes, de plantas, etc.)",
141
97
  },
142
98
  },
143
99
  {
144
100
  id: "aq10-9",
145
101
  text: {
146
102
  en: "I find it easy to work out what someone is thinking or feeling just by looking at their face",
147
- tr: "Sadece yüzüne bakarak birinin ne düşündüğünü ya da hissettiğini anlamak benim için kolaydır",
148
- de: "Es fällt mir leicht, allein am Gesicht abzulesen, was jemand denkt oder fühlt",
149
- zh: "我觉得只看别人的脸就能轻松看出对方在想什么或有什么感受",
150
- es: "Me resulta fácil deducir lo que alguien piensa o siente con solo mirarle la cara",
151
103
  },
152
104
  reverseScored: true,
153
105
  },
@@ -155,10 +107,6 @@ exports.aq10 = {
155
107
  id: "aq10-10",
156
108
  text: {
157
109
  en: "I find it difficult to work out people's intentions",
158
- tr: "İnsanların niyetlerini anlamakta zorlanırım",
159
- de: "Es fällt mir schwer, die Absichten anderer Menschen zu erkennen",
160
- zh: "我很难弄清别人的意图",
161
- es: "Me resulta difícil deducir las intenciones de las personas",
162
110
  },
163
111
  },
164
112
  ],
@@ -183,10 +131,6 @@ exports.aq10 = {
183
131
  max: 5,
184
132
  label: {
185
133
  en: "Below screening threshold",
186
- tr: "Tarama eşiğinin altında",
187
- de: "Unterhalb der Screening-Schwelle",
188
- zh: "低于筛查阈值",
189
- es: "Por debajo del umbral de cribado",
190
134
  },
191
135
  },
192
136
  {
@@ -195,10 +139,6 @@ exports.aq10 = {
195
139
  max: 10,
196
140
  label: {
197
141
  en: "At or above threshold — consider referral for a specialist autism assessment",
198
- tr: "Eşikte ya da üzerinde — uzman otizm değerlendirmesine yönlendirme düşünülmelidir",
199
- de: "An oder über der Schwelle — Überweisung zu einer spezialisierten Autismus-Diagnostik erwägen",
200
- zh: "达到或超过阈值——建议考虑转介进行自闭症专科评估",
201
- es: "En el umbral o por encima — considere la derivación para una evaluación especializada de autismo",
202
142
  },
203
143
  },
204
144
  ],
@@ -15,92 +15,56 @@ exports.asrs6 = {
15
15
  version: "1.0.0",
16
16
  title: {
17
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
- zh: "成人ADHD自评量表(ASRS-v1.1)筛查问卷",
21
- es: "Escala de Autoevaluación del TDAH en Adultos (ASRS-v1.1) — Cuestionario de cribado",
22
18
  },
23
19
  description: {
24
20
  en: "A 6-item screener for adult attention-deficit/hyperactivity disorder, drawn from the WHO's full 18-item ASRS.",
25
- 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ı.",
26
- de: "Ein 6-Item-Screener für Aufmerksamkeitsdefizit-/Hyperaktivitätsstörung bei Erwachsenen, abgeleitet aus der vollständigen 18-Item-ASRS der WHO.",
27
- zh: "一份包含6个条目的成人注意缺陷/多动障碍筛查问卷,摘自世界卫生组织完整的18条目ASRS量表。",
28
- es: "Un cuestionario de cribado de 6 ítems para el trastorno por déficit de atención e hiperactividad en adultos, extraído de la ASRS completa de 18 ítems de la OMS.",
29
21
  },
30
22
  instructions: {
31
23
  en: "As you answer each question, select the option that best describes how you have felt and conducted yourself over the past 6 months.",
32
- 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.",
33
- 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.",
34
- zh: "回答每个问题时,请选择最能描述您在过去6个月中的感受和行为表现的选项。",
35
- es: "Al responder cada pregunta, seleccione la opción que mejor describa cómo se ha sentido y comportado durante los últimos 6 meses.",
36
24
  },
37
25
  defaultLocale: "en",
38
26
  options: [
39
- { value: 0, label: { en: "Never", tr: "Hiçbir zaman", de: "Nie", zh: "从不", es: "Nunca" } },
40
- { value: 1, label: { en: "Rarely", tr: "Nadiren", de: "Selten", zh: "很少", es: "Rara vez" } },
41
- { value: 2, label: { en: "Sometimes", tr: "Bazen", de: "Manchmal", zh: "有时", es: "A veces" } },
42
- { value: 3, label: { en: "Often", tr: "Sık sık", de: "Oft", zh: "经常", es: "A menudo" } },
43
- { value: 4, label: { en: "Very often", tr: "Çok sık", de: "Sehr oft", zh: "非常频繁", es: "Muy a menudo" } },
27
+ { value: 0, label: { en: "Never" } },
28
+ { value: 1, label: { en: "Rarely" } },
29
+ { value: 2, label: { en: "Sometimes" } },
30
+ { value: 3, label: { en: "Often" } },
31
+ { value: 4, label: { en: "Very often" } },
44
32
  ],
45
33
  questions: [
46
34
  {
47
35
  id: "asrs6-1",
48
36
  text: {
49
37
  en: "How often do you have trouble wrapping up the final details of a project, once the challenging parts have been done?",
50
- 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?",
51
- de: "Wie oft haben Sie Schwierigkeiten, die letzten Details eines Projekts abzuschließen, nachdem die schwierigen Teile erledigt sind?",
52
- zh: "在完成一项工作中最具挑战性的部分之后,您在收尾处理最后细节时遇到困难的频率有多高?",
53
- es: "¿Con qué frecuencia tiene dificultades para ultimar los detalles finales de un proyecto, una vez terminadas las partes más difíciles?",
54
38
  },
55
39
  },
56
40
  {
57
41
  id: "asrs6-2",
58
42
  text: {
59
43
  en: "How often do you have difficulty getting things in order when you have to do a task that requires organization?",
60
- tr: "Organizasyon gerektiren bir iş yapmanız gerektiğinde, işleri sıraya koymakta ne sıklıkla güçlük çekersiniz?",
61
- de: "Wie oft haben Sie Schwierigkeiten, Ordnung in Dinge zu bringen, wenn Sie eine Aufgabe erledigen müssen, die Organisation erfordert?",
62
- zh: "当您需要完成一项讲求条理的任务时,您在把事情安排得井井有条方面遇到困难的频率有多高?",
63
- es: "¿Con qué frecuencia tiene dificultades para poner las cosas en orden cuando debe realizar una tarea que requiere organización?",
64
44
  },
65
45
  },
66
46
  {
67
47
  id: "asrs6-3",
68
48
  text: {
69
49
  en: "How often do you have problems remembering appointments or obligations?",
70
- tr: "Randevularınızı ya da yükümlülüklerinizi hatırlamakta ne sıklıkla güçlük çekersiniz?",
71
- de: "Wie oft haben Sie Probleme, sich an Termine oder Verpflichtungen zu erinnern?",
72
- zh: "您忘记约会或应办事项的频率有多高?",
73
- es: "¿Con qué frecuencia tiene problemas para recordar citas u obligaciones?",
74
50
  },
75
51
  },
76
52
  {
77
53
  id: "asrs6-4",
78
54
  text: {
79
55
  en: "When you have a task that requires a lot of thought, how often do you avoid or delay getting started?",
80
- 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?",
81
- de: "Wie oft vermeiden oder verzögern Sie den Beginn einer Aufgabe, die viel Nachdenken erfordert?",
82
- zh: "当您有一项需要动很多脑筋的任务时,您回避或拖延着手去做的频率有多高?",
83
- es: "Cuando tiene una tarea que requiere pensar mucho, ¿con qué frecuencia evita o retrasa empezarla?",
84
56
  },
85
57
  },
86
58
  {
87
59
  id: "asrs6-5",
88
60
  text: {
89
61
  en: "How often do you fidget or squirm with your hands or feet when you have to sit down for a long time?",
90
- 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?",
91
- de: "Wie oft zappeln Sie mit Händen oder Füßen, wenn Sie längere Zeit sitzen müssen?",
92
- zh: "当您必须长时间坐着时,您手脚不停地动、坐立不安的频率有多高?",
93
- es: "¿Con qué frecuencia mueve o agita las manos o los pies cuando tiene que permanecer sentado durante mucho tiempo?",
94
62
  },
95
63
  },
96
64
  {
97
65
  id: "asrs6-6",
98
66
  text: {
99
67
  en: "How often do you feel overly active and compelled to do things, like you were driven by a motor?",
100
- 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?",
101
- de: "Wie oft fühlen Sie sich übermäßig aktiv und getrieben, Dinge zu tun, als würden Sie von einem Motor angetrieben?",
102
- zh: "您感到自己过度活跃、不得不做些什么、就像被马达驱动着一样的频率有多高?",
103
- es: "¿Con qué frecuencia se siente demasiado activo y con la necesidad de hacer cosas, como si lo impulsara un motor?",
104
68
  },
105
69
  },
106
70
  ],
@@ -121,10 +85,6 @@ exports.asrs6 = {
121
85
  max: 3,
122
86
  label: {
123
87
  en: "Symptoms not consistent with adult ADHD",
124
- tr: "Belirtiler erişkin DEHB ile uyumlu değil",
125
- de: "Symptome nicht mit ADHS im Erwachsenenalter vereinbar",
126
- zh: "症状与成人ADHD不相符",
127
- es: "Síntomas no compatibles con TDAH en adultos",
128
88
  },
129
89
  },
130
90
  {
@@ -133,10 +93,6 @@ exports.asrs6 = {
133
93
  max: 6,
134
94
  label: {
135
95
  en: "Symptoms highly consistent with adult ADHD — further investigation warranted",
136
- tr: "Belirtiler erişkin DEHB ile yüksek düzeyde uyumlu — ileri değerlendirme gerekir",
137
- de: "Symptome in hohem Maße mit ADHS im Erwachsenenalter vereinbar — weitere Abklärung angezeigt",
138
- zh: "症状与成人ADHD高度相符——建议作进一步评估",
139
- es: "Síntomas altamente compatibles con TDAH en adultos — se recomienda una evaluación adicional",
140
96
  },
141
97
  },
142
98
  ],