openchs-models 1.33.2 → 1.33.5
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 +15 -5
- package/.commit-message.txt +21 -0
- package/.nvmrc +1 -1
- package/Makefile +32 -10
- package/REALM_V12_NOTES.md +46 -0
- package/dist/AbstractEncounter.js +4 -105
- package/dist/AddressLevel.js +5 -62
- package/dist/ApprovalStatus.js +4 -17
- package/dist/BaseEntity.js +5 -42
- package/dist/BeneficiaryModePin.js +4 -13
- package/dist/Checklist.js +6 -52
- package/dist/ChecklistDetail.js +4 -22
- package/dist/ChecklistItem.js +16 -96
- package/dist/ChecklistItemDetail.js +4 -43
- package/dist/ChecklistItemStatus.js +4 -33
- package/dist/Comment.js +6 -51
- package/dist/CommentThread.js +4 -26
- package/dist/CompositeDuration.js +1 -18
- package/dist/Concept.js +5 -107
- package/dist/ConceptAnswer.js +4 -21
- package/dist/CustomDashboardCache.js +4 -38
- package/dist/CustomFilter.js +5 -15
- package/dist/Dashboard.js +4 -23
- package/dist/DashboardCache.js +4 -23
- package/dist/DashboardSection.js +4 -24
- package/dist/DashboardSectionCardMapping.js +4 -21
- package/dist/Displayable.js +3 -11
- package/dist/Documentation.js +4 -21
- package/dist/DocumentationItem.js +4 -20
- package/dist/Duration.js +4 -39
- package/dist/Encounter.js +6 -41
- package/dist/EncounterType.js +4 -26
- package/dist/EntityApprovalStatus.js +6 -56
- package/dist/EntityMetaData.js +7 -105
- package/dist/EntityQueue.js +4 -15
- package/dist/EntityRule.js +1 -29
- package/dist/EntitySyncStatus.js +4 -19
- package/dist/Extension.js +4 -18
- package/dist/Family.js +4 -56
- package/dist/FileFormat.js +0 -7
- package/dist/Gender.js +4 -17
- package/dist/GroupDashboard.js +4 -23
- package/dist/GroupPrivileges.js +4 -28
- package/dist/GroupRole.js +4 -34
- package/dist/GroupSubject.js +6 -59
- package/dist/Groups.js +4 -14
- package/dist/Identifier.js +4 -20
- package/dist/IdentifierAssignment.js +6 -45
- package/dist/IdentifierSource.js +4 -15
- package/dist/Individual.js +17 -265
- package/dist/LocaleMapping.js +4 -13
- package/dist/LocationHierarchy.js +4 -25
- package/dist/Media.js +35 -35
- package/dist/MediaQueue.js +4 -26
- package/dist/MigrationsHelper.js +15 -22
- package/dist/MyGroups.js +4 -14
- package/dist/News.js +4 -31
- package/dist/Observation.js +4 -54
- package/dist/ObservationsHolder.js +104 -216
- package/dist/OrganisationConfig.js +4 -19
- package/dist/PersistedObject.js +1 -19
- package/dist/PhoneNumber.js +0 -11
- package/dist/PlatformTranslation.js +4 -17
- package/dist/Privilege.js +5 -22
- package/dist/Program.js +4 -39
- package/dist/ProgramEncounter.js +6 -48
- package/dist/ProgramEnrolment.js +8 -162
- package/dist/ReferenceEntity.js +1 -10
- package/dist/ReportCard.js +5 -60
- package/dist/ResetSync.js +4 -17
- package/dist/Rule.js +4 -28
- package/dist/RuleDependency.js +4 -17
- package/dist/RuleFailureTelemetry.js +4 -36
- package/dist/Schema.js +16 -268
- package/dist/SchemaNames.js +3 -46
- package/dist/Settings.js +4 -53
- package/dist/StandardReportCardType.js +4 -39
- package/dist/SubjectMigration.js +6 -45
- package/dist/SubjectType.js +6 -72
- package/dist/SyncTelemetry.js +4 -40
- package/dist/Translation.js +4 -17
- package/dist/UserInfo.js +4 -33
- package/dist/application/DashboardCacheFilter.js +4 -24
- package/dist/application/Filter.js +3 -16
- package/dist/application/Form.js +6 -93
- package/dist/application/FormElement.js +5 -100
- package/dist/application/FormElementGroup.js +4 -75
- package/dist/application/FormElementStatus.js +1 -11
- package/dist/application/FormMapping.js +6 -44
- package/dist/application/Format.js +4 -20
- package/dist/application/KeyValue.js +4 -19
- package/dist/application/MenuItem.js +4 -35
- package/dist/application/MultiSelectFilter.js +1 -11
- package/dist/application/NullProgramEnrolment.js +0 -8
- package/dist/application/SingleSelectFilter.js +1 -12
- package/dist/application/StaticFormElementGroup.js +0 -11
- package/dist/application/StringKeyNumericValue.js +4 -17
- package/dist/application/ValidationResult.js +6 -20
- package/dist/application/ValidationResults.js +1 -14
- package/dist/application/WorkItem.js +4 -20
- package/dist/application/WorkList.js +1 -24
- package/dist/application/WorkLists.js +1 -13
- package/dist/assignment/UserSubjectAssignment.js +6 -26
- package/dist/draft/DraftEncounter.js +4 -40
- package/dist/draft/DraftSubject.js +4 -46
- package/dist/error/IgnorableSyncError.js +1 -6
- package/dist/error/SyncError.js +1 -6
- package/dist/framework/ArrayHelper.js +3 -11
- package/dist/framework/DefinedObjectSchema.js +4 -12
- package/dist/framework/RealmCollectionHelper.js +1 -9
- package/dist/framework/RealmEmbeddedObjectHandler.js +126 -0
- package/dist/framework/RealmListProxy.js +1 -10
- package/dist/framework/RealmObjectSchema.js +1 -11
- package/dist/framework/RealmProxy.js +15 -39
- package/dist/framework/RealmResultsProxy.js +3 -37
- package/dist/framework/RealmResultsProxyHandler.js +2 -5
- package/dist/geo/Point.js +4 -17
- package/dist/index.js +9 -137
- package/dist/location/Locations.js +1 -6
- package/dist/observation/MultipleCodedValues.js +1 -21
- package/dist/observation/PrimitiveValue.js +1 -17
- package/dist/observation/QuestionGroup.js +1 -36
- package/dist/observation/RepeatableQuestionGroup.js +4 -27
- package/dist/observation/SingleCodedValue.js +1 -15
- package/dist/program/SubjectProgramEligibility.js +6 -56
- package/dist/relationship/IndividualRelation.js +6 -18
- package/dist/relationship/IndividualRelationGenderMapping.js +4 -22
- package/dist/relationship/IndividualRelationship.js +6 -51
- package/dist/relationship/IndividualRelationshipType.js +4 -24
- package/dist/relationship/IndividualRelative.js +4 -31
- package/dist/reports/DashboardFilter.js +4 -20
- package/dist/reports/DashboardFilterConfig.js +5 -85
- package/dist/reports/NestedReportCardResult.js +5 -35
- package/dist/reports/Range.js +4 -13
- package/dist/reports/ReportCardResult.js +5 -24
- package/dist/service/MetaDataService.js +1 -30
- package/dist/task/Task.js +6 -62
- package/dist/task/TaskStatus.js +4 -21
- package/dist/task/TaskType.js +4 -23
- package/dist/task/TaskUnAssignment.js +6 -30
- package/dist/utility/AgeUtil.js +1 -15
- package/dist/utility/ArrayUtil.js +1 -6
- package/dist/utility/AuditUtil.js +1 -8
- package/dist/utility/DateTimeUtil.js +1 -8
- package/dist/utility/General.js +4 -71
- package/dist/utility/JsonStringify.js +15 -28
- package/dist/utility/MergeUtil.js +1 -10
- package/dist/utility/ResourceUtil.js +1 -7
- package/dist/videos/Video.js +4 -23
- package/dist/videos/VideoTelemetric.js +6 -37
- package/package.json +6 -3
- package/scripts/validateSchemas.js +40 -0
- package/tsconfig.json +1 -1
- package/yarn.lock +0 -6744
package/dist/Concept.js
CHANGED
|
@@ -4,134 +4,95 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MediaType = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
9
|
-
|
|
10
8
|
var _General = _interopRequireDefault(require("./utility/General"));
|
|
11
|
-
|
|
12
9
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
|
-
|
|
14
10
|
var _MultipleCodedValues = _interopRequireDefault(require("./observation/MultipleCodedValues"));
|
|
15
|
-
|
|
16
11
|
var _SingleCodedValue = _interopRequireDefault(require("./observation/SingleCodedValue"));
|
|
17
|
-
|
|
18
12
|
var _PrimitiveValue = _interopRequireDefault(require("./observation/PrimitiveValue"));
|
|
19
|
-
|
|
20
13
|
var _Duration = _interopRequireDefault(require("./Duration"));
|
|
21
|
-
|
|
22
14
|
var _CompositeDuration = _interopRequireDefault(require("./CompositeDuration"));
|
|
23
|
-
|
|
24
15
|
var _KeyValue = _interopRequireDefault(require("./application/KeyValue"));
|
|
25
|
-
|
|
26
16
|
var _PhoneNumber = _interopRequireDefault(require("./PhoneNumber"));
|
|
27
|
-
|
|
28
17
|
var _Identifier = _interopRequireDefault(require("./Identifier"));
|
|
29
|
-
|
|
30
18
|
var _QuestionGroup = _interopRequireDefault(require("./observation/QuestionGroup"));
|
|
31
|
-
|
|
32
19
|
var _RepeatableQuestionGroup = _interopRequireDefault(require("./observation/RepeatableQuestionGroup"));
|
|
33
|
-
|
|
34
20
|
var _ConceptAnswer = _interopRequireDefault(require("./ConceptAnswer"));
|
|
35
|
-
|
|
36
21
|
var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
22
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
42
26
|
class Concept extends _BaseEntity.default {
|
|
43
27
|
constructor(that = null) {
|
|
44
28
|
super(that, Concept);
|
|
45
29
|
}
|
|
46
|
-
|
|
47
30
|
get lowNormal() {
|
|
48
31
|
return this.that.lowNormal;
|
|
49
32
|
}
|
|
50
|
-
|
|
51
33
|
set lowNormal(x) {
|
|
52
34
|
this.that.lowNormal = x;
|
|
53
35
|
}
|
|
54
|
-
|
|
55
36
|
get lowAbsolute() {
|
|
56
37
|
return this.that.lowAbsolute;
|
|
57
38
|
}
|
|
58
|
-
|
|
59
39
|
set lowAbsolute(x) {
|
|
60
40
|
this.that.lowAbsolute = x;
|
|
61
41
|
}
|
|
62
|
-
|
|
63
42
|
get hiAbsolute() {
|
|
64
43
|
return this.that.hiAbsolute;
|
|
65
44
|
}
|
|
66
|
-
|
|
67
45
|
set hiAbsolute(x) {
|
|
68
46
|
this.that.hiAbsolute = x;
|
|
69
47
|
}
|
|
70
|
-
|
|
71
48
|
get hiNormal() {
|
|
72
49
|
return this.that.hiNormal;
|
|
73
50
|
}
|
|
74
|
-
|
|
75
51
|
set hiNormal(x) {
|
|
76
52
|
this.that.hiNormal = x;
|
|
77
53
|
}
|
|
78
|
-
|
|
79
54
|
get unit() {
|
|
80
55
|
return this.that.unit;
|
|
81
56
|
}
|
|
82
|
-
|
|
83
57
|
set unit(x) {
|
|
84
58
|
this.that.unit = x;
|
|
85
59
|
}
|
|
86
|
-
|
|
87
60
|
get mediaUrl() {
|
|
88
61
|
return this.that.mediaUrl;
|
|
89
62
|
}
|
|
90
|
-
|
|
91
63
|
set mediaUrl(x) {
|
|
92
64
|
this.that.mediaUrl = x;
|
|
93
65
|
}
|
|
94
|
-
|
|
95
66
|
get mediaType() {
|
|
96
67
|
return this.that.mediaType;
|
|
97
68
|
}
|
|
98
|
-
|
|
99
69
|
set mediaType(x) {
|
|
100
70
|
this.that.mediaType = x;
|
|
101
71
|
}
|
|
102
|
-
|
|
103
72
|
get name() {
|
|
104
73
|
return this.that.name;
|
|
105
74
|
}
|
|
106
|
-
|
|
107
75
|
set name(x) {
|
|
108
76
|
this.that.name = x;
|
|
109
77
|
}
|
|
110
|
-
|
|
111
78
|
get datatype() {
|
|
112
79
|
return this.that.datatype;
|
|
113
80
|
}
|
|
114
|
-
|
|
115
81
|
set datatype(x) {
|
|
116
82
|
this.that.datatype = x;
|
|
117
83
|
}
|
|
118
|
-
|
|
119
84
|
get answers() {
|
|
120
85
|
return this.toEntityList("answers", _ConceptAnswer.default);
|
|
121
86
|
}
|
|
122
|
-
|
|
123
87
|
set answers(x) {
|
|
124
88
|
this.that.answers = this.fromEntityList(x);
|
|
125
89
|
}
|
|
126
|
-
|
|
127
90
|
get keyValues() {
|
|
128
91
|
return this.toEntityList("keyValues", _KeyValue.default);
|
|
129
92
|
}
|
|
130
|
-
|
|
131
93
|
set keyValues(x) {
|
|
132
94
|
this.that.keyValues = this.fromEntityList(x);
|
|
133
95
|
}
|
|
134
|
-
|
|
135
96
|
static fromResource(conceptResource, entityService) {
|
|
136
97
|
const concept = new Concept();
|
|
137
98
|
concept.name = conceptResource.name;
|
|
@@ -143,29 +104,22 @@ class Concept extends _BaseEntity.default {
|
|
|
143
104
|
concept.hiNormal = conceptResource.highNormal;
|
|
144
105
|
concept.unit = conceptResource.unit;
|
|
145
106
|
concept.voided = conceptResource.voided || false; //This change should be independently deployable irrespective of server
|
|
146
|
-
|
|
147
107
|
concept.keyValues = _lodash.default.map(conceptResource.keyValues, _KeyValue.default.fromResource);
|
|
148
108
|
concept.mediaUrl = conceptResource.mediaUrl;
|
|
149
109
|
concept.mediaType = conceptResource.mediaType;
|
|
150
110
|
return concept;
|
|
151
111
|
}
|
|
152
|
-
|
|
153
112
|
static associateChild(child, childEntityClass, childResource, entityService) {
|
|
154
113
|
let concept = _BaseEntity.default.getParentEntity(entityService, childEntityClass, childResource, "conceptUUID", Concept.schema.name);
|
|
155
|
-
|
|
156
114
|
concept = _General.default.pick(concept, ["uuid"], ["answers"]);
|
|
157
115
|
let newAnswers = concept.answers;
|
|
158
|
-
|
|
159
116
|
if (childEntityClass !== _ConceptAnswer.default) {
|
|
160
117
|
throw `${childEntityClass.name} not support by ${Concept.name}`;
|
|
161
118
|
}
|
|
162
|
-
|
|
163
119
|
_BaseEntity.default.addNewChild(child, newAnswers);
|
|
164
|
-
|
|
165
120
|
concept.answers = newAnswers;
|
|
166
121
|
return concept;
|
|
167
122
|
}
|
|
168
|
-
|
|
169
123
|
static create(name, dataType, keyValues, uuid = _General.default.randomUUID()) {
|
|
170
124
|
const concept = new Concept();
|
|
171
125
|
concept.name = name;
|
|
@@ -174,62 +128,49 @@ class Concept extends _BaseEntity.default {
|
|
|
174
128
|
concept.keyValues = _lodash.default.map(keyValues, _KeyValue.default.fromResource);
|
|
175
129
|
return concept;
|
|
176
130
|
}
|
|
131
|
+
|
|
177
132
|
/**
|
|
178
133
|
* This should never be cloned and used for reference as this is metadata which is not to be modified during transactional data operations
|
|
179
134
|
*
|
|
180
135
|
* @returns {Concept}
|
|
181
136
|
*/
|
|
182
|
-
|
|
183
|
-
|
|
184
137
|
cloneForReference() {
|
|
185
138
|
return this;
|
|
186
139
|
}
|
|
187
|
-
|
|
188
140
|
_valuePresent(value) {
|
|
189
141
|
return !_lodash.default.isNil(value) && !isNaN(value);
|
|
190
142
|
}
|
|
191
|
-
|
|
192
143
|
violatesRange(value) {
|
|
193
144
|
return this.isAboveHiAbsolute(value) || this.isBelowLowAbsolute(value);
|
|
194
145
|
}
|
|
195
|
-
|
|
196
146
|
isAbnormal(value) {
|
|
197
147
|
let valueWrapper = this.getValueWrapperFor(value);
|
|
198
|
-
|
|
199
148
|
switch (this.datatype) {
|
|
200
149
|
case Concept.dataType.Numeric:
|
|
201
150
|
return this.isBelowLowNormal(valueWrapper.answer) || this.isAboveHiNormal(valueWrapper.answer);
|
|
202
|
-
|
|
203
151
|
case Concept.dataType.Coded:
|
|
204
152
|
return valueWrapper.hasAnyAbnormalAnswer(this.abnormalAnswers());
|
|
205
|
-
|
|
206
153
|
default:
|
|
207
154
|
return false;
|
|
208
155
|
}
|
|
209
156
|
}
|
|
210
|
-
|
|
211
157
|
abnormalAnswers() {
|
|
212
158
|
return _lodash.default.filter(this.answers, conceptAnswer => conceptAnswer.abnormal).map(conceptAnswer => {
|
|
213
159
|
return conceptAnswer.concept.uuid;
|
|
214
160
|
});
|
|
215
161
|
}
|
|
216
|
-
|
|
217
162
|
isBelowLowNormal(value) {
|
|
218
163
|
return this._areValidNumbers(value, this.lowNormal) && value < this.lowNormal;
|
|
219
164
|
}
|
|
220
|
-
|
|
221
165
|
isAboveHiNormal(value) {
|
|
222
166
|
return this._areValidNumbers(value, this.hiNormal) && value > this.hiNormal;
|
|
223
167
|
}
|
|
224
|
-
|
|
225
168
|
isBelowLowAbsolute(value) {
|
|
226
169
|
return this._areValidNumbers(value, this.lowAbsolute) && value < this.lowAbsolute;
|
|
227
170
|
}
|
|
228
|
-
|
|
229
171
|
isAboveHiAbsolute(value) {
|
|
230
172
|
return this._areValidNumbers(value, this.hiAbsolute) && value > this.hiAbsolute;
|
|
231
173
|
}
|
|
232
|
-
|
|
233
174
|
addAnswer(concept) {
|
|
234
175
|
const conceptAnswer = new _ConceptAnswer.default();
|
|
235
176
|
conceptAnswer.uuid = _General.default.randomUUID();
|
|
@@ -237,149 +178,113 @@ class Concept extends _BaseEntity.default {
|
|
|
237
178
|
this.answers.push(conceptAnswer);
|
|
238
179
|
return conceptAnswer;
|
|
239
180
|
}
|
|
240
|
-
|
|
241
181
|
getPossibleAnswerConcept(nameOrUuid) {
|
|
242
182
|
return _lodash.default.find(this.answers, conceptAnswer => {
|
|
243
183
|
return conceptAnswer.concept.name === nameOrUuid || conceptAnswer.concept.uuid === nameOrUuid;
|
|
244
184
|
});
|
|
245
185
|
}
|
|
246
|
-
|
|
247
186
|
getValueWrapperFor(obsValue) {
|
|
248
187
|
if (this.isSelectConcept()) {
|
|
249
188
|
return _lodash.default.isArray(obsValue) ? new _MultipleCodedValues.default(obsValue) : new _SingleCodedValue.default(obsValue);
|
|
250
189
|
}
|
|
251
|
-
|
|
252
190
|
if (this.isDurationConcept()) {
|
|
253
191
|
return _CompositeDuration.default.fromObs(obsValue);
|
|
254
192
|
}
|
|
255
|
-
|
|
256
193
|
if (this.isPhoneNumberConcept()) {
|
|
257
194
|
return _PhoneNumber.default.fromObs(obsValue);
|
|
258
195
|
}
|
|
259
|
-
|
|
260
196
|
if (this.isIdConcept()) {
|
|
261
197
|
return _Identifier.default.fromObs(obsValue);
|
|
262
198
|
}
|
|
263
|
-
|
|
264
199
|
if (this.isQuestionGroup()) {
|
|
265
200
|
return 'repeatableObservations' in obsValue ? _RepeatableQuestionGroup.default.fromObs(obsValue) : _QuestionGroup.default.fromObs(obsValue);
|
|
266
201
|
}
|
|
267
|
-
|
|
268
202
|
return new _PrimitiveValue.default(obsValue, this.datatype);
|
|
269
203
|
}
|
|
270
|
-
|
|
271
204
|
isType(type) {
|
|
272
205
|
return this.datatype === type;
|
|
273
206
|
}
|
|
274
|
-
|
|
275
207
|
isCodedConcept() {
|
|
276
208
|
return this.isType(Concept.dataType.Coded);
|
|
277
209
|
}
|
|
278
|
-
|
|
279
210
|
isSubjectConcept() {
|
|
280
211
|
return this.isType(Concept.dataType.Subject);
|
|
281
212
|
}
|
|
282
|
-
|
|
283
213
|
isEncounterConcept() {
|
|
284
214
|
return this.isType(Concept.dataType.Encounter);
|
|
285
215
|
}
|
|
286
|
-
|
|
287
216
|
isMediaConcept() {
|
|
288
217
|
return _lodash.default.includes([Concept.dataType.Image, Concept.dataType.ImageV2, Concept.dataType.Video, Concept.dataType.File], this.datatype);
|
|
289
218
|
}
|
|
290
|
-
|
|
291
219
|
isMediaSelectConcept() {
|
|
292
220
|
return _lodash.default.includes([Concept.dataType.Image, Concept.dataType.ImageV2, Concept.dataType.Video, Concept.dataType.File], this.datatype);
|
|
293
221
|
}
|
|
294
|
-
|
|
295
222
|
isSelectConcept() {
|
|
296
223
|
return this.isCodedConcept() || this.isSubjectConcept() || this.isEncounterConcept() || this.isMediaSelectConcept();
|
|
297
224
|
}
|
|
298
|
-
|
|
299
225
|
isDurationConcept() {
|
|
300
226
|
return this.isType(Concept.dataType.Duration);
|
|
301
227
|
}
|
|
302
|
-
|
|
303
228
|
isPhoneNumberConcept() {
|
|
304
229
|
return this.isType(Concept.dataType.PhoneNumber);
|
|
305
230
|
}
|
|
306
|
-
|
|
307
231
|
isIdConcept() {
|
|
308
232
|
return this.isType(Concept.dataType.Id);
|
|
309
233
|
}
|
|
310
|
-
|
|
311
234
|
isQuestionGroup() {
|
|
312
235
|
return this.isType(Concept.dataType.QuestionGroup);
|
|
313
236
|
}
|
|
314
|
-
|
|
315
237
|
isPrimitive() {
|
|
316
238
|
return [Concept.dataType.Text, Concept.dataType.Time, Concept.dataType.Numeric, Concept.dataType.Audio, Concept.dataType.Date, Concept.dataType.DateTime, Concept.dataType.Location, Concept.dataType.Notes].includes(this.datatype);
|
|
317
239
|
}
|
|
318
|
-
|
|
319
240
|
getAnswers() {
|
|
320
241
|
return _lodash.default.sortBy(this.answers, answer => {
|
|
321
242
|
return _lodash.default.indexOf([Concept.StandardConcepts.OtherConceptUUID, Concept.StandardConcepts.NoneConceptUUID], answer.concept.uuid) !== -1 ? 99999 : answer.answerOrder;
|
|
322
243
|
}).filter(ans => !ans.voided);
|
|
323
244
|
}
|
|
324
|
-
|
|
325
245
|
getAnswerWithConceptName(answerName) {
|
|
326
246
|
return _lodash.default.find(this.getAnswers(), answer => answer.concept.name === answerName);
|
|
327
247
|
}
|
|
328
|
-
|
|
329
248
|
getAnswerWithConceptUuid(answerConceptUuid) {
|
|
330
249
|
return _lodash.default.find(this.getAnswers(), answer => answer.concept.uuid === answerConceptUuid);
|
|
331
250
|
}
|
|
332
|
-
|
|
333
251
|
get translatedFieldValue() {
|
|
334
252
|
return this.name;
|
|
335
253
|
}
|
|
336
|
-
|
|
337
254
|
_areValidNumbers(...numbers) {
|
|
338
255
|
return _lodash.default.every(numbers, value => value !== null && _lodash.default.isFinite(value));
|
|
339
256
|
}
|
|
340
|
-
|
|
341
257
|
recordByKey(key) {
|
|
342
258
|
return _lodash.default.find(this.keyValues, keyValue => keyValue.key === key);
|
|
343
259
|
}
|
|
344
|
-
|
|
345
260
|
recordValueByKey(key) {
|
|
346
261
|
return _lodash.default.invoke(_lodash.default.find(this.keyValues, it => it.key === key), "getValue");
|
|
347
262
|
}
|
|
348
|
-
|
|
349
263
|
isMobileNo() {
|
|
350
264
|
const keyValue = this.recordValueByKey(_KeyValue.default.PrimaryContactKey) || this.recordValueByKey(_KeyValue.default.ContactNumberKey);
|
|
351
265
|
return keyValue === _KeyValue.default.ContactYesValue;
|
|
352
266
|
}
|
|
353
|
-
|
|
354
267
|
isMediaTypeImage() {
|
|
355
268
|
return this.mediaType === MediaType.Image;
|
|
356
269
|
}
|
|
357
|
-
|
|
358
270
|
hasMediaType() {
|
|
359
271
|
return !_lodash.default.isNil(this.mediaType);
|
|
360
272
|
}
|
|
361
|
-
|
|
362
273
|
hasMediaUrl() {
|
|
363
274
|
return !_lodash.default.isNil(this.mediaUrl) && this.mediaUrl !== '';
|
|
364
275
|
}
|
|
365
|
-
|
|
366
276
|
hasAnswersWithMedia() {
|
|
367
277
|
return _lodash.default.some(this.answers, answer => answer.concept.hasMediaUrl() || answer.concept.hasMediaType());
|
|
368
278
|
}
|
|
369
|
-
|
|
370
279
|
hasMedia() {
|
|
371
280
|
return this.hasMediaUrl() || this.hasMediaType() || this.hasAnswersWithMedia();
|
|
372
281
|
}
|
|
373
|
-
|
|
374
282
|
}
|
|
375
|
-
|
|
376
283
|
exports.default = Concept;
|
|
377
|
-
|
|
378
284
|
_defineProperty(Concept, "StandardConcepts", {
|
|
379
285
|
OtherConceptUUID: "05ea583c-51d2-412d-ad00-06c432ffe538",
|
|
380
286
|
NoneConceptUUID: "ebda5e05-a995-43ca-ad1a-30af3b937539"
|
|
381
287
|
});
|
|
382
|
-
|
|
383
288
|
_defineProperty(Concept, "schema", {
|
|
384
289
|
name: _SchemaNames.default.Concept,
|
|
385
290
|
primaryKey: "uuid",
|
|
@@ -429,7 +334,6 @@ _defineProperty(Concept, "schema", {
|
|
|
429
334
|
}
|
|
430
335
|
}
|
|
431
336
|
});
|
|
432
|
-
|
|
433
337
|
_defineProperty(Concept, "keys", {
|
|
434
338
|
isWithinCatchment: 'isWithinCatchment',
|
|
435
339
|
lowestAddressLevelTypeUUIDs: 'lowestAddressLevelTypeUUIDs',
|
|
@@ -439,11 +343,9 @@ _defineProperty(Concept, "keys", {
|
|
|
439
343
|
encounterScope: 'encounterScope',
|
|
440
344
|
encounterIdentifier: 'encounterIdentifier'
|
|
441
345
|
});
|
|
442
|
-
|
|
443
346
|
_defineProperty(Concept, "encounterScopes", {
|
|
444
347
|
withinSubject: "Within Subject"
|
|
445
348
|
});
|
|
446
|
-
|
|
447
349
|
_defineProperty(Concept, "dataType", {
|
|
448
350
|
Date: "Date",
|
|
449
351
|
DateTime: "DateTime",
|
|
@@ -467,15 +369,11 @@ _defineProperty(Concept, "dataType", {
|
|
|
467
369
|
QuestionGroup: "QuestionGroup",
|
|
468
370
|
File: "File",
|
|
469
371
|
Encounter: "Encounter",
|
|
470
|
-
|
|
471
372
|
get Media() {
|
|
472
373
|
return [this.Image, this.ImageV2, this.Video, this.Audio, this.File];
|
|
473
374
|
}
|
|
474
|
-
|
|
475
375
|
});
|
|
476
|
-
|
|
477
376
|
_defineProperty(Concept, "merge", () => _BaseEntity.default.mergeOn("answers"));
|
|
478
|
-
|
|
479
377
|
const MediaType = {
|
|
480
378
|
Image: "Image"
|
|
481
379
|
};
|
package/dist/ConceptAnswer.js
CHANGED
|
@@ -4,54 +4,41 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
9
|
-
|
|
10
8
|
var _ResourceUtil = _interopRequireDefault(require("./utility/ResourceUtil"));
|
|
11
|
-
|
|
12
9
|
var _Concept = _interopRequireDefault(require("./Concept"));
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
13
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
14
|
class ConceptAnswer extends _BaseEntity.default {
|
|
19
15
|
constructor(that = null) {
|
|
20
16
|
super(that);
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
get abnormal() {
|
|
24
19
|
return this.that.abnormal;
|
|
25
20
|
}
|
|
26
|
-
|
|
27
21
|
set abnormal(x) {
|
|
28
22
|
this.that.abnormal = x;
|
|
29
23
|
}
|
|
30
|
-
|
|
31
24
|
get answerOrder() {
|
|
32
25
|
return this.that.answerOrder;
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
set answerOrder(x) {
|
|
36
28
|
this.that.answerOrder = x;
|
|
37
29
|
}
|
|
38
|
-
|
|
39
30
|
get unique() {
|
|
40
31
|
return this.that.unique;
|
|
41
32
|
}
|
|
42
|
-
|
|
43
33
|
set unique(x) {
|
|
44
34
|
this.that.unique = x;
|
|
45
35
|
}
|
|
46
|
-
|
|
47
36
|
get concept() {
|
|
48
37
|
return this.toEntity("concept", _Concept.default);
|
|
49
38
|
}
|
|
50
|
-
|
|
51
39
|
set concept(x) {
|
|
52
40
|
this.that.concept = this.fromObject(x);
|
|
53
41
|
}
|
|
54
|
-
|
|
55
42
|
static fromResource(resource, entityService) {
|
|
56
43
|
const conceptAnswer = new ConceptAnswer();
|
|
57
44
|
conceptAnswer.concept = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "conceptAnswerUUID"), _Concept.default.schema.name);
|
|
@@ -60,14 +47,10 @@ class ConceptAnswer extends _BaseEntity.default {
|
|
|
60
47
|
conceptAnswer.abnormal = resource.abnormal;
|
|
61
48
|
conceptAnswer.unique = resource.unique;
|
|
62
49
|
conceptAnswer.voided = resource.voided || false; //This change should be independently deployable irrespective of server
|
|
63
|
-
|
|
64
50
|
return conceptAnswer;
|
|
65
51
|
}
|
|
66
|
-
|
|
67
52
|
}
|
|
68
|
-
|
|
69
53
|
exports.default = ConceptAnswer;
|
|
70
|
-
|
|
71
54
|
_defineProperty(ConceptAnswer, "schema", {
|
|
72
55
|
name: "ConceptAnswer",
|
|
73
56
|
primaryKey: "uuid",
|
|
@@ -4,84 +4,62 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
9
|
-
|
|
10
8
|
var _Dashboard = _interopRequireDefault(require("./Dashboard"));
|
|
11
|
-
|
|
12
9
|
var _General = _interopRequireDefault(require("./utility/General"));
|
|
13
|
-
|
|
14
10
|
var _ReportCardResult = _interopRequireDefault(require("./reports/ReportCardResult"));
|
|
15
|
-
|
|
16
11
|
var _NestedReportCardResult = _interopRequireDefault(require("./reports/NestedReportCardResult"));
|
|
17
|
-
|
|
18
12
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
17
|
class CustomDashboardCache extends _BaseEntity.default {
|
|
25
18
|
constructor(that = null) {
|
|
26
19
|
super(that);
|
|
27
20
|
}
|
|
28
|
-
|
|
29
21
|
get updatedAt() {
|
|
30
22
|
return this.that.updatedAt;
|
|
31
23
|
}
|
|
32
|
-
|
|
33
24
|
set updatedAt(x) {
|
|
34
25
|
this.that.updatedAt = x;
|
|
35
26
|
}
|
|
36
|
-
|
|
37
27
|
get selectedValuesJSON() {
|
|
38
28
|
return this.that.selectedValuesJSON;
|
|
39
29
|
}
|
|
40
|
-
|
|
41
30
|
set selectedValuesJSON(x) {
|
|
42
31
|
this.that.selectedValuesJSON = x;
|
|
43
32
|
}
|
|
44
|
-
|
|
45
33
|
get filterApplied() {
|
|
46
34
|
return this.that.filterApplied;
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
set filterApplied(x) {
|
|
50
37
|
this.that.filterApplied = x;
|
|
51
38
|
}
|
|
52
|
-
|
|
53
39
|
get dashboard() {
|
|
54
40
|
return this.toEntity("dashboard", _Dashboard.default);
|
|
55
41
|
}
|
|
56
|
-
|
|
57
42
|
set dashboard(x) {
|
|
58
43
|
this.that.dashboard = this.fromObject(x);
|
|
59
44
|
}
|
|
60
|
-
|
|
61
45
|
get dashboardFiltersHash() {
|
|
62
46
|
return this.that.dashboardFiltersHash;
|
|
63
47
|
}
|
|
64
|
-
|
|
65
48
|
set dashboardFiltersHash(x) {
|
|
66
49
|
this.that.dashboardFiltersHash = x;
|
|
67
50
|
}
|
|
68
|
-
|
|
69
51
|
get reportCardResults() {
|
|
70
52
|
return this.toEntityList("reportCardResults", _ReportCardResult.default);
|
|
71
53
|
}
|
|
72
|
-
|
|
73
54
|
set reportCardResults(x) {
|
|
74
55
|
this.that.reportCardResults = this.fromEntityList(x);
|
|
75
56
|
}
|
|
76
|
-
|
|
77
57
|
get nestedReportCardResults() {
|
|
78
58
|
return this.toEntityList("nestedReportCardResults", _NestedReportCardResult.default);
|
|
79
59
|
}
|
|
80
|
-
|
|
81
60
|
set nestedReportCardResults(x) {
|
|
82
61
|
this.that.nestedReportCardResults = this.fromEntityList(x);
|
|
83
62
|
}
|
|
84
|
-
|
|
85
63
|
static newInstance(dashboard, dashboardFiltersHash) {
|
|
86
64
|
const customDashboardCache = new CustomDashboardCache();
|
|
87
65
|
customDashboardCache.uuid = _General.default.randomUUID();
|
|
@@ -89,7 +67,6 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
89
67
|
customDashboardCache.reset(dashboardFiltersHash);
|
|
90
68
|
return customDashboardCache;
|
|
91
69
|
}
|
|
92
|
-
|
|
93
70
|
reset(dashboardFiltersHash) {
|
|
94
71
|
this.filterApplied = false;
|
|
95
72
|
this.selectedValuesJSON = JSON.stringify({});
|
|
@@ -98,14 +75,11 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
98
75
|
this.reportCardResults = [];
|
|
99
76
|
this.nestedReportCardResults = [];
|
|
100
77
|
}
|
|
101
|
-
|
|
102
78
|
getSelectedValues() {
|
|
103
79
|
return JSON.parse(this.selectedValuesJSON);
|
|
104
80
|
}
|
|
105
|
-
|
|
106
81
|
getReportCardResult(reportCard) {
|
|
107
82
|
const result = this.reportCardResults.find(reportCardResult => reportCardResult.reportCard === reportCard.uuid && reportCardResult.dashboard === this.dashboard.uuid);
|
|
108
|
-
|
|
109
83
|
if (_lodash.default.isNil(result)) {
|
|
110
84
|
return result;
|
|
111
85
|
} else {
|
|
@@ -114,7 +88,6 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
114
88
|
return result;
|
|
115
89
|
}
|
|
116
90
|
}
|
|
117
|
-
|
|
118
91
|
getNestedReportCardResults(reportCard) {
|
|
119
92
|
return this.nestedReportCardResults.filter(nestedReportCardResult => nestedReportCardResult.reportCard === reportCard.uuid && nestedReportCardResult.dashboard === this.dashboard.uuid).map(x => {
|
|
120
93
|
x.clickable = true;
|
|
@@ -122,7 +95,6 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
122
95
|
return x;
|
|
123
96
|
});
|
|
124
97
|
}
|
|
125
|
-
|
|
126
98
|
clone() {
|
|
127
99
|
const customDashboardCache = new CustomDashboardCache();
|
|
128
100
|
customDashboardCache.uuid = this.uuid;
|
|
@@ -135,21 +107,16 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
135
107
|
customDashboardCache.nestedReportCardResults = this.nestedReportCardResults;
|
|
136
108
|
return customDashboardCache;
|
|
137
109
|
}
|
|
138
|
-
|
|
139
110
|
matchNestedReportCardResult(nestedReportCardResult) {
|
|
140
111
|
return this.nestedReportCardResults.find(x => x.reportCard === nestedReportCardResult.reportCard && x.itemKey === nestedReportCardResult.itemKey && x.dashboard === this.dashboard.uuid);
|
|
141
112
|
}
|
|
142
|
-
|
|
143
113
|
matchReportCardResult(reportCardResult) {
|
|
144
114
|
return this.reportCardResults.find(x => x.reportCard === reportCardResult.reportCard && x.dashboard === this.dashboard.uuid);
|
|
145
115
|
}
|
|
146
|
-
|
|
147
116
|
isCachePopulated() {
|
|
148
117
|
return _lodash.default.isNil(this.updatedAt);
|
|
149
118
|
}
|
|
150
|
-
|
|
151
119
|
}
|
|
152
|
-
|
|
153
120
|
_defineProperty(CustomDashboardCache, "schema", {
|
|
154
121
|
name: "CustomDashboardCache",
|
|
155
122
|
primaryKey: "uuid",
|
|
@@ -176,6 +143,5 @@ _defineProperty(CustomDashboardCache, "schema", {
|
|
|
176
143
|
}
|
|
177
144
|
}
|
|
178
145
|
});
|
|
179
|
-
|
|
180
146
|
var _default = CustomDashboardCache;
|
|
181
147
|
exports.default = _default;
|