@baravak/risloo-profile-cli 4.85.0 → 4.87.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 +1 -1
- package/src/handlebars/helpers/profiles/gauge.js +14 -2
- package/src/publish/json/profiles/AIS93.json +223 -0
- package/src/publish/json/profiles/CAARS93.json +533 -0
- package/src/publish/json/profiles/ISI93.json +219 -0
- package/src/samples/AIS93.js +90 -0
- package/src/samples/CAARS93.js +93 -0
- package/src/samples/ISI93.js +146 -0
- package/views/profiles/samples/AIS93.hbs +51 -0
- package/views/profiles/samples/CAARS93.hbs +67 -0
- package/views/profiles/samples/ISI93.hbs +82 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "$X1HXXXXX",
|
|
3
|
+
"scale": {
|
|
4
|
+
"id": "$ISI-93",
|
|
5
|
+
"title": "شاخص شدت بیخوابی مورین"
|
|
6
|
+
},
|
|
7
|
+
"chain": null,
|
|
8
|
+
"version": "1",
|
|
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
|
+
"items": [
|
|
47
|
+
{
|
|
48
|
+
"type": "text",
|
|
49
|
+
"text": "به سختی به خواب رفتن",
|
|
50
|
+
"answer": {
|
|
51
|
+
"type": "optional",
|
|
52
|
+
"options": [
|
|
53
|
+
"بدون مشکل",
|
|
54
|
+
"کم",
|
|
55
|
+
"متوسط",
|
|
56
|
+
"شدید",
|
|
57
|
+
"بسیار شدید"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"user_answered": "4"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"type": "text",
|
|
64
|
+
"text": "به سختی در خواب باقی ماندن",
|
|
65
|
+
"answer": {
|
|
66
|
+
"type": "optional",
|
|
67
|
+
"options": [
|
|
68
|
+
"بدون مشکل",
|
|
69
|
+
"کم",
|
|
70
|
+
"متوسط",
|
|
71
|
+
"شدید",
|
|
72
|
+
"بسیار شدید"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"user_answered": "4"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "text",
|
|
79
|
+
"text": "مشکل زود بیدار شدن بیش از حد (صبح خیلی زود بیدارشدن)",
|
|
80
|
+
"answer": {
|
|
81
|
+
"type": "optional",
|
|
82
|
+
"options": [
|
|
83
|
+
"بدون مشکل",
|
|
84
|
+
"کم",
|
|
85
|
+
"متوسط",
|
|
86
|
+
"شدید",
|
|
87
|
+
"بسیار شدید"
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"user_answered": "4"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"type": "text",
|
|
94
|
+
"text": "از وضعیت اخیر خواب خود تا چه حد راضی یا ناراضی هستید ؟",
|
|
95
|
+
"answer": {
|
|
96
|
+
"type": "optional",
|
|
97
|
+
"options": [
|
|
98
|
+
"خیلی راضی",
|
|
99
|
+
"راضی",
|
|
100
|
+
"متوسط",
|
|
101
|
+
"ناراضی",
|
|
102
|
+
"خیلی ناراضی"
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
"user_answered": "3"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"type": "text",
|
|
109
|
+
"text": "فکر می کنید مشکل خواب در ایجاد اختلال در کیفیت زندگی شما تا چه حد برای دیگران قابل توجه است؟",
|
|
110
|
+
"answer": {
|
|
111
|
+
"type": "optional",
|
|
112
|
+
"options": [
|
|
113
|
+
"اصلا",
|
|
114
|
+
"کمی",
|
|
115
|
+
"متوسط",
|
|
116
|
+
"زیاد",
|
|
117
|
+
"خیلی زیاد"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"user_answered": "3"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"type": "text",
|
|
124
|
+
"text": "تا چه حد نسبت به مشکل اخیر خواب خود نگران یا مشوش هستید؟",
|
|
125
|
+
"answer": {
|
|
126
|
+
"type": "optional",
|
|
127
|
+
"options": [
|
|
128
|
+
"اصلا",
|
|
129
|
+
"کمی",
|
|
130
|
+
"متوسط",
|
|
131
|
+
"زیاد",
|
|
132
|
+
"خیلی زیاد"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"user_answered": "4"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "text",
|
|
139
|
+
"text": "به نظر شما مشکل خواب تا چه اندازه با عملکرد روزانه شما تداخل دارد؟ (مثل خستگی روزانه، توانایی عملکرد حین کار/ وظایف روزانه، تمرکز، حافظه، خلق و غیره)",
|
|
140
|
+
"answer": {
|
|
141
|
+
"type": "optional",
|
|
142
|
+
"options": [
|
|
143
|
+
"اصلا",
|
|
144
|
+
"کمی",
|
|
145
|
+
"متوسط",
|
|
146
|
+
"زیاد",
|
|
147
|
+
"خیلی زیاد"
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"user_answered": "3"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"prerequisites": [
|
|
154
|
+
{
|
|
155
|
+
"type": "text",
|
|
156
|
+
"label": "gender",
|
|
157
|
+
"text": "جنسیت",
|
|
158
|
+
"answer": {
|
|
159
|
+
"type": "select",
|
|
160
|
+
"options": [
|
|
161
|
+
"زن",
|
|
162
|
+
"مرد"
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
"alias": "gender",
|
|
166
|
+
"force": true,
|
|
167
|
+
"user_answered": "1"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"type": "text",
|
|
171
|
+
"label": "age",
|
|
172
|
+
"text": "سن",
|
|
173
|
+
"answer": {
|
|
174
|
+
"type": "number"
|
|
175
|
+
},
|
|
176
|
+
"alias": "age",
|
|
177
|
+
"force": true,
|
|
178
|
+
"user_answered": "35"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"type": "text",
|
|
182
|
+
"label": "education",
|
|
183
|
+
"text": "تحصیلات",
|
|
184
|
+
"answer": {
|
|
185
|
+
"type": "select",
|
|
186
|
+
"options": [
|
|
187
|
+
"ابتدایی اول",
|
|
188
|
+
"ابتدایی دوم",
|
|
189
|
+
"متوسطه اول",
|
|
190
|
+
"متوسطه دوم",
|
|
191
|
+
"دیپلم",
|
|
192
|
+
"کارشناسی",
|
|
193
|
+
"کارشناسی ارشد",
|
|
194
|
+
"پزشکی عمومی",
|
|
195
|
+
"متخصص",
|
|
196
|
+
"دکتری تخصصی",
|
|
197
|
+
"حوزوی مقدمات",
|
|
198
|
+
"حوزوی سطح۱",
|
|
199
|
+
"حوزوی سطح۲",
|
|
200
|
+
"حوزوی سطح۳",
|
|
201
|
+
"حوزوی سطح۴"
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"alias": "education",
|
|
205
|
+
"force": true,
|
|
206
|
+
"user_answered": "6"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"cornometer": 743,
|
|
210
|
+
"score": {
|
|
211
|
+
"status": "valid",
|
|
212
|
+
"nocturnal": 11,
|
|
213
|
+
"daytime": 7,
|
|
214
|
+
"total": 18,
|
|
215
|
+
"severity": "moderate"
|
|
216
|
+
},
|
|
217
|
+
"score_current_version": "1.0.0",
|
|
218
|
+
"score_last_version": "1.0.0"
|
|
219
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const { Profile } = require("../Profile");
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// AIS93 — مقیاس بیخوابی آتن (AIS-8 فارسی). Chart drawn from the Figma
|
|
5
|
+
// half-ring gauge (Assessments v3.0.0, node 5405:146150): the total (0–24) as
|
|
6
|
+
// a 180° gauge filling clockwise from 0 on the left to 100 % on the right,
|
|
7
|
+
// percentage and "mark از max" in the centre, title above.
|
|
8
|
+
// The interpretation panel and the reference cut-off text were dropped on
|
|
9
|
+
// request to match that design.
|
|
10
|
+
// All-or-nothing: unless scoring/AIS93.py returns status "valid", only the
|
|
11
|
+
// no-result message is drawn — never a partial or zero score.
|
|
12
|
+
// The gauge piece sits at (346, 284) on the 943 × 754 design page, one pixel
|
|
13
|
+
// off-centre on each axis (insets 346 / 347 and 284 / 283), so the Chart is
|
|
14
|
+
// the page minus the measured left/top insets: 251 × 186. The piece is 250
|
|
15
|
+
// wide; its bottom labels paint down to y ≈ 186.
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
const CHART = { width: 251, height: 186 };
|
|
18
|
+
const INSET = { x: 346, y: 284 }; // measured on the design page
|
|
19
|
+
|
|
20
|
+
// Gauge centre on the Chart; R 125 / r 87.5, so the ring's top sits at y = 42.
|
|
21
|
+
const GAUGE = { x: 125, y: 167 };
|
|
22
|
+
const SWEEP = { start: Math.PI, end: 2 * Math.PI }; // left → top → right, clockwise
|
|
23
|
+
|
|
24
|
+
class AIS93 extends Profile {
|
|
25
|
+
static pages = 1;
|
|
26
|
+
|
|
27
|
+
labels = {
|
|
28
|
+
L1: { eng: "total", title: "نمرهٔ کل", max: 24 },
|
|
29
|
+
L2: { eng: "status" }, // valid | incomplete | invalid
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
profileSpec = {
|
|
33
|
+
sample: {
|
|
34
|
+
name: "مقیاس بیخوابی آتن",
|
|
35
|
+
multiProfile: false,
|
|
36
|
+
questions: false,
|
|
37
|
+
defaultFields: true,
|
|
38
|
+
fields: [],
|
|
39
|
+
},
|
|
40
|
+
profile: {
|
|
41
|
+
get dimensions() {
|
|
42
|
+
return {
|
|
43
|
+
width: CHART.width + 2 * this.padding.x, // 251 → 903
|
|
44
|
+
height: CHART.height + 2 * this.padding.y, // 186 → 714
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
// Measured Chart inset on the 943 × 754 design page minus the 20 px the
|
|
48
|
+
// layout owns on every side, so the with-sidebar page renders at scale 1.
|
|
49
|
+
padding: {
|
|
50
|
+
x: INSET.x - 20, // 326
|
|
51
|
+
y: INSET.y - 20, // 264
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
labels: Object.values(this.labels),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
constructor(dataset, options, config = {}) {
|
|
58
|
+
super();
|
|
59
|
+
this._init(dataset, options, config);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
_calcContext() {
|
|
63
|
+
const s = this.dataset.score;
|
|
64
|
+
|
|
65
|
+
// Anything but an explicit "valid" is no result: a missing status must not
|
|
66
|
+
// let `?? 0` read as the lowest valid score.
|
|
67
|
+
if (s[1].mark !== "valid") return [{ valid: false }];
|
|
68
|
+
|
|
69
|
+
const mark = s[0].mark ?? 0;
|
|
70
|
+
const max = s[0].label.max;
|
|
71
|
+
const p = Math.min(Math.max(mark / max, 0), 1);
|
|
72
|
+
|
|
73
|
+
return [
|
|
74
|
+
{
|
|
75
|
+
valid: true,
|
|
76
|
+
total: {
|
|
77
|
+
title: "بیخوابی آتن",
|
|
78
|
+
mark,
|
|
79
|
+
max,
|
|
80
|
+
pct: Math.round(p * 100),
|
|
81
|
+
zeta: SWEEP.start + p * (SWEEP.end - SWEEP.start),
|
|
82
|
+
x: GAUGE.x,
|
|
83
|
+
y: GAUGE.y,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = AIS93;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const { Profile } = require("../Profile");
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// CAARS93 — مقیاس درجهبندی ADHD بزرگسالان کانرز، نسخهٔ غربالگری خودگزارشی.
|
|
5
|
+
// No Figma source: the chart is designed from the approved individual-result
|
|
6
|
+
// specification of the science package (CAARS-FA30-C1), whose rules this
|
|
7
|
+
// layout enforces rather than decorates:
|
|
8
|
+
// - three raw scores, each on its own separate line with its own range
|
|
9
|
+
// (0–27, 0–27, 0–36) and the score's position on it; never one shared
|
|
10
|
+
// axis, never a combined or comparative chart;
|
|
11
|
+
// - classification is off: one neutral hue, no coloured zone, no threshold,
|
|
12
|
+
// no label, no warning, no T, percentile or norm;
|
|
13
|
+
// - the only interpretation is the two approved sentences, verbatim;
|
|
14
|
+
// - the reference cut-off is text only, with all its caveats, because the
|
|
15
|
+
// profile is read by the authorised specialist and never handed to the
|
|
16
|
+
// respondent; no score is ever compared with it;
|
|
17
|
+
// - all-or-nothing: unless scoring/CAARS93.py returns status "valid", only
|
|
18
|
+
// the no-result message is drawn — never a partial or zero score.
|
|
19
|
+
// Chart 863 × 674, centred on the 943 × 754 design page.
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
const CHART = { width: 863, height: 674 };
|
|
22
|
+
|
|
23
|
+
// Each scale owns its axis: 0 at x=LINE.left, its own maximum at x=LINE.right.
|
|
24
|
+
const LINE = { left: 20, right: 560, top: 92, pitch: 64 };
|
|
25
|
+
|
|
26
|
+
class CAARS93 extends Profile {
|
|
27
|
+
static pages = 1;
|
|
28
|
+
|
|
29
|
+
labels = {
|
|
30
|
+
L1: { eng: "inattention", title: "کمبود توجه", max: 27 },
|
|
31
|
+
L2: { eng: "hyperactivity", title: "پرتحرکی–کنترل تکانه", max: 27 },
|
|
32
|
+
L3: { eng: "adhd_index", title: "شاخص ADHD", max: 36 },
|
|
33
|
+
L4: { eng: "status" }, // valid | incomplete | invalid
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
profileSpec = {
|
|
37
|
+
sample: {
|
|
38
|
+
name: "مقیاس درجهبندی اختلال کمبود توجه/بیشفعالی بزرگسالان کانرز — نسخهٔ غربالگری خودگزارشی",
|
|
39
|
+
multiProfile: false,
|
|
40
|
+
questions: false,
|
|
41
|
+
defaultFields: true,
|
|
42
|
+
fields: [],
|
|
43
|
+
},
|
|
44
|
+
profile: {
|
|
45
|
+
get dimensions() {
|
|
46
|
+
return {
|
|
47
|
+
width: CHART.width + 2 * this.padding.x, // 863 → 903
|
|
48
|
+
height: CHART.height + 2 * this.padding.y, // 674 → 714
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
// Chart inset inside the 943 × 754 design page minus the 20 px the layout
|
|
52
|
+
// owns on every side, so the with-sidebar page renders at scale 1.
|
|
53
|
+
padding: {
|
|
54
|
+
x: (943 - CHART.width) / 2 - 20, // 20
|
|
55
|
+
y: (754 - CHART.height) / 2 - 20, // 20
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
labels: Object.values(this.labels),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
constructor(dataset, options, config = {}) {
|
|
62
|
+
super();
|
|
63
|
+
this._init(dataset, options, config);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_calcContext() {
|
|
67
|
+
const s = this.dataset.score;
|
|
68
|
+
|
|
69
|
+
// Anything but an explicit "valid" is no result: a missing status must not
|
|
70
|
+
// let `?? 0` zeros read as the lowest valid score.
|
|
71
|
+
if (s[3].mark !== "valid") return [{ valid: false }];
|
|
72
|
+
|
|
73
|
+
const scales = s.slice(0, 3).map((data, i) => {
|
|
74
|
+
const mark = data.mark ?? 0;
|
|
75
|
+
const max = data.label.max;
|
|
76
|
+
const y = LINE.top + i * LINE.pitch;
|
|
77
|
+
return {
|
|
78
|
+
title: data.label.title,
|
|
79
|
+
mark,
|
|
80
|
+
max,
|
|
81
|
+
left: LINE.left,
|
|
82
|
+
right: LINE.right,
|
|
83
|
+
valueX: LINE.right + 16,
|
|
84
|
+
y,
|
|
85
|
+
x: LINE.left + ((LINE.right - LINE.left) * mark) / max,
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return [{ valid: true, scales }];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = CAARS93;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
const { Profile } = require("../Profile");
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// ISI93 — شاخص شدت بیخوابی مورین. Layout assembled from two existing Figma
|
|
5
|
+
// components (Assessments v3.0.0):
|
|
6
|
+
// - the severity strip on top is the BDI "Total" piece (node 5069:129385):
|
|
7
|
+
// one bar over the total with dashed band edges, the band's upper score
|
|
8
|
+
// above each edge and the respondent's band highlighted in its colour;
|
|
9
|
+
// - each component is a 270° ring gauge, the "P Total" piece (node
|
|
10
|
+
// 4729:125971): 0 at the top, filling clockwise to 100 % on the left,
|
|
11
|
+
// percentage and "mark از max" in the centre, title underneath.
|
|
12
|
+
// Rules kept from the science record: the two components are drawn in one
|
|
13
|
+
// neutral hue and without a class, each against its own maximum (the "از max"
|
|
14
|
+
// readout keeps their unequal ranges visible); all-or-nothing — unless scoring
|
|
15
|
+
// returns status "valid", only the no-result message is drawn.
|
|
16
|
+
// Chart 545 × 289, centred on the 943 × 754 design page; the strip bar and the
|
|
17
|
+
// gauge pair are both centred on the Chart, so both sit mid-page.
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
const CHART = { width: 545, height: 289 };
|
|
20
|
+
|
|
21
|
+
// Severity strip: the piece sits at the Chart origin, its bar starts at x = 48
|
|
22
|
+
// and 28 points span its 449 px, so score s ends at s * STRIP.unit on the bar.
|
|
23
|
+
const STRIP = { width: 449, max: 28 };
|
|
24
|
+
STRIP.unit = STRIP.width / STRIP.max;
|
|
25
|
+
const INSIDE_MIN = 34; // narrowest bar that still holds a two-digit score inside
|
|
26
|
+
|
|
27
|
+
// Severity bands over the total; each edge sits on its band's upper score.
|
|
28
|
+
// Colours are the BDI severity palette [gradient start, gradient end / accent].
|
|
29
|
+
const BANDS = [
|
|
30
|
+
{ key: "none", to: 7, title: "ناچیز", colors: ["#CBD5E1", "#475569"] },
|
|
31
|
+
{ key: "subthreshold", to: 14, title: "زیرآستانه", colors: ["#FDE047", "#EAB308"] },
|
|
32
|
+
{ key: "moderate", to: 21, title: "متوسط", colors: ["#FDBA74", "#EA580C"] },
|
|
33
|
+
{ key: "severe", to: 28, title: "شدید", colors: ["#FDA4AF", "#E11D48"] },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
// Component gauges: ring centres, symmetric about the strip bar's centre
|
|
37
|
+
// (x = 272.5, also the Chart's centre); in RTL order the first component is
|
|
38
|
+
// on the right.
|
|
39
|
+
const GAUGE = { centers: [372.5, 172.5], y: 195 };
|
|
40
|
+
const SWEEP = { start: -Math.PI / 2, end: Math.PI }; // clockwise 270°
|
|
41
|
+
|
|
42
|
+
class ISI93 extends Profile {
|
|
43
|
+
static pages = 1;
|
|
44
|
+
|
|
45
|
+
labels = {
|
|
46
|
+
L1: { eng: "nocturnal", title: "شدت نشانههای شبانه", max: 16 },
|
|
47
|
+
L2: { eng: "daytime", title: "اثرهای روزانهٔ بیخوابی", max: 12 },
|
|
48
|
+
L3: { eng: "total", title: "نمرهٔ کل", max: 28 },
|
|
49
|
+
L4: { eng: "status" }, // valid | incomplete | invalid
|
|
50
|
+
L5: { eng: "severity" }, // none | subthreshold | moderate | severe
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
profileSpec = {
|
|
54
|
+
sample: {
|
|
55
|
+
name: "شاخص شدت بیخوابی مورین",
|
|
56
|
+
multiProfile: false,
|
|
57
|
+
questions: false,
|
|
58
|
+
defaultFields: true,
|
|
59
|
+
fields: [],
|
|
60
|
+
},
|
|
61
|
+
profile: {
|
|
62
|
+
get dimensions() {
|
|
63
|
+
return {
|
|
64
|
+
width: CHART.width + 2 * this.padding.x, // 545 → 903
|
|
65
|
+
height: CHART.height + 2 * this.padding.y, // 289 → 714
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
// Chart inset inside the 943 × 754 design page minus the 20 px the layout
|
|
69
|
+
// owns on every side, so the with-sidebar page renders at scale 1.
|
|
70
|
+
padding: {
|
|
71
|
+
x: (943 - CHART.width) / 2 - 20, // 179
|
|
72
|
+
y: (754 - CHART.height) / 2 - 20, // 212.5
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
labels: Object.values(this.labels),
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
constructor(dataset, options, config = {}) {
|
|
79
|
+
super();
|
|
80
|
+
this._init(dataset, options, config);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_calcContext() {
|
|
84
|
+
const s = this.dataset.score;
|
|
85
|
+
const status = s[3].mark;
|
|
86
|
+
const active = BANDS.findIndex((band) => band.key === s[4].mark);
|
|
87
|
+
|
|
88
|
+
// Anything but an explicit "valid" with a known class is no result: a
|
|
89
|
+
// missing status must not let `?? 0` zeros read as "no insomnia".
|
|
90
|
+
if (status !== "valid" || active === -1) return [{ valid: false }];
|
|
91
|
+
|
|
92
|
+
const bands = BANDS.map((band, i) => {
|
|
93
|
+
const from = i === 0 ? 0 : BANDS[i - 1].to * STRIP.unit;
|
|
94
|
+
const edge = band.to * STRIP.unit;
|
|
95
|
+
return {
|
|
96
|
+
to: band.to,
|
|
97
|
+
edge,
|
|
98
|
+
center: (from + edge) / 2,
|
|
99
|
+
title: band.title,
|
|
100
|
+
active: i === active,
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const mark = s[2].mark ?? 0;
|
|
105
|
+
const max = s[2].label.max;
|
|
106
|
+
const pct = Math.round((mark / max) * 100);
|
|
107
|
+
const width = mark * STRIP.unit;
|
|
108
|
+
const inside = width >= INSIDE_MIN;
|
|
109
|
+
const colors = BANDS[active].colors;
|
|
110
|
+
|
|
111
|
+
const components = s.slice(0, 2).map((data, i) => {
|
|
112
|
+
const value = data.mark ?? 0;
|
|
113
|
+
const p = Math.min(value / data.label.max, 1);
|
|
114
|
+
return {
|
|
115
|
+
title: data.label.title,
|
|
116
|
+
mark: value,
|
|
117
|
+
max: data.label.max,
|
|
118
|
+
pct: Math.round(p * 100),
|
|
119
|
+
zeta: SWEEP.start + p * (SWEEP.end - SWEEP.start),
|
|
120
|
+
x: GAUGE.centers[i],
|
|
121
|
+
y: GAUGE.y,
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
return [
|
|
126
|
+
{
|
|
127
|
+
valid: true,
|
|
128
|
+
bands,
|
|
129
|
+
total: {
|
|
130
|
+
mark,
|
|
131
|
+
max,
|
|
132
|
+
pct,
|
|
133
|
+
width,
|
|
134
|
+
colors,
|
|
135
|
+
// Score inside the tip when it fits, otherwise just past it.
|
|
136
|
+
labelX: inside ? width - 8 : width + 8,
|
|
137
|
+
labelAnchor: inside ? "start" : "end",
|
|
138
|
+
labelFill: inside ? "#FFFFFF" : colors[1],
|
|
139
|
+
},
|
|
140
|
+
components,
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
module.exports = ISI93;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{{#> layout}}
|
|
2
|
+
|
|
3
|
+
<defs>
|
|
4
|
+
{{#if valid}}
|
|
5
|
+
{{! Fill gradient from the Figma export, in gauge-centred user space (page 346,451 → 555.826,359.187 about centre 471,451) }}
|
|
6
|
+
<linearGradient id="aisGauge" x1="-125" y1="0" x2="84.826" y2="-91.813" gradientUnits="userSpaceOnUse">
|
|
7
|
+
<stop stop-color="#818CF8"/>
|
|
8
|
+
<stop offset="1" stop-color="#4338CA"/>
|
|
9
|
+
</linearGradient>
|
|
10
|
+
{{! Track shape: both ends rounded; clips the fill so a full gauge keeps the rounded right end }}
|
|
11
|
+
<clipPath id="aisGaugeTrack">
|
|
12
|
+
{{gauge 125 87.5 (object tl=6 tr=6 bl=6 br=6) (object start=(toRad 180) end=(toRad 0)) false}}
|
|
13
|
+
</clipPath>
|
|
14
|
+
{{/if}}
|
|
15
|
+
</defs>
|
|
16
|
+
|
|
17
|
+
<g transform="translate({{spec.profile.padding.x}}, {{spec.profile.padding.y}})">
|
|
18
|
+
|
|
19
|
+
{{#if valid}}
|
|
20
|
+
|
|
21
|
+
{{! ===================== Half-ring gauge (Figma node 5405:146150) ===================== }}
|
|
22
|
+
<g transform="translate({{total.x}}, {{total.y}})">
|
|
23
|
+
{{gauge 125 87.5 (object tl=6 tr=6 bl=6 br=6) (object start=(toRad 180) end=(toRad 0)) false fill="#F1F5F9"}}
|
|
24
|
+
{{#if total.mark}}{{gauge 125 87.5 (object tl=6 tr=0 bl=6 br=0) (object start=(toRad 180) end=total.zeta) false clip-path="url(#aisGaugeTrack)" fill="url(#aisGauge)"}}{{/if}}
|
|
25
|
+
</g>
|
|
26
|
+
|
|
27
|
+
<text x="124.5" y="18" text-anchor="middle" font-size="18" font-weight="500" fill="#4338CA">{{total.title}}</text>
|
|
28
|
+
|
|
29
|
+
<text x="125" y="141" text-anchor="middle" font-size="28" font-weight="600" fill="#4F46E5" direction="ltr">٪ {{total.pct}}</text>
|
|
30
|
+
<text x="125" y="166" text-anchor="middle" font-size="18" font-weight="500" fill="#64748B">{{total.mark}} از {{total.max}}</text>
|
|
31
|
+
|
|
32
|
+
<text x="18.5" y="186" text-anchor="middle" font-size="14" font-weight="500" fill="#64748B">0</text>
|
|
33
|
+
<text x="232.5" y="186" text-anchor="middle" font-size="14" font-weight="500" fill="#64748B" direction="ltr">٪ 100</text>
|
|
34
|
+
|
|
35
|
+
{{else}}
|
|
36
|
+
|
|
37
|
+
{{! ===================== No result (all-or-nothing), centred on the Chart ===================== }}
|
|
38
|
+
<g transform="translate(-306.5, -243.5)">
|
|
39
|
+
<rect x="181.5" y="237.5" width="500" height="199" rx="12" fill="#F8FAFC" stroke="#E2E8F0"/>
|
|
40
|
+
<circle cx="431.5" cy="288" r="17" fill="none" stroke="#64748B" stroke-width="2"/>
|
|
41
|
+
<line x1="431.5" y1="279" x2="431.5" y2="291" stroke="#64748B" stroke-width="2.5" stroke-linecap="round"/>
|
|
42
|
+
<circle cx="431.5" cy="297.5" r="1.6" fill="#64748B"/>
|
|
43
|
+
<text x="431.5" y="344" text-anchor="middle" font-size="17" font-weight="600" fill="#1E293B">نمره تولید نشد</text>
|
|
44
|
+
<text x="431.5" y="376" text-anchor="middle" font-size="13" fill="#64748B">پاسخ ناقص یا نامعتبر است؛ هیچ نمرهای، حتی نمرهٔ جزئی، گزارش نمیشود.</text>
|
|
45
|
+
</g>
|
|
46
|
+
|
|
47
|
+
{{/if}}
|
|
48
|
+
|
|
49
|
+
</g>
|
|
50
|
+
|
|
51
|
+
{{/layout}}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{{#> layout}}
|
|
2
|
+
|
|
3
|
+
<g transform="translate({{spec.profile.padding.x}}, {{spec.profile.padding.y}})">
|
|
4
|
+
|
|
5
|
+
{{#if valid}}
|
|
6
|
+
|
|
7
|
+
{{! ===================== Three raw scores, three separate lines ===================== }}
|
|
8
|
+
{{! Each line is its own axis (0 to that scale's maximum); one neutral hue, no zone, no threshold. }}
|
|
9
|
+
<text x="843" y="24" text-anchor="start" font-size="16" font-weight="600" fill="#1E293B">نمرهها</text>
|
|
10
|
+
|
|
11
|
+
{{#each scales as |item|}}
|
|
12
|
+
<text x="843" y="{{math item.y '+' 5}}" text-anchor="start" font-size="14" font-weight="600" fill="#334155">{{item.title}}</text>
|
|
13
|
+
<text x="{{item.valueX}}" y="{{math item.y '+' 5}}" text-anchor="end" font-size="13" fill="#334155"><tspan font-weight="700">{{item.mark}}</tspan> از {{item.max}}</text>
|
|
14
|
+
|
|
15
|
+
<line x1="{{item.left}}" y1="{{item.y}}" x2="{{item.right}}" y2="{{item.y}}" stroke="#CBD5E1" stroke-width="4" stroke-linecap="round"/>
|
|
16
|
+
<line x1="{{item.left}}" y1="{{math item.y '-' 7}}" x2="{{item.left}}" y2="{{math item.y '+' 7}}" stroke="#94A3B8" stroke-width="1.5"/>
|
|
17
|
+
<line x1="{{item.right}}" y1="{{math item.y '-' 7}}" x2="{{item.right}}" y2="{{math item.y '+' 7}}" stroke="#94A3B8" stroke-width="1.5"/>
|
|
18
|
+
<text x="{{item.left}}" y="{{math item.y '+' 24}}" text-anchor="middle" font-size="11" fill="#94A3B8">0</text>
|
|
19
|
+
<text x="{{item.right}}" y="{{math item.y '+' 24}}" text-anchor="middle" font-size="11" fill="#94A3B8">{{item.max}}</text>
|
|
20
|
+
|
|
21
|
+
<circle cx="{{item.x}}" cy="{{item.y}}" r="7" fill="#475569" stroke="white" stroke-width="2"/>
|
|
22
|
+
<text x="{{item.x}}" y="{{math item.y '-' 14}}" text-anchor="middle" font-size="13" font-weight="700" fill="#1E293B">{{item.mark}}</text>
|
|
23
|
+
{{/each}}
|
|
24
|
+
|
|
25
|
+
{{! ===================== Interpretation, uncertainty, reference cut-off ===================== }}
|
|
26
|
+
{{! Fixed text from the science package; the profile is read by the authorised specialist. }}
|
|
27
|
+
<rect x="0.5" y="272.5" width="862" height="401" rx="8" fill="#F8FAFC" stroke="#E2E8F0"/>
|
|
28
|
+
|
|
29
|
+
<text x="843" y="302" text-anchor="start" font-size="15" font-weight="600" fill="#1E293B">تفسیر</text>
|
|
30
|
+
<text x="843" y="330" text-anchor="start" font-size="13.5" fill="#334155">نمرهٔ بالاتر در هر مقیاس یعنی پاسخدهنده نشانههای بیشتری از همان مقیاس گزارش کرده است.</text>
|
|
31
|
+
<text x="843" y="354" text-anchor="start" font-size="13.5" fill="#334155">این نمره تشخیص نیست.</text>
|
|
32
|
+
|
|
33
|
+
<text x="843" y="390" text-anchor="start" font-size="15" font-weight="600" fill="#1E293B">عدم قطعیت و محدودیت</text>
|
|
34
|
+
<circle cx="840" cy="413.5" r="2" fill="#334155"/>
|
|
35
|
+
<text x="831" y="418" text-anchor="start" font-size="13.5" fill="#334155">این ابزار غربال است، نه تشخیص.</text>
|
|
36
|
+
<circle cx="840" cy="437.5" r="2" fill="#334155"/>
|
|
37
|
+
<text x="831" y="442" text-anchor="start" font-size="13.5" fill="#334155">برای این نسخه هنجار ایرانی و برش قابل محاسبه وجود ندارد.</text>
|
|
38
|
+
<circle cx="840" cy="461.5" r="2" fill="#334155"/>
|
|
39
|
+
<text x="831" y="466" text-anchor="start" font-size="13.5" fill="#334155">نمرهٔ بالا ممکن است از افسردگی یا اضطراب هم بیاید.</text>
|
|
40
|
+
<circle cx="840" cy="485.5" r="2" fill="#334155"/>
|
|
41
|
+
<text x="831" y="490" text-anchor="start" font-size="13.5" fill="#334155">آزمون تصمیمیار است، نه تصمیمگیر قطعی.</text>
|
|
42
|
+
|
|
43
|
+
<text x="843" y="526" text-anchor="start" font-size="15" font-weight="600" fill="#1E293B">نقطهٔ برش مرجع</text>
|
|
44
|
+
{{! "T ≥ 65" is its own left-to-right text: inside a right-to-left run it reorders to "65 ≥ T". }}
|
|
45
|
+
<text x="843" y="552" direction="ltr" text-anchor="end" font-size="13" font-weight="600" fill="#334155">T ≥ 65</text>
|
|
46
|
+
<text x="790" y="552" text-anchor="start" font-size="13" fill="#334155">— حساسیت 59٪، ویژگی 92٪</text>
|
|
47
|
+
<text x="843" y="576" direction="ltr" text-anchor="end" font-size="13" font-weight="600" fill="#334155">T ≥ 55</text>
|
|
48
|
+
<text x="790" y="576" text-anchor="start" font-size="13" fill="#334155">— حساسیت 89٪، ویژگی 68٪</text>
|
|
49
|
+
<text x="843" y="602" text-anchor="start" font-size="13" fill="#334155">منبع: مطالعهٔ روایی ملاکیِ یک ترجمهٔ فارسیِ دیگر از همین فرم، 1393.</text>
|
|
50
|
+
<text x="843" y="626" text-anchor="start" font-size="13" fill="#334155">جامعه: 100 والدِ کودکانِ مبتلا به ADHD؛ ملاک بیرونی: مصاحبهٔ روانپزشکی بر پایهٔ ملاکهای یوتا.</text>
|
|
51
|
+
<text x="843" y="654" text-anchor="start" font-size="13" font-weight="600" fill="#334155">این دو عدد روی مقیاس T تعریف شدهاند و با نمرههای خامِ این نسخه قابل مقایسه نیستند.</text>
|
|
52
|
+
|
|
53
|
+
{{else}}
|
|
54
|
+
|
|
55
|
+
{{! ===================== No result (all-or-nothing) ===================== }}
|
|
56
|
+
<rect x="181.5" y="237.5" width="500" height="199" rx="12" fill="#F8FAFC" stroke="#E2E8F0"/>
|
|
57
|
+
<circle cx="431.5" cy="288" r="17" fill="none" stroke="#64748B" stroke-width="2"/>
|
|
58
|
+
<line x1="431.5" y1="279" x2="431.5" y2="291" stroke="#64748B" stroke-width="2.5" stroke-linecap="round"/>
|
|
59
|
+
<circle cx="431.5" cy="297.5" r="1.6" fill="#64748B"/>
|
|
60
|
+
<text x="431.5" y="344" text-anchor="middle" font-size="17" font-weight="600" fill="#1E293B">نمره تولید نشد</text>
|
|
61
|
+
<text x="431.5" y="376" text-anchor="middle" font-size="13" fill="#64748B">پاسخ ناقص یا نامعتبر است؛ هیچ نمرهای، حتی نمرهٔ جزئی، گزارش نمیشود.</text>
|
|
62
|
+
|
|
63
|
+
{{/if}}
|
|
64
|
+
|
|
65
|
+
</g>
|
|
66
|
+
|
|
67
|
+
{{/layout}}
|