@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,218 @@
|
|
|
1
|
+
const { Profile, Mappings } = require("../Profile");
|
|
2
|
+
const GMIT93 = require("./GMIT93");
|
|
3
|
+
const RIASEC93 = require("./RIASEC93");
|
|
4
|
+
const _16PF = require("./16PF93");
|
|
5
|
+
|
|
6
|
+
class CAATS93 extends Profile {
|
|
7
|
+
// Number of pages
|
|
8
|
+
static pages = 1;
|
|
9
|
+
|
|
10
|
+
// Labels of the sample
|
|
11
|
+
labels = {
|
|
12
|
+
L1: { eng: "mbti_I", fr: "I" },
|
|
13
|
+
L2: { eng: "mbti_S", fr: "S" },
|
|
14
|
+
L3: { eng: "mbti_F", fr: "F" },
|
|
15
|
+
L4: { eng: "mbti_P", fr: "P" },
|
|
16
|
+
L5: { eng: "mbti_E", fr: "E" },
|
|
17
|
+
L6: { eng: "mbti_N", fr: "N" },
|
|
18
|
+
L7: { eng: "mbti_T", fr: "T" },
|
|
19
|
+
L8: { eng: "mbti_J", fr: "J" },
|
|
20
|
+
L9: { eng: "mbti_report", fr: "گزارش نهایی" },
|
|
21
|
+
L10: { eng: "raven_iq", fr: "نمره ریون" },
|
|
22
|
+
L11: { eng: "raven_level", fr: "سطح ریون" },
|
|
23
|
+
L12: { eng: "gmit_linguistic", fr: "زبانی - کلامی" },
|
|
24
|
+
L13: { eng: "gmit_logical_mathematical", fr: "منطقی - ریاضی" },
|
|
25
|
+
L14: { eng: "gmit_visual_spatial", fr: "دیداری - فضایی" },
|
|
26
|
+
L15: { eng: "gmit_bodily_kinesthetic", fr: "بدنی - جنبشی" },
|
|
27
|
+
L16: { eng: "gmit_interpersonal", fr: "میانفردی" },
|
|
28
|
+
L17: { eng: "gmit_intrapersonal", fr: "درونفردی" },
|
|
29
|
+
L18: { eng: "gmit_musical", fr: "موسیقیایی" },
|
|
30
|
+
L19: { eng: "gmit_naturalist", fr: "طبیعتگرا" },
|
|
31
|
+
L20: { eng: "riasec_realistic", fr: "واقعگرا (و)" },
|
|
32
|
+
L21: { eng: "riasec_investigative", fr: "جستجوگر (ج)" },
|
|
33
|
+
L22: { eng: "riasec_artistic", fr: "هنری (ه)" },
|
|
34
|
+
L23: { eng: "riasec_social", fr: "اجتماعی (الف)" },
|
|
35
|
+
L24: { eng: "riasec_enterprising", fr: "متهور (م)" },
|
|
36
|
+
L25: { eng: "riasec_conventional", fr: "قراردادی (ق)" },
|
|
37
|
+
L26: { eng: "16pf_a", fr: "A", right: "مردمگریزی", left: "مردمآمیزی" },
|
|
38
|
+
L27: { eng: "16pf_b", fr: "B", right: "استدلال عینی", left: "استدلال انتزاعی" },
|
|
39
|
+
L28: { eng: "16pf_c", fr: "C", right: "ناپایداری هیجانی", left: "پایداری هیجانی" },
|
|
40
|
+
L29: { eng: "16pf_e", fr: "E", right: "سلطهپذیری", left: "سلطهگری" },
|
|
41
|
+
L30: { eng: "16pf_f", fr: "F", right: "دلمردگی", left: "سرزندگی" },
|
|
42
|
+
L31: { eng: "16pf_g", fr: "G", right: "مصلحتگرا", left: "باوجدان" },
|
|
43
|
+
L32: { eng: "16pf_h", fr: "H", right: "ترسو", left: "جسور" },
|
|
44
|
+
L33: { eng: "16pf_i", fr: "I", right: "یکدنده", left: "حساس" },
|
|
45
|
+
L34: { eng: "16pf_l", fr: "L", right: "زودباور", left: "شکاک" },
|
|
46
|
+
L35: { eng: "16pf_m", fr: "M", right: "عملگرا", left: "کولیباز" },
|
|
47
|
+
L36: { eng: "16pf_n", fr: "N", right: "بیظرافت", left: "ظرافت" },
|
|
48
|
+
L37: { eng: "16pf_o", fr: "O", right: "اطمینان به خود", left: "مستعد احساس گناه" },
|
|
49
|
+
L38: { eng: "16pf_q1", fr: "Q1", right: "باز بودن نسبت به تغییر", left: "بنیادگرا" },
|
|
50
|
+
L39: { eng: "16pf_q2", fr: "Q2", right: "متکی بر خود", left: "مسلط به دیگران" },
|
|
51
|
+
L40: { eng: "16pf_q3", fr: "Q3", right: "اختلالمدار", left: "کمالگرا" },
|
|
52
|
+
L41: { eng: "16pf_q4", fr: "Q4", right: "آرام", left: "اضطراب" },
|
|
53
|
+
L42: { eng: "16pf_extraversion", fr: "برونگرایی" },
|
|
54
|
+
L43: { eng: "16pf_anxiety", fr: "اضطراب" },
|
|
55
|
+
L44: { eng: "16pf_flexibility", fr: "یکدندگی" },
|
|
56
|
+
L45: { eng: "16pf_independence", fr: "استقلال" },
|
|
57
|
+
L46: { eng: "16pf_selfcontrol", fr: "کنترل بالا" },
|
|
58
|
+
L47: { eng: "16pf_adjustment", fr: "سازگاری" },
|
|
59
|
+
L48: { eng: "16pf_leadership", fr: "قدرت رهبری" },
|
|
60
|
+
L49: { eng: "16pf_creativity", fr: "خلاقیت" },
|
|
61
|
+
L50: { eng: "16pf_status", fr: "وضعیت" },
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
profileSpec = {
|
|
65
|
+
/* "sample" determines some important info about the sample and profile */
|
|
66
|
+
/* Default prerequisites: 1. gender, 2. age, 3. education */
|
|
67
|
+
/* "prerequisites" is synonym to "fields" in our program */
|
|
68
|
+
sample: {
|
|
69
|
+
name: "پرسشنامه تجمیعی اعتبار سنجی" /* Name of the sample */,
|
|
70
|
+
multiProfile: false /* Whether the sample has multiple profiles or not */,
|
|
71
|
+
questions: true /* Determines whether to get questions from inital dataset or not */,
|
|
72
|
+
defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
|
|
73
|
+
fields: ["marital_status"] /* In case you want to get some additional fields and show in the profile */,
|
|
74
|
+
},
|
|
75
|
+
/* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
|
|
76
|
+
/* calculating its dimensions carefully is of great importance */
|
|
77
|
+
profile: {
|
|
78
|
+
get dimensions() {
|
|
79
|
+
return {
|
|
80
|
+
width: 902 + 2 * this.padding.x,
|
|
81
|
+
height: 714 + 2 * this.padding.y,
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
padding: {
|
|
85
|
+
x: 0,
|
|
86
|
+
y: 0,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
ravenItem: {
|
|
90
|
+
stops: [0, 65, 77, 89, 113, 125, 149],
|
|
91
|
+
interprets: [
|
|
92
|
+
{ level: 0, title: "عقبمانده" },
|
|
93
|
+
{ level: 1, title: "عقبمانده\nمرزی" },
|
|
94
|
+
{ level: 2, title: "کودن" },
|
|
95
|
+
{ level: 3, title: "متوسط" },
|
|
96
|
+
{ level: 4, title: "ممتاز" },
|
|
97
|
+
{ level: 5, title: "بسیار ممتاز" },
|
|
98
|
+
{ level: 6, title: "حدود نابغه" },
|
|
99
|
+
],
|
|
100
|
+
widthCoeff: 2.5,
|
|
101
|
+
},
|
|
102
|
+
/* "labels" part which has to be provided for each profile */
|
|
103
|
+
labels: Object.values(this.labels),
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
constructor(dataset, options, config = {}) {
|
|
107
|
+
super();
|
|
108
|
+
this._init(dataset, options, config);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
_calcContext() {
|
|
112
|
+
const {
|
|
113
|
+
spec: { parameters: spec },
|
|
114
|
+
dataset,
|
|
115
|
+
} = this;
|
|
116
|
+
|
|
117
|
+
const { ravenItem: ravenItemSpec } = spec;
|
|
118
|
+
|
|
119
|
+
const [GMIT_Context] = new GMIT93(
|
|
120
|
+
{ score: Object.fromEntries(dataset.score.slice(11, 19).map((s) => [s.label.eng, s.mark])) },
|
|
121
|
+
{},
|
|
122
|
+
{
|
|
123
|
+
items: {
|
|
124
|
+
offsetY: 7,
|
|
125
|
+
offsetX: 55,
|
|
126
|
+
ticks: {
|
|
127
|
+
heightOffset: 10,
|
|
128
|
+
numberOffset: { x: 3, y: 0 },
|
|
129
|
+
},
|
|
130
|
+
rect: { height: 10 },
|
|
131
|
+
widthCoeff: 7,
|
|
132
|
+
label: { offsetX: 5 },
|
|
133
|
+
},
|
|
134
|
+
labelsPrefix: "gmit",
|
|
135
|
+
}
|
|
136
|
+
).getTemplateEngineParams();
|
|
137
|
+
|
|
138
|
+
const [RIASEC_Context] = new RIASEC93(
|
|
139
|
+
{
|
|
140
|
+
items: dataset.questions.slice(558),
|
|
141
|
+
score: Object.fromEntries(dataset.score.slice(19, 25).map((s) => [s.label.eng, s.mark])),
|
|
142
|
+
},
|
|
143
|
+
{},
|
|
144
|
+
{
|
|
145
|
+
items: {
|
|
146
|
+
offsetY: 19,
|
|
147
|
+
rect: {
|
|
148
|
+
base: {
|
|
149
|
+
height: 2,
|
|
150
|
+
},
|
|
151
|
+
body: {
|
|
152
|
+
height: 4,
|
|
153
|
+
},
|
|
154
|
+
widthCoeff: 3.5,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
labelsPrefix: "riasec",
|
|
158
|
+
}
|
|
159
|
+
).getTemplateEngineParams();
|
|
160
|
+
|
|
161
|
+
const MBTI_Context = {
|
|
162
|
+
items: dataset.score.slice(0, 8).map((data) => ({
|
|
163
|
+
label: data.label,
|
|
164
|
+
mark: data.mark,
|
|
165
|
+
height: data.mark * 10,
|
|
166
|
+
active: data.mark >= 8,
|
|
167
|
+
})),
|
|
168
|
+
report: dataset.score[8].mark,
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const RAVEN_Context = {
|
|
172
|
+
item: {
|
|
173
|
+
mark: dataset.score[9].mark,
|
|
174
|
+
width:
|
|
175
|
+
dataset.score[9].mark >= ravenItemSpec.stops[1]
|
|
176
|
+
? 45 + (dataset.score[9].mark - ravenItemSpec.stops[1]) * ravenItemSpec.widthCoeff
|
|
177
|
+
: dataset.score[9].mark * 0.69,
|
|
178
|
+
level: dataset.score[10].mark,
|
|
179
|
+
stops: ravenItemSpec.stops.map((stop) => ({
|
|
180
|
+
mark: stop,
|
|
181
|
+
width:
|
|
182
|
+
stop >= ravenItemSpec.stops[1]
|
|
183
|
+
? 45 + (stop - ravenItemSpec.stops[1]) * ravenItemSpec.widthCoeff
|
|
184
|
+
: stop * 0.69,
|
|
185
|
+
})),
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const [_16PF_Context] = new _16PF(
|
|
190
|
+
{
|
|
191
|
+
score: Object.fromEntries(dataset.score.slice(25).map((s) => [s.label.eng, s.mark])),
|
|
192
|
+
fields: dataset.info.fields,
|
|
193
|
+
},
|
|
194
|
+
{},
|
|
195
|
+
{
|
|
196
|
+
items: {
|
|
197
|
+
offsetY: 19,
|
|
198
|
+
widthCoeff: 9,
|
|
199
|
+
label: {
|
|
200
|
+
offsetX: 9,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
gaugeItems: {
|
|
204
|
+
offsetX: 46,
|
|
205
|
+
circle: {
|
|
206
|
+
R: 16.5,
|
|
207
|
+
r: 12,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
labelsPrefix: "16pf",
|
|
211
|
+
}
|
|
212
|
+
).getTemplateEngineParams();
|
|
213
|
+
|
|
214
|
+
return [{ GMIT_Context, RIASEC_Context, MBTI_Context, _16PF_Context, RAVEN_Context }];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
module.exports = CAATS93;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
const { Profile } = require("../Profile");
|
|
2
|
+
|
|
3
|
+
class CADS93 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: "interpretation", fr: "تفسیر" },
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
profileSpec = {
|
|
14
|
+
/* "sample" determines some important info about the sample and profile */
|
|
15
|
+
/* Default prerequisites: 1. gender, 2. age, 3. education */
|
|
16
|
+
/* "prerequisites" is synonym to "fields" in our program */
|
|
17
|
+
sample: {
|
|
18
|
+
name: "پرسشنامه افسردگی کودکان و نوجوانان - جانبزرگی" /* Name of the sample */,
|
|
19
|
+
multiProfile: false /* Whether the sample has multiple profiles or not */,
|
|
20
|
+
questions: true /* Determines whether to get questions from inital dataset or not */,
|
|
21
|
+
defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
|
|
22
|
+
fields: [] /* In case you want to get some additional fields and show in the profile */,
|
|
23
|
+
},
|
|
24
|
+
/* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
|
|
25
|
+
/* calculating its dimensions carefully is of great importance */
|
|
26
|
+
profile: {
|
|
27
|
+
get dimensions() {
|
|
28
|
+
return {
|
|
29
|
+
width: 883 + 2 * this.padding.x,
|
|
30
|
+
height: 705 + 2 * this.padding.y,
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
padding: {
|
|
34
|
+
x: 0,
|
|
35
|
+
y: 10,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
/* "raw" is the general term used for total data element in the profile */
|
|
39
|
+
raw: {
|
|
40
|
+
maxValue: 56 /* Maximum value of raw mark provided by the dataset */,
|
|
41
|
+
offsetY: 83 /* Vertical offset from items */,
|
|
42
|
+
rect: {
|
|
43
|
+
width: 815 /* Width of the raw rectangle */,
|
|
44
|
+
height: 20 /* Height of the raw rectangle */,
|
|
45
|
+
br: 5 /* Border radius of the raw rectangle */,
|
|
46
|
+
},
|
|
47
|
+
widthCoeff: 14 /* Used for converting mark to the width */,
|
|
48
|
+
stops: [1, 7, 18, 28, 56] /* Stops array for the raw mark */,
|
|
49
|
+
interprets: [
|
|
50
|
+
{ fill: "#71717A", eng: "no_depression", fr: "" },
|
|
51
|
+
{ fill: "#FBBF24", eng: "mild", fr: "خفیف" },
|
|
52
|
+
{ fill: "#FB923C", eng: "moderate", fr: "متوسط" },
|
|
53
|
+
{ fill: "#EF4444", eng: "severe", fr: "شدید" },
|
|
54
|
+
{ fill: "#B91C1C", eng: "extreme", fr: "بسیار شدید" },
|
|
55
|
+
] /* Interprets array for the raw mark */,
|
|
56
|
+
label: {
|
|
57
|
+
stops: {
|
|
58
|
+
line: {
|
|
59
|
+
length: 32,
|
|
60
|
+
},
|
|
61
|
+
number: {
|
|
62
|
+
offsetY: 15,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
shape: {
|
|
66
|
+
width: 42,
|
|
67
|
+
height: 41.83,
|
|
68
|
+
offsetY: 35,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
/* "questions" is the general term for question items to be drawn in the profile */
|
|
73
|
+
questions: {
|
|
74
|
+
rect1: {
|
|
75
|
+
width: 32,
|
|
76
|
+
height: 28,
|
|
77
|
+
br: 4,
|
|
78
|
+
},
|
|
79
|
+
rect2: {
|
|
80
|
+
width: 811,
|
|
81
|
+
height: 28,
|
|
82
|
+
br: 4,
|
|
83
|
+
},
|
|
84
|
+
rect3: {
|
|
85
|
+
width: 32,
|
|
86
|
+
height: 130,
|
|
87
|
+
br: 5,
|
|
88
|
+
},
|
|
89
|
+
rect4: {
|
|
90
|
+
width: 382.5,
|
|
91
|
+
height: 28,
|
|
92
|
+
br: 4,
|
|
93
|
+
},
|
|
94
|
+
offsetX: 4,
|
|
95
|
+
offsetY: 6,
|
|
96
|
+
get distanceY() {
|
|
97
|
+
return this.rect1.height + this.offsetY;
|
|
98
|
+
},
|
|
99
|
+
colors: ["#F4F4F5", "#F1F5F9"],
|
|
100
|
+
choices: [
|
|
101
|
+
{ text: "الف", fill: "#71717A" },
|
|
102
|
+
{ text: "ب", fill: "#FBBF24" },
|
|
103
|
+
{ text: "ج", fill: "#FB923C" },
|
|
104
|
+
{ text: "د", fill: "#EF4444" },
|
|
105
|
+
{ text: "هـ", fill: "#B91C1C" },
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
/* "labels" part which has to be provided for each profile */
|
|
109
|
+
labels: Object.values(this.labels)
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
constructor(dataset, options, config = {}) {
|
|
113
|
+
super();
|
|
114
|
+
this._init(dataset, options, config);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
_calcContext() {
|
|
118
|
+
const {
|
|
119
|
+
spec: { parameters: spec },
|
|
120
|
+
dataset,
|
|
121
|
+
} = this;
|
|
122
|
+
|
|
123
|
+
// Deconstructing the Spec of the Profile
|
|
124
|
+
const { raw: rawSpec, questions: questionsSpec } = spec;
|
|
125
|
+
|
|
126
|
+
// Separate Raw Data from the Dataset
|
|
127
|
+
let rawData = dataset.score[0];
|
|
128
|
+
|
|
129
|
+
// Separate Interpretation from the Dataset
|
|
130
|
+
let interpret = dataset.score[1].mark;
|
|
131
|
+
|
|
132
|
+
const questions = [
|
|
133
|
+
dataset.questions.slice(0, 12).map((question, index) => ({
|
|
134
|
+
number: index + 1,
|
|
135
|
+
answer: {
|
|
136
|
+
choice: questionsSpec.choices[question.user_answered - 1],
|
|
137
|
+
text: question.answer.options[question.user_answered - 1],
|
|
138
|
+
},
|
|
139
|
+
})),
|
|
140
|
+
dataset.questions.slice(12).map((question, index) => ({
|
|
141
|
+
text: question.text,
|
|
142
|
+
answer: question.user_answered - 1,
|
|
143
|
+
})),
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
const raw = {
|
|
147
|
+
mark: rawData.mark,
|
|
148
|
+
label: rawData.label,
|
|
149
|
+
width: rawData.mark !== 0 ? (rawData.mark - 1) * rawSpec.widthCoeff + 45 : 0,
|
|
150
|
+
interpret: rawSpec.interprets.find((interpretation) => interpretation.eng === interpret),
|
|
151
|
+
stops: rawSpec.stops.map((stop) => ({
|
|
152
|
+
mark: stop,
|
|
153
|
+
width: (stop - 1) * rawSpec.widthCoeff + 45,
|
|
154
|
+
})),
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
return [{ raw, questions }];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
module.exports = CADS93;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
const { Profile, FS } = require("../Profile");
|
|
2
|
+
|
|
3
|
+
class CARSP93 extends Profile {
|
|
4
|
+
// Number of pages
|
|
5
|
+
static pages = 1;
|
|
6
|
+
|
|
7
|
+
// Labels of the sample
|
|
8
|
+
labels = {
|
|
9
|
+
L1: { eng: "total", fr: "کل" },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
profileSpec = {
|
|
13
|
+
/* "sample" determines some important info about the sample and profile */
|
|
14
|
+
/* Default prerequisites: 1. gender, 2. age, 3. education */
|
|
15
|
+
/* "prerequisites" is synonym to "fields" in our program */
|
|
16
|
+
sample: {
|
|
17
|
+
name: "پرسشنامه تشخیص کانرز - نسخه والدین" /* Name of the sample */,
|
|
18
|
+
multiProfile: false /* Whether the sample has multiple profiles or not */,
|
|
19
|
+
questions: false /* Determines whether to get questions from inital dataset or not */,
|
|
20
|
+
defaultFields: false /* Determines whether to have default prerequisites in the profile or not */,
|
|
21
|
+
fields: [
|
|
22
|
+
"child_gender",
|
|
23
|
+
"child_age",
|
|
24
|
+
"child_education",
|
|
25
|
+
] /* 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: 730 + 2 * this.padding.x,
|
|
33
|
+
height: 404.5 + 2 * this.padding.y,
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
padding: {
|
|
37
|
+
x: 80,
|
|
38
|
+
y: 0,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
/* "item" is the general term used for independent data element to be drawn in the profile */
|
|
42
|
+
item: {
|
|
43
|
+
minValue: 0 /* Minimum value of the item mark */,
|
|
44
|
+
maxValue: 104 /* Maximum value of the item mark */,
|
|
45
|
+
stops: [0, 25, 50, 75, 104] /* Stops array of the item mark */,
|
|
46
|
+
circle: {
|
|
47
|
+
center: {
|
|
48
|
+
radius: 42.5 /* Radius of the central circle */,
|
|
49
|
+
},
|
|
50
|
+
main: {
|
|
51
|
+
R: 340 /* Radius of the outer circle of the item element */,
|
|
52
|
+
r: 290 /* Radius of the inner circle of the item element */,
|
|
53
|
+
brs: {
|
|
54
|
+
tl: 0 /* Top left border radius */,
|
|
55
|
+
bl: 0 /* Bottom left border radius */,
|
|
56
|
+
tr: 0 /* Top right border radius */,
|
|
57
|
+
br: 0 /* Bottom right border radius */,
|
|
58
|
+
} /* Border radiuses at each end of the gauge of the item element */,
|
|
59
|
+
angles: {
|
|
60
|
+
start: FS.toRadians(-180),
|
|
61
|
+
end: FS.toRadians(0),
|
|
62
|
+
} /* Angles of each end of the item element */,
|
|
63
|
+
direction: false /* Clockwise direction for the item gauge element */,
|
|
64
|
+
base: {
|
|
65
|
+
fill: "#F4F4F5" /* Fill of the base part of the item gauge */,
|
|
66
|
+
stroke: "#E4E4E7" /* Stroke of the base part of the item gauge */,
|
|
67
|
+
},
|
|
68
|
+
body: {
|
|
69
|
+
fill: "#DB2777" /* Fill of the body part of the item gauge */,
|
|
70
|
+
stroke: "#9D174D" /* Stroke of the base part of the item gauge */,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
/* "labels" part which has to be provided for each profile */
|
|
76
|
+
labels: Object.values(this.labels)
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
constructor(dataset, options, config = {}) {
|
|
80
|
+
super();
|
|
81
|
+
this._init(dataset, options, config);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
_calcContext() {
|
|
85
|
+
const {
|
|
86
|
+
spec: { parameters: spec },
|
|
87
|
+
dataset,
|
|
88
|
+
} = this;
|
|
89
|
+
|
|
90
|
+
const { item: itemSpec } = spec;
|
|
91
|
+
|
|
92
|
+
const itemData = dataset.score[0];
|
|
93
|
+
|
|
94
|
+
const item = {
|
|
95
|
+
label: itemData.label,
|
|
96
|
+
mark: itemData.mark,
|
|
97
|
+
angle: this._markToAngle(
|
|
98
|
+
itemData.mark,
|
|
99
|
+
itemSpec.minValue,
|
|
100
|
+
itemSpec.maxValue,
|
|
101
|
+
itemSpec.circle.main.angles,
|
|
102
|
+
itemSpec.circle.main.direction
|
|
103
|
+
),
|
|
104
|
+
stops: itemSpec.stops.map((stop) => ({
|
|
105
|
+
mark: stop,
|
|
106
|
+
angle: this._markToAngle(
|
|
107
|
+
stop,
|
|
108
|
+
itemSpec.minValue,
|
|
109
|
+
itemSpec.maxValue,
|
|
110
|
+
itemSpec.circle.main.angles,
|
|
111
|
+
itemSpec.circle.main.direction
|
|
112
|
+
),
|
|
113
|
+
})),
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return [{ item }];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
_markToAngle(mark, min, max, angles, direction) {
|
|
120
|
+
const totalAngle = this._calcDiffAngle(angles.end, angles.start, direction);
|
|
121
|
+
const deltaTheta = ((mark - min) / (max - min)) * totalAngle;
|
|
122
|
+
return this._calcDistAngle(deltaTheta, angles.start, direction);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
_calcDiffAngle(theta, theta0, direction) {
|
|
126
|
+
return direction ? 2 * Math.PI - (theta - theta0) : theta - theta0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
_calcDistAngle(deltaTheta, theta0, direction) {
|
|
130
|
+
return direction ? 2 * Math.PI - deltaTheta + theta0 : deltaTheta + theta0;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
module.exports = CARSP93;
|