openchs-models 1.30.99 → 1.31.1
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/Makefile +1 -1
- package/dist/BaseEntity.js +15 -4
- package/dist/Checklist.js +0 -6
- package/dist/ChecklistItem.js +0 -4
- package/dist/Encounter.js +0 -4
- package/dist/EntityApprovalStatus.js +0 -27
- package/dist/GroupSubject.js +13 -3
- package/dist/Individual.js +2 -21
- package/dist/Observation.js +5 -0
- package/dist/ObservationsHolder.js +6 -13
- package/dist/ProgramEncounter.js +0 -4
- package/dist/ProgramEnrolment.js +0 -12
- package/dist/StandardReportCardType.js +0 -11
- package/dist/application/FormMapping.js +52 -0
- package/dist/error/ErrorCodes.js +2 -1
- package/dist/error/IgnorableSyncError.js +20 -0
- package/dist/framework/RealmResultsProxy.js +1 -3
- package/dist/index.js +8 -0
- package/dist/observation/MultipleCodedValues.js +2 -2
- package/dist/observation/PrimitiveValue.js +3 -1
- package/dist/observation/SingleCodedValue.js +2 -2
- package/dist/utility/General.js +0 -5
- package/package.json +1 -1
package/Makefile
CHANGED
package/dist/BaseEntity.js
CHANGED
|
@@ -19,7 +19,7 @@ var _PersistedObject = _interopRequireDefault(require("./PersistedObject"));
|
|
|
19
19
|
|
|
20
20
|
var _ArrayHelper = _interopRequireDefault(require("./framework/ArrayHelper"));
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _IgnorableSyncError = _interopRequireDefault(require("./error/IgnorableSyncError"));
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
|
|
@@ -111,7 +111,7 @@ class BaseEntity extends _PersistedObject.default {
|
|
|
111
111
|
return this.toString();
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
static getParentEntity(entityService, childEntityClass, childResource, parentUUIDField, parentSchema) {
|
|
114
|
+
static getParentEntity(entityService, childEntityClass, childResource, parentUUIDField, parentSchema, isIgnorable = false, explicitErrorCodeKey = undefined) {
|
|
115
115
|
const childUuid = childResource.uuid;
|
|
116
116
|
|
|
117
117
|
const parentUuid = _ResourceUtil.default.getUUIDFor(childResource, parentUUIDField);
|
|
@@ -123,8 +123,19 @@ class BaseEntity extends _PersistedObject.default {
|
|
|
123
123
|
return parent;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
BaseEntity.throwSyncError(childSchema, parentSchema, childUuid, parentUuid, isIgnorable, explicitErrorCodeKey);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
static throwSyncError(childSchema, parentSchema, childUuid, parentUuid, isIgnorable, explicitErrorCodeKey) {
|
|
130
|
+
const errorCodeKey = explicitErrorCodeKey ? explicitErrorCodeKey : `${childSchema}-${parentSchema}-Association`;
|
|
131
|
+
const code = _ErrorCodes.ErrorCodes[errorCodeKey];
|
|
132
|
+
const message = `${childSchema}{uuid='${childUuid}'} is unable to find ${parentSchema}{uuid='${parentUuid}'}`;
|
|
133
|
+
|
|
134
|
+
if (isIgnorable) {
|
|
135
|
+
throw new _IgnorableSyncError.default(code, message);
|
|
136
|
+
} else {
|
|
137
|
+
throw new _SyncError.default(code, message);
|
|
138
|
+
}
|
|
128
139
|
}
|
|
129
140
|
|
|
130
141
|
}
|
package/dist/Checklist.js
CHANGED
|
@@ -21,8 +21,6 @@ var _ChecklistDetail = _interopRequireDefault(require("./ChecklistDetail"));
|
|
|
21
21
|
|
|
22
22
|
var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
|
|
23
23
|
|
|
24
|
-
var _EntityApprovalStatus = _interopRequireDefault(require("./EntityApprovalStatus"));
|
|
25
|
-
|
|
26
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
25
|
|
|
28
26
|
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; }
|
|
@@ -128,10 +126,6 @@ class Checklist extends _BaseEntity.default {
|
|
|
128
126
|
}`;
|
|
129
127
|
}
|
|
130
128
|
|
|
131
|
-
addApprovalDescendantsWithLatestStatus(approvalStatus_status, list) {
|
|
132
|
-
_EntityApprovalStatus.default.addMatchingApprovalStatusEntity(this.items, approvalStatus_status, "baseDate", list);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
129
|
}
|
|
136
130
|
|
|
137
131
|
_defineProperty(Checklist, "schema", {
|
package/dist/ChecklistItem.js
CHANGED
|
@@ -305,10 +305,6 @@ class ChecklistItem extends _BaseEntity.default {
|
|
|
305
305
|
this.that.latestEntityApprovalStatus = this.fromObject(entityApprovalStatus);
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
getSchemaName() {
|
|
309
|
-
return _SchemaNames.default.ChecklistItem;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
308
|
}
|
|
313
309
|
|
|
314
310
|
_defineProperty(ChecklistItem, "schema", {
|
package/dist/Encounter.js
CHANGED
|
@@ -22,17 +22,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
22
22
|
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
23
|
|
|
24
24
|
class EntityApprovalStatus extends _BaseEntity.default {
|
|
25
|
-
static getMatchingApprovalStatusEntity(entities, approvalStatus_status, latestFieldPath) {
|
|
26
|
-
return _lodash.default.max(entities.filter(x => !_lodash.default.isNil(x.latestEntityApprovalStatus) && x.latestEntityApprovalStatus.hasStatus(approvalStatus_status)), y => _lodash.default.get(y, latestFieldPath));
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static addMatchingApprovalStatusEntity(entities, approvalStatus_status, latestFieldPath, list, groupingByPath) {
|
|
30
|
-
Object.values(_lodash.default.groupBy(entities, x => _lodash.default.get(x, groupingByPath))).forEach(y => {
|
|
31
|
-
const latestEntity = EntityApprovalStatus.getMatchingApprovalStatusEntity(y, approvalStatus_status, latestFieldPath);
|
|
32
|
-
if (!_lodash.default.isNil(latestEntity)) list.push(latestEntity);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
25
|
static getApprovalEntitiesSchema() {
|
|
37
26
|
return [_SchemaNames.default.Individual, _SchemaNames.default.ProgramEncounter, _SchemaNames.default.Encounter, _SchemaNames.default.ProgramEnrolment, _SchemaNames.default.ChecklistItem];
|
|
38
27
|
}
|
|
@@ -152,22 +141,6 @@ class EntityApprovalStatus extends _BaseEntity.default {
|
|
|
152
141
|
}];
|
|
153
142
|
}
|
|
154
143
|
|
|
155
|
-
hasStatus(status) {
|
|
156
|
-
return this.approvalStatus.status === status;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
get isRejected() {
|
|
160
|
-
return this.approvalStatus.isRejected;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
get isApproved() {
|
|
164
|
-
return this.approvalStatus.isApproved;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
get isPending() {
|
|
168
|
-
return this.approvalStatus.isPending;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
144
|
}
|
|
172
145
|
|
|
173
146
|
_defineProperty(EntityApprovalStatus, "schema", {
|
package/dist/GroupSubject.js
CHANGED
|
@@ -105,13 +105,21 @@ class GroupSubject extends _BaseEntity.default {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
static fromResource(resource, entityService) {
|
|
108
|
-
const
|
|
109
|
-
const
|
|
108
|
+
const childResource = resource;
|
|
109
|
+
const childEntityClass = GroupSubject;
|
|
110
|
+
const parentSchema = _Individual.default.schema.name;
|
|
111
|
+
const groupSubjectParentIdField = "groupSubjectUUID";
|
|
112
|
+
const memberSubjectParentIdField = "memberSubjectUUID";
|
|
113
|
+
|
|
114
|
+
const groupOrHouseholdSubject = _BaseEntity.default.getParentEntity(entityService, childEntityClass, childResource, groupSubjectParentIdField, parentSchema, true, GroupSubject.EXPLICIT_ERROR_CODE_KEY_FOR_MISSING_GROUP);
|
|
115
|
+
|
|
116
|
+
const memberSubject = _BaseEntity.default.getParentEntity(entityService, childEntityClass, childResource, memberSubjectParentIdField, parentSchema);
|
|
117
|
+
|
|
110
118
|
const groupRole = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "groupRoleUUID"), _GroupRole.default.schema.name);
|
|
111
119
|
|
|
112
120
|
const groupSubjectEntity = _General.default.assignFields(resource, new GroupSubject(), ["uuid", "voided"], ["membershipStartDate", "membershipEndDate"]);
|
|
113
121
|
|
|
114
|
-
groupSubjectEntity.groupSubject =
|
|
122
|
+
groupSubjectEntity.groupSubject = groupOrHouseholdSubject;
|
|
115
123
|
groupSubjectEntity.memberSubject = memberSubject;
|
|
116
124
|
groupSubjectEntity.groupRole = groupRole;
|
|
117
125
|
return groupSubjectEntity;
|
|
@@ -177,6 +185,8 @@ class GroupSubject extends _BaseEntity.default {
|
|
|
177
185
|
|
|
178
186
|
}
|
|
179
187
|
|
|
188
|
+
_defineProperty(GroupSubject, "EXPLICIT_ERROR_CODE_KEY_FOR_MISSING_GROUP", 'GroupSubjectMapping-GroupSubject-Association');
|
|
189
|
+
|
|
180
190
|
_defineProperty(GroupSubject, "schema", {
|
|
181
191
|
name: "GroupSubject",
|
|
182
192
|
primaryKey: "uuid",
|
package/dist/Individual.js
CHANGED
|
@@ -330,7 +330,7 @@ class Individual extends _BaseEntity.default {
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
static associateRelationship(child, childEntityClass, childResource, entityService) {
|
|
333
|
-
|
|
333
|
+
var individual = _BaseEntity.default.getParentEntity(entityService, childEntityClass, childResource, "individualAUUID", Individual.schema.name);
|
|
334
334
|
|
|
335
335
|
individual = _General.default.pick(individual, ["uuid"], ["enrolments", "encounters", "relationships", "groupSubjects", "comments", "groups"]);
|
|
336
336
|
|
|
@@ -351,7 +351,7 @@ class Individual extends _BaseEntity.default {
|
|
|
351
351
|
|
|
352
352
|
|
|
353
353
|
try {
|
|
354
|
-
|
|
354
|
+
var memberSubject = getParentByUUID("memberSubjectUUID");
|
|
355
355
|
memberSubject = copyFieldsForSubject(memberSubject);
|
|
356
356
|
|
|
357
357
|
_BaseEntity.default.addNewChild(child, memberSubject.groups);
|
|
@@ -971,21 +971,6 @@ class Individual extends _BaseEntity.default {
|
|
|
971
971
|
this.that.latestEntityApprovalStatus = this.fromObject(entityApprovalStatus);
|
|
972
972
|
}
|
|
973
973
|
|
|
974
|
-
getMemberEntitiesWithLatestStatus(approvalStatus_status) {
|
|
975
|
-
let descendants = [];
|
|
976
|
-
if (!_lodash.default.isNil(this.latestEntityApprovalStatus) && this.latestEntityApprovalStatus.hasStatus(approvalStatus_status)) descendants.push(this);
|
|
977
|
-
|
|
978
|
-
_EntityApprovalStatus.default.addMatchingApprovalStatusEntity(this.nonVoidedEncounters(), approvalStatus_status, "encounterDateTime", descendants, "encounterType.uuid");
|
|
979
|
-
|
|
980
|
-
_EntityApprovalStatus.default.addMatchingApprovalStatusEntity(this.nonVoidedEnrolments(), approvalStatus_status, "enrolmentDateTime", descendants, "program.uuid");
|
|
981
|
-
|
|
982
|
-
this.nonVoidedEnrolments().forEach(enrolment => {
|
|
983
|
-
const latestEntity = enrolment.addApprovalDescendantsWithLatestStatus(approvalStatus_status, descendants);
|
|
984
|
-
if (!_lodash.default.isNil(latestEntity)) descendants.push(latestEntity);
|
|
985
|
-
});
|
|
986
|
-
return descendants;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
974
|
toJSON() {
|
|
990
975
|
return {
|
|
991
976
|
uuid: this.uuid,
|
|
@@ -1011,10 +996,6 @@ class Individual extends _BaseEntity.default {
|
|
|
1011
996
|
};
|
|
1012
997
|
}
|
|
1013
998
|
|
|
1014
|
-
getSchemaName() {
|
|
1015
|
-
return _SchemaNames.default.Individual;
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
999
|
}
|
|
1019
1000
|
|
|
1020
1001
|
_defineProperty(Individual, "schema", {
|
package/dist/Observation.js
CHANGED
|
@@ -121,9 +121,9 @@ class ObservationsHolder {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
addOrUpdatePrimitiveObs(concept, value, answerSource =
|
|
124
|
+
addOrUpdatePrimitiveObs(concept, value, answerSource = _Observation.default.AnswerSource.Manual) {
|
|
125
125
|
let currentObservation = this.findObservation(concept);
|
|
126
|
-
const currentValue = currentObservation && currentObservation.getValueWrapper() || {};
|
|
126
|
+
const currentValue = currentObservation && currentObservation.getValueWrapper() || {};
|
|
127
127
|
|
|
128
128
|
this._removeExistingObs(concept);
|
|
129
129
|
|
|
@@ -146,7 +146,7 @@ class ObservationsHolder {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
addOrUpdateCodedObs(concept, value, isSingleSelect) {
|
|
149
|
+
addOrUpdateCodedObs(concept, value, isSingleSelect, answerSource = _Observation.default.AnswerSource.Auto) {
|
|
150
150
|
this._removeExistingObs(concept);
|
|
151
151
|
|
|
152
152
|
const getConceptUUID = conceptAnswer => conceptAnswer ? conceptAnswer.concept.uuid : undefined;
|
|
@@ -154,7 +154,7 @@ class ObservationsHolder {
|
|
|
154
154
|
if (!_lodash.default.isEmpty(value)) {
|
|
155
155
|
const answerUUID = isSingleSelect ? getConceptUUID(concept.getAnswerWithConceptName(value)) : value.map(v => getConceptUUID(concept.getAnswerWithConceptName(v)));
|
|
156
156
|
|
|
157
|
-
const observation = _Observation.default.create(concept, isSingleSelect ? new _SingleCodedValue.default(answerUUID,
|
|
157
|
+
const observation = _Observation.default.create(concept, isSingleSelect ? new _SingleCodedValue.default(answerUUID, answerSource) : new _MultipleCodedValues.default(answerUUID, answerSource));
|
|
158
158
|
|
|
159
159
|
this.observations.push(observation);
|
|
160
160
|
}
|
|
@@ -300,15 +300,7 @@ class ObservationsHolder {
|
|
|
300
300
|
});
|
|
301
301
|
});
|
|
302
302
|
} else {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if (!_lodash.default.isNil(observation) && observation.valueJSON.answerSource === _General.default.AnswerSource.Manual) {
|
|
306
|
-
_General.default.logDebug('ObservationsHolder', 'updatePrimitiveCodedObs: Not updating because answerSource is manual');
|
|
307
|
-
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
concept.isCodedConcept() ? this.addOrUpdateCodedObs(concept, value, fe.isSingleSelect()) : this.addOrUpdatePrimitiveObs(concept, value, _General.default.AnswerSource.Auto);
|
|
303
|
+
concept.isCodedConcept() ? this.addOrUpdateCodedObs(concept, value, fe.isSingleSelect()) : this.addOrUpdatePrimitiveObs(concept, value, _Observation.default.AnswerSource.Auto);
|
|
312
304
|
}
|
|
313
305
|
}
|
|
314
306
|
});
|
|
@@ -334,6 +326,7 @@ class ObservationsHolder {
|
|
|
334
326
|
return null;
|
|
335
327
|
}
|
|
336
328
|
|
|
329
|
+
observation.valueJSON.answerSource = _Observation.default.AnswerSource.Manual;
|
|
337
330
|
return observation;
|
|
338
331
|
}
|
|
339
332
|
}
|
package/dist/ProgramEncounter.js
CHANGED
|
@@ -145,10 +145,6 @@ class ProgramEncounter extends _AbstractEncounter.default {
|
|
|
145
145
|
this.that.latestEntityApprovalStatus = this.fromObject(entityApprovalStatus);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
getSchemaName() {
|
|
149
|
-
return _SchemaNames.default.ProgramEncounter;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
148
|
}
|
|
153
149
|
|
|
154
150
|
_defineProperty(ProgramEncounter, "fieldKeys", {
|
package/dist/ProgramEnrolment.js
CHANGED
|
@@ -591,14 +591,6 @@ class ProgramEnrolment extends _BaseEntity.default {
|
|
|
591
591
|
this.that.latestEntityApprovalStatus = this.fromObject(entityApprovalStatus);
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
-
addApprovalDescendantsWithLatestStatus(approvalStatus_status, list) {
|
|
595
|
-
_EntityApprovalStatus.default.addMatchingApprovalStatusEntity(this.nonVoidedEncounters(), approvalStatus_status, "encounterDateTime", list, "encounterType.uuid");
|
|
596
|
-
|
|
597
|
-
this.checklists.filter(x => !x.voided).forEach(x => {
|
|
598
|
-
x.addApprovalDescendantsWithLatestStatus(approvalStatus_status, list);
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
|
|
602
594
|
toJSON() {
|
|
603
595
|
return {
|
|
604
596
|
uuid: this.uuid,
|
|
@@ -619,10 +611,6 @@ class ProgramEnrolment extends _BaseEntity.default {
|
|
|
619
611
|
};
|
|
620
612
|
}
|
|
621
613
|
|
|
622
|
-
getSchemaName() {
|
|
623
|
-
return _SchemaNames.default.ProgramEnrolment;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
614
|
}
|
|
627
615
|
|
|
628
616
|
_defineProperty(ProgramEnrolment, "schema", {
|
|
@@ -11,8 +11,6 @@ var _General = _interopRequireDefault(require("./utility/General"));
|
|
|
11
11
|
|
|
12
12
|
var _TaskType = _interopRequireDefault(require("./task/TaskType"));
|
|
13
13
|
|
|
14
|
-
var _ApprovalStatus = _interopRequireDefault(require("./ApprovalStatus"));
|
|
15
|
-
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
15
|
|
|
18
16
|
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; }
|
|
@@ -112,10 +110,6 @@ class StandardReportCardType extends _BaseEntity.default {
|
|
|
112
110
|
return _.includes(this.defaultTypes(), this.name);
|
|
113
111
|
}
|
|
114
112
|
|
|
115
|
-
getApprovalStatusForType() {
|
|
116
|
-
return typeToStatusMap[this.name];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
113
|
}
|
|
120
114
|
|
|
121
115
|
_defineProperty(StandardReportCardType, "schema", {
|
|
@@ -151,10 +145,5 @@ _defineProperty(StandardReportCardType, "type", {
|
|
|
151
145
|
DueChecklist: "Due checklist"
|
|
152
146
|
});
|
|
153
147
|
|
|
154
|
-
const typeToStatusMap = {
|
|
155
|
-
[StandardReportCardType.type.PendingApproval]: _ApprovalStatus.default.statuses.Pending,
|
|
156
|
-
[StandardReportCardType.type.Approved]: _ApprovalStatus.default.statuses.Approved,
|
|
157
|
-
[StandardReportCardType.type.Rejected]: _ApprovalStatus.default.statuses.Rejected
|
|
158
|
-
};
|
|
159
148
|
var _default = StandardReportCardType;
|
|
160
149
|
exports.default = _default;
|
|
@@ -100,6 +100,58 @@ class FormMapping extends _BaseEntity.default {
|
|
|
100
100
|
return formMapping;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
getSchemaAndFilterQuery() {
|
|
104
|
+
switch (this.form.formType) {
|
|
105
|
+
case _Form.default.formTypes.IndividualProfile:
|
|
106
|
+
return {
|
|
107
|
+
schema: "Individual",
|
|
108
|
+
filterQuery: `subjectType.uuid = '${this.subjectType.uuid}'`
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
case _Form.default.formTypes.IndividualEncounterCancellation:
|
|
112
|
+
return {
|
|
113
|
+
schema: "Encounter",
|
|
114
|
+
filterQuery: `individual.subjectType.uuid = '${this.subjectType.uuid}' and encounterType.uuid = '${this.observationsTypeEntityUUID}' and cancelDateTime <> null`
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
case _Form.default.formTypes.Encounter:
|
|
118
|
+
return {
|
|
119
|
+
schema: "Encounter",
|
|
120
|
+
filterQuery: `individual.subjectType.uuid = '${this.subjectType.uuid}' and encounterType.uuid = '${this.observationsTypeEntityUUID}' and cancelDateTime = null`
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
case _Form.default.formTypes.ProgramEnrolment:
|
|
124
|
+
return {
|
|
125
|
+
schema: "ProgramEnrolment",
|
|
126
|
+
filterQuery: `individual.subjectType.uuid = '${this.subjectType.uuid}' and program.uuid = '${this.entityUUID}' and programExitDateTime = null`
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
case _Form.default.formTypes.ProgramExit:
|
|
130
|
+
return {
|
|
131
|
+
schema: "ProgramEnrolment",
|
|
132
|
+
filterQuery: `individual.subjectType.uuid = '${this.subjectType.uuid}' and program.uuid = '${this.entityUUID}' and programExitDateTime <> null`
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
case _Form.default.formTypes.ProgramEncounter:
|
|
136
|
+
return {
|
|
137
|
+
schema: "ProgramEncounter",
|
|
138
|
+
filterQuery: `programEnrolment.individual.subjectType.uuid = '${this.subjectType.uuid}' and programEnrolment.program.uuid = '${this.entityUUID}' and encounterType.uuid = '${this.observationsTypeEntityUUID}' and cancelDateTime = null`
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
case _Form.default.formTypes.ProgramEncounterCancellation:
|
|
142
|
+
return {
|
|
143
|
+
schema: "ProgramEncounter",
|
|
144
|
+
filterQuery: `programEnrolment.individual.subjectType.uuid = '${this.subjectType.uuid}' and programEnrolment.program.uuid = '${this.entityUUID}' and encounterType.uuid = '${this.observationsTypeEntityUUID}' and cancelDateTime <> null`
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
case _Form.default.formTypes.ChecklistItem:
|
|
148
|
+
return {
|
|
149
|
+
schema: "ChecklistItem",
|
|
150
|
+
filterQuery: ''
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
103
155
|
getEntityNameAndEntityTypeUUID() {
|
|
104
156
|
const formTypes = _Form.default.formTypes;
|
|
105
157
|
|
package/dist/error/ErrorCodes.js
CHANGED
|
@@ -18,6 +18,7 @@ const ErrorCodes = Object.freeze({
|
|
|
18
18
|
'Checklist-ProgramEnrolment-Association': 'Association error 11',
|
|
19
19
|
'ChecklistItem-Checklist-Association': 'Association error 12',
|
|
20
20
|
'VideoTelemetric-Video-Association': 'Association error 13',
|
|
21
|
-
'NoCatchmentFound': 'NoCatchmentFoundErrorMessage'
|
|
21
|
+
'NoCatchmentFound': 'NoCatchmentFoundErrorMessage',
|
|
22
|
+
'GroupSubjectMapping-GroupSubject-Association': 'Ignorable Association error 01'
|
|
22
23
|
});
|
|
23
24
|
exports.ErrorCodes = ErrorCodes;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _SyncError = _interopRequireDefault(require("./SyncError"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
class IgnorableSyncError extends _SyncError.default {
|
|
13
|
+
constructor(code, message, fileName, lineNumber) {
|
|
14
|
+
super(code, message, fileName, lineNumber);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var _default = IgnorableSyncError;
|
|
20
|
+
exports.default = _default;
|
|
@@ -60,9 +60,7 @@ class RealmResultsProxy {
|
|
|
60
60
|
|
|
61
61
|
filtered(query, ...args) {
|
|
62
62
|
if (this.logQueries) console.log(this.entityClass, query, ...args);
|
|
63
|
-
|
|
64
|
-
realmResultsProxy.setLogQueries(this.logQueries);
|
|
65
|
-
return realmResultsProxy;
|
|
63
|
+
return RealmResultsProxy.create(this.realmCollection.filtered(query, ...args), this.entityClass);
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
getAt(index) {
|
package/dist/index.js
CHANGED
|
@@ -615,6 +615,12 @@ Object.defineProperty(exports, "SyncError", {
|
|
|
615
615
|
return _SyncError.default;
|
|
616
616
|
}
|
|
617
617
|
});
|
|
618
|
+
Object.defineProperty(exports, "IgnorableSyncError", {
|
|
619
|
+
enumerable: true,
|
|
620
|
+
get: function () {
|
|
621
|
+
return _IgnorableSyncError.default;
|
|
622
|
+
}
|
|
623
|
+
});
|
|
618
624
|
Object.defineProperty(exports, "News", {
|
|
619
625
|
enumerable: true,
|
|
620
626
|
get: function () {
|
|
@@ -1004,6 +1010,8 @@ var _DashboardFilter = _interopRequireDefault(require("./reports/DashboardFilter
|
|
|
1004
1010
|
|
|
1005
1011
|
var _SyncError = _interopRequireDefault(require("./error/SyncError"));
|
|
1006
1012
|
|
|
1013
|
+
var _IgnorableSyncError = _interopRequireDefault(require("./error/IgnorableSyncError"));
|
|
1014
|
+
|
|
1007
1015
|
var _News = _interopRequireDefault(require("./News"));
|
|
1008
1016
|
|
|
1009
1017
|
var _Comment = _interopRequireDefault(require("./Comment"));
|
|
@@ -9,12 +9,12 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
9
9
|
|
|
10
10
|
var _ArrayHelper = _interopRequireDefault(require("../framework/ArrayHelper"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _Observation = _interopRequireDefault(require("../Observation"));
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
16
|
class MultipleCodedValues {
|
|
17
|
-
constructor(answer, answerSource =
|
|
17
|
+
constructor(answer, answerSource = _Observation.default.AnswerSource.Manual) {
|
|
18
18
|
this.answer = _lodash.default.isNil(answer) ? [] : answer;
|
|
19
19
|
this.answerSource = answerSource;
|
|
20
20
|
}
|
|
@@ -13,10 +13,12 @@ var _moment = _interopRequireDefault(require("moment"));
|
|
|
13
13
|
|
|
14
14
|
var _General = _interopRequireDefault(require("../utility/General"));
|
|
15
15
|
|
|
16
|
+
var _Observation = _interopRequireDefault(require("../Observation"));
|
|
17
|
+
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
19
|
|
|
18
20
|
class PrimitiveValue {
|
|
19
|
-
constructor(value, datatype, answerSource =
|
|
21
|
+
constructor(value, datatype, answerSource = _Observation.default.AnswerSource.Manual) {
|
|
20
22
|
this.value = value;
|
|
21
23
|
this.datatype = datatype;
|
|
22
24
|
this.answer = this._valueFromString();
|
|
@@ -7,12 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _Observation = _interopRequireDefault(require("../Observation"));
|
|
11
11
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
14
|
class SingleCodedValue {
|
|
15
|
-
constructor(answerUUID, answerSource =
|
|
15
|
+
constructor(answerUUID, answerSource = _Observation.default.AnswerSource.Manual) {
|
|
16
16
|
this.answer = answerUUID;
|
|
17
17
|
this.answerSource = answerSource;
|
|
18
18
|
}
|
package/dist/utility/General.js
CHANGED