c2-clinical 1.0.120 → 1.0.122

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.
@@ -5,18 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const OnAnswerQuestionsFlowTester_1 = __importDefault(require("../flow/on-answer/OnAnswerQuestionsFlowTester"));
7
7
  const answerExample = {
8
- _id: "689e395a23b914800683aa78",
8
+ _id: "68a4ce0e2e90c3294e993538",
9
9
  form: "689e029db13c27189bce136d",
10
- sequence: 4,
11
- code: "HEIGHT_IN_CM",
12
- description: "Altura",
13
- parent: "689e37a223b914800683aa68",
14
- line: 3,
15
- column: 2,
10
+ sequence: 17,
11
+ code: "ESTIMATE_HEIGHT",
12
+ description: "Altura estimada",
13
+ parent: "68a4b4a82e90c3294e99350b",
14
+ line: 15,
15
+ column: 1,
16
16
  type: "QUESTION",
17
17
  typeAnswer: "OPEN_NUMBER",
18
18
  category: "ANTHROPOMETRY",
19
- measurementUnit: "cm",
19
+ formulaToAnswer: "'${FORMULA_ESTIMATE_HEIGHT}' === 'CHUMLEA' ? ((2.02 * Number('${CHUMLEA_TO_HEIGHT_KNEE_HEIGHT}')) - (0.04 * Number('${PATIENT_AGE_IN_YEARS}')) + 64.19) : 0",
20
20
  formulaToEnable: "true",
21
21
  active: true,
22
22
  show: true,
@@ -25,10 +25,10 @@ const answerExample = {
25
25
  options: [],
26
26
  validations: [],
27
27
  requestGraphicData: [],
28
- createdAtDateTime: "2025-08-14T19:30:35.000Z",
29
- updatedAtDateTime: "2025-08-14T19:30:35.000Z",
28
+ createdAtDateTime: "2025-08-19T19:18:38.430Z",
29
+ updatedAtDateTime: "2025-08-19T19:18:38.430Z",
30
30
  __v: 0,
31
- answer: "180"
31
+ answer: 172
32
32
  };
33
33
  const lines = [
34
34
  {
@@ -147,7 +147,6 @@ const lines = [
147
147
  collumns: [
148
148
  {
149
149
  _id: "689e390023b914800683aa70",
150
- answer: "80",
151
150
  form: "689e029db13c27189bce136d",
152
151
  sequence: 3,
153
152
  code: "CURRENT_WEIGHT",
@@ -191,7 +190,13 @@ const lines = [
191
190
  readOnly: false,
192
191
  required: false,
193
192
  options: [],
194
- validations: [],
193
+ validations: [
194
+ {
195
+ type: "WARNING",
196
+ typeOutput: "TEXT",
197
+ formulaToMessage: "Number('${ESTIMATE_HEIGHT}') > 0 ? 'Altura estimada' : ''"
198
+ }
199
+ ],
195
200
  requestGraphicData: [],
196
201
  createdAtDateTime: "2025-08-14T19:30:35.000Z",
197
202
  updatedAtDateTime: "2025-08-14T19:30:35.000Z",
@@ -506,6 +511,7 @@ const lines = [
506
511
  type: "QUESTION",
507
512
  typeAnswer: "OPEN_NUMBER",
508
513
  category: "ANTHROPOMETRY",
514
+ answer: 172,
509
515
  formulaToAnswer: "'${FORMULA_ESTIMATE_HEIGHT}' === 'CHUMLEA' ? ((2.02 * Number('${CHUMLEA_TO_HEIGHT_KNEE_HEIGHT}')) - (0.04 * Number('${PATIENT_AGE_IN_YEARS}')) + 64.19) : 0",
510
516
  formulaToEnable: "true",
511
517
  active: true,
@@ -517,8 +523,7 @@ const lines = [
517
523
  requestGraphicData: [],
518
524
  createdAtDateTime: "2025-08-19T19:18:38.430Z",
519
525
  updatedAtDateTime: "2025-08-19T19:18:38.430Z",
520
- __v: 0,
521
- answer: 0
526
+ __v: 0
522
527
  }
523
528
  ]
524
529
  }
@@ -16,7 +16,7 @@ class BuildTreeFlowItem {
16
16
  const lines = config.children.reduce((acc, item) => {
17
17
  if (!acc.some((a) => a.line === item.line)) {
18
18
  acc.push({
19
- id: GenerateUUIDFlowItem_1.default.execute(),
19
+ id: item.lineId ?? GenerateUUIDFlowItem_1.default.execute(),
20
20
  line: item.line,
21
21
  collumns: []
22
22
  });
@@ -22,14 +22,22 @@ class ProcessAnswerFlowTester {
22
22
  if (relationed?.formulaToReferenceValue) {
23
23
  relationed.referenceValue = ExecFormulaFlowTester_1.default.execute(relationed.formulaToReferenceValue, allQuestionsAnswereds, attendanceMetActivities);
24
24
  }
25
- // formulaToClassificationLabel: string;
25
+ // formulaToClassificationLabel
26
26
  if (relationed?.formulaToClassificationLabel) {
27
27
  relationed.classificationLabel = ExecFormulaFlowTester_1.default.execute(relationed.formulaToClassificationLabel, allQuestionsAnswereds, attendanceMetActivities);
28
28
  }
29
- // formulaToClassificationColor: string;
29
+ // formulaToClassificationColor
30
30
  if (relationed?.formulaToClassificationColor) {
31
31
  relationed.classificationColor = ExecFormulaFlowTester_1.default.execute(relationed.formulaToClassificationColor, allQuestionsAnswereds, attendanceMetActivities);
32
32
  }
33
+ // formulaToMessage para validations
34
+ if (relationed?.validations?.length) {
35
+ relationed.validations
36
+ .filter((v) => v.formulaToMessage)
37
+ .forEach((v) => {
38
+ v.message = ExecFormulaFlowTester_1.default.execute(v.formulaToMessage, allQuestionsAnswereds, attendanceMetActivities);
39
+ });
40
+ }
33
41
  // check options is enables
34
42
  if (relationed?.options?.length) {
35
43
  relationed.options
@@ -11,7 +11,7 @@ class ConvertRowToFormUnitsFlowItem {
11
11
  iterate(row) {
12
12
  let formUnits = [];
13
13
  row.collumns?.forEach((collumn) => {
14
- formUnits.push({ ...collumn, lines: undefined });
14
+ formUnits.push({ ...collumn, lineId: row.id });
15
15
  if (collumn.lines?.length) {
16
16
  collumn.lines.forEach((line) => {
17
17
  formUnits = [...formUnits, ...this.iterate(line)];
@@ -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;
@@ -95,6 +96,7 @@ export interface IFormUnit extends IDefault {
95
96
  }[];
96
97
  };
97
98
  isAnalyticalResult: boolean;
99
+ lineId?: string;
98
100
  }
99
101
  export interface IQuestionOption {
100
102
  sequence: number;
@@ -179,14 +181,17 @@ export declare const ValidationSchema: Schema<any, import("mongoose").Model<any,
179
181
  type: string;
180
182
  typeOutput: string;
181
183
  formulaToMessage: string;
184
+ message?: string | null | undefined;
182
185
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
183
186
  type: string;
184
187
  typeOutput: string;
185
188
  formulaToMessage: string;
189
+ message?: string | null | undefined;
186
190
  }>, {}> & import("mongoose").FlatRecord<{
187
191
  type: string;
188
192
  typeOutput: string;
189
193
  formulaToMessage: string;
194
+ message?: string | null | undefined;
190
195
  }> & {
191
196
  _id: Types.ObjectId;
192
197
  } & {
@@ -241,14 +246,17 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
241
246
  type: string;
242
247
  typeOutput: string;
243
248
  formulaToMessage: string;
249
+ message?: string | null | undefined;
244
250
  }, Types.Subdocument<Types.ObjectId, any, {
245
251
  type: string;
246
252
  typeOutput: string;
247
253
  formulaToMessage: string;
254
+ message?: string | null | undefined;
248
255
  }> & {
249
256
  type: string;
250
257
  typeOutput: string;
251
258
  formulaToMessage: string;
259
+ message?: string | null | undefined;
252
260
  }>;
253
261
  show: boolean;
254
262
  readOnly: boolean;
@@ -388,14 +396,17 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
388
396
  type: string;
389
397
  typeOutput: string;
390
398
  formulaToMessage: string;
399
+ message?: string | null | undefined;
391
400
  }, Types.Subdocument<Types.ObjectId, any, {
392
401
  type: string;
393
402
  typeOutput: string;
394
403
  formulaToMessage: string;
404
+ message?: string | null | undefined;
395
405
  }> & {
396
406
  type: string;
397
407
  typeOutput: string;
398
408
  formulaToMessage: string;
409
+ message?: string | null | undefined;
399
410
  }>;
400
411
  show: boolean;
401
412
  readOnly: boolean;
@@ -535,14 +546,17 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
535
546
  type: string;
536
547
  typeOutput: string;
537
548
  formulaToMessage: string;
549
+ message?: string | null | undefined;
538
550
  }, Types.Subdocument<Types.ObjectId, any, {
539
551
  type: string;
540
552
  typeOutput: string;
541
553
  formulaToMessage: string;
554
+ message?: string | null | undefined;
542
555
  }> & {
543
556
  type: string;
544
557
  typeOutput: string;
545
558
  formulaToMessage: string;
559
+ message?: string | null | undefined;
546
560
  }>;
547
561
  show: boolean;
548
562
  readOnly: boolean;
@@ -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
@@ -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.120",
3
+ "version": "1.0.122",
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>",