@baravak/risloo-profile-cli 3.1.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 (200) hide show
  1. package/.github/workflows/push.yml +14 -0
  2. package/.prettierrc +16 -0
  3. package/.yarn/releases/yarn-1.22.19.cjs +147529 -0
  4. package/.yarnrc.yml +1 -0
  5. package/README.md +98 -0
  6. package/bin/risloo.js +9 -0
  7. package/package.json +44 -0
  8. package/src/Gift.js +29 -0
  9. package/src/Profile.js +405 -0
  10. package/src/cli-commands/Executor.js +118 -0
  11. package/src/cli-commands/ExtractExecutor.js +194 -0
  12. package/src/cli-commands/GiftExecutor.js +56 -0
  13. package/src/cli-commands/utilities/BaseOps.js +71 -0
  14. package/src/cli-commands/utilities/Benchmarker.js +88 -0
  15. package/src/cli-commands/utilities/CustomErrors.js +14 -0
  16. package/src/cli-commands/utilities/Response.js +59 -0
  17. package/src/cli-commands/utilities/STATUSES.js +16 -0
  18. package/src/cli-commands/utilities/Status.js +9 -0
  19. package/src/cli.js +125 -0
  20. package/src/handlebars/helpers/abs.js +8 -0
  21. package/src/handlebars/helpers/addCommas.js +8 -0
  22. package/src/handlebars/helpers/array.js +8 -0
  23. package/src/handlebars/helpers/assignGlobal.js +9 -0
  24. package/src/handlebars/helpers/boolean.js +19 -0
  25. package/src/handlebars/helpers/ceil.js +8 -0
  26. package/src/handlebars/helpers/concat.js +8 -0
  27. package/src/handlebars/helpers/cos.js +8 -0
  28. package/src/handlebars/helpers/displacePoint.js +11 -0
  29. package/src/handlebars/helpers/ellipsisChars.js +10 -0
  30. package/src/handlebars/helpers/ellipsisLines.js +11 -0
  31. package/src/handlebars/helpers/first.js +11 -0
  32. package/src/handlebars/helpers/floor.js +8 -0
  33. package/src/handlebars/helpers/forLoop.js +15 -0
  34. package/src/handlebars/helpers/getArrOfProp.js +8 -0
  35. package/src/handlebars/helpers/isArray.js +8 -0
  36. package/src/handlebars/helpers/join.js +10 -0
  37. package/src/handlebars/helpers/last.js +11 -0
  38. package/src/handlebars/helpers/lineWrap.js +28 -0
  39. package/src/handlebars/helpers/math.js +24 -0
  40. package/src/handlebars/helpers/modulo.js +8 -0
  41. package/src/handlebars/helpers/normalizeAngle.js +7 -0
  42. package/src/handlebars/helpers/object.js +8 -0
  43. package/src/handlebars/helpers/objectEntries.js +8 -0
  44. package/src/handlebars/helpers/polarToCartesian.js +14 -0
  45. package/src/handlebars/helpers/prepend.js +10 -0
  46. package/src/handlebars/helpers/profiles/bar.js +45 -0
  47. package/src/handlebars/helpers/profiles/calcGaugeSidePoints.js +34 -0
  48. package/src/handlebars/helpers/profiles/gauge.js +61 -0
  49. package/src/handlebars/helpers/profiles/polygon.js +40 -0
  50. package/src/handlebars/helpers/reverse.js +9 -0
  51. package/src/handlebars/helpers/roundToTwo.js +8 -0
  52. package/src/handlebars/helpers/setVar.js +8 -0
  53. package/src/handlebars/helpers/sin.js +8 -0
  54. package/src/handlebars/helpers/split.js +8 -0
  55. package/src/handlebars/helpers/tan.js +8 -0
  56. package/src/handlebars/helpers/ternary.js +9 -0
  57. package/src/handlebars/helpers/toDeg.js +8 -0
  58. package/src/handlebars/helpers/toRad.js +8 -0
  59. package/src/handlebars/helpers/withGroup.js +20 -0
  60. package/src/handlebars/helpers/wrapOnNewline.js +11 -0
  61. package/src/handlebars/helpers.js +86 -0
  62. package/src/handlebars/importPartials.js +40 -0
  63. package/src/handlebars/init.js +15 -0
  64. package/src/publish/bot.js +91 -0
  65. package/src/publish/json/gift/gift.json +16 -0
  66. package/src/publish/json/profiles/16PF93.json +201 -0
  67. package/src/publish/json/profiles/AEQ93.json +96 -0
  68. package/src/publish/json/profiles/AMS93.json +102 -0
  69. package/src/publish/json/profiles/AMS9A.json +102 -0
  70. package/src/publish/json/profiles/BAOMEIS93.json +99 -0
  71. package/src/publish/json/profiles/BEQI93.json +1589 -0
  72. package/src/publish/json/profiles/CAATS93.json +11355 -0
  73. package/src/publish/json/profiles/CADS93.json +351 -0
  74. package/src/publish/json/profiles/CARSP93.json +96 -0
  75. package/src/publish/json/profiles/CERQ93.json +106 -0
  76. package/src/publish/json/profiles/CRAAS93.json +98 -0
  77. package/src/publish/json/profiles/CSI93.json +143 -0
  78. package/src/publish/json/profiles/DSWLS93.json +93 -0
  79. package/src/publish/json/profiles/EMSS93.json +116 -0
  80. package/src/publish/json/profiles/FACES93.json +106 -0
  81. package/src/publish/json/profiles/FTEPT93.json +102 -0
  82. package/src/publish/json/profiles/GMIT93.json +98 -0
  83. package/src/publish/json/profiles/HPL93.json +102 -0
  84. package/src/publish/json/profiles/IBT93.json +106 -0
  85. package/src/publish/json/profiles/IUS93.json +93 -0
  86. package/src/publish/json/profiles/JCSI93.json +102 -0
  87. package/src/publish/json/profiles/JPFQ93.json +1 -0
  88. package/src/publish/json/profiles/KJGI93.json +100 -0
  89. package/src/publish/json/profiles/LMIQ93.json +109 -0
  90. package/src/publish/json/profiles/MMFAD93.json +103 -0
  91. package/src/publish/json/profiles/MMFAD9A.json +103 -0
  92. package/src/publish/json/profiles/MOCI93.json +100 -0
  93. package/src/publish/json/profiles/OBQ4493.json +96 -0
  94. package/src/publish/json/profiles/PIES93.json +104 -0
  95. package/src/publish/json/profiles/PIES9A.json +104 -0
  96. package/src/publish/json/profiles/PMCIEF93.json +1 -0
  97. package/src/publish/json/profiles/PSWQ93.json +97 -0
  98. package/src/publish/json/profiles/RIASEC93.json +2511 -0
  99. package/src/publish/json/profiles/SAFE93.json +110 -0
  100. package/src/publish/json/profiles/SASQ93.json +92 -0
  101. package/src/publish/json/profiles/SCASP93.json +611 -0
  102. package/src/publish/json/profiles/SDCAQ93.json +96 -0
  103. package/src/publish/json/profiles/STAIY93.json +98 -0
  104. package/src/publish/json/profiles/WAQ93.json +100 -0
  105. package/src/publish/json/profiles/YBOCS93.json +1322 -0
  106. package/src/publish/json/profiles/empty.json +139 -0
  107. package/src/publish/new-version.hbs +11 -0
  108. package/src/publish/test.js +109 -0
  109. package/src/qrcode/qrCodeGenerator.js +14 -0
  110. package/src/qrcode/qrRender.js +229 -0
  111. package/src/samples/16PF93.js +158 -0
  112. package/src/samples/AEQ93.js +121 -0
  113. package/src/samples/AMS93.js +139 -0
  114. package/src/samples/AMS9A.js +9 -0
  115. package/src/samples/BAOMEIS93.js +146 -0
  116. package/src/samples/BEQI93.js +255 -0
  117. package/src/samples/CAATS93.js +218 -0
  118. package/src/samples/CADS93.js +161 -0
  119. package/src/samples/CARSP93.js +134 -0
  120. package/src/samples/CERQ93.js +195 -0
  121. package/src/samples/CRAAS93.js +141 -0
  122. package/src/samples/CSI93.js +315 -0
  123. package/src/samples/DSWLS93.js +112 -0
  124. package/src/samples/EMSS93.js +178 -0
  125. package/src/samples/FACES93.js +225 -0
  126. package/src/samples/FTEPT93.js +167 -0
  127. package/src/samples/GMIT93.js +142 -0
  128. package/src/samples/HPL93.js +132 -0
  129. package/src/samples/IBT93.js +99 -0
  130. package/src/samples/IUS93.js +204 -0
  131. package/src/samples/JCSI93.js +174 -0
  132. package/src/samples/JPFQ93.js +74 -0
  133. package/src/samples/KJGI93.js +136 -0
  134. package/src/samples/LMIQ93.js +188 -0
  135. package/src/samples/MMFAD93.js +135 -0
  136. package/src/samples/MMFAD9A.js +31 -0
  137. package/src/samples/MOCI93.js +128 -0
  138. package/src/samples/OBQ4493.js +132 -0
  139. package/src/samples/PIES93.js +228 -0
  140. package/src/samples/PIES9A.js +32 -0
  141. package/src/samples/PMCIEF93.js +64 -0
  142. package/src/samples/PSWQ93.js +126 -0
  143. package/src/samples/RIASEC93.js +144 -0
  144. package/src/samples/SAFE93.js +64 -0
  145. package/src/samples/SASQ93.js +130 -0
  146. package/src/samples/SCASP93.js +207 -0
  147. package/src/samples/SDCAQ93.js +174 -0
  148. package/src/samples/STAIY93.js +159 -0
  149. package/src/samples/WAQ93.js +208 -0
  150. package/src/samples/YBOCS93.js +583 -0
  151. package/src/samples/empty.js +53 -0
  152. package/views/gift.hbs +160 -0
  153. package/views/profiles/fonts.css +18 -0
  154. package/views/profiles/layout.hbs +27 -0
  155. package/views/profiles/samples/16PF93.hbs +54 -0
  156. package/views/profiles/samples/AEQ93.hbs +31 -0
  157. package/views/profiles/samples/AMS93.hbs +97 -0
  158. package/views/profiles/samples/AMS9A.hbs +1 -0
  159. package/views/profiles/samples/BAOMEIS93.hbs +48 -0
  160. package/views/profiles/samples/BEQI93.hbs +118 -0
  161. package/views/profiles/samples/CAATS93.hbs +251 -0
  162. package/views/profiles/samples/CADS93.hbs +104 -0
  163. package/views/profiles/samples/CARSP93.hbs +26 -0
  164. package/views/profiles/samples/CERQ93.hbs +115 -0
  165. package/views/profiles/samples/CRAAS93.hbs +88 -0
  166. package/views/profiles/samples/CSI93_1.hbs +110 -0
  167. package/views/profiles/samples/CSI93_2.hbs +76 -0
  168. package/views/profiles/samples/DSWLS93.hbs +26 -0
  169. package/views/profiles/samples/EMSS93.hbs +101 -0
  170. package/views/profiles/samples/FACES93_1.hbs +107 -0
  171. package/views/profiles/samples/FACES93_2.hbs +51 -0
  172. package/views/profiles/samples/FTEPT93.hbs +67 -0
  173. package/views/profiles/samples/GMIT93.hbs +45 -0
  174. package/views/profiles/samples/HPL93.hbs +36 -0
  175. package/views/profiles/samples/IBT93.hbs +67 -0
  176. package/views/profiles/samples/IUS93.hbs +123 -0
  177. package/views/profiles/samples/JCSI93.hbs +65 -0
  178. package/views/profiles/samples/JPFQ93.hbs +44 -0
  179. package/views/profiles/samples/KJGI93.hbs +57 -0
  180. package/views/profiles/samples/LMIQ93.hbs +82 -0
  181. package/views/profiles/samples/MMFAD93.hbs +35 -0
  182. package/views/profiles/samples/MMFAD9A.hbs +1 -0
  183. package/views/profiles/samples/MOCI93.hbs +60 -0
  184. package/views/profiles/samples/OBQ4493.hbs +61 -0
  185. package/views/profiles/samples/PIES93.hbs +67 -0
  186. package/views/profiles/samples/PIES9A.hbs +1 -0
  187. package/views/profiles/samples/PMCIEF93.hbs +8 -0
  188. package/views/profiles/samples/PSWQ93.hbs +32 -0
  189. package/views/profiles/samples/RIASEC93.hbs +38 -0
  190. package/views/profiles/samples/SAFE93.hbs +118 -0
  191. package/views/profiles/samples/SASQ93.hbs +45 -0
  192. package/views/profiles/samples/SCASP93.hbs +94 -0
  193. package/views/profiles/samples/SDCAQ93.hbs +68 -0
  194. package/views/profiles/samples/STAIY93.hbs +67 -0
  195. package/views/profiles/samples/WAQ93.hbs +74 -0
  196. package/views/profiles/samples/YBOCS93_1.hbs +96 -0
  197. package/views/profiles/samples/YBOCS93_2.hbs +115 -0
  198. package/views/profiles/samples/YBOCS93_3.hbs +93 -0
  199. package/views/profiles/samples/empty.hbs +10 -0
  200. package/views/profiles/sidebar.hbs +193 -0
@@ -0,0 +1,583 @@
1
+ const { Profile, FS } = require("../Profile");
2
+
3
+ class YBOCS93 extends Profile {
4
+ // Number of pages
5
+ static pages = 3;
6
+
7
+ // Labels of the sample
8
+ labels = {
9
+ L1: { eng: "aggressive_obsession", fr: "پرخاشگری" },
10
+ L2: { eng: "contamination_obsession", fr: "آلودگی" },
11
+ L3: { eng: "sexual_obsession", fr: "جنسی" },
12
+ L4: { eng: "hoarding_saving", fr: "احتکار" },
13
+ L5: { eng: "religious", fr: "مذهبی" },
14
+ L6: { eng: "symmetry_exactness", fr: "تقارن" },
15
+ L7: { eng: "obsession_miscellaneous", fr: "متفرقه" },
16
+ L8: { eng: "somatic", fr: "جسمی" },
17
+ L9: { eng: "cleaning_washing", fr: "نظافت" },
18
+ L10: { eng: "checking", fr: "وارسی" },
19
+ L11: { eng: "repeating", fr: "تکرار" },
20
+ L12: { eng: "counting", fr: "شمارش" },
21
+ L13: { eng: "ordering_arranging", fr: "نظم" },
22
+ L14: { eng: "hoarding_collecting", fr: "احتکار" },
23
+ L15: { eng: "compulsive_miscellaneous", fr: "متفرقه" },
24
+ L16: { eng: "obsession_severity", fr: "شدت وسواس" },
25
+ L17: { eng: "report", fr: "تفسیر" },
26
+ };
27
+
28
+ // Questions alternate titles and categories
29
+ questionsAppendix = [
30
+ {
31
+ num: 1,
32
+ title: "آسیب به خود",
33
+ cat: "پرخاشگری",
34
+ },
35
+ {
36
+ num: 2,
37
+ title: "آسیب به دیگری",
38
+ cat: "پرخاشگری",
39
+ },
40
+ {
41
+ num: 3,
42
+ title: "تصاویر خشن",
43
+ cat: "پرخاشگری",
44
+ },
45
+ {
46
+ num: 4,
47
+ title: "کلمات مستهجن",
48
+ cat: "پرخاشگری",
49
+ },
50
+ {
51
+ num: 5,
52
+ title: "اعمال شرم‌آور",
53
+ cat: "پرخاشگری",
54
+ },
55
+ {
56
+ num: 6,
57
+ title: "تکانه ناخواسته",
58
+ cat: "پرخاشگری",
59
+ },
60
+ {
61
+ num: 7,
62
+ title: "دزدی",
63
+ cat: "پرخاشگری",
64
+ },
65
+ {
66
+ num: 8,
67
+ title: "آسیب یا بی‌دقتی",
68
+ cat: "پرخاشگری",
69
+ },
70
+ {
71
+ num: 9,
72
+ title: "باعث حادثه",
73
+ cat: "پرخاشگری",
74
+ },
75
+ {
76
+ num: 10,
77
+ title: "حساسیت فضولات",
78
+ cat: "آلودگی",
79
+ },
80
+ {
81
+ num: 11,
82
+ title: "کثیفی، میکروب، نجاست",
83
+ cat: "آلودگی",
84
+ },
85
+ {
86
+ num: 12,
87
+ title: "آلوده کننده محیط",
88
+ cat: "آلودگی",
89
+ },
90
+ {
91
+ num: 13,
92
+ title: "پاک کننده‌ها",
93
+ cat: "آلودگی",
94
+ },
95
+ {
96
+ num: 14,
97
+ title: "حیوانات",
98
+ cat: "آلودگی",
99
+ },
100
+ {
101
+ num: 15,
102
+ title: "چسبناک",
103
+ cat: "آلودگی",
104
+ },
105
+ {
106
+ num: 16,
107
+ title: "بیماری از آلودگی",
108
+ cat: "آلودگی",
109
+ },
110
+ {
111
+ num: 17,
112
+ title: "آلوده کردن دیگران",
113
+ cat: "آلودگی",
114
+ },
115
+ {
116
+ num: 18,
117
+ title: "تکانه جنسی",
118
+ cat: "جنسی",
119
+ },
120
+ {
121
+ num: 19,
122
+ title: "جنسی کودکان",
123
+ cat: "جنسی",
124
+ },
125
+ {
126
+ num: 20,
127
+ title: "همجنس‌بازی",
128
+ cat: "جنسی",
129
+ },
130
+ {
131
+ num: 21,
132
+ title: "پرخاشگری جنسی",
133
+ cat: "جنسی",
134
+ },
135
+ {
136
+ num: 22,
137
+ title: "جمع کردن اشیاء",
138
+ cat: "احتکار",
139
+ },
140
+ {
141
+ num: 23,
142
+ title: "توهین به مقدسات",
143
+ cat: "مذهبی",
144
+ },
145
+ {
146
+ num: 24,
147
+ title: "اخلاقیات",
148
+ cat: "مذهبی",
149
+ },
150
+ {
151
+ num: 25,
152
+ title: "تقارن، دقت",
153
+ cat: "تقارن",
154
+ },
155
+ {
156
+ num: 26,
157
+ title: "به خاطر سپاری موارد خاص",
158
+ cat: "متفرقه",
159
+ },
160
+ {
161
+ num: 27,
162
+ title: "بیان کلمات خاص",
163
+ cat: "متفرقه",
164
+ },
165
+ {
166
+ num: 28,
167
+ title: "بیان نادرست عبارات",
168
+ cat: "متفرقه",
169
+ },
170
+ {
171
+ num: 29,
172
+ title: "گم کردن اشیاء",
173
+ cat: "متفرقه",
174
+ },
175
+ {
176
+ num: 30,
177
+ title: "تصویر ذهنی خنثی",
178
+ cat: "متفرقه",
179
+ },
180
+ {
181
+ num: 31,
182
+ title: "کلمه آهنگ نامفهوم",
183
+ cat: "متفرقه",
184
+ },
185
+ {
186
+ num: 32,
187
+ title: "صدا نجوا خاص",
188
+ cat: "متفرقه",
189
+ },
190
+ {
191
+ num: 33,
192
+ title: "اعداد شانسی",
193
+ cat: "متفرقه",
194
+ },
195
+ {
196
+ num: 34,
197
+ title: "معنای رنگ",
198
+ cat: "متفرقه",
199
+ },
200
+ {
201
+ num: 35,
202
+ title: "ترس خرافی",
203
+ cat: "متفرقه",
204
+ },
205
+ {
206
+ num: 36,
207
+ title: "نگران بیماری",
208
+ cat: "جسمی",
209
+ },
210
+ {
211
+ num: 37,
212
+ title: "بد شکلی بدن",
213
+ cat: "جسمی",
214
+ },
215
+ {
216
+ num: 38,
217
+ title: "دست شستن",
218
+ cat: "پرخاشگری",
219
+ },
220
+ {
221
+ num: 39,
222
+ title: "آداب افراطی",
223
+ cat: "پرخاشگری",
224
+ },
225
+ {
226
+ num: 40,
227
+ title: "تمیز کردن اشیاء بی‌جان",
228
+ cat: "پرخاشگری",
229
+ },
230
+ {
231
+ num: 41,
232
+ title: "اقدام برای اجتناب",
233
+ cat: "پرخاشگری",
234
+ },
235
+ {
236
+ num: 42,
237
+ title: "آسیب به دیگری",
238
+ cat: "وارسی",
239
+ },
240
+ {
241
+ num: 43,
242
+ title: "آسیب به خود",
243
+ cat: "وارسی",
244
+ },
245
+ {
246
+ num: 44,
247
+ title: "حادثه وحشتناک",
248
+ cat: "وارسی",
249
+ },
250
+ {
251
+ num: 45,
252
+ title: "ارتکاب به اشتباه",
253
+ cat: "وارسی",
254
+ },
255
+ {
256
+ num: 46,
257
+ title: "جنبه‌های بدنی",
258
+ cat: "وارسی",
259
+ },
260
+ {
261
+ num: 47,
262
+ title: "دوباره خوانی",
263
+ cat: "تکرار",
264
+ },
265
+ {
266
+ num: 48,
267
+ title: "فعالیت روزمره",
268
+ cat: "تکرار",
269
+ },
270
+ {
271
+ num: 49,
272
+ title: "شمارش",
273
+ cat: "شمارش",
274
+ },
275
+ {
276
+ num: 50,
277
+ title: "نظم و ترتیب",
278
+ cat: "نظم",
279
+ },
280
+ {
281
+ num: 51,
282
+ title: "احتکار",
283
+ cat: "احتکار",
284
+ },
285
+ {
286
+ num: 52,
287
+ title: "آداب ذهنی",
288
+ cat: "متفرقه",
289
+ },
290
+ {
291
+ num: 53,
292
+ title: "اطمینان، صحبت",
293
+ cat: "متفرقه",
294
+ },
295
+ {
296
+ num: 54,
297
+ title: "لمس اشیاء",
298
+ cat: "متفرقه",
299
+ },
300
+ {
301
+ num: 55,
302
+ title: "اجتناب از اشیاء",
303
+ cat: "متفرقه",
304
+ },
305
+ {
306
+ num: 56,
307
+ title: "تشریفات غذا",
308
+ cat: "متفرقه",
309
+ },
310
+ {
311
+ num: 57,
312
+ title: "رفتار خرافی",
313
+ cat: "متفرقه",
314
+ },
315
+ {
316
+ num: 58,
317
+ title: "کندن مو",
318
+ cat: "متفرقه",
319
+ },
320
+ {
321
+ num: 1,
322
+ title: "وقت صرف شده",
323
+ cat: "شدت\nوسواس",
324
+ },
325
+ {
326
+ num: 2,
327
+ title: "اثر روی کارکرد",
328
+ cat: "شدت\nوسواس",
329
+ },
330
+ {
331
+ num: 3,
332
+ title: "ایجاد پریشانی",
333
+ cat: "شدت\nوسواس",
334
+ },
335
+ {
336
+ num: 4,
337
+ title: "تلاش برای مقاومت",
338
+ cat: "شدت\nوسواس",
339
+ },
340
+ {
341
+ num: 5,
342
+ title: "توان کنترل",
343
+ cat: "شدت\nوسواس",
344
+ },
345
+ {
346
+ num: 6,
347
+ title: "وقت صرف شده",
348
+ cat: "شدت\nاجبار",
349
+ },
350
+ {
351
+ num: 7,
352
+ title: "اثر روی کارکرد",
353
+ cat: "شدت\nاجبار",
354
+ },
355
+ {
356
+ num: 8,
357
+ title: "ایجاد پریشانی",
358
+ cat: "شدت\nاجبار",
359
+ },
360
+ {
361
+ num: 9,
362
+ title: "تلاش برای مقاومت",
363
+ cat: "شدت\nاجبار",
364
+ },
365
+ {
366
+ num: 10,
367
+ title: "توان کنترل",
368
+ cat: "شدت\nاجبار",
369
+ },
370
+ {
371
+ num: 11,
372
+ title: "-",
373
+ cat: "نیرومندی باور",
374
+ },
375
+ {
376
+ num: 12,
377
+ title: "-",
378
+ cat: "اجتناب",
379
+ },
380
+ {
381
+ num: 13,
382
+ title: "-",
383
+ cat: "-",
384
+ },
385
+ {
386
+ num: 14,
387
+ title: "-",
388
+ cat: "-",
389
+ },
390
+ ];
391
+
392
+ profileSpec = {
393
+ /* "sample" determines some important info about the sample and profile */
394
+ /* Default prerequisites: 1. gender, 2. age, 3. education */
395
+ /* "prerequisites" is synonym to "fields" in our program */
396
+ sample: {
397
+ name: "پرسشنامه یل‌براون وسواس" /* Name of the sample */,
398
+ multiProfile: true /* Whether the sample has multiple profiles or not */,
399
+ questions: true /* Determines whether to get questions from inital dataset or not */,
400
+ defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
401
+ fields: ["marital_status"] /* In case you want to get some additional fields and show in the profile */,
402
+ },
403
+ /* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
404
+ /* calculating its dimensions carefully is of great importance */
405
+ profile: {
406
+ get dimensions() {
407
+ return [
408
+ {
409
+ width: 723 + 2 * this.padding[0].x,
410
+ height: 645 + 2 * this.padding[0].y,
411
+ },
412
+ {
413
+ width: 903 + 2 * this.padding[1].x,
414
+ height: 714 + 2 * this.padding[1].y,
415
+ },
416
+ {
417
+ width: 903 + 2 * this.padding[2].x,
418
+ height: 714 + 2 * this.padding[2].y,
419
+ },
420
+ ];
421
+ },
422
+ padding: [
423
+ {
424
+ x: 0,
425
+ y: 36,
426
+ },
427
+ {
428
+ x: 0,
429
+ y: 0,
430
+ },
431
+ {
432
+ x: 0,
433
+ y: 0,
434
+ },
435
+ ],
436
+ },
437
+ /* "raw" is the general term used for total data element in the profile */
438
+ raw: {
439
+ interprets: {
440
+ sub_clinical: "غیر بالینی",
441
+ mild: "خفیف",
442
+ moderate: "متوسط",
443
+ severe: "شدید",
444
+ extreme: "خیلی شدید",
445
+ },
446
+ stops: [0, 7, 15, 23, 31, 54],
447
+ heightCoeff: 10,
448
+ },
449
+ page1: {
450
+ /* "items" is the general term used for independent data elements to be drawn in the profile */
451
+ items: {
452
+ offsetY: 32 /* Horizontal offset between two top items */,
453
+ get distanceY() {
454
+ return this.offsetY + this.rect.body.height;
455
+ } /* Horizontal distance between two top items */,
456
+ maxValues: {
457
+ [this.labels.L1.eng]: 36,
458
+ [this.labels.L2.eng]: 32,
459
+ [this.labels.L3.eng]: 16,
460
+ [this.labels.L4.eng]: 4,
461
+ [this.labels.L5.eng]: 8,
462
+ [this.labels.L6.eng]: 4,
463
+ [this.labels.L7.eng]: 40,
464
+ [this.labels.L8.eng]: 8,
465
+ [this.labels.L9.eng]: 16,
466
+ [this.labels.L10.eng]: 20,
467
+ [this.labels.L11.eng]: 8,
468
+ [this.labels.L12.eng]: 4,
469
+ [this.labels.L13.eng]: 4,
470
+ [this.labels.L14.eng]: 4,
471
+ [this.labels.L15.eng]: 28,
472
+ } /* Maximum value of items */,
473
+ rect: {
474
+ base: {
475
+ height: 4,
476
+ },
477
+ body: {
478
+ height: 8,
479
+ brs: {
480
+ tl: 0,
481
+ tr: 4,
482
+ bl: 0,
483
+ br: 0,
484
+ },
485
+ },
486
+ widthCoeff: 6,
487
+ },
488
+ },
489
+ },
490
+ questionItems: {
491
+ answers: [
492
+ { fill: "#D4D4D8", fr: "صدق نمی‌کند" },
493
+ { fill: "#FBBF24", fr: "خیلی کم" },
494
+ { fill: "#F97316", fr: "کم" },
495
+ { fill: "#EC4899", fr: "زیاد" },
496
+ { fill: "#B91C1C", fr: "خیلی زیاد" },
497
+ ],
498
+ },
499
+ /* "labels" part which has to be provided for each profile */
500
+ labels: Object.values(this.labels),
501
+ };
502
+
503
+ constructor(dataset, options, config = {}) {
504
+ super();
505
+ this._init(dataset, options, config);
506
+ }
507
+
508
+ _calcContext() {
509
+ const {
510
+ spec: { parameters: spec },
511
+ dataset,
512
+ questionsAppendix: QA,
513
+ } = this;
514
+
515
+ // Deconstructing the Spec of the Profile
516
+ const { raw: rawSpec, page1: page1Spec, questionItems: questionItemsSpec } = spec;
517
+
518
+ // Separate Raw Data from the Dataset
519
+ const rawData = dataset.score.slice(-2);
520
+
521
+ // Gathering required info for raw
522
+ const raw = {
523
+ mark: rawData[0].mark,
524
+ interpret: {
525
+ eng: rawData[1].mark,
526
+ fr: rawSpec.interprets[rawData[1].mark],
527
+ },
528
+ };
529
+
530
+ // Gathering required info for questions
531
+ const questionItemsPart1Count = questionItemsSpec.answers.map((answerSpec, index) => ({
532
+ answer: index,
533
+ ...answerSpec,
534
+ count: 0,
535
+ }));
536
+ const questionItemsPart1 = dataset.questions.slice(0, 58).map((question, index) => {
537
+ questionItemsPart1Count[question.user_answered - 1].count++;
538
+ return {
539
+ ...QA[index],
540
+ answer: question.user_answered - 1,
541
+ fill: questionItemsSpec.answers[question.user_answered - 1].fill,
542
+ };
543
+ });
544
+ const questionItemsPart2 = dataset.questions.slice(58).map((question, index) => ({
545
+ ...QA[index + 58],
546
+ answer: question.user_answered - 1,
547
+ fill: questionItemsSpec.answers[question.user_answered - 1].fill,
548
+ }));
549
+
550
+ const questionItemsPart1Sorted = [...questionItemsPart1].sort((q1, q2) => q2.answer - q1.answer);
551
+
552
+ // Gathering required info for page 1 items
553
+ const page1Items = dataset.score.slice(0, 15).map((data, index) => ({
554
+ label: data.label,
555
+ mark: data.mark,
556
+ maxValue: page1Spec.items.maxValues[data.label.eng],
557
+ width: {
558
+ base: page1Spec.items.maxValues[data.label.eng] * page1Spec.items.rect.widthCoeff,
559
+ body: data.mark * page1Spec.items.rect.widthCoeff,
560
+ },
561
+ }));
562
+
563
+ return [
564
+ { items: page1Items, raw, suicideThoughts: questionItemsPart2[13].answer },
565
+ {
566
+ titleAppend: " - مرتب شده بر اساس سؤالات",
567
+ questionItemsPart1Count,
568
+ questionItemsPart1,
569
+ questionItemsPart2,
570
+ raw,
571
+ },
572
+ {
573
+ titleAppend: " - مرتب شده بر اساس پاسخ‌ها",
574
+ questionItemsPart1Count,
575
+ questionItemsPart1Sorted,
576
+ questionItemsPart2,
577
+ raw,
578
+ },
579
+ ];
580
+ }
581
+ }
582
+
583
+ module.exports = YBOCS93;
@@ -0,0 +1,53 @@
1
+ const { Profile } = require("../profile");
2
+
3
+ class empty extends Profile {
4
+ // Number of pages
5
+ static pages = 1;
6
+
7
+ // Labels of the sample
8
+ labels = {};
9
+
10
+ profileSpec = {
11
+ /* "sample" determines some important info about the sample and profile */
12
+ /* Default prerequisites: 1. gender, 2. age, 3. education, 4. marital_status */
13
+ /* "prerequisites" is synonym to "fields" in our program */
14
+ sample: {
15
+ name: "پرسشنامه خالی" /* Name of the sample */,
16
+ multiProfile: false /* Whether the sample has multiple profiles or not */,
17
+ answers: false /* Determines whether to get answers from inital dataset or not */,
18
+ defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
19
+ fields: [] /* In case you want to get some additional fields and show in the profile */,
20
+ },
21
+ /* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
22
+ /* calculating its dimensions carefully is of great importance */
23
+ profile: {
24
+ get dimensions() {
25
+ return {
26
+ width: 500 + 2 * this.padding.x,
27
+ height: 500 + 2 * this.padding.y,
28
+ }
29
+ },
30
+ padding: {
31
+ x: 0,
32
+ y: 0,
33
+ },
34
+ },
35
+ labels: Object.values(this.labels),
36
+ };
37
+
38
+ constructor(dataset, profileVariant, config = {}) {
39
+ super();
40
+ this._init(dataset, profileVariant, config);
41
+ }
42
+
43
+ _calcContext() {
44
+ const {
45
+ spec: { parameters: spec },
46
+ dataset,
47
+ } = this;
48
+
49
+ return [{}];
50
+ }
51
+ }
52
+
53
+ module.exports = empty;