openchs-models 1.31.63 → 1.31.65
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.
|
@@ -115,7 +115,7 @@ class IdentifierAssignment extends _BaseEntity.default {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
static fromResource(identifierAssignmentResource, entityService) {
|
|
118
|
-
const identifierAssignment = _General.default.assignFields(identifierAssignmentResource, new IdentifierAssignment(), ["uuid", "identifier", "assignmentOrder", "voided"]);
|
|
118
|
+
const identifierAssignment = _General.default.assignFields(identifierAssignmentResource, new IdentifierAssignment(), ["uuid", "identifier", "assignmentOrder", "voided", "used"]);
|
|
119
119
|
|
|
120
120
|
identifierAssignment.identifierSource = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(identifierAssignmentResource, "identifierSourceUUID"), _IdentifierSource.default.schema.name);
|
|
121
121
|
identifierAssignment.individual = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(identifierAssignmentResource, "individualUUID"), _Individual.default.schema.name);
|
|
@@ -125,7 +125,7 @@ class IdentifierAssignment extends _BaseEntity.default {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
get toResource() {
|
|
128
|
-
const resource = _lodash.default.pick(this, ["uuid", "identifier", "assignmentOrder", "voided"]);
|
|
128
|
+
const resource = _lodash.default.pick(this, ["uuid", "identifier", "assignmentOrder", "voided", "used"]);
|
|
129
129
|
|
|
130
130
|
resource.individualUUID = this.individual ? this.individual.uuid : null;
|
|
131
131
|
resource.programEnrolmentUUID = this.programEnrolment ? this.programEnrolment.uuid : null;
|
package/dist/application/Form.js
CHANGED
|
@@ -227,32 +227,6 @@ class Form extends _BaseEntity.default {
|
|
|
227
227
|
|
|
228
228
|
const extraObs = observations.filter(obs => _lodash.default.isNil(orderedObservations.find(oobs => oobs.concept.uuid === obs.concept.uuid)));
|
|
229
229
|
return orderedObservations.concat(extraObs);
|
|
230
|
-
} //TODO add tests
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
orderObservationsPerFEG(observations) {
|
|
234
|
-
const orderedObservations = [];
|
|
235
|
-
|
|
236
|
-
const formElementOrdering = _lodash.default.sortBy(this.formElementGroups, feg => feg.displayOrder).map(feg => {
|
|
237
|
-
let fegOrderedObservations = [];
|
|
238
|
-
const returnValue = {};
|
|
239
|
-
returnValue.uuid = feg.uuid;
|
|
240
|
-
returnValue.feg = feg;
|
|
241
|
-
returnValue.sortedObservationsArray = fegOrderedObservations;
|
|
242
|
-
this.orderObservationsWithinAFEG(feg.getFormElements(), observations, fegOrderedObservations);
|
|
243
|
-
orderedObservations.concat(fegOrderedObservations);
|
|
244
|
-
return returnValue;
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
return formElementOrdering;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
orderObservationsWithinAFEG(formElements, observations, orderedObservations) {
|
|
251
|
-
_lodash.default.sortBy(formElements, fe => fe.displayOrder).forEach(formElement => this.addSortedObservations(formElement, observations, orderedObservations));
|
|
252
|
-
|
|
253
|
-
const extraObs = observations.filter(obs => _lodash.default.isNil(orderedObservations.find(oobs => oobs.concept.uuid === obs.concept.uuid)));
|
|
254
|
-
orderedObservations.concat(extraObs);
|
|
255
|
-
return extraObs;
|
|
256
230
|
}
|
|
257
231
|
|
|
258
232
|
sectionWiseOrderedObservations(observations) {
|
|
@@ -31,8 +31,6 @@ var _BaseEntity = _interopRequireDefault(require("../BaseEntity"));
|
|
|
31
31
|
|
|
32
32
|
var _SchemaNames = _interopRequireDefault(require("../SchemaNames"));
|
|
33
33
|
|
|
34
|
-
var _RepeatableQuestionGroup = _interopRequireDefault(require("../observation/RepeatableQuestionGroup"));
|
|
35
|
-
|
|
36
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
35
|
|
|
38
36
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -151,18 +149,8 @@ class FormElement extends _BaseEntity.default {
|
|
|
151
149
|
return formElement;
|
|
152
150
|
}
|
|
153
151
|
|
|
154
|
-
newFormElement() {
|
|
155
|
-
return new FormElement();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
152
|
getType() {
|
|
159
|
-
|
|
160
|
-
return this.type;
|
|
161
|
-
} else if (this.concept.datatype === _Concept.default.dataType.QuestionGroup && this.repeatable) {
|
|
162
|
-
return _RepeatableQuestionGroup.default.TypeName;
|
|
163
|
-
} else {
|
|
164
|
-
return this.concept.datatype;
|
|
165
|
-
}
|
|
153
|
+
return this.concept.datatype === _Concept.default.dataType.Coded ? this.type : this.concept.datatype;
|
|
166
154
|
}
|
|
167
155
|
|
|
168
156
|
isMultiSelect() {
|
|
@@ -398,12 +386,8 @@ class FormElement extends _BaseEntity.default {
|
|
|
398
386
|
return _lodash.default.find(this.formElementGroup.getFormElements(), fe => fe.uuid === this.groupUuid);
|
|
399
387
|
}
|
|
400
388
|
|
|
401
|
-
isRepeatableQuestionGroup() {
|
|
402
|
-
return this.concept.isQuestionGroup() && this.repeatable;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
389
|
clone() {
|
|
406
|
-
const formElement =
|
|
390
|
+
const formElement = new FormElement();
|
|
407
391
|
formElement.uuid = this.uuid;
|
|
408
392
|
formElement.name = this.name;
|
|
409
393
|
formElement.displayOrder = this.displayOrder;
|
package/dist/index.js
CHANGED
|
@@ -783,12 +783,6 @@ Object.defineProperty(exports, "DashboardCacheFilter", {
|
|
|
783
783
|
return _DashboardCacheFilter.default;
|
|
784
784
|
}
|
|
785
785
|
});
|
|
786
|
-
Object.defineProperty(exports, "JSONStringify", {
|
|
787
|
-
enumerable: true,
|
|
788
|
-
get: function () {
|
|
789
|
-
return _JsonStringify.JSONStringify;
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
786
|
|
|
793
787
|
var _AbstractEncounter = _interopRequireDefault(require("./AbstractEncounter"));
|
|
794
788
|
|
|
@@ -1040,8 +1034,6 @@ var _AgeUtil = _interopRequireDefault(require("./utility/AgeUtil"));
|
|
|
1040
1034
|
|
|
1041
1035
|
var _DashboardCacheFilter = _interopRequireDefault(require("./application/DashboardCacheFilter"));
|
|
1042
1036
|
|
|
1043
|
-
var _JsonStringify = require("./utility/JsonStringify");
|
|
1044
|
-
|
|
1045
1037
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
1046
1038
|
|
|
1047
1039
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
package/package.json
CHANGED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.JSONStringify = void 0;
|
|
7
|
-
|
|
8
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
//initial code from : https://javascript.plainenglish.io/create-your-own-implementation-of-json-stringify-simiplied-version-8ab6746cdd1
|
|
13
|
-
const isArray = function (value) {
|
|
14
|
-
return Array.isArray(value) && typeof value === 'object';
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const isObject = function (value) {
|
|
18
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const isString = function (value) {
|
|
22
|
-
return typeof value === 'string';
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const isBoolean = function (value) {
|
|
26
|
-
return typeof value === 'boolean';
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const isNumber = function (value) {
|
|
30
|
-
return typeof value === 'number';
|
|
31
|
-
}; // Common check for number, string and boolean value
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const restOfDataTypes = function (value) {
|
|
35
|
-
return isNumber(value) || isString(value) || isBoolean(value);
|
|
36
|
-
}; // This function will be used to remove extra comma from the arrays and object
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const removeComma = function (str) {
|
|
40
|
-
const tempArr = str.split('');
|
|
41
|
-
tempArr.pop();
|
|
42
|
-
return tempArr.join('');
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const duckCheckNativeRealmCollection = function (obj) {
|
|
46
|
-
return typeof obj === "object" && !_lodash.default.isNil(_lodash.default.get(obj, "removeAllListeners")) && !_lodash.default.isNil(_lodash.default.get(obj, "snapshot"));
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
function duckCheckForError(obj) {
|
|
50
|
-
return obj.stack && obj.message;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const JSONStringifyInternal = function (obj, depth, objectMap, arrayWidth, objectKey) {
|
|
54
|
-
if (depth === 0) return "BELOW_DEPTH"; // Boolean and Number behave in a same way and String we need to add extra quotes
|
|
55
|
-
|
|
56
|
-
if (restOfDataTypes(obj)) {
|
|
57
|
-
const passQuotes = isString(obj) ? `"` : '';
|
|
58
|
-
return `${passQuotes}${obj}${passQuotes}`;
|
|
59
|
-
} // Recursive function call for Arrays to handle nested arrays
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (isArray(obj)) {
|
|
63
|
-
let arrStr = '';
|
|
64
|
-
obj.forEach((eachValue, index) => {
|
|
65
|
-
if (index === arrayWidth) arrStr += "....";
|
|
66
|
-
if (index >= arrayWidth) return;
|
|
67
|
-
arrStr += JSONStringifyInternal(eachValue, depth - 1, objectMap, arrayWidth);
|
|
68
|
-
arrStr += ',';
|
|
69
|
-
});
|
|
70
|
-
return `[` + removeComma(arrStr) + `]`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (duckCheckNativeRealmCollection(obj, objectKey)) {
|
|
74
|
-
return "<realm-collection>";
|
|
75
|
-
} // Recursive function call for Object to handle nested Object
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (isObject(obj) && _lodash.default.isNil(objectMap.get(obj))) {
|
|
79
|
-
objectMap.set(obj, true);
|
|
80
|
-
let objStr = '';
|
|
81
|
-
const objKeys = Object.keys(obj);
|
|
82
|
-
objKeys.forEach(eachKey => {
|
|
83
|
-
const eachValue = obj[eachKey];
|
|
84
|
-
objStr += `"${eachKey}":${JSONStringifyInternal(eachValue, depth - 1, objectMap, arrayWidth, eachKey)},`;
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
if (duckCheckForError(obj)) {
|
|
88
|
-
objStr += `message:${obj.message},`;
|
|
89
|
-
objStr += `stack:${obj.stack},`;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return `{` + removeComma(objStr) + `}`;
|
|
93
|
-
} else if (!_lodash.default.isNil(objectMap.get(obj))) {
|
|
94
|
-
return "<object_repeated>";
|
|
95
|
-
} else {
|
|
96
|
-
return obj;
|
|
97
|
-
}
|
|
98
|
-
}; // This class is not meant for production purposes, it is to be used for developer assistance like logging.
|
|
99
|
-
// It supports recursive object structure, native realm collection, restricting array width (number of elements that can be stringified), and object tree depth
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const JSONStringify = function (obj, objectTreeDepth = 3, arrayWidth = 4) {
|
|
103
|
-
const objectMap = new Map();
|
|
104
|
-
return JSONStringifyInternal(obj, objectTreeDepth, objectMap, arrayWidth);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
exports.JSONStringify = JSONStringify;
|