@baravak/risloo-profile-cli 4.19.0 → 4.19.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baravak/risloo-profile-cli",
3
- "version": "4.19.0",
3
+ "version": "4.19.1",
4
4
  "description": "**Risloo Profile CLI** is a library for creating profiles, reports and sheets for *psychological* samples.",
5
5
  "main": "bin/risloo.js",
6
6
  "publishConfig": {
@@ -91,12 +91,26 @@
91
91
  }
92
92
  ],
93
93
  "score": {
94
- "overall_performance": 24,
95
- "problem_solving": 12,
96
- "communication": 19,
97
- "roles": 22,
98
- "affective_involvement": 14,
99
- "behaviour_control": 16,
100
- "affective_responsiveness": 9
94
+ "overall_performance_raw": 24,
95
+ "overall_performance_avg": 2,
96
+ "overall_performance_report": "unhealthy",
97
+ "problem_solving_raw": 12,
98
+ "problem_solving_avg": 2,
99
+ "problem_solving_report": "healthy",
100
+ "communication_raw": 19,
101
+ "communication_avg": 2.1,
102
+ "communication_report": "healthy",
103
+ "roles_raw": 22,
104
+ "roles_avg": 2,
105
+ "roles_report": "healthy",
106
+ "affective_involvement_raw": 14,
107
+ "affective_involvement_avg": 2,
108
+ "affective_involvement_report": "healthy",
109
+ "behaviour_control_raw": 16,
110
+ "behaviour_control_avg": 1.7,
111
+ "behaviour_control_report": "healthy",
112
+ "affective_responsiveness_raw": 9,
113
+ "affective_responsiveness_avg": 1.5,
114
+ "affective_responsiveness_report": "healthy"
101
115
  }
102
116
  }
@@ -7,13 +7,33 @@ class MMAFD9A extends Profile {
7
7
 
8
8
  // Labels of the sample
9
9
  labels = {
10
- L1: { eng: "problem_solving", fr: "حل مسأله", CoP: 2.2, max: 24},
11
- L2: { eng: "roles", fr: "نقش‌ها", CoP: 2.3, max: 44},
12
- L3: { eng: "affective_responsiveness", fr: "پاسخ‌دهی عاطفی", CoP: 2.2, max: 24},
13
- L4: { eng: "communication", fr: "ارتباط", CoP: 2.2, max: 36},
14
- L5: { eng: "affective_involvement", fr: "مشارکت عاطفی", CoP: 2.1, max: 28},
15
- L6: { eng: "behaviour_control", fr: "کنترل رفتار", CoP: 1.9, max: 36},
16
- L7: { eng: "overall_performance", fr: "کارکرد عمومی", CoP: 2, max: 48},
10
+ L1: { eng: "problem_solving_raw", fr: "حل مسأله", CoP: 2.2},
11
+ L1_2 : {eng: "problem_solving_avg"},
12
+ L1_3 : {eng: "problem_solving_report"},
13
+
14
+ L2: { eng: "roles_raw", fr: "نقش‌ها", CoP: 2.3},
15
+ L2_2 : {eng: "roles_avg"},
16
+ L2_3 : {eng: "roles_report"},
17
+
18
+ L3: { eng: "affective_responsiveness_raw", fr: "پاسخ‌دهی عاطفی", CoP: 2.2},
19
+ L3_2 : {eng: "affective_responsiveness_avg"},
20
+ L3_3 : {eng: "affective_responsiveness_report"},
21
+
22
+ L4: { eng: "communication_raw", fr: "ارتباط", CoP: 2.2},
23
+ L4_2 : {eng: "communication_avg"},
24
+ L4_3 : {eng: "communication_report"},
25
+
26
+ L5: { eng: "affective_involvement_raw", fr: "مشارکت عاطفی", CoP: 2.1},
27
+ L5_2 : {eng: "affective_involvement_avg"},
28
+ L5_3 : {eng: "affective_involvement_report"},
29
+
30
+ L6: { eng: "behaviour_control_raw", fr: "کنترل رفتار", CoP: 1.9},
31
+ L6_2 : {eng: "behaviour_control_avg"},
32
+ L6_3 : {eng: "behaviour_control_report"},
33
+
34
+ L7: { eng: "overall_performance_raw", fr: "کارکرد عمومی", CoP: 2},
35
+ L7_2 : {eng: "overall_performance_avg"},
36
+ L7_3 : {eng: "overall_performance_report"},
17
37
  };
18
38
 
19
39
  profileSpec = {
@@ -53,51 +73,54 @@ class MMAFD9A extends Profile {
53
73
  spec: { parameters: spec },
54
74
  dataset,
55
75
  } = this;
76
+ const scores = []
77
+ for (let i = 0; i < 21; i+= 3) {
78
+ const item = {mark: dataset.score[i].mark, label: {...dataset.score[i].label}}
79
+ const avg = dataset.score[i + 1].mark
80
+ item.label.avg = avg
56
81
 
82
+ const elements = [];
83
+ let greenLiene = 12;
84
+ for (let i = 0; i < 31; i++) {
85
+ let color = "";
86
+ let type = "";
87
+ const point = 1 + round(i * 0.1, 1);
88
+ if (point < item.label.CoP) {
89
+ greenLiene += 14;
90
+ }
91
+ if (point === avg) {
92
+ color = avg >= item.label.CoP ? "#DC2626" : "#16A34A";
93
+ type = "selected";
94
+ } else {
95
+ type = Math.round(point) === point ? "z" : "nz";
96
+ if (point === item.label.CoP) {
97
+ color = "#A8A29E";
98
+ } else if (point > item.label.CoP) {
99
+ color = type === "z" ? '#F43F5E33' : "#F43F5E1A";
100
+ } else {
101
+ color = type === 'z' ? '#16A34A33' : "#16A34A1A";
102
+ }
103
+ }
104
+ elements.push({
105
+ point,
106
+ color,
107
+ type,
108
+ isCoP: point === item.label.CoP,
109
+ });
110
+ }
111
+ item.label.CoPText = item.label.CoP.toString().replace(".", "٬");
112
+ scores.push({
113
+ ...item,
114
+ elements,
115
+ greenLiene,
116
+ redLine: 446 - greenLiene,
117
+ avgText: item.label.avg.toString().replace(".", "٬"),
118
+ avgSelected: elements.findIndex((e) => e.type === "selected")
119
+ })
120
+ }
57
121
  return [
58
122
  {
59
- scores: dataset.score.map((score) => {
60
- const elements = [];
61
- score.label.avg = round(score.mark / (score.label.max/4), 1);
62
- const avg = round(score.label.avg, 1);
63
- let greenLiene = 12;
64
- for (let i = 0; i < 31; i++) {
65
- let color = "";
66
- let type = "";
67
- const point = 1 + round(i * 0.1, 1);
68
- if (point < score.label.CoP) {
69
- greenLiene += 14;
70
- }
71
- if (point === avg) {
72
- color = avg >= score.label.CoP ? "#DC2626" : "#16A34A";
73
- type = "selected";
74
- } else {
75
- type = Math.round(point) === point ? "z" : "nz";
76
- if (point === score.label.CoP) {
77
- color = "#A8A29E";
78
- } else if (point > avg) {
79
- color = type === "z" ? '#F43F5E33' : "#F43F5E1A";
80
- } else {
81
- color = type === 'z' ? '#16A34A33' : "#16A34A1A";
82
- }
83
- }
84
- elements.push({
85
- point,
86
- color,
87
- type,
88
- isCoP: point === score.label.CoP,
89
- });
90
- }
91
- score.label.CoPText = score.label.CoP.toString().replace(".", "٬");
92
- return {
93
- ...score,
94
- elements,
95
- greenLiene,
96
- redLine: 446 - greenLiene,
97
- avgText: score.label.avg.toString().replace(".", "٬"),
98
- avgSelected: elements.findIndex((e) => e.type === "selected")
99
- };
100
- }),
123
+ scores
101
124
  },
102
125
  ];
103
126
  }