@baravak/risloo-profile-cli 4.84.0 → 4.86.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.
@@ -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,135 @@
1
+ const { Profile } = require("../Profile");
2
+
3
+ // ---------------------------------------------------------------------------
4
+ // PSQI93 — شاخص کیفیت خواب پیتزبورگ. No Figma source: the chart was designed
5
+ // directly from the approved result specification of the science record
6
+ // (catalog/assessments/psqi, «مشخصات نتیجه فردی»), whose rules this layout
7
+ // enforces rather than decorates:
8
+ // - seven components on one shared 0–3 axis, raw only — no per-component
9
+ // class, colour or label (no evidence for any);
10
+ // - the total 0–21, drawn neutral: the screening result lives ONLY in the
11
+ // approved interpretation text — no badge, no colour, no cut line;
12
+ // - all-or-nothing: when scoring/PSQI93.py returns status "invalid" nothing
13
+ // but the no-result message is drawn — never a partial or zero score.
14
+ // Chart 863 × 674, centred on the 943 × 754 design page.
15
+ // ---------------------------------------------------------------------------
16
+ const CHART = { width: 863, height: 674 };
17
+
18
+ // Component rows: bars grow left → right from the 0 guide; the total card sits
19
+ // to the right of the chart.
20
+ const ROW = { top: 84, pitch: 44, height: 18 };
21
+ const AXIS = { zero: 162, unit: 150, max: 3 }; // 0 at x=162, 3 at x=612
22
+ const BASELINE = 13.2; // 14 px text on an 18 px row
23
+
24
+ // Total card bar, also left → right: 0 at the card's left inset, 21 at its right.
25
+ const TOTAL = { left: 713, length: 130, max: 21, cutoff: 6 };
26
+
27
+ // Interpretation panel: one fixed line pitch; the conditional false-positive
28
+ // line collapses its space when the screen is negative.
29
+ const TEXT = { top: 494, pitch: 27 };
30
+
31
+ class PSQI93 extends Profile {
32
+ static pages = 1;
33
+
34
+ labels = {
35
+ L1: { eng: "subjective_quality", title: "کیفیت ذهنی خواب" },
36
+ L2: { eng: "latency", title: "تأخیر خواب" },
37
+ L3: { eng: "duration", title: "مدت خواب" },
38
+ L4: { eng: "efficiency", title: "کارایی معمول خواب" },
39
+ L5: { eng: "disturbances", title: "اختلال‌های خواب" },
40
+ L6: { eng: "medication", title: "مصرف داروی خواب" },
41
+ L7: { eng: "daytime_dysfunction", title: "اختلال عملکرد روزانه" },
42
+ L8: { eng: "total", title: "نمره کل", max: 21 },
43
+ L9: { eng: "status" }, // valid | invalid
44
+ L10: { eng: "screening" }, // positive | negative — read, never drawn as a label
45
+ };
46
+
47
+ profileSpec = {
48
+ sample: {
49
+ name: "شاخص کیفیت خواب پیتزبورگ",
50
+ multiProfile: false,
51
+ questions: false,
52
+ defaultFields: true,
53
+ fields: [],
54
+ },
55
+ profile: {
56
+ get dimensions() {
57
+ return {
58
+ width: CHART.width + 2 * this.padding.x, // 863 → 903
59
+ height: CHART.height + 2 * this.padding.y, // 674 → 714
60
+ };
61
+ },
62
+ // Chart inset inside the 943 × 754 design page minus the 20 px the layout
63
+ // owns on every side, so the with-sidebar page renders at scale 1.
64
+ padding: {
65
+ x: (943 - CHART.width) / 2 - 20, // 20
66
+ y: (754 - CHART.height) / 2 - 20, // 20
67
+ },
68
+ },
69
+ labels: Object.values(this.labels),
70
+ };
71
+
72
+ constructor(dataset, options, config = {}) {
73
+ super();
74
+ this._init(dataset, options, config);
75
+ }
76
+
77
+ _calcContext() {
78
+ const s = this.dataset.score;
79
+ const status = s[8].mark;
80
+
81
+ // Anything but an explicit "valid" is treated as no result: a missing
82
+ // status must not let seven `?? 0` zeros read as "no sleep problem".
83
+ if (status !== "valid") return [{ valid: false }];
84
+
85
+ const items = s.slice(0, 7).map((data, i) => {
86
+ const mark = data.mark ?? 0;
87
+ const top = ROW.top + i * ROW.pitch;
88
+ const width = mark * AXIS.unit;
89
+ return {
90
+ title: data.label.title,
91
+ mark,
92
+ top,
93
+ width,
94
+ x: AXIS.zero,
95
+ baseline: top + BASELINE,
96
+ };
97
+ });
98
+
99
+ const totalMark = s[7].mark ?? 0;
100
+ const positive = totalMark >= TOTAL.cutoff;
101
+ const totalWidth = (TOTAL.length * totalMark) / TOTAL.max;
102
+
103
+ const line = (n) => TEXT.top + n * TEXT.pitch;
104
+ const falsePositive = positive ? line(3) : null;
105
+ const next = positive ? 4 : 3;
106
+
107
+ return [
108
+ {
109
+ valid: true,
110
+ items,
111
+ ticks: [0, 1, 2, 3].map((v) => ({ v, x: AXIS.zero + v * AXIS.unit })),
112
+ total: {
113
+ mark: totalMark,
114
+ max: TOTAL.max,
115
+ width: totalWidth,
116
+ x: TOTAL.left,
117
+ },
118
+ screen: {
119
+ positive,
120
+ text: positive ? "نیازمند بررسی بیشتر" : "نشانه‌ای از مشکل قابل‌توجه دیده نشد",
121
+ },
122
+ lines: {
123
+ direction: line(0),
124
+ screen: line(1),
125
+ cutoff: line(2),
126
+ falsePositive,
127
+ limits1: line(next),
128
+ limits2: line(next + 1),
129
+ },
130
+ },
131
+ ];
132
+ }
133
+ }
134
+
135
+ module.exports = PSQI93;
@@ -0,0 +1,63 @@
1
+ {{#> layout}}
2
+
3
+ <g transform="translate({{spec.profile.padding.x}}, {{spec.profile.padding.y}})">
4
+
5
+ {{#if valid}}
6
+
7
+ {{! ===================== The total, on its own 0–24 line ===================== }}
8
+ {{! One neutral hue; no zone, no threshold, no tick at the reference cut-off. }}
9
+ <text x="843" y="24" text-anchor="start" font-size="16" font-weight="600" fill="#1E293B">نمرهٔ کل</text>
10
+
11
+ <line x1="{{total.left}}" y1="{{total.y}}" x2="{{total.right}}" y2="{{total.y}}" stroke="#CBD5E1" stroke-width="4" stroke-linecap="round"/>
12
+ <line x1="{{total.left}}" y1="{{math total.y '-' 7}}" x2="{{total.left}}" y2="{{math total.y '+' 7}}" stroke="#94A3B8" stroke-width="1.5"/>
13
+ <line x1="{{total.right}}" y1="{{math total.y '-' 7}}" x2="{{total.right}}" y2="{{math total.y '+' 7}}" stroke="#94A3B8" stroke-width="1.5"/>
14
+ <text x="{{total.left}}" y="{{math total.y '+' 24}}" text-anchor="middle" font-size="11" fill="#94A3B8">0</text>
15
+ <text x="{{total.right}}" y="{{math total.y '+' 24}}" text-anchor="middle" font-size="11" fill="#94A3B8">{{total.max}}</text>
16
+
17
+ <circle cx="{{total.x}}" cy="{{total.y}}" r="7" fill="#475569" stroke="white" stroke-width="2"/>
18
+ <text x="{{total.x}}" y="{{math total.y '-' 14}}" text-anchor="middle" font-size="13" font-weight="700" fill="#1E293B">{{total.mark}}</text>
19
+
20
+ {{! Total card (right of the line) }}
21
+ <rect x="693.5" y="52.5" width="169" height="120" rx="8" fill="#F8FAFC" stroke="#E2E8F0"/>
22
+ <text x="778" y="82" text-anchor="middle" font-size="14" font-weight="600" fill="#475569">نمرهٔ کل</text>
23
+ <text x="778" y="134" text-anchor="middle" font-size="44" font-weight="700" fill="#1E293B">{{total.mark}}</text>
24
+ <text x="778" y="158" text-anchor="middle" font-size="13" fill="#64748B">از {{total.max}}</text>
25
+
26
+ {{! ===================== Interpretation, uncertainty, reference cut-off ===================== }}
27
+ {{! Fixed text from the science package; the profile is read by the authorised specialist. }}
28
+ <rect x="0.5" y="204.5" width="862" height="401" rx="8" fill="#F8FAFC" stroke="#E2E8F0"/>
29
+
30
+ <text x="843" y="236" text-anchor="start" font-size="15" font-weight="600" fill="#1E293B">تفسیر</text>
31
+ <text x="843" y="264" text-anchor="start" font-size="13.5" fill="#334155">نمرهٔ بالاتر، دشواری بیشتری در خواب را نشان می‌دهد، همان‌طور که پاسخ‌دهنده خودش گزارش کرده است.</text>
32
+ <text x="843" y="288" text-anchor="start" font-size="13.5" fill="#334155">این نمره تشخیص نیست.</text>
33
+
34
+ <text x="843" y="326" text-anchor="start" font-size="15" font-weight="600" fill="#1E293B">عدم قطعیت و محدودیت</text>
35
+ <circle cx="840" cy="349.5" r="2" fill="#334155"/>
36
+ <text x="831" y="354" text-anchor="start" font-size="13.5" fill="#334155">این نسخهٔ فارسی اعتبارسنجی نشده و برش بومی ندارد.</text>
37
+ <circle cx="840" cy="373.5" r="2" fill="#334155"/>
38
+ <text x="831" y="378" text-anchor="start" font-size="13.5" fill="#334155">این ابزار غربال است، نه تشخیص.</text>
39
+ <circle cx="840" cy="397.5" r="2" fill="#334155"/>
40
+ <text x="831" y="402" text-anchor="start" font-size="13.5" fill="#334155">آزمون تصمیم‌یار است، نه تصمیم‌گیر قطعی.</text>
41
+
42
+ <text x="843" y="440" text-anchor="start" font-size="15" font-weight="600" fill="#1E293B">نقطهٔ برش مرجع</text>
43
+ <text x="843" y="468" text-anchor="start" font-size="13" fill="#334155">نمرهٔ کل <tspan font-weight="700">6</tspan> — فقط اطلاعات مرجع برای متخصص؛ نمرهٔ این پاسخ‌نامه با آن طبقه‌بندی نمی‌شود.</text>
44
+ <text x="843" y="496" text-anchor="start" font-size="13" fill="#334155">منبع: مطالعهٔ روایی تشخیصیِ نسخهٔ یونانی، در برابر تشخیص بی‌خوابی غیرارگانیک در <tspan class="eng-font" font-family="Dana">ICD-10</tspan>.</text>
45
+ <text x="843" y="520" text-anchor="start" font-size="13" fill="#334155">جامعه: نمونهٔ بالینی/مختلط آتن، 299 نفر.</text>
46
+ <text x="843" y="544" text-anchor="start" font-size="13" fill="#334155">سال: 2003.</text>
47
+ <text x="843" y="572" text-anchor="start" font-size="13" font-weight="600" fill="#334155">این عدد به نسخهٔ فارسی و به فرم پنج‌گویه‌ای تعلق ندارد.</text>
48
+
49
+ {{else}}
50
+
51
+ {{! ===================== No result (all-or-nothing) ===================== }}
52
+ <rect x="181.5" y="237.5" width="500" height="199" rx="12" fill="#F8FAFC" stroke="#E2E8F0"/>
53
+ <circle cx="431.5" cy="288" r="17" fill="none" stroke="#64748B" stroke-width="2"/>
54
+ <line x1="431.5" y1="279" x2="431.5" y2="291" stroke="#64748B" stroke-width="2.5" stroke-linecap="round"/>
55
+ <circle cx="431.5" cy="297.5" r="1.6" fill="#64748B"/>
56
+ <text x="431.5" y="344" text-anchor="middle" font-size="17" font-weight="600" fill="#1E293B">نمره تولید نشد</text>
57
+ <text x="431.5" y="376" text-anchor="middle" font-size="13" fill="#64748B">پاسخ ناقص یا نامعتبر است؛ هیچ نمره‌ای، حتی نمرهٔ جزئی، گزارش نمی‌شود.</text>
58
+
59
+ {{/if}}
60
+
61
+ </g>
62
+
63
+ {{/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}}
@@ -0,0 +1,82 @@
1
+ {{#> layout}}
2
+
3
+ <defs>
4
+ {{#if valid}}
5
+ {{! Severity strip fill, in the respondent's band colour (BDI "Total") }}
6
+ <linearGradient id="isiTotal" x1="-4.8" y1="14" x2="{{total.width}}" y2="14" gradientUnits="userSpaceOnUse">
7
+ <stop stop-color="{{total.colors.[0]}}"/>
8
+ <stop offset="1" stop-color="{{total.colors.[1]}}"/>
9
+ </linearGradient>
10
+ <clipPath id="isiTotalTrack">
11
+ {{bar 449 28 (object tl=0 bl=0 tr=4 br=4) (toRad 0)}}
12
+ </clipPath>
13
+
14
+ {{! Component ring gauge ("P Total" at 6/7 scale: R 60, r 42), neutral slate: gradient local to the ring centre }}
15
+ <linearGradient id="isiGauge" x1="60" y1="-59.34" x2="-50.43" y2="107.66" gradientUnits="userSpaceOnUse">
16
+ <stop stop-color="#94A3B8"/>
17
+ <stop offset="0.5" stop-color="#475569"/>
18
+ <stop offset="1" stop-color="#475569"/>
19
+ </linearGradient>
20
+ <clipPath id="isiGaugeTrack">
21
+ {{gauge 60 42 (object tl=6 tr=6 bl=6 br=6) (object start=(toRad -90) end=(toRad 180)) false}}
22
+ </clipPath>
23
+ {{/if}}
24
+ </defs>
25
+
26
+ <g transform="translate({{spec.profile.padding.x}}, {{spec.profile.padding.y}})">
27
+
28
+ {{#if valid}}
29
+
30
+ {{! ===================== Severity strip (BDI "Total" piece) ===================== }}
31
+ <g>
32
+ <g transform="translate(48, 44)">
33
+ <text y="0" x="-8" dy=".85em" text-anchor="start" font-size="13" font-weight="500" fill="#64748B">نمره کل</text>
34
+ <text y="0" x="-8" dy="2.1em" text-anchor="start" font-size="13" font-weight="600" fill="#475569">{{total.pct}} ٪</text>
35
+ {{bar 449 28 (object tl=0 bl=0 tr=4 br=4) (toRad 0) fill="#F8FAFC"}}
36
+ {{#if total.width}}
37
+ {{bar total.width 28 (object tl=0 bl=0 tr=4 br=4) (toRad 0) fill="url(#isiTotal)" clip-path="url(#isiTotalTrack)"}}
38
+ {{/if}}
39
+ <text y="14" x="{{total.labelX}}" dy=".3em" text-anchor="{{total.labelAnchor}}" font-size="16" font-weight="600" fill="{{total.labelFill}}">{{total.mark}}</text>
40
+ </g>
41
+
42
+ {{! Band edges: upper score above a dashed line, band title centred in the band }}
43
+ <g transform="translate(48, 16)">
44
+ {{#each bands as |band|}}
45
+ <text y="-16" x="{{band.edge}}" dy=".85em" text-anchor="middle" font-size="12" font-weight="400" fill="#94A3B8">{{band.to}}</text>
46
+ <text y="3" x="{{band.center}}" dy=".85em" text-anchor="middle" font-size="13" font-weight="{{ternary band.active 600 400}}" fill="{{ternary band.active ../total.colors.[1] '#64748B'}}">{{band.title}}</text>
47
+ <line x1="{{math band.edge '-' 0.5}}" y1="{{ternary @last -0.5 2}}" x2="{{math band.edge '-' 0.5}}" y2="23" stroke="#E2E8F0" stroke-linecap="round" stroke-dasharray="4 4"/>
48
+ {{/each}}
49
+ </g>
50
+ </g>
51
+
52
+ {{! ===================== Components: 270° ring gauges ("P Total") ===================== }}
53
+ {{#each components as |item|}}
54
+ <g transform="translate({{item.x}}, {{item.y}})">
55
+ {{gauge 60 42 (object tl=6 tr=6 bl=6 br=6) (object start=(toRad -90) end=(toRad 180)) false clip-path="url(#isiGaugeTrack)" fill="#F1F5F9"}}
56
+ {{#if item.mark}}{{gauge 60 42 (object tl=6 tr=6 bl=6 br=6) (object start=(toRad -90) end=item.zeta) false clip-path="url(#isiGaugeTrack)" fill="url(#isiGauge)"}}{{/if}}
57
+
58
+ <text x="0" y="-3" text-anchor="middle" font-size="21" font-weight="600" fill="#334155" direction="ltr">٪ {{item.pct}}</text>
59
+ <text x="0" y="19" text-anchor="middle" font-size="13" font-weight="500" fill="#64748B">{{item.mark}} از {{item.max}}</text>
60
+
61
+ <text x="-51" y="-7" text-anchor="middle" font-size="12" fill="#64748B" direction="ltr">٪ 100</text>
62
+ <text x="-9" y="-48" text-anchor="middle" font-size="12" fill="#64748B">0</text>
63
+
64
+ <text x="0" y="88" text-anchor="middle" font-size="14" font-weight="500" fill="#475569">{{item.title}}</text>
65
+ </g>
66
+ {{/each}}
67
+
68
+ {{else}}
69
+
70
+ {{! ===================== No result (all-or-nothing) ===================== }}
71
+ <rect x="22.5" y="45" width="500" height="199" rx="12" fill="#F8FAFC" stroke="#E2E8F0"/>
72
+ <circle cx="272.5" cy="95.5" r="17" fill="none" stroke="#64748B" stroke-width="2"/>
73
+ <line x1="272.5" y1="86.5" x2="272.5" y2="98.5" stroke="#64748B" stroke-width="2.5" stroke-linecap="round"/>
74
+ <circle cx="272.5" cy="105" r="1.6" fill="#64748B"/>
75
+ <text x="272.5" y="151.5" text-anchor="middle" font-size="17" font-weight="600" fill="#1E293B">نمره تولید نشد</text>
76
+ <text x="272.5" y="183.5" text-anchor="middle" font-size="13" fill="#64748B">پاسخ ناقص یا نامعتبر است؛ هیچ نمره‌ای، حتی نمرهٔ جزئی، گزارش نمی‌شود.</text>
77
+
78
+ {{/if}}
79
+
80
+ </g>
81
+
82
+ {{/layout}}