@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.
- package/.github/workflows/push.yml +14 -0
- package/.prettierrc +16 -0
- package/.yarn/releases/yarn-1.22.19.cjs +147529 -0
- package/.yarnrc.yml +1 -0
- package/README.md +98 -0
- package/bin/risloo.js +9 -0
- package/package.json +44 -0
- package/src/Gift.js +29 -0
- package/src/Profile.js +405 -0
- package/src/cli-commands/Executor.js +118 -0
- package/src/cli-commands/ExtractExecutor.js +194 -0
- package/src/cli-commands/GiftExecutor.js +56 -0
- package/src/cli-commands/utilities/BaseOps.js +71 -0
- package/src/cli-commands/utilities/Benchmarker.js +88 -0
- package/src/cli-commands/utilities/CustomErrors.js +14 -0
- package/src/cli-commands/utilities/Response.js +59 -0
- package/src/cli-commands/utilities/STATUSES.js +16 -0
- package/src/cli-commands/utilities/Status.js +9 -0
- package/src/cli.js +125 -0
- package/src/handlebars/helpers/abs.js +8 -0
- package/src/handlebars/helpers/addCommas.js +8 -0
- package/src/handlebars/helpers/array.js +8 -0
- package/src/handlebars/helpers/assignGlobal.js +9 -0
- package/src/handlebars/helpers/boolean.js +19 -0
- package/src/handlebars/helpers/ceil.js +8 -0
- package/src/handlebars/helpers/concat.js +8 -0
- package/src/handlebars/helpers/cos.js +8 -0
- package/src/handlebars/helpers/displacePoint.js +11 -0
- package/src/handlebars/helpers/ellipsisChars.js +10 -0
- package/src/handlebars/helpers/ellipsisLines.js +11 -0
- package/src/handlebars/helpers/first.js +11 -0
- package/src/handlebars/helpers/floor.js +8 -0
- package/src/handlebars/helpers/forLoop.js +15 -0
- package/src/handlebars/helpers/getArrOfProp.js +8 -0
- package/src/handlebars/helpers/isArray.js +8 -0
- package/src/handlebars/helpers/join.js +10 -0
- package/src/handlebars/helpers/last.js +11 -0
- package/src/handlebars/helpers/lineWrap.js +28 -0
- package/src/handlebars/helpers/math.js +24 -0
- package/src/handlebars/helpers/modulo.js +8 -0
- package/src/handlebars/helpers/normalizeAngle.js +7 -0
- package/src/handlebars/helpers/object.js +8 -0
- package/src/handlebars/helpers/objectEntries.js +8 -0
- package/src/handlebars/helpers/polarToCartesian.js +14 -0
- package/src/handlebars/helpers/prepend.js +10 -0
- package/src/handlebars/helpers/profiles/bar.js +45 -0
- package/src/handlebars/helpers/profiles/calcGaugeSidePoints.js +34 -0
- package/src/handlebars/helpers/profiles/gauge.js +61 -0
- package/src/handlebars/helpers/profiles/polygon.js +40 -0
- package/src/handlebars/helpers/reverse.js +9 -0
- package/src/handlebars/helpers/roundToTwo.js +8 -0
- package/src/handlebars/helpers/setVar.js +8 -0
- package/src/handlebars/helpers/sin.js +8 -0
- package/src/handlebars/helpers/split.js +8 -0
- package/src/handlebars/helpers/tan.js +8 -0
- package/src/handlebars/helpers/ternary.js +9 -0
- package/src/handlebars/helpers/toDeg.js +8 -0
- package/src/handlebars/helpers/toRad.js +8 -0
- package/src/handlebars/helpers/withGroup.js +20 -0
- package/src/handlebars/helpers/wrapOnNewline.js +11 -0
- package/src/handlebars/helpers.js +86 -0
- package/src/handlebars/importPartials.js +40 -0
- package/src/handlebars/init.js +15 -0
- package/src/publish/bot.js +91 -0
- package/src/publish/json/gift/gift.json +16 -0
- package/src/publish/json/profiles/16PF93.json +201 -0
- package/src/publish/json/profiles/AEQ93.json +96 -0
- package/src/publish/json/profiles/AMS93.json +102 -0
- package/src/publish/json/profiles/AMS9A.json +102 -0
- package/src/publish/json/profiles/BAOMEIS93.json +99 -0
- package/src/publish/json/profiles/BEQI93.json +1589 -0
- package/src/publish/json/profiles/CAATS93.json +11355 -0
- package/src/publish/json/profiles/CADS93.json +351 -0
- package/src/publish/json/profiles/CARSP93.json +96 -0
- package/src/publish/json/profiles/CERQ93.json +106 -0
- package/src/publish/json/profiles/CRAAS93.json +98 -0
- package/src/publish/json/profiles/CSI93.json +143 -0
- package/src/publish/json/profiles/DSWLS93.json +93 -0
- package/src/publish/json/profiles/EMSS93.json +116 -0
- package/src/publish/json/profiles/FACES93.json +106 -0
- package/src/publish/json/profiles/FTEPT93.json +102 -0
- package/src/publish/json/profiles/GMIT93.json +98 -0
- package/src/publish/json/profiles/HPL93.json +102 -0
- package/src/publish/json/profiles/IBT93.json +106 -0
- package/src/publish/json/profiles/IUS93.json +93 -0
- package/src/publish/json/profiles/JCSI93.json +102 -0
- package/src/publish/json/profiles/JPFQ93.json +1 -0
- package/src/publish/json/profiles/KJGI93.json +100 -0
- package/src/publish/json/profiles/LMIQ93.json +109 -0
- package/src/publish/json/profiles/MMFAD93.json +103 -0
- package/src/publish/json/profiles/MMFAD9A.json +103 -0
- package/src/publish/json/profiles/MOCI93.json +100 -0
- package/src/publish/json/profiles/OBQ4493.json +96 -0
- package/src/publish/json/profiles/PIES93.json +104 -0
- package/src/publish/json/profiles/PIES9A.json +104 -0
- package/src/publish/json/profiles/PMCIEF93.json +1 -0
- package/src/publish/json/profiles/PSWQ93.json +97 -0
- package/src/publish/json/profiles/RIASEC93.json +2511 -0
- package/src/publish/json/profiles/SAFE93.json +110 -0
- package/src/publish/json/profiles/SASQ93.json +92 -0
- package/src/publish/json/profiles/SCASP93.json +611 -0
- package/src/publish/json/profiles/SDCAQ93.json +96 -0
- package/src/publish/json/profiles/STAIY93.json +98 -0
- package/src/publish/json/profiles/WAQ93.json +100 -0
- package/src/publish/json/profiles/YBOCS93.json +1322 -0
- package/src/publish/json/profiles/empty.json +139 -0
- package/src/publish/new-version.hbs +11 -0
- package/src/publish/test.js +109 -0
- package/src/qrcode/qrCodeGenerator.js +14 -0
- package/src/qrcode/qrRender.js +229 -0
- package/src/samples/16PF93.js +158 -0
- package/src/samples/AEQ93.js +121 -0
- package/src/samples/AMS93.js +139 -0
- package/src/samples/AMS9A.js +9 -0
- package/src/samples/BAOMEIS93.js +146 -0
- package/src/samples/BEQI93.js +255 -0
- package/src/samples/CAATS93.js +218 -0
- package/src/samples/CADS93.js +161 -0
- package/src/samples/CARSP93.js +134 -0
- package/src/samples/CERQ93.js +195 -0
- package/src/samples/CRAAS93.js +141 -0
- package/src/samples/CSI93.js +315 -0
- package/src/samples/DSWLS93.js +112 -0
- package/src/samples/EMSS93.js +178 -0
- package/src/samples/FACES93.js +225 -0
- package/src/samples/FTEPT93.js +167 -0
- package/src/samples/GMIT93.js +142 -0
- package/src/samples/HPL93.js +132 -0
- package/src/samples/IBT93.js +99 -0
- package/src/samples/IUS93.js +204 -0
- package/src/samples/JCSI93.js +174 -0
- package/src/samples/JPFQ93.js +74 -0
- package/src/samples/KJGI93.js +136 -0
- package/src/samples/LMIQ93.js +188 -0
- package/src/samples/MMFAD93.js +135 -0
- package/src/samples/MMFAD9A.js +31 -0
- package/src/samples/MOCI93.js +128 -0
- package/src/samples/OBQ4493.js +132 -0
- package/src/samples/PIES93.js +228 -0
- package/src/samples/PIES9A.js +32 -0
- package/src/samples/PMCIEF93.js +64 -0
- package/src/samples/PSWQ93.js +126 -0
- package/src/samples/RIASEC93.js +144 -0
- package/src/samples/SAFE93.js +64 -0
- package/src/samples/SASQ93.js +130 -0
- package/src/samples/SCASP93.js +207 -0
- package/src/samples/SDCAQ93.js +174 -0
- package/src/samples/STAIY93.js +159 -0
- package/src/samples/WAQ93.js +208 -0
- package/src/samples/YBOCS93.js +583 -0
- package/src/samples/empty.js +53 -0
- package/views/gift.hbs +160 -0
- package/views/profiles/fonts.css +18 -0
- package/views/profiles/layout.hbs +27 -0
- package/views/profiles/samples/16PF93.hbs +54 -0
- package/views/profiles/samples/AEQ93.hbs +31 -0
- package/views/profiles/samples/AMS93.hbs +97 -0
- package/views/profiles/samples/AMS9A.hbs +1 -0
- package/views/profiles/samples/BAOMEIS93.hbs +48 -0
- package/views/profiles/samples/BEQI93.hbs +118 -0
- package/views/profiles/samples/CAATS93.hbs +251 -0
- package/views/profiles/samples/CADS93.hbs +104 -0
- package/views/profiles/samples/CARSP93.hbs +26 -0
- package/views/profiles/samples/CERQ93.hbs +115 -0
- package/views/profiles/samples/CRAAS93.hbs +88 -0
- package/views/profiles/samples/CSI93_1.hbs +110 -0
- package/views/profiles/samples/CSI93_2.hbs +76 -0
- package/views/profiles/samples/DSWLS93.hbs +26 -0
- package/views/profiles/samples/EMSS93.hbs +101 -0
- package/views/profiles/samples/FACES93_1.hbs +107 -0
- package/views/profiles/samples/FACES93_2.hbs +51 -0
- package/views/profiles/samples/FTEPT93.hbs +67 -0
- package/views/profiles/samples/GMIT93.hbs +45 -0
- package/views/profiles/samples/HPL93.hbs +36 -0
- package/views/profiles/samples/IBT93.hbs +67 -0
- package/views/profiles/samples/IUS93.hbs +123 -0
- package/views/profiles/samples/JCSI93.hbs +65 -0
- package/views/profiles/samples/JPFQ93.hbs +44 -0
- package/views/profiles/samples/KJGI93.hbs +57 -0
- package/views/profiles/samples/LMIQ93.hbs +82 -0
- package/views/profiles/samples/MMFAD93.hbs +35 -0
- package/views/profiles/samples/MMFAD9A.hbs +1 -0
- package/views/profiles/samples/MOCI93.hbs +60 -0
- package/views/profiles/samples/OBQ4493.hbs +61 -0
- package/views/profiles/samples/PIES93.hbs +67 -0
- package/views/profiles/samples/PIES9A.hbs +1 -0
- package/views/profiles/samples/PMCIEF93.hbs +8 -0
- package/views/profiles/samples/PSWQ93.hbs +32 -0
- package/views/profiles/samples/RIASEC93.hbs +38 -0
- package/views/profiles/samples/SAFE93.hbs +118 -0
- package/views/profiles/samples/SASQ93.hbs +45 -0
- package/views/profiles/samples/SCASP93.hbs +94 -0
- package/views/profiles/samples/SDCAQ93.hbs +68 -0
- package/views/profiles/samples/STAIY93.hbs +67 -0
- package/views/profiles/samples/WAQ93.hbs +74 -0
- package/views/profiles/samples/YBOCS93_1.hbs +96 -0
- package/views/profiles/samples/YBOCS93_2.hbs +115 -0
- package/views/profiles/samples/YBOCS93_3.hbs +93 -0
- package/views/profiles/samples/empty.hbs +10 -0
- package/views/profiles/sidebar.hbs +193 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
const { Profile, FS } = require("../Profile");
|
|
2
|
+
|
|
3
|
+
class MMAFD93 extends Profile {
|
|
4
|
+
// Number of pages
|
|
5
|
+
static pages = 1;
|
|
6
|
+
|
|
7
|
+
// Labels of the sample
|
|
8
|
+
labels = {
|
|
9
|
+
L1: { eng: "raw", fr: "نمره کل" },
|
|
10
|
+
L2: { eng: "problem_solving", fr: "حل مشکل" },
|
|
11
|
+
L3: { eng: "overall_performance", fr: "عملکرد کلی" },
|
|
12
|
+
L4: { eng: "behaviour_control", fr: "کنترل رفتار" },
|
|
13
|
+
L5: { eng: "affective_involvement", fr: "آمیزش عاطفی" },
|
|
14
|
+
L6: { eng: "communication", fr: "ارتباط" },
|
|
15
|
+
L7: { eng: "affective_responsiveness", fr: "همراهی عاطفی" },
|
|
16
|
+
L8: { eng: "roles", fr: "نقشها" },
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
profileSpec = {
|
|
20
|
+
/* "sample" determines some important info about the sample and profile */
|
|
21
|
+
/* Default prerequisites: 1. gender, 2. age, 3. education */
|
|
22
|
+
/* "prerequisites" is synonym to "fields" in our program */
|
|
23
|
+
sample: {
|
|
24
|
+
name: "پرسشنامه عملکرد خانواده ۵۳ سؤالی" /* Name of the sample */,
|
|
25
|
+
multiProfile: false /* Whether the sample has multiple profiles or not */,
|
|
26
|
+
questions: false /* Determines whether to get questions from inital dataset or not */,
|
|
27
|
+
defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
|
|
28
|
+
fields: ["marital_status"] /* In case you want to get some additional fields and show in the profile */,
|
|
29
|
+
},
|
|
30
|
+
/* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
|
|
31
|
+
/* calculating its dimensions carefully is of great importance */
|
|
32
|
+
profile: {
|
|
33
|
+
get dimensions() {
|
|
34
|
+
return {
|
|
35
|
+
width: 705 + 2 * this.padding.x,
|
|
36
|
+
height: 653 + 2 * this.padding.y,
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
padding: {
|
|
40
|
+
x: 0,
|
|
41
|
+
y: 40,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
/* Spec for the polygons drawn in the profile */
|
|
45
|
+
polygons: {
|
|
46
|
+
n: 7 /* Number of vertices of the polygons */,
|
|
47
|
+
get theta() {
|
|
48
|
+
return (2 * Math.PI) / this.n;
|
|
49
|
+
},
|
|
50
|
+
startAngle: FS.toRadians(-90) /* Start angle of the polygon */,
|
|
51
|
+
radius: 270 /* Radius of the peripheral circle of the main polygon */,
|
|
52
|
+
centerOffset: 67 /* Radius of the peropheral circle of the smallest polygon */,
|
|
53
|
+
},
|
|
54
|
+
/* "raw" is the general term used for total data element in the profile */
|
|
55
|
+
raw: {
|
|
56
|
+
maxValue: 256,
|
|
57
|
+
mark: {
|
|
58
|
+
paddingY: 18,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
/* "items" is the general term used for independent data elements to be drawn in the profile */
|
|
62
|
+
items: {
|
|
63
|
+
maxValues: {
|
|
64
|
+
[this.labels.L2.eng]: 20,
|
|
65
|
+
[this.labels.L3.eng]: 60,
|
|
66
|
+
[this.labels.L4.eng]: 40,
|
|
67
|
+
[this.labels.L5.eng]: 40,
|
|
68
|
+
[this.labels.L6.eng]: 30,
|
|
69
|
+
[this.labels.L7.eng]: 35,
|
|
70
|
+
[this.labels.L8.eng]: 40,
|
|
71
|
+
} /* Maximum value of marks provided by the dataset */,
|
|
72
|
+
labels: {
|
|
73
|
+
offset: 50 /* Offset of the label from the vertice of the polygon */,
|
|
74
|
+
paddingY: 12 /* Half distance between two parts of the label */,
|
|
75
|
+
},
|
|
76
|
+
dataPoints: {
|
|
77
|
+
radius: 12 /* Radius of the circle of the data point */,
|
|
78
|
+
fills: {
|
|
79
|
+
[this.labels.L2.eng]: "#F59E0B",
|
|
80
|
+
[this.labels.L3.eng]: "#DB2777",
|
|
81
|
+
[this.labels.L4.eng]: "#9333EA",
|
|
82
|
+
[this.labels.L5.eng]: "#2563EB",
|
|
83
|
+
[this.labels.L6.eng]: "#059669",
|
|
84
|
+
[this.labels.L7.eng]: "#DC2626",
|
|
85
|
+
[this.labels.L8.eng]: "#71717A",
|
|
86
|
+
} /* Colors used for theming data points */,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
/* "labels" part which has to be provided for each profile */
|
|
90
|
+
labels: Object.values(this.labels)
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
constructor(dataset, options, config = {}) {
|
|
94
|
+
super();
|
|
95
|
+
this._init(dataset, options, config);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
_calcContext() {
|
|
99
|
+
const {
|
|
100
|
+
spec: { parameters: spec },
|
|
101
|
+
dataset,
|
|
102
|
+
} = this;
|
|
103
|
+
|
|
104
|
+
// Deconstructing the Spec of the Profile
|
|
105
|
+
let { polygons: polygonsSpec, items: itemsSpec } = spec;
|
|
106
|
+
|
|
107
|
+
const rawData = dataset.score.shift();
|
|
108
|
+
|
|
109
|
+
const raw = {
|
|
110
|
+
label: rawData.label,
|
|
111
|
+
mark: rawData.mark,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// Gather Required Info for Items
|
|
115
|
+
const items = dataset.score.map((data, index) => ({
|
|
116
|
+
label: data.label,
|
|
117
|
+
mark: data.mark,
|
|
118
|
+
maxValue: itemsSpec.maxValues[data.label.eng],
|
|
119
|
+
angle: polygonsSpec.startAngle - index * polygonsSpec.theta,
|
|
120
|
+
radius:
|
|
121
|
+
(data.mark / itemsSpec.maxValues[data.label.eng]) * (polygonsSpec.radius - polygonsSpec.centerOffset) +
|
|
122
|
+
polygonsSpec.centerOffset,
|
|
123
|
+
fill: itemsSpec.dataPoints.fills[data.label.eng],
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
return [
|
|
127
|
+
{
|
|
128
|
+
raw,
|
|
129
|
+
items,
|
|
130
|
+
},
|
|
131
|
+
];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
module.exports = MMAFD93;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const MMAFD93 = require("./MMFAD93");
|
|
2
|
+
|
|
3
|
+
const customConfig = {
|
|
4
|
+
test: {
|
|
5
|
+
name: "پرسشنامه عملکرد خانواده ۶۰ سؤالی" /* Name of the test */,
|
|
6
|
+
},
|
|
7
|
+
raw: {
|
|
8
|
+
maxValue: 240,
|
|
9
|
+
},
|
|
10
|
+
items: {
|
|
11
|
+
maxValues: {
|
|
12
|
+
problem_solving: 24,
|
|
13
|
+
roles: 36,
|
|
14
|
+
affective_responsiveness: 28,
|
|
15
|
+
communication: 28,
|
|
16
|
+
affective_involvement: 36,
|
|
17
|
+
behaviour_control: 36,
|
|
18
|
+
overall_performance: 52,
|
|
19
|
+
} /* Maximum value of marks provided by the dataset */,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// This profile is completely identical to MMFAD93
|
|
24
|
+
|
|
25
|
+
class MMFAD9A extends MMAFD93 {
|
|
26
|
+
constructor(dataset, options, config = customConfig) {
|
|
27
|
+
super(dataset, options, config);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = MMFAD9A;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
const { Profile } = require("../Profile");
|
|
2
|
+
|
|
3
|
+
class MOCI93 extends Profile {
|
|
4
|
+
// Number of pages
|
|
5
|
+
static pages = 1;
|
|
6
|
+
|
|
7
|
+
// Labels of the sample
|
|
8
|
+
labels = {
|
|
9
|
+
L1: { eng: "washing", fr: "شستشو", abbr: "W" },
|
|
10
|
+
L2: { eng: "control", fr: "وارسی", abbr: "C" },
|
|
11
|
+
L3: { eng: "slowing_repeat", fr: "کندی - تکرار", abbr: "SR" },
|
|
12
|
+
L4: { eng: "doubt", fr: "تردید", abbr: "D" },
|
|
13
|
+
L5: { eng: "total", fr: "نمره کل", abbr: "T" },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
profileSpec = {
|
|
17
|
+
/* "sample" determines some important info about the sample and profile */
|
|
18
|
+
/* Default prerequisites: 1. gender, 2. age, 3. education */
|
|
19
|
+
/* "prerequisites" is synonym to "fields" in our program */
|
|
20
|
+
sample: {
|
|
21
|
+
name: "مقیاس وسواس فکری - علمی مادزلی" /* Name of the sample */,
|
|
22
|
+
multiProfile: false /* Whether the sample has multiple profiles or not */,
|
|
23
|
+
questions: false /* Determines whether to get questions from inital dataset or not */,
|
|
24
|
+
defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
|
|
25
|
+
fields: ["marital_status"] /* In case you want to get some additional fields and show in the profile */,
|
|
26
|
+
},
|
|
27
|
+
/* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
|
|
28
|
+
/* calculating its dimensions carefully is of great importance */
|
|
29
|
+
profile: {
|
|
30
|
+
get dimensions() {
|
|
31
|
+
return {
|
|
32
|
+
width: 620 + 2 * this.padding.x,
|
|
33
|
+
height: 586 + 2 * this.padding.y,
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
padding: {
|
|
37
|
+
x: 15,
|
|
38
|
+
y: 50,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
/* "raw" is the general term used for total data element in the profile */
|
|
42
|
+
raw: {
|
|
43
|
+
offsetX: 110 /* Horizontal offset between raw and last item */,
|
|
44
|
+
get distanceX() {
|
|
45
|
+
return this.offsetX + this.rect.width;
|
|
46
|
+
} /* Horizontal distance between raw and last item */,
|
|
47
|
+
rect: {
|
|
48
|
+
width: 60 /* Width of the raw rectangle */,
|
|
49
|
+
height: 30 /* Height of the raw rectangle */,
|
|
50
|
+
offsetY: 2 /* Vertical offset between two consecutive raw rectangles */,
|
|
51
|
+
get distanceY() {
|
|
52
|
+
return this.height + this.offsetY;
|
|
53
|
+
} /* Vertical Distance between two consecutive raw rectangles */,
|
|
54
|
+
defaultColor: "#F3F4F6" /* Default color of the raw rectangle */,
|
|
55
|
+
color: "#831843" /* Focused color of the raw rectangle */,
|
|
56
|
+
},
|
|
57
|
+
maxValue: 30 /* Maximum value of raw mark provided by the dataset */,
|
|
58
|
+
step: 2 /* Step is used to divide the mark in drawing the profile */,
|
|
59
|
+
},
|
|
60
|
+
/* "items" is the general term used for independent data elements to be drawn in the profile */
|
|
61
|
+
items: {
|
|
62
|
+
offsetX: 80 /* Horizontal offset between two consecutive item */,
|
|
63
|
+
get distanceX() {
|
|
64
|
+
return this.offsetX + this.rect.width;
|
|
65
|
+
} /* Horizontal distance between two consecutive item */,
|
|
66
|
+
rect: {
|
|
67
|
+
width: 50 /* Width of the items rectangle */,
|
|
68
|
+
height: 30 /* Height of the items rectangle */,
|
|
69
|
+
offsetY: 2 /* Vertical offset between two consecutive items rectangle */,
|
|
70
|
+
get distanceY() {
|
|
71
|
+
return this.height + this.offsetY;
|
|
72
|
+
} /* Vertical distance between two consecutive items rectangle */,
|
|
73
|
+
defaultColor: "#F3F4F6" /* Default color of the items rectangle */,
|
|
74
|
+
colors: ["#4C1D95", "#1E3A8A", "#374151", "#92400E"] /* Colors used for theming items */,
|
|
75
|
+
},
|
|
76
|
+
maxValues: {
|
|
77
|
+
[this.labels.L1.eng]: 11,
|
|
78
|
+
[this.labels.L2.eng]: 9,
|
|
79
|
+
[this.labels.L3.eng]: 7,
|
|
80
|
+
[this.labels.L4.eng]: 7,
|
|
81
|
+
} /* Maximum values of items marks provided by the dataset */,
|
|
82
|
+
step: 1 /* Step is used to divide the mark in drawing the profile */,
|
|
83
|
+
},
|
|
84
|
+
/* "labels" part which has to be provided for each profile */
|
|
85
|
+
labels: Object.values(this.labels),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
constructor(dataset, options, config = {}) {
|
|
89
|
+
super();
|
|
90
|
+
this._init(dataset, options, config);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_calcContext() {
|
|
94
|
+
const {
|
|
95
|
+
spec: { parameters: spec },
|
|
96
|
+
dataset,
|
|
97
|
+
} = this;
|
|
98
|
+
|
|
99
|
+
// Deconstructing the Spec of the Profile
|
|
100
|
+
const {
|
|
101
|
+
items: {
|
|
102
|
+
maxValues,
|
|
103
|
+
rect: { colors },
|
|
104
|
+
},
|
|
105
|
+
} = spec;
|
|
106
|
+
|
|
107
|
+
// Separate Raw Data from the Dataset
|
|
108
|
+
const rawData = dataset.score.pop();
|
|
109
|
+
|
|
110
|
+
// Gather Required Info for Raw
|
|
111
|
+
const raw = {
|
|
112
|
+
label: rawData.label,
|
|
113
|
+
mark: rawData.mark,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Gather Required Info for Items
|
|
117
|
+
const items = dataset.score.map((data, index) => ({
|
|
118
|
+
label: data.label,
|
|
119
|
+
mark: data.mark,
|
|
120
|
+
maxValue: maxValues[data.label.eng],
|
|
121
|
+
fill: colors[index],
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
return [{ items, raw }];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
module.exports = MOCI93;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const { Profile } = require("../Profile");
|
|
2
|
+
|
|
3
|
+
class OBQ4493 extends Profile {
|
|
4
|
+
// Number of pages
|
|
5
|
+
static pages = 1;
|
|
6
|
+
|
|
7
|
+
// Labels of the sample
|
|
8
|
+
labels = {
|
|
9
|
+
L1: { eng: "complete_performance", fr: "عملکرد کامل", abbr: "CP" },
|
|
10
|
+
L2: { eng: "importance_and_control_of_thought", fr: "اهمیت و کنترل فکر", abbr: "ICT" },
|
|
11
|
+
L3: { eng: "responsibility_and_threat_estimation", fr: "مسئولیت و تخمین تهدید", abbr: "RT" },
|
|
12
|
+
L4: { eng: "perfectionism_certainty", fr: "کمالگرایی / یقین", abbr: "PC" },
|
|
13
|
+
L5: { eng: "general", fr: "عمومی", abbr: "G" },
|
|
14
|
+
L6: { eng: "raw", fr: "مجموع", abbr: "T" },
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
profileSpec = {
|
|
18
|
+
/* "sample" determines some important info about the sample and profile */
|
|
19
|
+
/* Default prerequisites: 1. gender, 2. age, 3. education */
|
|
20
|
+
/* "prerequisites" is synonym to "fields" in our program */
|
|
21
|
+
sample: {
|
|
22
|
+
name: "پرسشنامه باورهای احساسی" /* Name of the sample */,
|
|
23
|
+
multiProfile: false /* Whether the sample has multiple profiles or not */,
|
|
24
|
+
questions: false /* Determines whether to get questions from inital dataset or not */,
|
|
25
|
+
defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
|
|
26
|
+
fields: ["marital_status"] /* In case you want to get some additional fields and show in the profile */,
|
|
27
|
+
},
|
|
28
|
+
/* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
|
|
29
|
+
/* calculating its dimensions carefully is of great importance */
|
|
30
|
+
profile: {
|
|
31
|
+
get dimensions() {
|
|
32
|
+
return {
|
|
33
|
+
width: 903 + 2 * this.padding.x,
|
|
34
|
+
height: 708 + 2 * this.padding.y,
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
padding: {
|
|
38
|
+
x: 0,
|
|
39
|
+
y: 0,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
/* "raw" is the general term used for total data element in the profile */
|
|
43
|
+
raw: {
|
|
44
|
+
labels: {
|
|
45
|
+
offsetY: 18,
|
|
46
|
+
},
|
|
47
|
+
maxValuesOffsetX: 10,
|
|
48
|
+
maxValue: 132,
|
|
49
|
+
rect: {
|
|
50
|
+
width: 800,
|
|
51
|
+
height: 48,
|
|
52
|
+
br: 5,
|
|
53
|
+
offsetY: 100,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
/* "items" is the general term used for independent data elements to be drawn in the profile */
|
|
57
|
+
items: {
|
|
58
|
+
labels: {
|
|
59
|
+
offsetY: 18,
|
|
60
|
+
},
|
|
61
|
+
maxValuesOffsetX: 10,
|
|
62
|
+
maxValues: {
|
|
63
|
+
[this.labels.L1.eng]: 15,
|
|
64
|
+
[this.labels.L2.eng]: 16,
|
|
65
|
+
[this.labels.L3.eng]: 21,
|
|
66
|
+
[this.labels.L4.eng]: 30,
|
|
67
|
+
[this.labels.L5.eng]: 48,
|
|
68
|
+
},
|
|
69
|
+
rect: {
|
|
70
|
+
width: 800,
|
|
71
|
+
height: 30,
|
|
72
|
+
br: 5,
|
|
73
|
+
offsetY: 70,
|
|
74
|
+
get distanceY() {
|
|
75
|
+
return this.height + this.offsetY;
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
separator: {
|
|
80
|
+
line: {
|
|
81
|
+
width: 903,
|
|
82
|
+
offsetY: 72.5,
|
|
83
|
+
},
|
|
84
|
+
desc: {
|
|
85
|
+
offsetY: 17.5,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
/* "labels" part which has to be provided for each profile */
|
|
89
|
+
labels: Object.values(this.labels),
|
|
90
|
+
desc: "این آزمون هر چقدر به سمت مثبت برود، نشاندهنده باورهای وسواس بالاست و در صورت منفی بودن، باورهای وسواس پایین است.",
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
constructor(dataset, options, config = {}) {
|
|
94
|
+
super();
|
|
95
|
+
this._init(dataset, options, config);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
_calcContext() {
|
|
99
|
+
const {
|
|
100
|
+
spec: { parameters: spec },
|
|
101
|
+
dataset,
|
|
102
|
+
} = this;
|
|
103
|
+
|
|
104
|
+
const { items: itemsSpec, raw: rawSpec } = spec;
|
|
105
|
+
|
|
106
|
+
// Separate Raw Data from the Dataset
|
|
107
|
+
const rawData = dataset.score.pop();
|
|
108
|
+
|
|
109
|
+
const raw = {
|
|
110
|
+
label: rawData.label,
|
|
111
|
+
mark: rawData.mark,
|
|
112
|
+
maxValue: rawSpec.maxValue,
|
|
113
|
+
width: Math.abs((rawData.mark / rawSpec.maxValue) * (rawSpec.rect.width / 2)),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const items = dataset.score.map((data) => ({
|
|
117
|
+
label: data.label,
|
|
118
|
+
mark: data.mark,
|
|
119
|
+
maxValue: itemsSpec.maxValues[data.label.eng],
|
|
120
|
+
width: Math.abs((data.mark / itemsSpec.maxValues[data.label.eng]) * (itemsSpec.rect.width / 2)),
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
return [
|
|
124
|
+
{
|
|
125
|
+
raw,
|
|
126
|
+
items,
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
module.exports = OBQ4493;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
const { Profile, FS, Mappings } = require("../Profile");
|
|
2
|
+
|
|
3
|
+
class PIES93 extends Profile {
|
|
4
|
+
// Number of pages
|
|
5
|
+
static pages = 1;
|
|
6
|
+
|
|
7
|
+
// Labels of the sample
|
|
8
|
+
labels = {
|
|
9
|
+
L1: { eng: "hope", fr: "امید", abbr: "HO" },
|
|
10
|
+
L2: { eng: "will", fr: "اراده (خواسته)", abbr: "W" },
|
|
11
|
+
L3: { eng: "purpose", fr: "هدفمندی", abbr: "PU" },
|
|
12
|
+
L4: { eng: "competence", fr: "شایستگی", abbr: "CO" },
|
|
13
|
+
L5: { eng: "fidelity", fr: "صداقت (وفاداری)", abbr: "FI" },
|
|
14
|
+
L6: { eng: "love", fr: "عشق", abbr: "LO" },
|
|
15
|
+
L7: { eng: "care", fr: "مراقبت", abbr: "CA" },
|
|
16
|
+
L8: { eng: "wisdom", fr: "خرد (فرزانگی)", abbr: "WI" },
|
|
17
|
+
L9: { eng: "raw", fr: "نمره کل", abbr: "#" },
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
profileSpec = {
|
|
21
|
+
/* "sample" determines some important info about the sample and profile */
|
|
22
|
+
/* Default prerequisites: 1. gender, 2. age, 3. education */
|
|
23
|
+
/* "prerequisites" is synonym to "fields" in our program */
|
|
24
|
+
sample: {
|
|
25
|
+
name: "پرسشنامه سیاهه روانی - اجتماعی نیرومندی من ۳۲ سؤالی" /* Name of the sample */,
|
|
26
|
+
multiProfile: false /* Whether the sample has multiple profiles or not */,
|
|
27
|
+
questions: false /* Determines whether to get questions from inital dataset or not */,
|
|
28
|
+
defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
|
|
29
|
+
fields: ["marital_status"] /* In case you want to get some additional fields and show in the profile */,
|
|
30
|
+
},
|
|
31
|
+
/* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
|
|
32
|
+
/* calculating its dimensions carefully is of great importance */
|
|
33
|
+
profile: {
|
|
34
|
+
get dimensions() {
|
|
35
|
+
return {
|
|
36
|
+
width: 821 + 2 * this.padding.x,
|
|
37
|
+
height: 610 + 2 * this.padding.y,
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
padding: {
|
|
41
|
+
x: 40,
|
|
42
|
+
y: 0,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
/* "raw" is the general term used for total data element in the profile */
|
|
46
|
+
raw: {
|
|
47
|
+
maxValue: 160 /* Maximum value of raw mark provided by the dataset */,
|
|
48
|
+
offsetX: 120 /* Horizontal offset from items */,
|
|
49
|
+
ticks: {
|
|
50
|
+
num: 4 /* Number of ticks */,
|
|
51
|
+
line: {
|
|
52
|
+
width: 9 /* Width of the tick line */,
|
|
53
|
+
offsetX: 5 /* Horizontal offset from the rectangle */,
|
|
54
|
+
},
|
|
55
|
+
number: {
|
|
56
|
+
offsetX: 15 /* Horizontal Offset from the line */,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
rect: {
|
|
60
|
+
width: 40 /* Width of the raw rectangle */,
|
|
61
|
+
height: 610 /* Height of the raw rectangle */,
|
|
62
|
+
get borderRadius() {
|
|
63
|
+
return this.width / 2;
|
|
64
|
+
} /* Border radius of the raw rectangle */,
|
|
65
|
+
},
|
|
66
|
+
label: {
|
|
67
|
+
circle: {
|
|
68
|
+
radius: 18 /* Radius of the circle in the label part */,
|
|
69
|
+
},
|
|
70
|
+
offsetY: 40 /* Vertical offset of the label from the circle */,
|
|
71
|
+
},
|
|
72
|
+
heightCoeff: 3.81 /* Used for converting mark to the height */,
|
|
73
|
+
},
|
|
74
|
+
/* "items" is the general term used for independent data elements to be drawn in the profile */
|
|
75
|
+
items: {
|
|
76
|
+
maxValue: 20 /* Maximum value of items mark provided by the dataset */,
|
|
77
|
+
offsetY: 30 /* Offset between two consecutive item in the profile */,
|
|
78
|
+
get distanceY() {
|
|
79
|
+
return this.offsetY + this.base.rect.height;
|
|
80
|
+
} /* Distance between two consecutive item in the profile */,
|
|
81
|
+
totalHeight: "" /* To be calculated in the class with the function provided */,
|
|
82
|
+
calcTotalHeight: function (n) {
|
|
83
|
+
return this.distanceY * (n - 1) + this.base.rect.height;
|
|
84
|
+
} /* Method for calculating the total height of items */,
|
|
85
|
+
ticks: {
|
|
86
|
+
num: 4 /* Number of ticks */,
|
|
87
|
+
heightOffset: 40 /* Half length that the ticks lines of items is greater than items total heigth */,
|
|
88
|
+
numberOffset: {
|
|
89
|
+
x: 15 /* Horizontal distance from the line */,
|
|
90
|
+
y: 10 /* Vertical distance from the line */,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
body: {
|
|
94
|
+
rect: {
|
|
95
|
+
maxWidth: 400 /* Max width of the body part of items */,
|
|
96
|
+
brs: {
|
|
97
|
+
tl: 0 /* Top left border radius */,
|
|
98
|
+
bl: 0 /* Bottom left border radius */,
|
|
99
|
+
tr: 20 /* Top right border radius */,
|
|
100
|
+
br: 20 /* Bottom right border radius */,
|
|
101
|
+
} /* Border radiuses of the base rectangle */,
|
|
102
|
+
},
|
|
103
|
+
colors: [
|
|
104
|
+
"#8B5CF6",
|
|
105
|
+
"#EC4899",
|
|
106
|
+
"#10B981",
|
|
107
|
+
"#F59E0B",
|
|
108
|
+
"#007BA4",
|
|
109
|
+
"#EF4444",
|
|
110
|
+
"#6B7280",
|
|
111
|
+
"#047857",
|
|
112
|
+
] /* Colors used for theming items body parts */,
|
|
113
|
+
opacityMappings: new Mappings()
|
|
114
|
+
.addMapping("1-5", 0.6)
|
|
115
|
+
.addMapping("6-10", 0.7)
|
|
116
|
+
.addMapping("11-15", 0.8)
|
|
117
|
+
.addMapping("16-19", 0.9)
|
|
118
|
+
.addMapping("20", 1) /* Opacity mapping for marks */,
|
|
119
|
+
},
|
|
120
|
+
base: {
|
|
121
|
+
rect: {
|
|
122
|
+
width: 220 /* Width of the items rectangle (base part) */,
|
|
123
|
+
height: 40 /* Height of the items rectangle (base part) */,
|
|
124
|
+
brs: {
|
|
125
|
+
tl: 20 /* Top left border radius */,
|
|
126
|
+
bl: 20 /* Bottom left border radius */,
|
|
127
|
+
tr: 0 /* Top right border radius */,
|
|
128
|
+
br: 0 /* Bottom right border radius */,
|
|
129
|
+
} /* Border radiuses of the base rectangle */,
|
|
130
|
+
},
|
|
131
|
+
label: {
|
|
132
|
+
circle: {
|
|
133
|
+
radius: 18 /* Radius of the circle in the label part */,
|
|
134
|
+
},
|
|
135
|
+
offsetX: 40 /* Horizontal offset of the label from the circle */,
|
|
136
|
+
},
|
|
137
|
+
colors: [
|
|
138
|
+
"#A27DF8",
|
|
139
|
+
"#F06DAD",
|
|
140
|
+
"#40C79A",
|
|
141
|
+
"#F7B13C",
|
|
142
|
+
"#3395B6",
|
|
143
|
+
"#F26969",
|
|
144
|
+
"#898E99",
|
|
145
|
+
"#369379",
|
|
146
|
+
] /* Colors used for theming items base parts */,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
/* "labels" part which has to be provided for each profile */
|
|
150
|
+
labels: Object.values(this.labels),
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
constructor(dataset, options, config = {}) {
|
|
154
|
+
super();
|
|
155
|
+
this._init(dataset, options, config);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
_calcContext() {
|
|
159
|
+
const {
|
|
160
|
+
spec: { parameters: spec },
|
|
161
|
+
dataset,
|
|
162
|
+
} = this;
|
|
163
|
+
|
|
164
|
+
// Deconstructing the Spec of the Profile
|
|
165
|
+
const { raw: rawSpec, items: itemsSpec } = spec;
|
|
166
|
+
|
|
167
|
+
// Separate Raw Data from the Dataset
|
|
168
|
+
const rawData = dataset.score.pop();
|
|
169
|
+
|
|
170
|
+
spec.items.totalHeight = spec.items.calcTotalHeight(dataset.score.length);
|
|
171
|
+
|
|
172
|
+
// Gather Required Info for Raw
|
|
173
|
+
const raw = {
|
|
174
|
+
label: rawData.label,
|
|
175
|
+
mark: rawData.mark,
|
|
176
|
+
height: (rawData.mark / rawSpec.maxValue) * rawSpec.rect.height,
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// Gather Required Info for Items
|
|
180
|
+
const items = dataset.score.map((data, index) => ({
|
|
181
|
+
label: data.label,
|
|
182
|
+
width: (data.mark / itemsSpec.maxValue) * itemsSpec.body.rect.maxWidth,
|
|
183
|
+
mark: data.mark,
|
|
184
|
+
baseColor: itemsSpec.base.colors[index],
|
|
185
|
+
body: {
|
|
186
|
+
color: itemsSpec.body.colors[index],
|
|
187
|
+
opacity: itemsSpec.body.opacityMappings.map(data.mark),
|
|
188
|
+
},
|
|
189
|
+
}));
|
|
190
|
+
|
|
191
|
+
// Calculate Ticks Numbers Array for Raw
|
|
192
|
+
const rawTicksNumbers = FS.createArithmeticSequence(
|
|
193
|
+
rawSpec.maxValue,
|
|
194
|
+
-rawSpec.maxValue / rawSpec.ticks.num,
|
|
195
|
+
rawSpec.ticks.num
|
|
196
|
+
).reverse();
|
|
197
|
+
|
|
198
|
+
// Gather Required Info for Raw Ticks
|
|
199
|
+
const rawTicks = rawTicksNumbers.map((tick) => ({
|
|
200
|
+
number: tick,
|
|
201
|
+
bottomPos: (tick / rawSpec.maxValue) * rawSpec.rect.height,
|
|
202
|
+
}));
|
|
203
|
+
|
|
204
|
+
// Calculate Ticks Numbers Array for Items
|
|
205
|
+
const itemsTicksNumbers = FS.createArithmeticSequence(
|
|
206
|
+
itemsSpec.maxValue,
|
|
207
|
+
-itemsSpec.maxValue / itemsSpec.ticks.num,
|
|
208
|
+
itemsSpec.ticks.num
|
|
209
|
+
).reverse();
|
|
210
|
+
|
|
211
|
+
// Gather Required Info for Items Ticks
|
|
212
|
+
const itemsTicks = itemsTicksNumbers.map((tick) => ({
|
|
213
|
+
number: tick,
|
|
214
|
+
leftPos: (tick / itemsSpec.maxValue) * itemsSpec.body.rect.maxWidth,
|
|
215
|
+
}));
|
|
216
|
+
|
|
217
|
+
return [
|
|
218
|
+
{
|
|
219
|
+
raw,
|
|
220
|
+
items,
|
|
221
|
+
rawTicks,
|
|
222
|
+
itemsTicks,
|
|
223
|
+
},
|
|
224
|
+
];
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
module.exports = PIES93;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const { Mappings } = require("../Profile");
|
|
2
|
+
const PIES93 = require("./PIES93");
|
|
3
|
+
|
|
4
|
+
const customConfig = {
|
|
5
|
+
sample: {
|
|
6
|
+
name: "پرسشنامه سياهه رواني - اجتماعي نيرومندي من (ايگو) فرم 64 سؤالي" /* Name of the sample */,
|
|
7
|
+
},
|
|
8
|
+
raw: {
|
|
9
|
+
maxValue: 320,
|
|
10
|
+
},
|
|
11
|
+
items: {
|
|
12
|
+
maxValue: 40,
|
|
13
|
+
body: {
|
|
14
|
+
opacityMappings: new Mappings()
|
|
15
|
+
.addMapping("8-9", 0.6)
|
|
16
|
+
.addMapping("10-19", 0.7)
|
|
17
|
+
.addMapping("20-29", 0.8)
|
|
18
|
+
.addMapping("30-39", 0.9)
|
|
19
|
+
.addMapping("40", 1),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// This profile is partially identical to PIES93
|
|
25
|
+
|
|
26
|
+
class PIES9A extends PIES93 {
|
|
27
|
+
constructor(dataset, options, config = customConfig) {
|
|
28
|
+
super(dataset, options, config);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = PIES9A;
|