openchs-models 1.31.35 → 1.31.36
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/.circleci/config.yml +1 -0
- package/.editorconfig +1 -1
- package/Makefile +4 -0
- package/dist/AbstractEncounter.js +53 -0
- package/dist/AddressLevel.js +1 -1
- package/dist/Checklist.js +41 -2
- package/dist/ChecklistItem.js +43 -5
- package/dist/ChecklistItemDetail.js +1 -1
- package/dist/ChecklistItemStatus.js +3 -2
- package/dist/Comment.js +41 -2
- package/dist/Concept.js +9 -13
- package/dist/DashboardCache.js +21 -37
- package/dist/Encounter.js +22 -10
- package/dist/EntityApprovalStatus.js +41 -2
- package/dist/EntityMetaData.js +5 -1
- package/dist/Family.js +2 -2
- package/dist/GroupSubject.js +41 -2
- package/dist/IdentifierAssignment.js +41 -2
- package/dist/Individual.js +44 -6
- package/dist/Observation.js +8 -3
- package/dist/ObservationsHolder.js +42 -76
- package/dist/ProgramEncounter.js +22 -8
- package/dist/ProgramEnrolment.js +46 -8
- package/dist/ReportCard.js +63 -6
- package/dist/Schema.js +173 -6
- package/dist/SchemaNames.js +12 -4
- package/dist/SubjectMigration.js +41 -2
- package/dist/SubjectType.js +5 -3
- package/dist/UserInfo.js +13 -0
- package/dist/application/DashboardCacheFilter.js +80 -0
- package/dist/application/FormElement.js +4 -6
- package/dist/application/Format.js +1 -0
- package/dist/application/KeyValue.js +2 -1
- package/dist/application/StringKeyNumericValue.js +1 -0
- package/dist/assignment/UserSubjectAssignment.js +41 -2
- package/dist/draft/DraftEncounter.js +6 -6
- package/dist/draft/DraftSubject.js +2 -2
- package/dist/framework/RealmProxy.js +9 -1
- package/dist/framework/RealmResultsProxy.js +8 -0
- package/dist/geo/Point.js +2 -1
- package/dist/index.js +9 -23
- package/dist/program/SubjectProgramEligibility.js +42 -3
- package/dist/relationship/IndividualRelationship.js +42 -7
- package/dist/service/MetaDataService.js +80 -5
- package/dist/task/Task.js +43 -4
- package/dist/task/TaskUnAssignment.js +41 -2
- package/dist/utility/AuditUtil.js +39 -0
- package/dist/utility/ResourceUtil.js +4 -0
- package/package.json +1 -1
- package/dist/VisitScheduleConfig.js +0 -73
- package/dist/VisitScheduleInterval.js +0 -71
|
@@ -17,8 +17,14 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
17
17
|
|
|
18
18
|
var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
|
|
19
19
|
|
|
20
|
+
var _AuditUtil = require("./utility/AuditUtil");
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
24
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
+
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
|
+
|
|
22
28
|
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; }
|
|
23
29
|
|
|
24
30
|
function getMatchingApprovalStatusEntities(entities, approvalStatus_status) {
|
|
@@ -102,6 +108,38 @@ class EntityApprovalStatus extends _BaseEntity.default {
|
|
|
102
108
|
this.that.autoApproved = x;
|
|
103
109
|
}
|
|
104
110
|
|
|
111
|
+
get createdBy() {
|
|
112
|
+
return this.that.createdBy;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
set createdBy(x) {
|
|
116
|
+
this.that.createdBy = x;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get lastModifiedBy() {
|
|
120
|
+
return this.that.lastModifiedBy;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
set lastModifiedBy(x) {
|
|
124
|
+
this.that.lastModifiedBy = x;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get createdByUUID() {
|
|
128
|
+
return this.that.createdByUUID;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
set createdByUUID(x) {
|
|
132
|
+
this.that.createdByUUID = x;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
get lastModifiedByUUID() {
|
|
136
|
+
return this.that.lastModifiedByUUID;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
set lastModifiedByUUID(x) {
|
|
140
|
+
this.that.lastModifiedByUUID = x;
|
|
141
|
+
}
|
|
142
|
+
|
|
105
143
|
get toResource() {
|
|
106
144
|
const resource = _lodash.default.pick(this, ["uuid", "entityType", "approvalStatusComment", "autoApproved", "voided"]);
|
|
107
145
|
|
|
@@ -117,6 +155,7 @@ class EntityApprovalStatus extends _BaseEntity.default {
|
|
|
117
155
|
|
|
118
156
|
entityApprovalStatus.approvalStatus = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "approvalStatusUUID"), _ApprovalStatus.default.schema.name);
|
|
119
157
|
entityApprovalStatus.entityUUID = _ResourceUtil.default.getUUIDFor(resource, "entityUUID");
|
|
158
|
+
(0, _AuditUtil.mapAuditFields)(entityApprovalStatus, resource);
|
|
120
159
|
return entityApprovalStatus;
|
|
121
160
|
}
|
|
122
161
|
|
|
@@ -173,7 +212,7 @@ class EntityApprovalStatus extends _BaseEntity.default {
|
|
|
173
212
|
_defineProperty(EntityApprovalStatus, "schema", {
|
|
174
213
|
name: _SchemaNames.default.EntityApprovalStatus,
|
|
175
214
|
primaryKey: "uuid",
|
|
176
|
-
properties: {
|
|
215
|
+
properties: _objectSpread({
|
|
177
216
|
uuid: "string",
|
|
178
217
|
entityUUID: "string",
|
|
179
218
|
approvalStatus: "ApprovalStatus",
|
|
@@ -195,7 +234,7 @@ _defineProperty(EntityApprovalStatus, "schema", {
|
|
|
195
234
|
type: "bool",
|
|
196
235
|
default: false
|
|
197
236
|
}
|
|
198
|
-
}
|
|
237
|
+
}, _AuditUtil.AuditFields)
|
|
199
238
|
});
|
|
200
239
|
|
|
201
240
|
_defineProperty(EntityApprovalStatus, "entityType", {
|
package/dist/EntityMetaData.js
CHANGED
|
@@ -634,7 +634,11 @@ class EntityMetaData {
|
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
static entitiesLoadedFromServer() {
|
|
637
|
-
return _lodash.default.differenceBy(_Schema.default.getInstance().getEntities(), [_Settings.default, _LocaleMapping.default], "schema.name");
|
|
637
|
+
return _lodash.default.differenceBy(_Schema.default.getInstance().getEntities(), [_Settings.default, _LocaleMapping.default].concat(EntityMetaData.embeddedEntities()), "schema.name");
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
static embeddedEntities() {
|
|
641
|
+
return _lodash.default.filter(_Schema.default.getInstance().getEntities(), entity => entity.schema.embedded);
|
|
638
642
|
}
|
|
639
643
|
|
|
640
644
|
static findByName(entityName) {
|
package/dist/Family.js
CHANGED
|
@@ -211,7 +211,7 @@ class Family extends _BaseEntity.default {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
_defineProperty(Family, "schema", {
|
|
214
|
-
name:
|
|
214
|
+
name: _SchemaNames.default.Family,
|
|
215
215
|
primaryKey: "uuid",
|
|
216
216
|
properties: {
|
|
217
217
|
uuid: "string",
|
|
@@ -226,7 +226,7 @@ _defineProperty(Family, "schema", {
|
|
|
226
226
|
},
|
|
227
227
|
observations: {
|
|
228
228
|
type: "list",
|
|
229
|
-
objectType: "
|
|
229
|
+
objectType: "EmbeddedObservation"
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
});
|
package/dist/GroupSubject.js
CHANGED
|
@@ -17,8 +17,14 @@ var _General = _interopRequireDefault(require("./utility/General"));
|
|
|
17
17
|
|
|
18
18
|
var _GroupRole = _interopRequireDefault(require("./GroupRole"));
|
|
19
19
|
|
|
20
|
+
var _AuditUtil = require("./utility/AuditUtil");
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
24
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
25
|
+
|
|
26
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
|
+
|
|
22
28
|
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; }
|
|
23
29
|
|
|
24
30
|
class GroupSubject extends _BaseEntity.default {
|
|
@@ -66,6 +72,38 @@ class GroupSubject extends _BaseEntity.default {
|
|
|
66
72
|
this.that.membershipEndDate = x;
|
|
67
73
|
}
|
|
68
74
|
|
|
75
|
+
get createdBy() {
|
|
76
|
+
return this.that.createdBy;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
set createdBy(x) {
|
|
80
|
+
this.that.createdBy = x;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get lastModifiedBy() {
|
|
84
|
+
return this.that.lastModifiedBy;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
set lastModifiedBy(x) {
|
|
88
|
+
this.that.lastModifiedBy = x;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get createdByUUID() {
|
|
92
|
+
return this.that.createdByUUID;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
set createdByUUID(x) {
|
|
96
|
+
this.that.createdByUUID = x;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
get lastModifiedByUUID() {
|
|
100
|
+
return this.that.lastModifiedByUUID;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
set lastModifiedByUUID(x) {
|
|
104
|
+
this.that.lastModifiedByUUID = x;
|
|
105
|
+
}
|
|
106
|
+
|
|
69
107
|
get toResource() {
|
|
70
108
|
const resource = _lodash.default.pick(this, ["uuid"]);
|
|
71
109
|
|
|
@@ -122,6 +160,7 @@ class GroupSubject extends _BaseEntity.default {
|
|
|
122
160
|
groupSubjectEntity.groupSubject = groupOrHouseholdSubject;
|
|
123
161
|
groupSubjectEntity.memberSubject = memberSubject;
|
|
124
162
|
groupSubjectEntity.groupRole = groupRole;
|
|
163
|
+
(0, _AuditUtil.mapAuditFields)(groupSubjectEntity, resource);
|
|
125
164
|
return groupSubjectEntity;
|
|
126
165
|
}
|
|
127
166
|
|
|
@@ -190,7 +229,7 @@ _defineProperty(GroupSubject, "EXPLICIT_ERROR_CODE_KEY_FOR_MISSING_MEMBER", 'Gro
|
|
|
190
229
|
_defineProperty(GroupSubject, "schema", {
|
|
191
230
|
name: "GroupSubject",
|
|
192
231
|
primaryKey: "uuid",
|
|
193
|
-
properties: {
|
|
232
|
+
properties: _objectSpread({
|
|
194
233
|
uuid: "string",
|
|
195
234
|
groupSubject: "Individual",
|
|
196
235
|
memberSubject: "Individual",
|
|
@@ -204,7 +243,7 @@ _defineProperty(GroupSubject, "schema", {
|
|
|
204
243
|
type: "bool",
|
|
205
244
|
default: false
|
|
206
245
|
}
|
|
207
|
-
}
|
|
246
|
+
}, _AuditUtil.AuditFields)
|
|
208
247
|
});
|
|
209
248
|
|
|
210
249
|
var _default = GroupSubject;
|
|
@@ -19,8 +19,14 @@ var _IdentifierSource = _interopRequireDefault(require("./IdentifierSource"));
|
|
|
19
19
|
|
|
20
20
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
21
21
|
|
|
22
|
+
var _AuditUtil = require("./utility/AuditUtil");
|
|
23
|
+
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
25
|
|
|
26
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
+
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
|
+
|
|
24
30
|
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; }
|
|
25
31
|
|
|
26
32
|
class IdentifierAssignment extends _BaseEntity.default {
|
|
@@ -76,12 +82,45 @@ class IdentifierAssignment extends _BaseEntity.default {
|
|
|
76
82
|
this.that.used = x;
|
|
77
83
|
}
|
|
78
84
|
|
|
85
|
+
get createdBy() {
|
|
86
|
+
return this.that.createdBy;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
set createdBy(x) {
|
|
90
|
+
this.that.createdBy = x;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
get lastModifiedBy() {
|
|
94
|
+
return this.that.lastModifiedBy;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
set lastModifiedBy(x) {
|
|
98
|
+
this.that.lastModifiedBy = x;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
get createdByUUID() {
|
|
102
|
+
return this.that.createdByUUID;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
set createdByUUID(x) {
|
|
106
|
+
this.that.createdByUUID = x;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
get lastModifiedByUUID() {
|
|
110
|
+
return this.that.lastModifiedByUUID;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
set lastModifiedByUUID(x) {
|
|
114
|
+
this.that.lastModifiedByUUID = x;
|
|
115
|
+
}
|
|
116
|
+
|
|
79
117
|
static fromResource(identifierAssignmentResource, entityService) {
|
|
80
118
|
const identifierAssignment = _General.default.assignFields(identifierAssignmentResource, new IdentifierAssignment(), ["uuid", "identifier", "assignmentOrder", "voided"]);
|
|
81
119
|
|
|
82
120
|
identifierAssignment.identifierSource = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(identifierAssignmentResource, "identifierSourceUUID"), _IdentifierSource.default.schema.name);
|
|
83
121
|
identifierAssignment.individual = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(identifierAssignmentResource, "individualUUID"), _Individual.default.schema.name);
|
|
84
122
|
identifierAssignment.programEnrolment = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(identifierAssignmentResource, "programEnrolmentUUID"), _ProgramEnrolment.default.schema.name);
|
|
123
|
+
(0, _AuditUtil.mapAuditFields)(identifierAssignment, identifierAssignmentResource);
|
|
85
124
|
return identifierAssignment;
|
|
86
125
|
}
|
|
87
126
|
|
|
@@ -112,7 +151,7 @@ exports.default = IdentifierAssignment;
|
|
|
112
151
|
_defineProperty(IdentifierAssignment, "schema", {
|
|
113
152
|
name: "IdentifierAssignment",
|
|
114
153
|
primaryKey: "uuid",
|
|
115
|
-
properties: {
|
|
154
|
+
properties: _objectSpread({
|
|
116
155
|
uuid: "string",
|
|
117
156
|
identifierSource: "IdentifierSource",
|
|
118
157
|
identifier: "string",
|
|
@@ -134,5 +173,5 @@ _defineProperty(IdentifierAssignment, "schema", {
|
|
|
134
173
|
default: false,
|
|
135
174
|
optional: false
|
|
136
175
|
}
|
|
137
|
-
}
|
|
176
|
+
}, _AuditUtil.AuditFields)
|
|
138
177
|
});
|
package/dist/Individual.js
CHANGED
|
@@ -53,8 +53,14 @@ var _MergeUtil = _interopRequireDefault(require("./utility/MergeUtil"));
|
|
|
53
53
|
|
|
54
54
|
var _AgeUtil = _interopRequireDefault(require("./utility/AgeUtil"));
|
|
55
55
|
|
|
56
|
+
var _AuditUtil = require("./utility/AuditUtil");
|
|
57
|
+
|
|
56
58
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
57
59
|
|
|
60
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
61
|
+
|
|
62
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
63
|
+
|
|
58
64
|
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; }
|
|
59
65
|
|
|
60
66
|
const mergeMap = new Map([[_SchemaNames.default.ProgramEnrolment, "enrolments"], [_SchemaNames.default.Encounter, "encounters"], [_SchemaNames.default.IndividualRelationship, "relationships"], [_SchemaNames.default.EntityApprovalStatus, "approvalStatuses"], [_SchemaNames.default.Comment, "comments"]]);
|
|
@@ -228,6 +234,38 @@ class Individual extends _BaseEntity.default {
|
|
|
228
234
|
this.that.approvalStatuses = this.fromEntityList(x);
|
|
229
235
|
}
|
|
230
236
|
|
|
237
|
+
get createdBy() {
|
|
238
|
+
return this.that.createdBy;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
set createdBy(x) {
|
|
242
|
+
this.that.createdBy = x;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
get lastModifiedBy() {
|
|
246
|
+
return this.that.lastModifiedBy;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
set lastModifiedBy(x) {
|
|
250
|
+
this.that.lastModifiedBy = x;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
get createdByUUID() {
|
|
254
|
+
return this.that.createdByUUID;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
set createdByUUID(x) {
|
|
258
|
+
this.that.createdByUUID = x;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
get lastModifiedByUUID() {
|
|
262
|
+
return this.that.lastModifiedByUUID;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
set lastModifiedByUUID(x) {
|
|
266
|
+
this.that.lastModifiedByUUID = x;
|
|
267
|
+
}
|
|
268
|
+
|
|
231
269
|
static createEmptyInstance() {
|
|
232
270
|
const individual = new Individual();
|
|
233
271
|
individual.uuid = _General.default.randomUUID();
|
|
@@ -318,6 +356,7 @@ class Individual extends _BaseEntity.default {
|
|
|
318
356
|
individual.name = individual.nameString;
|
|
319
357
|
if (!_lodash.default.isNil(individualResource.registrationLocation)) individual.registrationLocation = _Point.default.fromResource(individualResource.registrationLocation);
|
|
320
358
|
individual.subjectType = subjectType;
|
|
359
|
+
(0, _AuditUtil.mapAuditFields)(individual, individualResource);
|
|
321
360
|
return individual;
|
|
322
361
|
}
|
|
323
362
|
|
|
@@ -1020,7 +1059,7 @@ class Individual extends _BaseEntity.default {
|
|
|
1020
1059
|
_defineProperty(Individual, "schema", {
|
|
1021
1060
|
name: _SchemaNames.default.Individual,
|
|
1022
1061
|
primaryKey: "uuid",
|
|
1023
|
-
properties: {
|
|
1062
|
+
properties: _objectSpread({
|
|
1024
1063
|
uuid: "string",
|
|
1025
1064
|
subjectType: "SubjectType",
|
|
1026
1065
|
name: "string",
|
|
@@ -1065,7 +1104,7 @@ _defineProperty(Individual, "schema", {
|
|
|
1065
1104
|
},
|
|
1066
1105
|
observations: {
|
|
1067
1106
|
type: "list",
|
|
1068
|
-
objectType: "
|
|
1107
|
+
objectType: "EmbeddedObservation"
|
|
1069
1108
|
},
|
|
1070
1109
|
relationships: {
|
|
1071
1110
|
type: "list",
|
|
@@ -1076,7 +1115,7 @@ _defineProperty(Individual, "schema", {
|
|
|
1076
1115
|
objectType: "GroupSubject"
|
|
1077
1116
|
},
|
|
1078
1117
|
registrationLocation: {
|
|
1079
|
-
type:
|
|
1118
|
+
type: _SchemaNames.default.EmbeddedPoint,
|
|
1080
1119
|
optional: true
|
|
1081
1120
|
},
|
|
1082
1121
|
comments: {
|
|
@@ -1094,9 +1133,8 @@ _defineProperty(Individual, "schema", {
|
|
|
1094
1133
|
latestEntityApprovalStatus: {
|
|
1095
1134
|
type: "EntityApprovalStatus",
|
|
1096
1135
|
optional: true
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
}
|
|
1136
|
+
}
|
|
1137
|
+
}, _AuditUtil.AuditFields)
|
|
1100
1138
|
});
|
|
1101
1139
|
|
|
1102
1140
|
_defineProperty(Individual, "validationKeys", {
|
package/dist/Observation.js
CHANGED
|
@@ -49,7 +49,7 @@ class Observation extends _PersistedObject.default {
|
|
|
49
49
|
this.that.valueJSON = x;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
static create(concept, value
|
|
52
|
+
static create(concept, value) {
|
|
53
53
|
const observation = new Observation();
|
|
54
54
|
observation.concept = concept;
|
|
55
55
|
observation.valueJSON = value;
|
|
@@ -164,7 +164,7 @@ class Observation extends _PersistedObject.default {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
cloneForEdit() {
|
|
167
|
-
return clone(this.concept
|
|
167
|
+
return clone(this.concept, this.getValueWrapper().cloneForEdit());
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
shallowClone() {
|
|
@@ -254,10 +254,15 @@ class Observation extends _PersistedObject.default {
|
|
|
254
254
|
return this.concept.isMobileNo();
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
+
isForMedia(mediaName) {
|
|
258
|
+
return _Concept.default.dataType.Media.includes(this.concept.datatype) && this.valueJSON.includes(mediaName);
|
|
259
|
+
}
|
|
260
|
+
|
|
257
261
|
}
|
|
258
262
|
|
|
259
263
|
_defineProperty(Observation, "schema", {
|
|
260
|
-
name: "
|
|
264
|
+
name: "EmbeddedObservation",
|
|
265
|
+
embedded: true,
|
|
261
266
|
properties: {
|
|
262
267
|
concept: "Concept",
|
|
263
268
|
valueJSON: "string"
|
|
@@ -72,54 +72,10 @@ class ObservationsHolder {
|
|
|
72
72
|
findObservationByValue(value) {
|
|
73
73
|
return _lodash.default.find(this.observations, observation => observation.getValue() === value);
|
|
74
74
|
}
|
|
75
|
+
/*
|
|
76
|
+
Called from the wizard on changes done by the user for primitive fields (including Date)
|
|
77
|
+
*/
|
|
75
78
|
|
|
76
|
-
updateObs(formElement, value) {
|
|
77
|
-
const currentValue = this.getObservation(formElement.concept);
|
|
78
|
-
|
|
79
|
-
_ArrayHelper.default.remove(this.observations, obs => obs.concept.uuid === formElement.concept.uuid);
|
|
80
|
-
|
|
81
|
-
if (formElement.concept.isPrimitive() && (0, _lodash.isNil)(formElement.durationOptions)) {
|
|
82
|
-
this.addOrUpdatePrimitiveObs(formElement.concept, value);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (formElement.getType() === _Concept.default.dataType.Id) {
|
|
86
|
-
if (!_lodash.default.isEmpty(value)) {
|
|
87
|
-
this.observations.push(_Observation.default.create(formElement.concept, _Identifier.default.fromObs(_objectSpread({}, currentValue, {
|
|
88
|
-
value
|
|
89
|
-
}))));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (formElement.isSingleSelect()) {
|
|
94
|
-
if (!_lodash.default.isEmpty(value)) {
|
|
95
|
-
const observation = _Observation.default.create(formElement.concept, new _SingleCodedValue.default(value));
|
|
96
|
-
|
|
97
|
-
this.observations.push(observation);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (formElement.isMultiSelect()) {
|
|
102
|
-
if (!_lodash.default.isEmpty(value)) {
|
|
103
|
-
const observation = _Observation.default.create(formElement.concept, new _MultipleCodedValues.default(value));
|
|
104
|
-
|
|
105
|
-
this.observations.push(observation);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (formElement.getType() === _Concept.default.dataType.Duration && !(0, _lodash.isNil)(formElement.durationOptions)) {
|
|
110
|
-
if (!_lodash.default.isEmpty(value) && !_lodash.default.isEmpty(value.durations)) {
|
|
111
|
-
const observation = _Observation.default.create(formElement.concept, _CompositeDuration.default.fromObs(value));
|
|
112
|
-
|
|
113
|
-
this.observations.push(observation);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (formElement.getType() === _Concept.default.dataType.PhoneNumber) {
|
|
118
|
-
const observation = _Observation.default.create(formElement.concept, _PhoneNumber.default.fromObs(value));
|
|
119
|
-
|
|
120
|
-
this.observations.push(observation);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
79
|
|
|
124
80
|
addOrUpdatePrimitiveObs(concept, value, answerSource = _Observation.default.AnswerSource.Manual) {
|
|
125
81
|
let currentObservation = this.findObservation(concept);
|
|
@@ -136,7 +92,8 @@ class ObservationsHolder {
|
|
|
136
92
|
this.observations.push(_Observation.default.create(concept, new _PrimitiveValue.default(value, concept.datatype, answerSource)));
|
|
137
93
|
}
|
|
138
94
|
}
|
|
139
|
-
}
|
|
95
|
+
} //private
|
|
96
|
+
|
|
140
97
|
|
|
141
98
|
_removeExistingObs(concept) {
|
|
142
99
|
const observation = this.getObservation(concept);
|
|
@@ -144,7 +101,8 @@ class ObservationsHolder {
|
|
|
144
101
|
if (!_lodash.default.isEmpty(observation)) {
|
|
145
102
|
_ArrayHelper.default.remove(this.observations, obs => obs.concept.uuid === observation.concept.uuid);
|
|
146
103
|
}
|
|
147
|
-
}
|
|
104
|
+
} //private
|
|
105
|
+
|
|
148
106
|
|
|
149
107
|
addOrUpdateCodedObs(concept, value, isSingleSelect, answerSource = _Observation.default.AnswerSource.Auto) {
|
|
150
108
|
this._removeExistingObs(concept);
|
|
@@ -159,6 +117,10 @@ class ObservationsHolder {
|
|
|
159
117
|
this.observations.push(observation);
|
|
160
118
|
}
|
|
161
119
|
}
|
|
120
|
+
/*
|
|
121
|
+
called during edit of form element by the user and when the page transition takes place
|
|
122
|
+
*/
|
|
123
|
+
|
|
162
124
|
|
|
163
125
|
removeNonApplicableObs(allFormElements, applicableFormElements) {
|
|
164
126
|
const formElementsIncludingRepeatableElements = [];
|
|
@@ -193,9 +155,10 @@ class ObservationsHolder {
|
|
|
193
155
|
}
|
|
194
156
|
});
|
|
195
157
|
return _lodash.default.flatten(inApplicableFormElements.map(fe => this._removeObs(fe))).filter(obs => !_lodash.default.isEmpty(obs));
|
|
196
|
-
}
|
|
158
|
+
} //private
|
|
197
159
|
|
|
198
|
-
|
|
160
|
+
|
|
161
|
+
removeNonApplicableAnswersFromQuestionGroup(fe, isSingleSelect) {
|
|
199
162
|
const questionGroup = this.getQuestionGroups(fe);
|
|
200
163
|
const questionGroupObservation = questionGroup && questionGroup.getGroupObservationAtIndex(fe.questionGroupIndex);
|
|
201
164
|
const observation = questionGroupObservation && questionGroupObservation.getObservation(fe.concept);
|
|
@@ -212,7 +175,8 @@ class ObservationsHolder {
|
|
|
212
175
|
|
|
213
176
|
questionGroupObservation.addObservation(newObservation);
|
|
214
177
|
}
|
|
215
|
-
}
|
|
178
|
+
} //private
|
|
179
|
+
|
|
216
180
|
|
|
217
181
|
_removeObs(formElement) {
|
|
218
182
|
if (formElement.isQuestionGroup()) {
|
|
@@ -228,7 +192,8 @@ class ObservationsHolder {
|
|
|
228
192
|
const parentFormElement = formElement.getParentFormElement();
|
|
229
193
|
const questionGroupObservations = this.getObservation(parentFormElement.concept);
|
|
230
194
|
return questionGroupObservations && questionGroupObservations.getValueWrapper();
|
|
231
|
-
}
|
|
195
|
+
} //private
|
|
196
|
+
|
|
232
197
|
|
|
233
198
|
removeNonApplicableAnswers(fe, isSingleSelect, observation) {
|
|
234
199
|
if (!_lodash.default.isEmpty(observation)) {
|
|
@@ -245,6 +210,10 @@ class ObservationsHolder {
|
|
|
245
210
|
this.observations.push(newObservation);
|
|
246
211
|
}
|
|
247
212
|
}
|
|
213
|
+
/*
|
|
214
|
+
Called from wizard after the update of the fields is called for all types. This is to sync up the coded fields based on the rules.
|
|
215
|
+
*/
|
|
216
|
+
|
|
248
217
|
|
|
249
218
|
updatePrimitiveCodedObs(applicableFormElements, formElementStatuses) {
|
|
250
219
|
const updateQuestionGroupObs = (parentFormElement, questionGroupIndex, fe, value) => {
|
|
@@ -305,10 +274,15 @@ class ObservationsHolder {
|
|
|
305
274
|
}
|
|
306
275
|
});
|
|
307
276
|
}
|
|
277
|
+
/*
|
|
278
|
+
called for direct edit of single select field
|
|
279
|
+
*/
|
|
280
|
+
|
|
308
281
|
|
|
309
282
|
toggleSingleSelectAnswer(concept, answerUUID) {
|
|
310
283
|
return this.toggleCodedAnswer(concept, answerUUID, true);
|
|
311
|
-
}
|
|
284
|
+
} //private
|
|
285
|
+
|
|
312
286
|
|
|
313
287
|
toggleCodedAnswer(concept, answerUUID, isSingleSelect) {
|
|
314
288
|
let observation = this.getObservation(concept);
|
|
@@ -330,6 +304,10 @@ class ObservationsHolder {
|
|
|
330
304
|
return observation;
|
|
331
305
|
}
|
|
332
306
|
}
|
|
307
|
+
/*
|
|
308
|
+
called for direct edit of duration field
|
|
309
|
+
*/
|
|
310
|
+
|
|
333
311
|
|
|
334
312
|
updateCompositeDurationValue(concept, duration) {
|
|
335
313
|
let observation = this.getObservation(concept);
|
|
@@ -344,6 +322,10 @@ class ObservationsHolder {
|
|
|
344
322
|
this.observations.push(observation);
|
|
345
323
|
return observation;
|
|
346
324
|
}
|
|
325
|
+
/*
|
|
326
|
+
called for direct edit of phone number field
|
|
327
|
+
*/
|
|
328
|
+
|
|
347
329
|
|
|
348
330
|
updatePhoneNumberValue(concept, phoneNumber, verified = false, skipVerification = false) {
|
|
349
331
|
let observation = this.getObservation(concept);
|
|
@@ -374,7 +356,8 @@ class ObservationsHolder {
|
|
|
374
356
|
if (!childObservations.isEmpty()) {
|
|
375
357
|
this.observations.push(_Observation.default.create(parentConcept, childObservations));
|
|
376
358
|
}
|
|
377
|
-
}
|
|
359
|
+
} //private
|
|
360
|
+
|
|
378
361
|
|
|
379
362
|
updateChildObservations(childFormElement, childObservations, value, verified = false, skipVerification = false) {
|
|
380
363
|
const childConcept = childFormElement.concept;
|
|
@@ -466,7 +449,8 @@ class ObservationsHolder {
|
|
|
466
449
|
observation.valueJSON = JSON.stringify(observation.valueJSON);
|
|
467
450
|
}
|
|
468
451
|
});
|
|
469
|
-
}
|
|
452
|
+
} //private
|
|
453
|
+
|
|
470
454
|
|
|
471
455
|
getObservationReadableValue(concept) {
|
|
472
456
|
let obs = this.getObservation(concept);
|
|
@@ -482,7 +466,8 @@ class ObservationsHolder {
|
|
|
482
466
|
} else {
|
|
483
467
|
this.observations.push(_Observation.default.create(concept, valueWrapper));
|
|
484
468
|
}
|
|
485
|
-
}
|
|
469
|
+
} //private
|
|
470
|
+
|
|
486
471
|
|
|
487
472
|
updateObservationBasedOnValue(oldValue, newValue) {
|
|
488
473
|
const observation = this.findObservationByValue(oldValue);
|
|
@@ -517,25 +502,6 @@ class ObservationsHolder {
|
|
|
517
502
|
}
|
|
518
503
|
}
|
|
519
504
|
|
|
520
|
-
migrateMultiSelectMediaObservations(form) {
|
|
521
|
-
_lodash.default.forEach(form.nonVoidedFormElementGroups(), feg => {
|
|
522
|
-
_lodash.default.forEach(feg.getFormElements(), fe => {
|
|
523
|
-
const concept = fe.concept;
|
|
524
|
-
const observation = this.getObservation(concept);
|
|
525
|
-
|
|
526
|
-
if (_lodash.default.includes(_Concept.default.dataType.Media, fe.getType()) && observation && fe.isMultiSelect()) {
|
|
527
|
-
const valueWrapper = observation.getValueWrapper();
|
|
528
|
-
|
|
529
|
-
if (!_lodash.default.isArray(valueWrapper.getValue())) {
|
|
530
|
-
_General.default.logDebug("ObservationHolder", `Found string value ${valueWrapper.getValue()} for multi select media element, doing migration`);
|
|
531
|
-
|
|
532
|
-
observation.valueJSON = new _MultipleCodedValues.default([valueWrapper.getValue()]);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
|
|
539
505
|
toString(I18n) {
|
|
540
506
|
let display = "";
|
|
541
507
|
this.observations.forEach(obs => {
|