c2-clinical 1.0.107 → 1.0.111
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/dist/flow/group/item/BuildTreeFlowItem.d.ts +1 -1
- package/dist/flow/group/item/BuildTreeFlowItem.js +10 -52
- package/dist/flow/on-answer/ProcessAnswerFlowTester.d.ts +4 -3
- package/dist/flow/on-answer/ProcessAnswerFlowTester.js +7 -2
- package/dist/flow/on-answer/item/ConvertRowToFormUnitsFlowItem.d.ts +8 -0
- package/dist/flow/on-answer/item/ConvertRowToFormUnitsFlowItem.js +24 -0
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@ class BuildTreeFlowItem {
|
|
|
22
22
|
// });
|
|
23
23
|
// return rootFormUnit;
|
|
24
24
|
const rootFormUnit = questions.filter((q) => !q.parent);
|
|
25
|
-
return this.
|
|
25
|
+
return this.buildRows({ parent: undefined, children: rootFormUnit });
|
|
26
26
|
}
|
|
27
27
|
iterate(parent, children) {
|
|
28
28
|
parent.children = children.filter((child) => child.parent?._id?.toString() === parent?._id?.toString());
|
|
@@ -47,34 +47,15 @@ class BuildTreeFlowItem {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
iterate2(config) {
|
|
50
|
+
// private iterate2(config: { parent?: IFormUnit; children: IFormUnit[] }): IRow[] {
|
|
51
|
+
// config.children.sort((a, b) => a.line - b.line);
|
|
52
|
+
// if (!config.parent) {
|
|
53
|
+
// return this.buildRows(config);
|
|
54
|
+
// }
|
|
55
|
+
// return this.buildRows(config);
|
|
56
|
+
// }
|
|
57
|
+
buildRows(config) {
|
|
51
58
|
config.children.sort((a, b) => a.line - b.line);
|
|
52
|
-
if (!config.parent) {
|
|
53
|
-
const lines = config.children.reduce((acc, item) => {
|
|
54
|
-
if (!acc.some((a) => a.line === item.line)) {
|
|
55
|
-
acc.push({
|
|
56
|
-
id: (0, node_crypto_1.randomUUID)(),
|
|
57
|
-
line: item.line,
|
|
58
|
-
collumns: []
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
acc.find((a) => a.line === item.line)?.collumns.push(item);
|
|
62
|
-
return acc;
|
|
63
|
-
}, []);
|
|
64
|
-
lines?.forEach((line, index) => {
|
|
65
|
-
line.collumns?.sort((a, b) => a.column - b.column);
|
|
66
|
-
line.collumns?.forEach((collumn) => {
|
|
67
|
-
const newChildren = this.bank.filter((child) => child.parent?._id?.toString() === collumn?._id?.toString());
|
|
68
|
-
if (newChildren?.length) {
|
|
69
|
-
collumn.lines = this.iterate2({ parent: collumn, children: newChildren });
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
return lines;
|
|
74
|
-
}
|
|
75
|
-
// const siblings = children.filter(
|
|
76
|
-
// (child: IFormUnit) => child.parent?._id?.toString() === parent?._id?.toString()
|
|
77
|
-
// );
|
|
78
59
|
const lines = config.children.reduce((acc, item) => {
|
|
79
60
|
if (!acc.some((a) => a.line === item.line)) {
|
|
80
61
|
acc.push({
|
|
@@ -91,34 +72,11 @@ class BuildTreeFlowItem {
|
|
|
91
72
|
line.collumns?.forEach((collumn) => {
|
|
92
73
|
const newChildren = this.bank.filter((child) => child.parent?._id?.toString() === collumn?._id?.toString());
|
|
93
74
|
if (newChildren?.length) {
|
|
94
|
-
collumn.lines = this.
|
|
75
|
+
collumn.lines = this.buildRows({ parent: collumn, children: newChildren });
|
|
95
76
|
}
|
|
96
77
|
});
|
|
97
78
|
});
|
|
98
79
|
return lines;
|
|
99
|
-
// parent.children = children.filter(
|
|
100
|
-
// (child: IFormUnit) => child.parent?._id?.toString() === parent?._id?.toString()
|
|
101
|
-
// );
|
|
102
|
-
// parent.children.sort((a, b) => a.line - b.line);
|
|
103
|
-
// const lines: IRow[] = parent.children.reduce((acc: IRow[], item) => {
|
|
104
|
-
// if (!acc.some((a: IRow) => a.line === item.line)) {
|
|
105
|
-
// acc.push({
|
|
106
|
-
// id: randomUUID(),
|
|
107
|
-
// line: item.line,
|
|
108
|
-
// collumns: []
|
|
109
|
-
// });
|
|
110
|
-
// }
|
|
111
|
-
// acc.find((a: IRow) => a.line === item.line)?.collumns.push(item);
|
|
112
|
-
// return acc;
|
|
113
|
-
// }, []);
|
|
114
|
-
// parent.lines?.forEach((line: IRow, index: number) => {
|
|
115
|
-
// line.collumns?.sort((a, b) => a.column - b.column);
|
|
116
|
-
// });
|
|
117
|
-
// if (parent.children.length > 0) {
|
|
118
|
-
// parent.children.forEach((parentPossible: IFormUnit) => {
|
|
119
|
-
// this.iterate(parentPossible, children);
|
|
120
|
-
// });
|
|
121
|
-
// }
|
|
122
80
|
}
|
|
123
81
|
}
|
|
124
82
|
exports.default = new BuildTreeFlowItem();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { IFormUnit } from "../../models/form/FormUnit";
|
|
1
|
+
import { IFormUnit, IRow } from "../../models/form/FormUnit";
|
|
2
2
|
import { IMetActivityPatient } from "../../models/met-activity/MetActivityPatient";
|
|
3
|
-
declare class
|
|
3
|
+
declare class ProcessAnswerFlowTester {
|
|
4
|
+
executeByRows(questionAnswered: IFormUnit, rows: IRow[], attendanceMetActivities: IMetActivityPatient[]): IFormUnit[];
|
|
4
5
|
execute(questionAnswered: IFormUnit, bankAnswer: IFormUnit[], attendanceMetActivities: IMetActivityPatient[]): IFormUnit[];
|
|
5
6
|
}
|
|
6
|
-
declare const _default:
|
|
7
|
+
declare const _default: ProcessAnswerFlowTester;
|
|
7
8
|
export default _default;
|
|
@@ -4,8 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const ExecFormulaFlowTester_1 = __importDefault(require("./ExecFormulaFlowTester"));
|
|
7
|
+
const ConvertRowToFormUnitsFlowItem_1 = __importDefault(require("./item/ConvertRowToFormUnitsFlowItem"));
|
|
7
8
|
const GetAnswerRelationedsFlowItemTester_1 = __importDefault(require("./item/GetAnswerRelationedsFlowItemTester"));
|
|
8
|
-
class
|
|
9
|
+
class ProcessAnswerFlowTester {
|
|
10
|
+
executeByRows(questionAnswered, rows, attendanceMetActivities) {
|
|
11
|
+
const bankAnswer = ConvertRowToFormUnitsFlowItem_1.default.execute(rows);
|
|
12
|
+
return this.execute(questionAnswered, bankAnswer, attendanceMetActivities);
|
|
13
|
+
}
|
|
9
14
|
execute(questionAnswered, bankAnswer, attendanceMetActivities) {
|
|
10
15
|
const answerRelacioneds = GetAnswerRelationedsFlowItemTester_1.default.execute(questionAnswered, bankAnswer);
|
|
11
16
|
const autoAnswereds = [];
|
|
@@ -50,4 +55,4 @@ class ProcessAnswerFlow {
|
|
|
50
55
|
return questionsRelacionedsAnsweredsRet;
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
|
-
exports.default = new
|
|
58
|
+
exports.default = new ProcessAnswerFlowTester();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IFormUnit, IRow } from "../../../models/form/FormUnit";
|
|
2
|
+
declare class ConvertRowToFormUnitsFlowItem {
|
|
3
|
+
private formUnits;
|
|
4
|
+
execute(rows: IRow[]): IFormUnit[];
|
|
5
|
+
private iterate;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: ConvertRowToFormUnitsFlowItem;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class ConvertRowToFormUnitsFlowItem {
|
|
4
|
+
formUnits = [];
|
|
5
|
+
execute(rows) {
|
|
6
|
+
for (const row of rows) {
|
|
7
|
+
this.formUnits = [...this.formUnits, ...this.iterate(row)];
|
|
8
|
+
}
|
|
9
|
+
return this.formUnits;
|
|
10
|
+
}
|
|
11
|
+
iterate(row) {
|
|
12
|
+
let formUnits = [];
|
|
13
|
+
row.collumns?.forEach((collumn) => {
|
|
14
|
+
formUnits.push({ ...collumn, lines: undefined });
|
|
15
|
+
if (collumn.lines?.length) {
|
|
16
|
+
collumn.lines.forEach((line) => {
|
|
17
|
+
formUnits = [...formUnits, ...this.iterate(line)];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return formUnits;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = new ConvertRowToFormUnitsFlowItem();
|
package/package.json
CHANGED