@baravak/risloo-profile-cli 4.3.1 → 4.3.3
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 +60 -15
- package/src/samples/PMCIEF93.js +1 -0
- 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
|
-
this.dataset.score[i].label.percentage = Math.round(((this.dataset.score[i].mark * 100) / this.dataset.score[i].label.width))
|
|
69
|
+
this.dataset.score[i].label.percentage = Math.round((((this.dataset.score[i].mark ?? 0) * 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
|
@@ -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
|