@baravak/risloo-profile-cli 4.3.0 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/handlebars/importPartials.js +1 -0
- package/src/samples/JPFQ93.js +59 -14
- package/src/samples/PMCIEF93.js +1 -0
- package/src/samples/YSQ93.js +53 -20
- package/views/profiles/samples/JPFQ93_2.hbs +5 -0
- package/views/profiles/samples/JPFQ93_partial.hbs +8 -8
- package/views/profiles/samples/JPFQ93_partial2.hbs +31 -0
- /package/views/profiles/samples/{JPFQ93.hbs → JPFQ93_1.hbs} +0 -0
package/package.json
CHANGED
package/src/samples/JPFQ93.js
CHANGED
|
@@ -2,7 +2,7 @@ const { Profile, FS } = require("../Profile");
|
|
|
2
2
|
|
|
3
3
|
class JPFQ93 extends Profile {
|
|
4
4
|
// Number of pages
|
|
5
|
-
static pages =
|
|
5
|
+
static pages = 2;
|
|
6
6
|
|
|
7
7
|
// Labels of the sample
|
|
8
8
|
labels = {
|
|
@@ -25,7 +25,7 @@ class JPFQ93 extends Profile {
|
|
|
25
25
|
sample: {
|
|
26
26
|
name: "کارکردهای شخصیت - جانبزرگی" /* Name of the sample */,
|
|
27
27
|
multiProfile: false /* Whether the sample has multiple profiles or not */,
|
|
28
|
-
questions:
|
|
28
|
+
questions: true /* Determines whether to get questions from inital dataset or not */,
|
|
29
29
|
defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
|
|
30
30
|
fields: [] /* In case you want to get some additional fields and show in the profile */,
|
|
31
31
|
},
|
|
@@ -53,25 +53,70 @@ class JPFQ93 extends Profile {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
_calcContext() {
|
|
56
|
-
const { dataset } = this;
|
|
56
|
+
const { dataset, questions } = this;
|
|
57
57
|
let markSum = 0
|
|
58
|
+
const clinicalScores = clinicalScoring(dataset.questions)
|
|
59
|
+
const score2 = []
|
|
58
60
|
dataset.score.forEach(score => {
|
|
59
61
|
markSum += score.mark
|
|
62
|
+
const s2= {label: {...score.label}}
|
|
63
|
+
s2.mark = clinicalScores[score.label.eng].total
|
|
64
|
+
s2.label.percentage = clinicalScores[score.label.eng].percentage
|
|
65
|
+
s2.label.width = clinicalScores[score.label.eng].width
|
|
66
|
+
score2.push(s2)
|
|
60
67
|
})
|
|
61
|
-
// const items = dataset.score.map((data) => ({
|
|
62
|
-
// label: data.label,
|
|
63
|
-
// mark: data.mark,
|
|
64
|
-
// coordinates: {
|
|
65
|
-
// x: (data.mark.interaction - 6) * 25,
|
|
66
|
-
// y: (data.mark.structure - 6) * 25,
|
|
67
|
-
// },
|
|
68
|
-
// }));
|
|
69
|
-
// markSum = 378
|
|
70
68
|
this.dataset.score.forEach((f, i) => {
|
|
71
69
|
this.dataset.score[i].label.percentage = Math.round(((this.dataset.score[i].mark * 100) / this.dataset.score[i].label.width))
|
|
72
70
|
})
|
|
73
|
-
|
|
71
|
+
let markSum1 = 0
|
|
72
|
+
for(const cs in clinicalScores){
|
|
73
|
+
markSum1 += clinicalScores[cs].total
|
|
74
|
+
}
|
|
75
|
+
return [{ markSum: markSum1, clinicalScores: score2, titleAppend:' - نیمرخ بالینی' }, { markSum, titleAppend:' - نیمرخ پژوهشی' }];
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
|
-
|
|
78
|
+
function clinicalScoring(items){
|
|
79
|
+
f1 = 'identity'
|
|
80
|
+
f2 = 'self_direction'
|
|
81
|
+
f3 = 'empathy'
|
|
82
|
+
f4 = 'intimacy'
|
|
83
|
+
f5 = 'psychoticism'
|
|
84
|
+
f6 = 'detachment'
|
|
85
|
+
f7 = 'disinhibition'
|
|
86
|
+
f8 = 'negative_affectivity'
|
|
87
|
+
f9 = 'antagonism'
|
|
88
|
+
factors = {
|
|
89
|
+
[`${f1}`] : [1,5,9,12,14,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,48,50,53],
|
|
90
|
+
[`${f2}`] : [2,6,10,15,20,26,32,38,44,49],
|
|
91
|
+
[`${f3}`] : [4,8,13,18,24,30,36,42,47,52,55],
|
|
92
|
+
[`${f4}`] : [3,7,11,16,22,28,34,40,46,51,54],
|
|
93
|
+
[`${f5}`] : [56,62,68,73,78,83,88,96,102,108,111],
|
|
94
|
+
[`${f6}`] : [60,67,72,77,82,87,94,100,106],
|
|
95
|
+
[`${f7}`] : [57,61,63,66,69,74,79,84,89,91,93,95,97,103,107,110,114,118,120,122,124,126],
|
|
96
|
+
[`${f8}`] : [59,65,71,76,81,86,92,99,105,112,116,119,121,123,125],
|
|
97
|
+
[`${f9}`] : [58,64,70,75,80,85,90,98,101,104,109,113,115,117]
|
|
98
|
+
}
|
|
99
|
+
reverse_scoring_numbers = [1,5,6,10,11,12,14,26,32,34,47,50,115]
|
|
100
|
+
result = {}
|
|
101
|
+
for(const f in factors){
|
|
102
|
+
const fItems = factors[f]
|
|
103
|
+
if(result[f] === undefined){
|
|
104
|
+
result[f] = {total: 0, percentage: 0, width: fItems.length * 2}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
fItems.forEach(index => {
|
|
108
|
+
answer = parseInt(items[index -1].user_answered)
|
|
109
|
+
let incScore = 0
|
|
110
|
+
if(reverse_scoring_numbers.indexOf(index) === -1){
|
|
111
|
+
incScore = Math.floor((4 - answer)/1.5)
|
|
112
|
+
}else{
|
|
113
|
+
incScore = Math.floor((answer - 1)/1.5)
|
|
114
|
+
}
|
|
115
|
+
result[f].total = result[f].total + incScore
|
|
116
|
+
})
|
|
117
|
+
totalScore = fItems.length * 2
|
|
118
|
+
result[f].percentage = Math.round((result[f].total * 100) / totalScore)
|
|
119
|
+
}
|
|
120
|
+
return result
|
|
121
|
+
}
|
|
77
122
|
module.exports = JPFQ93;
|
package/src/samples/PMCIEF93.js
CHANGED
package/src/samples/YSQ93.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const { Profile, FS, Mappings } = require("../Profile");
|
|
2
|
-
|
|
3
2
|
class YSQ93 extends Profile {
|
|
4
3
|
// Number of pages
|
|
5
4
|
static pages = 1;
|
|
@@ -74,31 +73,31 @@ class YSQ93 extends Profile {
|
|
|
74
73
|
const a6 = [];
|
|
75
74
|
let start = 0;
|
|
76
75
|
const a5_line = [32]
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
a5.push({item: key+1, start:start})
|
|
76
|
+
factors_key[s.label.eng].forEach((e, ei) => {
|
|
77
|
+
e = parseInt(e)
|
|
78
|
+
if(dataset.questions[e - 1].user_answered == 5){
|
|
79
|
+
if(!a5.length){
|
|
80
|
+
start+= 37
|
|
81
|
+
}else{
|
|
82
|
+
start+= 26
|
|
86
83
|
}
|
|
87
|
-
|
|
84
|
+
a5.push({item: e, start:start})
|
|
85
|
+
}
|
|
86
|
+
});
|
|
88
87
|
a5_line.push(start + 2)
|
|
89
88
|
const a6_start = start ? start + 36 : 0;
|
|
90
89
|
const a6_line = [a6_start + 32]
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
a6.push({item: key+1, start:start})
|
|
90
|
+
factors_key[s.label.eng].forEach((e, ei) => {
|
|
91
|
+
e = parseInt(e)
|
|
92
|
+
if(dataset.questions[e -1].user_answered == 6){
|
|
93
|
+
if(!a6.length){
|
|
94
|
+
start = a6_start + 37
|
|
95
|
+
}else{
|
|
96
|
+
start+= 26
|
|
100
97
|
}
|
|
98
|
+
a6.push({item: e, start:start})
|
|
101
99
|
}
|
|
100
|
+
})
|
|
102
101
|
a6_line.push(start + 2)
|
|
103
102
|
const is_critical = a5.length + a6.length >= 3 ? true : false
|
|
104
103
|
return Object.assign({}, s, {
|
|
@@ -118,5 +117,39 @@ class YSQ93 extends Profile {
|
|
|
118
117
|
return [{ items }];
|
|
119
118
|
}
|
|
120
119
|
}
|
|
120
|
+
const f1= 'ed'
|
|
121
|
+
const f2 = 'ab'
|
|
122
|
+
const f3 = 'ma'
|
|
123
|
+
const f4 = 'si'
|
|
124
|
+
const f5 = 'ds'
|
|
125
|
+
const f6 = 'fa'
|
|
126
|
+
const f7 = 'ai'
|
|
127
|
+
const f8 = 'vu'
|
|
128
|
+
const f9 = 'eu'
|
|
129
|
+
const f10 = 'sb'
|
|
130
|
+
const f11 = 'ss'
|
|
131
|
+
const f12 = 'ei'
|
|
132
|
+
const f13 = 'us'
|
|
133
|
+
const f14 = 'et'
|
|
134
|
+
const f15 = 'is'
|
|
135
|
+
const f16 = 'as'
|
|
136
|
+
const f17 = 'np'
|
|
137
|
+
const f18 = 'pu'
|
|
121
138
|
|
|
139
|
+
const factors_item = {
|
|
140
|
+
1: f1, 2: f2, 3: f3, 4: f4, 5: f5, 6: f6, 7: f7, 8: f8, 9: f9, 10: f10, 11: f11, 12: f12, 13: f13, 14: f14, 15: f15, 16: f16, 17: f17, 18: f18,
|
|
141
|
+
19: f1, 20: f2, 21: f3, 22: f4, 23: f5, 24: f6, 25: f7, 26: f8, 27: f9, 28: f10, 29: f11, 30: f12, 31: f13, 32: f14, 33: f15, 34: f16, 35: f17, 36: f18,
|
|
142
|
+
37: f1, 38: f2, 39: f3, 40: f4, 41: f5, 42: f6, 43: f7, 44: f8, 45: f9, 46: f10, 47: f11, 48: f12, 49: f13, 50: f14, 51: f15, 52: f16, 53: f17, 54: f18,
|
|
143
|
+
55: f1, 56: f2, 57: f3, 58: f4, 59: f5, 60: f6, 61: f7, 62: f8, 63: f9, 64: f10, 65: f11, 66: f12, 67: f13, 68: f14, 69: f15, 70: f16, 71: f17, 72: f18,
|
|
144
|
+
73: f1, 74: f2, 75: f3, 76: f4, 77: f5, 78: f6, 79: f7, 80: f8, 81: f9, 82: f10, 83: f11, 84: f12, 85: f13, 86: f14, 87: f15, 88: f16, 89: f17, 90: f18
|
|
145
|
+
}
|
|
146
|
+
const factors_key = {}
|
|
147
|
+
for(const fi in factors_item){
|
|
148
|
+
const fk = factors_item[fi]
|
|
149
|
+
if(factors_key[fk] === undefined){
|
|
150
|
+
factors_key[fk] = [fi]
|
|
151
|
+
}else{
|
|
152
|
+
factors_key[fk].push(fi)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
122
155
|
module.exports = YSQ93;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{{#each
|
|
1
|
+
{{#each clinicalScores}}
|
|
2
2
|
<g transform="translate(0, {{math 5 '+' ( math 51 '*' @key )}})">
|
|
3
3
|
<text y="0" x="169" text-anchor="start" font-size="24px" font-weight="400" dy="24px" fill="#3F3F46">{{label.fr}}</text>
|
|
4
4
|
<g transform="translate(186, 0)">
|
|
5
|
-
{{bar (math label.width '*'
|
|
6
|
-
{{bar (math mark '*'
|
|
7
|
-
<text y="17" x="{{math (math label.width '*'
|
|
5
|
+
{{bar (math label.width '*' 5.25) 30 (object tl=0 tr=15 bl=0 br=15) (toRad 0) fill=label.background opacity='.8'}}
|
|
6
|
+
{{bar (math mark '*' 5.25) 30 (object tl=0 tr=15 bl=0 br=15) (toRad 0) fill=label.fill opacity='.8'}}
|
|
7
|
+
<text y="17" x="{{math (math label.width '*' 5.25) '+' 8 }}" dy="6px" text-anchor="start" direction="ltr">
|
|
8
8
|
<tspan fill="{{label.fill}}" font-size="27px" font-weight="500">
|
|
9
9
|
{{mark}}
|
|
10
10
|
</tspan>
|
|
11
11
|
<tspan font-size="20px" fill="#71717A" font-weight="400">/ {{label.width}}</tspan>
|
|
12
12
|
</text>
|
|
13
|
-
<g transform="translate({{math 95 '+' (math label.width '*'
|
|
13
|
+
<g transform="translate({{math 95 '+' (math label.width '*' 5.25)}}, 4)">
|
|
14
14
|
<rect x="0" y="0" rx="4" fill="#F8FAFC" width="50" height="25" />
|
|
15
15
|
<text x="25" y="12.5" dy="0.25em" text-anchor="middle" font-weight="400" font-size="20px" fill="{{label.fill}}">%{{label.percentage}}</text>
|
|
16
16
|
</g>
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
<g transform="translate(612, 447)">
|
|
22
22
|
<g transform="translate(53, -3)">
|
|
23
23
|
{{bar 9 378 (object tl=0 tr=0 bl=4.5 br=4.5) (toRad 180) fill='#E4E4E7'}}
|
|
24
|
-
{{bar 9 markSum (object tl=0 tr=0 bl=4.5 br=4.5) (toRad 180) fill='#52525B'}}
|
|
24
|
+
{{bar 9 (math markSum '*' 1.5) (object tl=0 tr=0 bl=4.5 br=4.5) (toRad 180) fill='#52525B'}}
|
|
25
25
|
</g>
|
|
26
|
-
<text x="49.5" y="-410.5" dominant-baseline="auto" text-anchor="middle" fill="#71717A" font-size="30px" font-weight="400">
|
|
27
|
-
<text x="66" y="{{math markSum '*' -1}}" dy="6" text-anchor="start" font-size="36px" fill="#3F3F46" font-weight="500" direction="ltr">{{markSum}}</text>
|
|
26
|
+
<text x="49.5" y="-410.5" dominant-baseline="auto" text-anchor="middle" fill="#71717A" font-size="30px" font-weight="400">252</text>
|
|
27
|
+
<text x="66" y="{{math markSum '*' -1.5}}" dy="6" text-anchor="start" font-size="36px" fill="#3F3F46" font-weight="500" direction="ltr">{{markSum}}</text>
|
|
28
28
|
<text transform="rotate(-90, 0, 0)" x="0" y="0" text-anchor="end" dy="18" font-size="24px" font-weight="400" fill="#52525B">نمره کل</text>
|
|
29
29
|
|
|
30
30
|
<rect x="41" y="-3" width="15" height="3" fill="#FFFFFF" style="filter: drop-shadow(0 -3px 5px rgba(0,0,0, .5));"/>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{{#each dataset.score}}
|
|
2
|
+
<g transform="translate(0, {{math 5 '+' ( math 51 '*' @key )}})">
|
|
3
|
+
<text y="0" x="169" text-anchor="start" font-size="24px" font-weight="400" dy="24px" fill="#3F3F46">{{label.fr}}</text>
|
|
4
|
+
<g transform="translate(186, 0)">
|
|
5
|
+
{{bar (math label.width '*' 3.5) 30 (object tl=0 tr=15 bl=0 br=15) (toRad 0) fill=label.background opacity='.8'}}
|
|
6
|
+
{{bar (math mark '*' 3.5) 30 (object tl=0 tr=15 bl=0 br=15) (toRad 0) fill=label.fill opacity='.8'}}
|
|
7
|
+
<text y="17" x="{{math (math label.width '*' 3.5) '+' 8 }}" dy="6px" text-anchor="start" direction="ltr">
|
|
8
|
+
<tspan fill="{{label.fill}}" font-size="27px" font-weight="500">
|
|
9
|
+
{{mark}}
|
|
10
|
+
</tspan>
|
|
11
|
+
<tspan font-size="20px" fill="#71717A" font-weight="400">/ {{label.width}}</tspan>
|
|
12
|
+
</text>
|
|
13
|
+
<g transform="translate({{math 95 '+' (math label.width '*' 3.5)}}, 4)">
|
|
14
|
+
<rect x="0" y="0" rx="4" fill="#F8FAFC" width="50" height="25" />
|
|
15
|
+
<text x="25" y="12.5" dy="0.25em" text-anchor="middle" font-weight="400" font-size="20px" fill="{{label.fill}}">%{{label.percentage}}</text>
|
|
16
|
+
</g>
|
|
17
|
+
</g>
|
|
18
|
+
</g>
|
|
19
|
+
{{/each}}
|
|
20
|
+
<rect x="183" y="3" width="3" height="450" rx="1" fill="#FFFFFF" style="filter: drop-shadow(3px 0 5px rgba(0,0,0, .5));"/>
|
|
21
|
+
<g transform="translate(612, 447)">
|
|
22
|
+
<g transform="translate(53, -3)">
|
|
23
|
+
{{bar 9 378 (object tl=0 tr=0 bl=4.5 br=4.5) (toRad 180) fill='#E4E4E7'}}
|
|
24
|
+
{{bar 9 markSum (object tl=0 tr=0 bl=4.5 br=4.5) (toRad 180) fill='#52525B'}}
|
|
25
|
+
</g>
|
|
26
|
+
<text x="49.5" y="-410.5" dominant-baseline="auto" text-anchor="middle" fill="#71717A" font-size="30px" font-weight="400">378</text>
|
|
27
|
+
<text x="66" y="{{math markSum '*' -1}}" dy="6" text-anchor="start" font-size="36px" fill="#3F3F46" font-weight="500" direction="ltr">{{markSum}}</text>
|
|
28
|
+
<text transform="rotate(-90, 0, 0)" x="0" y="0" text-anchor="end" dy="18" font-size="24px" font-weight="400" fill="#52525B">نمره کل</text>
|
|
29
|
+
|
|
30
|
+
<rect x="41" y="-3" width="15" height="3" fill="#FFFFFF" style="filter: drop-shadow(0 -3px 5px rgba(0,0,0, .5));"/>
|
|
31
|
+
</g>
|
|
File without changes
|