c2-clinical 1.0.121 → 1.0.123

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.
@@ -18,7 +18,9 @@ class OnAnswerQuestionsFlowTester {
18
18
  }
19
19
  executeByRows(answered, lines, metActivitiesPatient) {
20
20
  const bankAnswer = ConvertRowToFormUnitsFlowItem_1.default.execute(lines);
21
+ console.log("bankAnswerConverted", bankAnswer);
21
22
  const { bank } = this.execute(answered, bankAnswer, metActivitiesPatient);
23
+ console.log("bankAnswerReturned", bankAnswer);
22
24
  return {
23
25
  bank,
24
26
  lines: GroupFormUnitsFlow_1.default.execute(bank, [])
@@ -12,24 +12,38 @@ class ProcessAnswerFlowTester {
12
12
  const allQuestionsAnswereds = bankAnswer?.filter((q) => q.answer !== "" && q.answer !== undefined);
13
13
  answerRelacioneds.forEach((relationed) => {
14
14
  //executa fórmula para answer
15
- const answerCalculated = ExecFormulaFlowTester_1.default.execute(relationed.formulaToAnswer, allQuestionsAnswereds, attendanceMetActivities);
16
- if (relationed.answer !== answerCalculated) {
17
- relationed.answer = answerCalculated;
18
- allQuestionsAnswereds.push(relationed);
19
- autoAnswereds.push(relationed);
15
+ if (relationed.code !== questionAnswered.code) {
16
+ const answerCalculated = ExecFormulaFlowTester_1.default.execute(relationed.formulaToAnswer, allQuestionsAnswereds, attendanceMetActivities);
17
+ if (relationed.answer !== answerCalculated) {
18
+ relationed.answer = answerCalculated;
19
+ allQuestionsAnswereds.push(relationed);
20
+ autoAnswereds.push(relationed);
21
+ }
22
+ }
23
+ // formulaToDescription
24
+ if (relationed.formulaToDescription) {
25
+ relationed.description = ExecFormulaFlowTester_1.default.execute(relationed.formulaToDescription, allQuestionsAnswereds, attendanceMetActivities);
20
26
  }
21
27
  // formulaToReferenceValue
22
28
  if (relationed?.formulaToReferenceValue) {
23
29
  relationed.referenceValue = ExecFormulaFlowTester_1.default.execute(relationed.formulaToReferenceValue, allQuestionsAnswereds, attendanceMetActivities);
24
30
  }
25
- // formulaToClassificationLabel: string;
31
+ // formulaToClassificationLabel
26
32
  if (relationed?.formulaToClassificationLabel) {
27
33
  relationed.classificationLabel = ExecFormulaFlowTester_1.default.execute(relationed.formulaToClassificationLabel, allQuestionsAnswereds, attendanceMetActivities);
28
34
  }
29
- // formulaToClassificationColor: string;
35
+ // formulaToClassificationColor
30
36
  if (relationed?.formulaToClassificationColor) {
31
37
  relationed.classificationColor = ExecFormulaFlowTester_1.default.execute(relationed.formulaToClassificationColor, allQuestionsAnswereds, attendanceMetActivities);
32
38
  }
39
+ // formulaToMessage para validations
40
+ if (relationed?.validations?.length) {
41
+ relationed.validations
42
+ .filter((v) => v.formulaToMessage)
43
+ .forEach((v) => {
44
+ v.message = ExecFormulaFlowTester_1.default.execute(v.formulaToMessage, allQuestionsAnswereds, attendanceMetActivities);
45
+ });
46
+ }
33
47
  // check options is enables
34
48
  if (relationed?.options?.length) {
35
49
  relationed.options
@@ -9,6 +9,7 @@ class GetAnswerRelationedsFlowItemTester {
9
9
  regex.test(fu.formulaToClassificationLabel) ||
10
10
  regex.test(fu.formulaToClassificationColor) ||
11
11
  regex.test(fu.formulaToEnable) ||
12
+ regex.test(fu.formulaToDescription) ||
12
13
  fu.validations?.some((v) => regex.test(v.formulaToMessage)) ||
13
14
  fu.options?.some((v) => regex.test(v.formulaToEnable)));
14
15
  });
@@ -43,14 +43,17 @@ export declare const AnamneseAnswerSchema: Schema<any, import("mongoose").Model<
43
43
  type: string;
44
44
  typeOutput: string;
45
45
  formulaToMessage: string;
46
+ message?: string | null | undefined;
46
47
  }, Types.Subdocument<Types.ObjectId, any, {
47
48
  type: string;
48
49
  typeOutput: string;
49
50
  formulaToMessage: string;
51
+ message?: string | null | undefined;
50
52
  }> & {
51
53
  type: string;
52
54
  typeOutput: string;
53
55
  formulaToMessage: string;
56
+ message?: string | null | undefined;
54
57
  }>;
55
58
  requestGraphicData: Types.DocumentArray<{
56
59
  method: string;
@@ -110,14 +113,17 @@ export declare const AnamneseAnswerSchema: Schema<any, import("mongoose").Model<
110
113
  type: string;
111
114
  typeOutput: string;
112
115
  formulaToMessage: string;
116
+ message?: string | null | undefined;
113
117
  }, Types.Subdocument<Types.ObjectId, any, {
114
118
  type: string;
115
119
  typeOutput: string;
116
120
  formulaToMessage: string;
121
+ message?: string | null | undefined;
117
122
  }> & {
118
123
  type: string;
119
124
  typeOutput: string;
120
125
  formulaToMessage: string;
126
+ message?: string | null | undefined;
121
127
  }>;
122
128
  requestGraphicData: Types.DocumentArray<{
123
129
  method: string;
@@ -177,14 +183,17 @@ export declare const AnamneseAnswerSchema: Schema<any, import("mongoose").Model<
177
183
  type: string;
178
184
  typeOutput: string;
179
185
  formulaToMessage: string;
186
+ message?: string | null | undefined;
180
187
  }, Types.Subdocument<Types.ObjectId, any, {
181
188
  type: string;
182
189
  typeOutput: string;
183
190
  formulaToMessage: string;
191
+ message?: string | null | undefined;
184
192
  }> & {
185
193
  type: string;
186
194
  typeOutput: string;
187
195
  formulaToMessage: string;
196
+ message?: string | null | undefined;
188
197
  }>;
189
198
  requestGraphicData: Types.DocumentArray<{
190
199
  method: string;
@@ -41,14 +41,17 @@ export declare const AnthropometryAnswerSchema: Schema<any, import("mongoose").M
41
41
  type: string;
42
42
  typeOutput: string;
43
43
  formulaToMessage: string;
44
+ message?: string | null | undefined;
44
45
  }, Types.Subdocument<Types.ObjectId, any, {
45
46
  type: string;
46
47
  typeOutput: string;
47
48
  formulaToMessage: string;
49
+ message?: string | null | undefined;
48
50
  }> & {
49
51
  type: string;
50
52
  typeOutput: string;
51
53
  formulaToMessage: string;
54
+ message?: string | null | undefined;
52
55
  }>;
53
56
  requestGraphicData: Types.DocumentArray<{
54
57
  method: string;
@@ -99,14 +102,17 @@ export declare const AnthropometryAnswerSchema: Schema<any, import("mongoose").M
99
102
  type: string;
100
103
  typeOutput: string;
101
104
  formulaToMessage: string;
105
+ message?: string | null | undefined;
102
106
  }, Types.Subdocument<Types.ObjectId, any, {
103
107
  type: string;
104
108
  typeOutput: string;
105
109
  formulaToMessage: string;
110
+ message?: string | null | undefined;
106
111
  }> & {
107
112
  type: string;
108
113
  typeOutput: string;
109
114
  formulaToMessage: string;
115
+ message?: string | null | undefined;
110
116
  }>;
111
117
  requestGraphicData: Types.DocumentArray<{
112
118
  method: string;
@@ -157,14 +163,17 @@ export declare const AnthropometryAnswerSchema: Schema<any, import("mongoose").M
157
163
  type: string;
158
164
  typeOutput: string;
159
165
  formulaToMessage: string;
166
+ message?: string | null | undefined;
160
167
  }, Types.Subdocument<Types.ObjectId, any, {
161
168
  type: string;
162
169
  typeOutput: string;
163
170
  formulaToMessage: string;
171
+ message?: string | null | undefined;
164
172
  }> & {
165
173
  type: string;
166
174
  typeOutput: string;
167
175
  formulaToMessage: string;
176
+ message?: string | null | undefined;
168
177
  }>;
169
178
  requestGraphicData: Types.DocumentArray<{
170
179
  method: string;
@@ -37,6 +37,7 @@ export interface IValidationQuestion {
37
37
  type: TypeValidationEnum;
38
38
  typeOutput: TypeOutputValidationEnum;
39
39
  formulaToMessage: string;
40
+ message?: string;
40
41
  }
41
42
  export interface IRow {
42
43
  id: string;
@@ -49,6 +50,7 @@ export interface IFormUnit extends IDefault {
49
50
  sequence: number;
50
51
  code: string;
51
52
  description: string;
53
+ formulaToDescription: string;
52
54
  example: string;
53
55
  parent: Types.ObjectId | IFormUnit;
54
56
  line: number;
@@ -180,14 +182,17 @@ export declare const ValidationSchema: Schema<any, import("mongoose").Model<any,
180
182
  type: string;
181
183
  typeOutput: string;
182
184
  formulaToMessage: string;
185
+ message?: string | null | undefined;
183
186
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
184
187
  type: string;
185
188
  typeOutput: string;
186
189
  formulaToMessage: string;
190
+ message?: string | null | undefined;
187
191
  }>, {}> & import("mongoose").FlatRecord<{
188
192
  type: string;
189
193
  typeOutput: string;
190
194
  formulaToMessage: string;
195
+ message?: string | null | undefined;
191
196
  }> & {
192
197
  _id: Types.ObjectId;
193
198
  } & {
@@ -242,14 +247,17 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
242
247
  type: string;
243
248
  typeOutput: string;
244
249
  formulaToMessage: string;
250
+ message?: string | null | undefined;
245
251
  }, Types.Subdocument<Types.ObjectId, any, {
246
252
  type: string;
247
253
  typeOutput: string;
248
254
  formulaToMessage: string;
255
+ message?: string | null | undefined;
249
256
  }> & {
250
257
  type: string;
251
258
  typeOutput: string;
252
259
  formulaToMessage: string;
260
+ message?: string | null | undefined;
253
261
  }>;
254
262
  show: boolean;
255
263
  readOnly: boolean;
@@ -295,6 +303,7 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
295
303
  account?: Types.ObjectId | null | undefined;
296
304
  description?: string | null | undefined;
297
305
  reference?: Types.ObjectId | null | undefined;
306
+ formulaToDescription?: string | null | undefined;
298
307
  example?: string | null | undefined;
299
308
  parent?: Types.ObjectId | null | undefined;
300
309
  line?: number | null | undefined;
@@ -389,14 +398,17 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
389
398
  type: string;
390
399
  typeOutput: string;
391
400
  formulaToMessage: string;
401
+ message?: string | null | undefined;
392
402
  }, Types.Subdocument<Types.ObjectId, any, {
393
403
  type: string;
394
404
  typeOutput: string;
395
405
  formulaToMessage: string;
406
+ message?: string | null | undefined;
396
407
  }> & {
397
408
  type: string;
398
409
  typeOutput: string;
399
410
  formulaToMessage: string;
411
+ message?: string | null | undefined;
400
412
  }>;
401
413
  show: boolean;
402
414
  readOnly: boolean;
@@ -442,6 +454,7 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
442
454
  account?: Types.ObjectId | null | undefined;
443
455
  description?: string | null | undefined;
444
456
  reference?: Types.ObjectId | null | undefined;
457
+ formulaToDescription?: string | null | undefined;
445
458
  example?: string | null | undefined;
446
459
  parent?: Types.ObjectId | null | undefined;
447
460
  line?: number | null | undefined;
@@ -536,14 +549,17 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
536
549
  type: string;
537
550
  typeOutput: string;
538
551
  formulaToMessage: string;
552
+ message?: string | null | undefined;
539
553
  }, Types.Subdocument<Types.ObjectId, any, {
540
554
  type: string;
541
555
  typeOutput: string;
542
556
  formulaToMessage: string;
557
+ message?: string | null | undefined;
543
558
  }> & {
544
559
  type: string;
545
560
  typeOutput: string;
546
561
  formulaToMessage: string;
562
+ message?: string | null | undefined;
547
563
  }>;
548
564
  show: boolean;
549
565
  readOnly: boolean;
@@ -589,6 +605,7 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
589
605
  account?: Types.ObjectId | null | undefined;
590
606
  description?: string | null | undefined;
591
607
  reference?: Types.ObjectId | null | undefined;
608
+ formulaToDescription?: string | null | undefined;
592
609
  example?: string | null | undefined;
593
610
  parent?: Types.ObjectId | null | undefined;
594
611
  line?: number | null | undefined;
@@ -27,7 +27,8 @@ exports.ValidationSchema = new mongoose_1.Schema({
27
27
  enum: enum_1.TypeOutputValidationEnum,
28
28
  default: enum_1.TypeOutputValidationEnum.TEXT
29
29
  },
30
- formulaToMessage: { type: String, required: true }
30
+ formulaToMessage: { type: String, required: true },
31
+ message: { type: String }
31
32
  }, { _id: false });
32
33
  exports.FormUnitSchema = new mongoose_1.Schema({
33
34
  //account só é usado quando for montado por uma conta, quando for modelo disponível a todos ele deve estar sem preenchimento
@@ -36,6 +37,7 @@ exports.FormUnitSchema = new mongoose_1.Schema({
36
37
  form: { type: mongoose_1.Schema.Types.ObjectId, ref: "form", required: true },
37
38
  sequence: { type: Number, required: true },
38
39
  code: { type: String, required: true },
40
+ formulaToDescription: { type: String },
39
41
  description: { type: String },
40
42
  example: { type: String },
41
43
  parent: { type: mongoose_1.Schema.Types.ObjectId, ref: "form-unit" },
@@ -43,14 +43,17 @@ export declare const QAAnswerSchema: Schema<any, import("mongoose").Model<any, a
43
43
  type: string;
44
44
  typeOutput: string;
45
45
  formulaToMessage: string;
46
+ message?: string | null | undefined;
46
47
  }, Types.Subdocument<Types.ObjectId, any, {
47
48
  type: string;
48
49
  typeOutput: string;
49
50
  formulaToMessage: string;
51
+ message?: string | null | undefined;
50
52
  }> & {
51
53
  type: string;
52
54
  typeOutput: string;
53
55
  formulaToMessage: string;
56
+ message?: string | null | undefined;
54
57
  }>;
55
58
  requestGraphicData: Types.DocumentArray<{
56
59
  method: string;
@@ -110,14 +113,17 @@ export declare const QAAnswerSchema: Schema<any, import("mongoose").Model<any, a
110
113
  type: string;
111
114
  typeOutput: string;
112
115
  formulaToMessage: string;
116
+ message?: string | null | undefined;
113
117
  }, Types.Subdocument<Types.ObjectId, any, {
114
118
  type: string;
115
119
  typeOutput: string;
116
120
  formulaToMessage: string;
121
+ message?: string | null | undefined;
117
122
  }> & {
118
123
  type: string;
119
124
  typeOutput: string;
120
125
  formulaToMessage: string;
126
+ message?: string | null | undefined;
121
127
  }>;
122
128
  requestGraphicData: Types.DocumentArray<{
123
129
  method: string;
@@ -177,14 +183,17 @@ export declare const QAAnswerSchema: Schema<any, import("mongoose").Model<any, a
177
183
  type: string;
178
184
  typeOutput: string;
179
185
  formulaToMessage: string;
186
+ message?: string | null | undefined;
180
187
  }, Types.Subdocument<Types.ObjectId, any, {
181
188
  type: string;
182
189
  typeOutput: string;
183
190
  formulaToMessage: string;
191
+ message?: string | null | undefined;
184
192
  }> & {
185
193
  type: string;
186
194
  typeOutput: string;
187
195
  formulaToMessage: string;
196
+ message?: string | null | undefined;
188
197
  }>;
189
198
  requestGraphicData: Types.DocumentArray<{
190
199
  method: string;
@@ -32,14 +32,17 @@ export declare const QPCAnswerSchema: Schema<any, import("mongoose").Model<any,
32
32
  type: string;
33
33
  typeOutput: string;
34
34
  formulaToMessage: string;
35
+ message?: string | null | undefined;
35
36
  }, Types.Subdocument<Types.ObjectId, any, {
36
37
  type: string;
37
38
  typeOutput: string;
38
39
  formulaToMessage: string;
40
+ message?: string | null | undefined;
39
41
  }> & {
40
42
  type: string;
41
43
  typeOutput: string;
42
44
  formulaToMessage: string;
45
+ message?: string | null | undefined;
43
46
  }>;
44
47
  requestGraphicData: Types.DocumentArray<{
45
48
  method: string;
@@ -90,14 +93,17 @@ export declare const QPCAnswerSchema: Schema<any, import("mongoose").Model<any,
90
93
  type: string;
91
94
  typeOutput: string;
92
95
  formulaToMessage: string;
96
+ message?: string | null | undefined;
93
97
  }, Types.Subdocument<Types.ObjectId, any, {
94
98
  type: string;
95
99
  typeOutput: string;
96
100
  formulaToMessage: string;
101
+ message?: string | null | undefined;
97
102
  }> & {
98
103
  type: string;
99
104
  typeOutput: string;
100
105
  formulaToMessage: string;
106
+ message?: string | null | undefined;
101
107
  }>;
102
108
  requestGraphicData: Types.DocumentArray<{
103
109
  method: string;
@@ -148,14 +154,17 @@ export declare const QPCAnswerSchema: Schema<any, import("mongoose").Model<any,
148
154
  type: string;
149
155
  typeOutput: string;
150
156
  formulaToMessage: string;
157
+ message?: string | null | undefined;
151
158
  }, Types.Subdocument<Types.ObjectId, any, {
152
159
  type: string;
153
160
  typeOutput: string;
154
161
  formulaToMessage: string;
162
+ message?: string | null | undefined;
155
163
  }> & {
156
164
  type: string;
157
165
  typeOutput: string;
158
166
  formulaToMessage: string;
167
+ message?: string | null | undefined;
159
168
  }>;
160
169
  requestGraphicData: Types.DocumentArray<{
161
170
  method: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-clinical",
3
- "version": "1.0.121",
3
+ "version": "1.0.123",
4
4
  "description": "Biblioteca Typescript para API NodeJS",
5
5
  "repository": "https://github.com/cabralsilva/c2-clinical.git",
6
6
  "author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>",