@baravak/risloo-profile-cli 4.27.0 → 4.28.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baravak/risloo-profile-cli",
3
- "version": "4.27.0",
3
+ "version": "4.28.0",
4
4
  "description": "**Risloo Profile CLI** is a library for creating profiles, reports and sheets for *psychological* samples.",
5
5
  "main": "bin/risloo.js",
6
6
  "publishConfig": {
@@ -0,0 +1,316 @@
1
+ {
2
+ "id": "$X1HXXXXX",
3
+ "scale": {
4
+ "id": "$PCL5-93",
5
+ "title": "چک لیست نشانه‌های استرس پس از سانحه (PCL-5)"
6
+ },
7
+ "chain": null,
8
+ "version": "2",
9
+ "edition": "",
10
+ "edition_version": null,
11
+ "client": {
12
+ "id": "GH966XXXX",
13
+ "name": "مراجع"
14
+ },
15
+ "room": {
16
+ "id": "RS96XXXX",
17
+ "manager": {
18
+ "id": "GH9XXXXX",
19
+ "name": "درمانگر",
20
+ "user_id": "IR9XXXX"
21
+ },
22
+ "center": {
23
+ "id": "RS966XXXX",
24
+ "acceptation": null,
25
+ "status": "active",
26
+ "type": "personal_clinic",
27
+ "detail": {
28
+ "title": "درمانگر"
29
+ }
30
+ },
31
+ "acceptation": null,
32
+ "status": "active",
33
+ "type": "personal_clinic"
34
+ },
35
+ "case": null,
36
+ "code": null,
37
+ "created_at": 1694157079,
38
+ "started_at": 1694157198,
39
+ "scored_at": 1694242467,
40
+ "closed_at": 1694160574,
41
+ "total_amount": 100000,
42
+ "prepayment": true,
43
+ "purchased": true,
44
+ "amount": 100000,
45
+ "description": "# دستورالعمل:\n\nدر ادامه فهرستی از مشکلاتی آمده است که برخی افراد در واکنش به یک تجربه بسیار استرس‌زا ممکن است داشته باشند.\n\nبا در نظر داشتن بدترین رویدادی که تجربه کرده‌اید، هر مورد را با دقت بخوانید و عددی را انتخاب کنید که نشان دهد **در ماه گذشته تا چه اندازه آن مشکل شما را آزار داده است**.",
46
+ "psychologist_description": null,
47
+ "items": [
48
+ {
49
+ "type": "text",
50
+ "text": "خاطرات مکرر، آزاردهنده و ناخواسته‌ی تجربه استرس‌‌زا",
51
+ "answer": {
52
+ "type": "optional",
53
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
54
+ },
55
+ "user_answered": "4"
56
+ },
57
+ {
58
+ "type": "text",
59
+ "text": "رؤیاهای مکرر و آشفته‌کننده‌ی تجربه استرس‌زا",
60
+ "answer": {
61
+ "type": "optional",
62
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
63
+ },
64
+ "user_answered": "1"
65
+ },
66
+ {
67
+ "type": "text",
68
+ "text": "ناگهان طوری احساس و رفتار کردن، انگار که تجربه استرس‌آور دوباره اتفاق می‏افتد (انگار واقعاً به آن زمان برگشته‌اید و دوباره آن را تجربه می‌کنید)",
69
+ "answer": {
70
+ "type": "optional",
71
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
72
+ },
73
+ "user_answered": "5"
74
+ },
75
+ {
76
+ "type": "text",
77
+ "text": "احساس آشفتگی شدید وقتی چیزی شما را یاد آن تجربه استرس‌آور می‌اندازد",
78
+ "answer": {
79
+ "type": "optional",
80
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
81
+ },
82
+ "user_answered": "1"
83
+ },
84
+ {
85
+ "type": "text",
86
+ "text": "داشتن واکنش‌های فیزیکی شدید وقتی چیزی شما را یاد تجربه استرس‌زا می‏اندازد (برای مثال، تپش قلب، دشواری در نفس کشیدن، عرق کردن)",
87
+ "answer": {
88
+ "type": "optional",
89
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
90
+ },
91
+ "user_answered": "4"
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "اجتناب از خاطرات، افکار، یا احساسات مرتبط با تجربه استرس‌زا",
96
+ "answer": {
97
+ "type": "optional",
98
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
99
+ },
100
+ "user_answered": "1"
101
+ },
102
+ {
103
+ "type": "text",
104
+ "text": "اجتناب از یادآورهای بیرونی تجربه استرس‌زا (برای مثال، مردم، مکان‌ها، گفتگوها، فعالیت‌ها، اشیاء، یا موقعیت‌ها)",
105
+ "answer": {
106
+ "type": "optional",
107
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
108
+ },
109
+ "user_answered": "3"
110
+ },
111
+ {
112
+ "type": "text",
113
+ "text": "مشکل در یادآوری بخش‌های مهم تجربه استرس‌زا",
114
+ "answer": {
115
+ "type": "optional",
116
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
117
+ },
118
+ "user_answered": "2"
119
+ },
120
+ {
121
+ "type": "text",
122
+ "text": "باورهای منفی عمیق نسبت به خود، افراد، یا دنیا (برای مثال، داشتن افکاری از قبیل این که: من بد هستم، یک جای کارم ایراد اساسی دارد، هیچ کس قابل اعتماد نیست، دنیا کاملاً خطرناک است)",
123
+ "answer": {
124
+ "type": "optional",
125
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
126
+ },
127
+ "user_answered": "3"
128
+ },
129
+ {
130
+ "type": "text",
131
+ "text": "سرزنش شدید خود و افراد دیگر به خاطر تجربه استرس‌زا و اتفاق‌های بعد از آن",
132
+ "answer": {
133
+ "type": "optional",
134
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
135
+ },
136
+ "user_answered": "2"
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "احساسات منفی شدید مانند ترس، خشم، احساس گناه، یا شرم",
141
+ "answer": {
142
+ "type": "optional",
143
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
144
+ },
145
+ "user_answered": "3"
146
+ },
147
+ {
148
+ "type": "text",
149
+ "text": "از دست دادن علاقه نسبت به فعالیت‌هایی که قبلاً از آن‌ها لذت می‌برده‌اید",
150
+ "answer": {
151
+ "type": "optional",
152
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
153
+ },
154
+ "user_answered": "1"
155
+ },
156
+ {
157
+ "type": "text",
158
+ "text": "احساس فاصله گرفتن یا بریدن از دیگران",
159
+ "answer": {
160
+ "type": "optional",
161
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
162
+ },
163
+ "user_answered": "3"
164
+ },
165
+ {
166
+ "type": "text",
167
+ "text": "مشکل در تجربه احساسات مثبت (برای مثال، ناتوانی در داشتن احساسات عاشقانه نسبت به افراد نزدیک، یا احساس بی‌حسی عاطفی)",
168
+ "answer": {
169
+ "type": "optional",
170
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
171
+ },
172
+ "user_answered": "1"
173
+ },
174
+ {
175
+ "type": "text",
176
+ "text": "احساس تحریک‌پذیری، خشم، یا خشونت",
177
+ "answer": {
178
+ "type": "optional",
179
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
180
+ },
181
+ "user_answered": "1"
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "خطر کردن شدید در انجام کارهای آسیب‌زننده",
186
+ "answer": {
187
+ "type": "optional",
188
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
189
+ },
190
+ "user_answered": "2"
191
+ },
192
+ {
193
+ "type": "text",
194
+ "text": "احساس «هشیاری مفرط»، مراقبت یا آماده باش",
195
+ "answer": {
196
+ "type": "optional",
197
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
198
+ },
199
+ "user_answered": "2"
200
+ },
201
+ {
202
+ "type": "text",
203
+ "text": "احساس تلاطم، یا به آسانی وحشت‌زده شدن",
204
+ "answer": {
205
+ "type": "optional",
206
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
207
+ },
208
+ "user_answered": "5"
209
+ },
210
+ {
211
+ "type": "text",
212
+ "text": "مشکل در تمرکز",
213
+ "answer": {
214
+ "type": "optional",
215
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
216
+ },
217
+ "user_answered": "1"
218
+ },
219
+ {
220
+ "type": "text",
221
+ "text": "مشکل در به خواب رفتن یا تداوم خواب",
222
+ "answer": {
223
+ "type": "optional",
224
+ "options": ["اصلاً", "کمی", "تا حدی (متوسط)", "زیاد", "بسیار زیاد"]
225
+ },
226
+ "user_answered": "3"
227
+ }
228
+ ],
229
+ "prerequisites": [
230
+ {
231
+ "type": "text",
232
+ "label": "gender",
233
+ "text": "جنسیت",
234
+ "answer": {
235
+ "type": "select",
236
+ "options": ["زن", "مرد"]
237
+ },
238
+ "alias": "gender",
239
+ "force": true,
240
+ "user_answered": "1"
241
+ },
242
+ {
243
+ "type": "text",
244
+ "label": "age",
245
+ "text": "سن",
246
+ "answer": {
247
+ "type": "number"
248
+ },
249
+ "alias": "age",
250
+ "force": true,
251
+ "user_answered": "44"
252
+ },
253
+ {
254
+ "type": "text",
255
+ "label": "education",
256
+ "text": "تحصیلات",
257
+ "answer": {
258
+ "type": "select",
259
+ "options": [
260
+ "ابتدایی اول",
261
+ "ابتدایی دوم",
262
+ "متوسطه اول",
263
+ "متوسطه دوم",
264
+ "دیپلم",
265
+ "کارشناسی",
266
+ "کارشناسی ارشد",
267
+ "پزشکی عمومی",
268
+ "متخصص",
269
+ "دکتری تخصصی",
270
+ "حوزوی مقدمات",
271
+ "حوزوی سطح۱",
272
+ "حوزوی سطح۲",
273
+ "حوزوی سطح۳",
274
+ "حوزوی سطح۴"
275
+ ]
276
+ },
277
+ "alias": "education",
278
+ "force": true,
279
+ "user_answered": "12"
280
+ },
281
+ {
282
+ "type": "text",
283
+ "label": "marital_status",
284
+ "text": "وضعیت تأهل",
285
+ "answer": {
286
+ "type": "select",
287
+ "options": ["مجرد", "متأهل"]
288
+ },
289
+ "alias": "marital_status",
290
+ "force": true,
291
+ "user_answered": "1"
292
+ }
293
+ ],
294
+ "cornometer": 2,
295
+ "score": {
296
+ "intrusion_raw": 10,
297
+ "intrusion_percentage": 0.5,
298
+ "intrusion_dsm_mode": "positive",
299
+ "avoidance_raw": 2,
300
+ "avoidance_percentage": 0.25,
301
+ "avoidance_dsm_mode": "positive",
302
+ "negative_mood_raw": 6,
303
+ "negative_mood_percentage": 0.38,
304
+ "negative_mood_dsm_mode": "positive",
305
+ "arousal_reactivity_raw": 8,
306
+ "arousal_reactivity_percentage": 0.5,
307
+ "arousal_reactivity_dsm_mode": "positive",
308
+ "emotional_numbing_raw": 2,
309
+ "emotional_numbing_percentage": 0.1,
310
+ "total_raw": 28,
311
+ "total_percentage": 0.35,
312
+ "status": "moderate"
313
+ },
314
+ "score_current_version": "1.0.0",
315
+ "score_last_version": "1.0.0"
316
+ }
@@ -0,0 +1,187 @@
1
+ const { Profile } = require("../Profile");
2
+ const list = ["intrusion", "avoidance", "negative_mood", "arousal_reactivity", "emotional_numbing"];
3
+ const segments = [
4
+ { limit: 19, multiplier: 5 }, // 95
5
+ { limit: 27, multiplier: 12 }, // 191
6
+ { limit: 32, multiplier: 20 }, // 291
7
+ { limit: 80, multiplier: 3 }, // 435
8
+ ];
9
+ const alerts = {
10
+ minimal: {
11
+ colors: ["#475569", "#CBD5E1", "#475569", "#475569", "#F8FAFC"],
12
+ title: "علائم ناچیز",
13
+ description: "نیازی به مداخله نیست. توصیه به آموزش‌های عمومی تاب‌آوری.",
14
+ },
15
+ mild: {
16
+ colors: ["#EAB308", "#FDE047", "#EAB308", "#FEF9C3", "#FEFCE8"],
17
+ title: "علائم خفیف",
18
+ description: "مانیتورینگ یا مشاوره اولیه گروهی یا فردی.",
19
+ },
20
+ moderate: {
21
+ colors: ["#EA580C", "#FDBA74", "#EA580C", "#FFEDD5", "#FFF7ED"],
22
+ title: "علائم متوسط",
23
+ description: "نیازمند ارزیابی تخصصی؛ ارجاع به روان‌شناس بالینی.",
24
+ },
25
+ severe: {
26
+ colors: ["#E11D48", "#E11D48", "#E11D48", "#FFE4E6", "#FFF1F2"],
27
+ title: "علائم شدید",
28
+ description: "احتمال بالای بالینی؛ ارجاع فوری به درمان تخصصی.",
29
+ },
30
+ };
31
+ class PCL593 extends Profile {
32
+ // Number of pages
33
+ static pages = 2;
34
+
35
+ // Labels of the sample
36
+ labels = {
37
+ L1_1: { eng: "intrusion_raw", short: "B", title: ["تجربه‌های", "مزاحم"], max: 20, dsm_count: 5 },
38
+ L1_2: { eng: "intrusion_percentage" },
39
+ L1_3: { eng: "intrusion_dsm_mode" },
40
+
41
+ L2_1: { eng: "avoidance_raw", short: "C", title: ["اجتناب"], max: 8, dsm_count: 2 },
42
+ L2_2: { eng: "avoidance_percentage" },
43
+ L2_3: { eng: "avoidance_dsm_mode" },
44
+
45
+ L3_1: { eng: "negative_mood_raw", short: "D", title: ["تغییرات منفی", "خلقی"], max: 16, dsm_count: 7 },
46
+ L3_2: { eng: "negative_mood_percentage" },
47
+ L3_3: { eng: "negative_mood_dsm_mode" },
48
+
49
+ L4_1: { eng: "arousal_reactivity_raw", short: "E", title: ["برانگیختگی", "و بی‌قراری"], max: 16, dsm_count: 6 },
50
+ L4_2: { eng: "arousal_reactivity_percentage" },
51
+ L4_3: { eng: "arousal_reactivity_dsm_mode" },
52
+
53
+ L5_1: { eng: "emotional_numbing_raw", short: "F", title: ["بی‌حسی", "عاطفی"], max: 20 },
54
+ L5_2: { eng: "emotional_numbing_percentage" },
55
+
56
+ L6_1: { eng: "total_raw", short: "", title: "", max: 80 },
57
+ L6_2: { eng: "total_percentage" },
58
+
59
+ L7: { eng: "status" },
60
+ };
61
+
62
+ profileSpec = {
63
+ /* "sample" determines some important info about the sample and profile */
64
+ /* Default prerequisites: 1. gender, 2. age, 3. education */
65
+ /* "prerequisites" is synonym to "fields" in our program */
66
+ sample: {
67
+ name: "چک لیست نشانه‌های استرس پس از سانحه (PCL-5)" /* Name of the sample */,
68
+ multiProfile: false /* Whether the sample has multiple profiles or not */,
69
+ questions: true /* Determines whether to get questions from inital dataset or not */,
70
+ defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
71
+ fields: [] /* In case you want to get some additional fields and show in the profile */,
72
+ },
73
+ /* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
74
+ /* calculating its dimensions carefully is of great importance */
75
+ profile: {
76
+ get dimensions() {
77
+ return [
78
+ {
79
+ width: 526 + 2 * this.padding.x,
80
+ height: 559 + 2 * this.padding.y,
81
+ },
82
+ {
83
+ width: 760 + 2 * this.padding.x,
84
+ height: 706 + 2 * this.padding.y,
85
+ },
86
+ ];
87
+ },
88
+ padding: [
89
+ {
90
+ x: 189,
91
+ y: 78,
92
+ },
93
+ {
94
+ x: 19,
95
+ y: 4,
96
+ },
97
+ ],
98
+ },
99
+ /* "labels" part which has to be provided for each profile */
100
+ labels: Object.values(this.labels),
101
+ };
102
+
103
+ constructor(dataset, options, config = {}) {
104
+ super();
105
+ this._init(dataset, options, config);
106
+ }
107
+
108
+ _calcContext() {
109
+ const { dataset } = this;
110
+
111
+ const factors = {};
112
+ for (const item of dataset.score) {
113
+ const group = list.find((i) => item.label.eng.startsWith(i));
114
+ if (group === undefined) continue;
115
+ const type = item.label.eng.substring(group.length + 1);
116
+ if (type === "raw") {
117
+ factors[group] = {
118
+ mark: item.mark ?? 0,
119
+ label: {
120
+ ...item.label,
121
+ eng: group,
122
+ },
123
+ };
124
+ } else if (type === "percentage") {
125
+ factors[group].label[type] = item.mark ?? 0;
126
+ factors[group].label.percentageT = Math.round((item.mark ?? 0) * 100);
127
+ } else {
128
+ factors[group].label[type] = item.mark ?? 0;
129
+ }
130
+ }
131
+
132
+ const total = {
133
+ mark: dataset.score[14].mark ?? 0,
134
+ len: calculateSegmentedLength(dataset.score[14].mark ?? 0),
135
+ label: {
136
+ ...dataset.score[14],
137
+ percentage: Math.round((dataset.score[15].mark ?? 0) * 100),
138
+ },
139
+ };
140
+
141
+ const status = {
142
+ mark: dataset.score[16].mark,
143
+ style: alerts[dataset.score[16].mark],
144
+ };
145
+ let lastItem = 0
146
+ let top = 0
147
+ const factorWithQuestions = Object.values(factors).map((factor, i) => {
148
+ if(i === 4) return factor
149
+ const itemCount = factor.label.dsm_count
150
+ factor.items = dataset.questions.slice(lastItem, itemCount + lastItem).map(item => ({
151
+ ...item,
152
+ text: item.text.replace(/\([^\(\)]*\)/, '')
153
+ }))
154
+ const height = (itemCount * 29) - 3 + 16
155
+ factor.itemOption = {
156
+ height,
157
+ startItem: lastItem + 1,
158
+ top
159
+ }
160
+ top += height
161
+ lastItem += itemCount
162
+ return factor
163
+ })
164
+ return [{ factors: factorWithQuestions, total, status }, {
165
+ factors: factorWithQuestions.filter(item => item.items !== undefined),
166
+ questions: dataset.questions,
167
+ titleAppend: ' - براساس DSM-5'
168
+ }];
169
+ }
170
+ }
171
+
172
+ function calculateSegmentedLength(n) {
173
+ n = Math.max(Math.min(0, n), n);
174
+ let total = 0;
175
+ let current = 1;
176
+
177
+ for (const { limit, multiplier } of segments) {
178
+ if (n < current) break;
179
+ const upper = Math.min(n, limit);
180
+ const count = upper - current + 1;
181
+ total += count * multiplier;
182
+ current = limit + 1;
183
+ }
184
+
185
+ return total;
186
+ }
187
+ module.exports = PCL593;
@@ -0,0 +1,96 @@
1
+ {{#> layout}}
2
+ <defs>
3
+ <linearGradient id="bar" gradientTransform="rotate(90)">
4
+ <stop offset="0%" stop-color="#4F46E5" stop-opacity="1" />
5
+ <stop offset="100%" stop-color="#A5B4FC" stop-opacity="1" />
6
+ </linearGradient>
7
+ <linearGradient id="total">
8
+ <stop offset="0%" stop-color="{{status.style.colors.[1]}}" stop-opacity="1" />
9
+ <stop offset="1000%" stop-color="{{status.style.colors.[0]}}" stop-opacity="1" />
10
+ </linearGradient>
11
+ <filter id="barsp" x="0" y="0" width="532" height="7" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
12
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
13
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
14
+ <feOffset dy="-1"/>
15
+ <feGaussianBlur stdDeviation="1.5"/>
16
+ <feComposite in2="hardAlpha" operator="out"/>
17
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0"/>
18
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect"/>
19
+ <feBlend mode="normal" in="SourceGraphic" in2="effect" result="shape"/>
20
+ </filter>
21
+ <clipPath id="total_path">
22
+ {{bar 435 28 (object tl=0 bl=0 tr=4 br=4) (toRad 0)}}
23
+ </clipPath>
24
+ <clipPath id="factor_path">
25
+ {{bar 28 300 (object tl=4 tr=4 br=0 bl=0) (toRad 0)}}
26
+ </clipPath>
27
+ </defs>
28
+ <g transform="translate({{spec.profile.padding.[0].x}}, {{spec.profile.padding.[0].y}})">
29
+ <g transform="translate(85, 24)">
30
+ {{#each factors as | item index |}}
31
+ <g transform="translate({{math 92 '*' index }}, 0)">
32
+ <text x="14" y="-16" dy="0.25em" text-anchor="middle" direction="ltr">
33
+ <tspan font-size="16" font-weight="700" fill="#4F46E5">{{item.mark}}</tspan>
34
+ <tspan font-size="12" font-weight="300" fill="#64748B">/</tspan>
35
+ <tspan font-size="13" font-weight="400" fill="#94A3B8">{{item.label.max}}</tspan>
36
+ </text>
37
+ <text x="14" y="313" dy="0.85em" text-anchor="middle" font-size="13" font-weight="400" fill="#334155">{{item.label.short}}</text>
38
+ <text y="330" dy="0.9em" text-anchor="middle" font-size="13" font-weight="400" fill="#334155">
39
+ {{#each item.label.title as |title i|}}<tspan x="14" dy="{{math 0.9 '+' (math i '*' 0.4)}}em">{{title}}</tspan>{{/each}}</text>
40
+ {{bar 28 300 (object tl=4 tr=4 br=0 bl=0) (toRad 0) fill="#F8FAFC"}}
41
+ </g>
42
+ {{/each}}
43
+ <line x1="-45" x2="442" stroke="#E2E8F0" stroke-linecap="round" stroke-dasharray="6 6"/>
44
+ <text x="-80" y="0" dy="0.25em" text-anchor="end" font-size="12" font-weight="400" fill="#94A3B8">100 ٪</text>
45
+
46
+ <line x1="-45" x2="442" y1="75" y2="75" stroke="#E2E8F0" stroke-linecap="round" stroke-dasharray="6 6"/>
47
+
48
+ <line x1="-45" x2="442" y1="150" y2="150" stroke="#E2E8F0" stroke-linecap="round" stroke-dasharray="6 6"/>
49
+ <text x="-80" y="150" dy="0.25em" text-anchor="end" font-size="12" font-weight="400" fill="#94A3B8">50 ٪</text>
50
+
51
+ <line x1="-45" x2="442" y1="225" y2="225" stroke="#E2E8F0" stroke-linecap="round" stroke-dasharray="6 6"/>
52
+
53
+ {{#each factors as | item index |}}
54
+ <g transform="translate({{math 92 '*' index }}, {{math (math 1 '-' item.label.percentage) '*' 300 }})">
55
+ {{bar 28 (math item.label.percentage '*' 300) (object tl=4 tr=4 br=0 bl=0) (toRad 0) fill="url(#bar)" clip-path="url(#factor_path)"}}
56
+ <text x="14" y="{{ternary (boolean item.label.percentageT '<=' 10) -18 8}}" dy="0.65em" text-anchor="middle" font-size="16" font-weight="600" fill="{{ternary (boolean item.label.percentageT '<=' 10) '#4F46E5' '#FFFFFF'}}">{{item.label.percentageT}}</text>
57
+ </g>
58
+ {{/each}}
59
+
60
+ <g opacity="0.5" filter="url(#barsp)" transform="translate(-88, 296)">
61
+ <line x1="3.5" y1="4.5" x2="526" y2="4.5" stroke="white" stroke-linecap="round"/>
62
+ </g>
63
+ </g>
64
+ <g transform="translate(48.5, 494)">
65
+ <text x="-8.5" y="8" text-anchor="start" font-size="13" font-weight="500" fill="#64748B">نمره کل</text>
66
+ <text x="-8.5" y="25" text-anchor="start" font-size="13" font-weight="600" fill="#475569">{{total.label.percentage}} ٪</text>
67
+ {{bar 435 28 (object tl=0 bl=0 tr=4 br=4) (toRad 0) fill="#F8FAFC"}}
68
+ {{bar total.len 28 (object tl=0 bl=0 tr=4 br=4) (toRad 0) fill="url(#total)" clip-path="url(#total_path)"}}
69
+ {{#if (boolean total.mark '<=' 19)}}
70
+ <text x="{{math total.len '+' 8}}" y="14" dy="0.25em" text-anchor="end" font-size="16" font-weight="600" fill="#475569">{{total.mark}}</text>
71
+ {{else}}
72
+ <text x="{{math total.len '-' 8}}" y="14" dy="0.25em" text-anchor="start" font-size="16" font-weight="600" fill="#FFFFFF">{{total.mark}}</text>
73
+ {{/if}}
74
+ <text x="47.5" y="-10" dy="-0.4em" text-anchor="middle" font-size="13" font-weight="{{ternary (boolean status.mark '===' 'minimal') 600 400}}" fill="{{ternary (boolean status.mark '===' 'minimal') status.style.colors.[0] '#64748B'}}">علائم ناچیز</text>
75
+ <text x="95" y="-32" dy="-0.4em" text-anchor="middle" font-size="12" font-weight="400" fill="#94A3B8">19</text>
76
+ <line x1="94.5" y1="-27.5" x2="94.5" y2="-3.5" stroke="#E2E8F0" stroke-linecap="round" stroke-dasharray="4 4"/>
77
+
78
+ <text x="143" y="-10" dy="-0.4em" text-anchor="middle" font-size="13" font-weight="{{ternary (boolean status.mark '===' 'mild') 600 400}}" fill="{{ternary (boolean status.mark '===' 'mild') status.style.colors.[0] '#64748B'}}">علائم خفیف</text>
79
+ <text x="191" y="-32" dy="-0.4em" text-anchor="middle" font-size="12" font-weight="400" fill="#94A3B8">27</text>
80
+ <line x1="190.5" y1="-27.5" x2="190.5" y2="-3.5" stroke="#E2E8F0" stroke-linecap="round" stroke-dasharray="4 4"/>
81
+
82
+ <text x="241" y="-10" dy="-0.4em" text-anchor="middle" font-size="13" font-weight="{{ternary (boolean status.mark '===' 'moderate') 600 400}}" fill="{{ternary (boolean status.mark '===' 'moderate') status.style.colors.[0] '#64748B'}}">علائم متوسط</text>
83
+ <text x="291" y="-32" dy="-0.4em" text-anchor="middle" font-size="12" font-weight="400" fill="#94A3B8">32</text>
84
+ <line x1="290.5" y1="-27.5" x2="290.5" y2="-3.5" stroke="#E2E8F0" stroke-linecap="round" stroke-dasharray="4 4"/>
85
+
86
+ <text x="363" y="-10" dy="-0.4em" text-anchor="middle" font-size="13" font-weight="{{ternary (boolean status.mark '===' 'severe') 600 400}}" fill="{{ternary (boolean status.mark '===' 'severe') status.style.colors.[0] '#64748B'}}">علائم شدید</text>
87
+ <text x="435" y="-32" dy="-0.4em" text-anchor="middle" font-size="12" font-weight="400" fill="#94A3B8">80</text>
88
+ <line x1="434.5" y1="-27.5" x2="434.5" y2="-3.5" stroke="#E2E8F0" stroke-linecap="round" stroke-dasharray="4 4"/>
89
+
90
+ </g>
91
+ <g transform="translate(48.5, 526)">
92
+ <rect width="434" height="33" rx="4" fill="{{status.style.colors.[4]}}" stroke="{{status.style.colors.[3]}}"/>
93
+ <text x="217" y="16.5" text-anchor="middle" dy="0.3em" font-size="13" font-weight="400" fill="{{status.style.colors.[2]}}">{{status.style.description}}</text>
94
+ </g>
95
+ </g>
96
+ {{/layout}}
@@ -0,0 +1,95 @@
1
+ {{#> layout}}
2
+ <g transform="translate({{spec.profile.padding.x}}, {{spec.profile.padding.y}})">
3
+ <g transform="translate(105, 0)">
4
+ {{#each factors as | factor index |}}
5
+ <g transform="translate(0, {{math factor.itemOption.top '+' (math index '*' 8)}})">
6
+ <rect width="606" height="{{factor.itemOption.height}}" stroke="{{ternary (boolean factor.label.dsm_mode '===' 'positive') '#BE123C' '#E2E8F0'}}" rx="8" fill="none" />
7
+ <rect x="506" y="8" width="92" height="{{math factor.itemOption.height '-' 16}}" fill="{{ternary (boolean factor.label.dsm_mode '===' 'positive') '#FFF1F2' '#F1F5F9'}}" rx="4" />
8
+ {{#if (boolean factor.label.dsm_mode '===' 'positive')}}
9
+ <rect width="8" height="8" fill="#BE123C" transform="translate(602, {{math (math factor.itemOption.height '/' 2) '-' 4}}) rotate(45, 4, 4)" />
10
+ <text x="685" y="{{math factor.itemOption.height '/' 2}}" font-size="13" font-weight="400" fill="#1E293B" dy="-0.35em" text-anchor="middle">
11
+ به دلیل مثبت بودن حداقل
12
+ </text>
13
+ <text x="685" y="{{math factor.itemOption.height '/' 2}}" font-size="13" font-weight="400" fill="#1E293B" dy="1em" text-anchor="middle"><tspan fill="#BE123C">{{ternary (boolean index '<' 2) 'یک' 'دو'}} نشانه</tspan>
14
+ <tspan>احراز شده است.</tspan></text>
15
+ {{/if}}
16
+ <g transform="translate(8,8)">
17
+ {{#each factor.items as | item im |}}
18
+ <g transform="translate(0,{{math 29 '*' im}})">
19
+ <rect width="460" height="26" fill="#F8FAFC" rx="4"/>
20
+ <text x="452" y="13" dy="0.25em" font-weight="400" font-size="12" fill="#475569" text-anchor="start">{{item.text}}</text>
21
+ <text x="477" y="13" dy="0.3em" font-weight="400" font-size="11" fill="#64748B" text-anchor="middle">{{math im '+' factor.itemOption.startItem}}</text>
22
+ <rect x="4" y="4" width="18" height="18" fill="{{ternary (boolean item.user_answered '>' 2) '#BE123C' '#94A3B8'}}" rx="5"/>
23
+ <text x="13" y="13" dy="0.3em" font-weight="500" font-size="13" fill="#FFFFFF" text-anchor="middle">{{math item.user_answered '-' 1}}</text>
24
+ </g>
25
+ {{/each}}
26
+ </g>
27
+ </g>
28
+ {{/each}}
29
+ <g transform="translate(552, 79)">
30
+ <text dy="-1.25em" font-weight="600" font-size="14" fill="#475569" text-anchor="middle">معیار B</text>
31
+ <text dy="0.25em" font-weight="400" font-size="13" fill="#475569" text-anchor="middle">تجربه‌های</text>
32
+ <text dy="1.75em" font-weight="400" font-size="13" fill="#475569" text-anchor="middle">مزاحم</text>
33
+ </g>
34
+ <g transform="translate(552, 201.5)">
35
+ <text dy="-0.35em" font-weight="600" font-size="14" fill="#475569" text-anchor="middle">معیار C</text>
36
+ <text dy="1em" font-weight="400" font-size="13" fill="#475569" text-anchor="middle">اجتناب</text>
37
+ </g>
38
+ <g transform="translate(552, 353)">
39
+ <text dy="-1.25em" font-weight="600" font-size="14" fill="#475569" text-anchor="middle">معیار D</text>
40
+ <text dy="0.25em" font-weight="400" font-size="13" fill="#475569" text-anchor="middle">تغییرات منفی</text>
41
+ <text dy="1.75em" font-weight="400" font-size="13" fill="#475569" text-anchor="middle">خلقی</text>
42
+ </g>
43
+ <g transform="translate(552, 562.5)">
44
+ <text dy="-1.25em" font-weight="600" font-size="14" fill="#475569" text-anchor="middle">معیار E</text>
45
+ <text dy="0.25em" font-weight="400" font-size="13" fill="#475569" text-anchor="middle">برانگیختگی</text>
46
+ <text dy="1.75em" font-weight="400" font-size="13" fill="#475569" text-anchor="middle">و بی‌قراری</text>
47
+ </g>
48
+ </g>
49
+ <g transform="translate(110, 683)">
50
+ <g transform="translate(71, 0)">
51
+ <rect x="-18" width="18" height="18" fill="#BE123C" rx="5" />
52
+ <text x="-9" y="9" dy="0.3em" font-weight="500" font-size="13" fill="#FFFFFF" text-anchor="middle">4</text>
53
+ <text x="-25" y="9" dy="0.25em" font-weight="400" font-size="12" fill="#64748B" text-anchor="start">خیلی زیاد</text>
54
+ </g>
55
+ <g transform="translate(133, 0)">
56
+ <rect x="-18" width="18" height="18" fill="#BE123C" rx="5" />
57
+ <text x="-9" y="9" dy="0.3em" font-weight="500" font-size="13" fill="#FFFFFF" text-anchor="middle">3</text>
58
+ <text x="-25" y="9" dy="0.25em" font-weight="400" font-size="12" fill="#64748B" text-anchor="start">زیاد</text>
59
+ </g>
60
+ <g transform="translate(211, 0)">
61
+ <rect x="-18" width="18" height="18" fill="#BE123C" rx="5" />
62
+ <text x="-9" y="9" dy="0.3em" font-weight="500" font-size="13" fill="#FFFFFF" text-anchor="middle">2</text>
63
+ <text x="-25" y="9" dy="0.25em" font-weight="400" font-size="12" fill="#64748B" text-anchor="start">تا حدی</text>
64
+ </g>
65
+ <g transform="translate(532, 0)">
66
+ <rect x="-18" width="18" height="18" fill="#94A3B8" rx="5" />
67
+ <text x="-9" y="9" dy="0.3em" font-weight="500" font-size="13" fill="#FFFFFF" text-anchor="middle">1</text>
68
+ <text x="-25" y="9" dy="0.25em" font-weight="400" font-size="12" fill="#64748B" text-anchor="start">کمی</text>
69
+ </g>
70
+ <g transform="translate(596, 0)">
71
+ <rect x="-18" width="18" height="18" fill="#94A3B8" rx="5" />
72
+ <text x="-9" y="9" dy="0.3em" font-weight="500" font-size="13" fill="#FFFFFF" text-anchor="middle">0</text>
73
+ <text x="-25" y="9" dy="0.25em" font-weight="400" font-size="12" fill="#64748B" text-anchor="start">اصلا</text>
74
+ </g>
75
+ <g transform="translate(298, -5)">
76
+ <text dy="0.8em" font-size="12" fill="#64748B" text-anchor="middle"><tspan font-weight="400">پـاسـخ</tspan>
77
+ <tspan font-weight="600" >مثـبـت</tspan></text>
78
+ <text dy="2em" font-size="12" font-weight="400" fill="#64748B" text-anchor="middle">به وجود نشانه</text>
79
+ <g transform="translate(-59, 9.5)">
80
+ <path d="M11.25 5L0.749999 5M0.749999 5L5.25 0.5M0.749999 5L5.25 9.5" stroke="#94A3B8" stroke-linecap="round" stroke-linejoin="round"/>
81
+ </g>
82
+ </g>
83
+
84
+ <g transform="translate(400, -5)">
85
+ <text dy="0.8em" font-size="12" fill="#64748B" text-anchor="middle"><tspan font-weight="400">پـاسـخ</tspan>
86
+ <tspan font-weight="600" >منـفی</tspan></text>
87
+ <text dy="2em" font-size="12" font-weight="400" fill="#64748B" text-anchor="middle">به وجود نشانه</text>
88
+ <line x1="-51" y1="0.5" x2="-51" y2="27.5" stroke="#CBD5E1" stroke-linecap="round" stroke-dasharray="4 4"/>
89
+ <g transform="translate(47, 9.5)">
90
+ <path d="M0.75 5L11.25 5M11.25 5L6.75 0.5M11.25 5L6.75 9.5" stroke="#94A3B8" stroke-linecap="round" stroke-linejoin="round"/>
91
+ </g>
92
+ </g>
93
+ </g>
94
+ </g>
95
+ {{/layout}}