openchs-models 1.30.94 → 1.30.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Checklist.js +6 -0
- package/dist/ChecklistItem.js +4 -0
- package/dist/Encounter.js +4 -0
- package/dist/EntityApprovalStatus.js +8 -0
- package/dist/Individual.js +17 -2
- package/dist/Observation.js +0 -5
- package/dist/ObservationsHolder.js +5 -5
- package/dist/ProgramEncounter.js +4 -0
- package/dist/ProgramEnrolment.js +13 -0
- package/dist/StandardReportCardType.js +11 -0
- package/dist/framework/RealmResultsProxy.js +3 -1
- package/dist/observation/MultipleCodedValues.js +2 -2
- package/dist/observation/PrimitiveValue.js +1 -3
- package/dist/observation/SingleCodedValue.js +2 -2
- package/dist/utility/General.js +5 -0
- package/package.json +1 -1
package/dist/Checklist.js
CHANGED
|
@@ -21,6 +21,8 @@ var _ChecklistDetail = _interopRequireDefault(require("./ChecklistDetail"));
|
|
|
21
21
|
|
|
22
22
|
var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
|
|
23
23
|
|
|
24
|
+
var _EntityApprovalStatus = _interopRequireDefault(require("./EntityApprovalStatus"));
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
26
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; }
|
|
@@ -126,6 +128,10 @@ class Checklist extends _BaseEntity.default {
|
|
|
126
128
|
}`;
|
|
127
129
|
}
|
|
128
130
|
|
|
131
|
+
getApprovalDescendantsWithLatestStatus(approvalStatus_status) {
|
|
132
|
+
return _EntityApprovalStatus.default.getMatchingApprovalStatusEntity(this.items, approvalStatus_status);
|
|
133
|
+
}
|
|
134
|
+
|
|
129
135
|
}
|
|
130
136
|
|
|
131
137
|
_defineProperty(Checklist, "schema", {
|
package/dist/ChecklistItem.js
CHANGED
|
@@ -305,6 +305,10 @@ 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
|
+
|
|
308
312
|
}
|
|
309
313
|
|
|
310
314
|
_defineProperty(ChecklistItem, "schema", {
|
package/dist/Encounter.js
CHANGED
|
@@ -22,6 +22,10 @@ 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) {
|
|
26
|
+
return entities.filter(x => !_lodash.default.isNil(x.latestEntityApprovalStatus) && x.latestEntityApprovalStatus.hasStatus(approvalStatus_status));
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
static getApprovalEntitiesSchema() {
|
|
26
30
|
return [_SchemaNames.default.Individual, _SchemaNames.default.ProgramEncounter, _SchemaNames.default.Encounter, _SchemaNames.default.ProgramEnrolment, _SchemaNames.default.ChecklistItem];
|
|
27
31
|
}
|
|
@@ -141,6 +145,10 @@ class EntityApprovalStatus extends _BaseEntity.default {
|
|
|
141
145
|
}];
|
|
142
146
|
}
|
|
143
147
|
|
|
148
|
+
hasStatus(status) {
|
|
149
|
+
return this.approvalStatus.status === status;
|
|
150
|
+
}
|
|
151
|
+
|
|
144
152
|
}
|
|
145
153
|
|
|
146
154
|
_defineProperty(EntityApprovalStatus, "schema", {
|
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
|
+
let 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
|
+
let memberSubject = getParentByUUID("memberSubjectUUID");
|
|
355
355
|
memberSubject = copyFieldsForSubject(memberSubject);
|
|
356
356
|
|
|
357
357
|
_BaseEntity.default.addNewChild(child, memberSubject.groups);
|
|
@@ -971,6 +971,17 @@ 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
|
+
descendants = descendants.concat(_EntityApprovalStatus.default.getMatchingApprovalStatusEntity(this.nonVoidedEnrolments(), approvalStatus_status));
|
|
978
|
+
descendants = descendants.concat(_EntityApprovalStatus.default.getMatchingApprovalStatusEntity(this.nonVoidedEncounters(), approvalStatus_status));
|
|
979
|
+
this.nonVoidedEnrolments().forEach(enrolment => {
|
|
980
|
+
descendants = descendants.concat(enrolment.getApprovalDescendantsWithLatestStatus(approvalStatus_status));
|
|
981
|
+
});
|
|
982
|
+
return descendants;
|
|
983
|
+
}
|
|
984
|
+
|
|
974
985
|
toJSON() {
|
|
975
986
|
return {
|
|
976
987
|
uuid: this.uuid,
|
|
@@ -996,6 +1007,10 @@ class Individual extends _BaseEntity.default {
|
|
|
996
1007
|
};
|
|
997
1008
|
}
|
|
998
1009
|
|
|
1010
|
+
getSchemaName() {
|
|
1011
|
+
return _SchemaNames.default.Individual;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
999
1014
|
}
|
|
1000
1015
|
|
|
1001
1016
|
_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 = _General.default.AnswerSource.Manual) {
|
|
125
125
|
let currentObservation = this.findObservation(concept);
|
|
126
|
-
const currentValue = currentObservation && currentObservation.getValueWrapper() || {};
|
|
126
|
+
const currentValue = currentObservation && currentObservation.getValueWrapper() || {}; // if (currentValue.answerSource === General.AnswerSource.Manual) return;
|
|
127
127
|
|
|
128
128
|
this._removeExistingObs(concept);
|
|
129
129
|
|
|
@@ -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, _General.default.AnswerSource.Auto) : new _MultipleCodedValues.default(answerUUID, _General.default.AnswerSource.Auto));
|
|
158
158
|
|
|
159
159
|
this.observations.push(observation);
|
|
160
160
|
}
|
|
@@ -302,13 +302,13 @@ class ObservationsHolder {
|
|
|
302
302
|
} else {
|
|
303
303
|
const observation = this.findObservation(concept);
|
|
304
304
|
|
|
305
|
-
if (!_lodash.default.isNil(observation) && observation.valueJSON.answerSource ===
|
|
305
|
+
if (!_lodash.default.isNil(observation) && observation.valueJSON.answerSource === _General.default.AnswerSource.Manual) {
|
|
306
306
|
_General.default.logDebug('ObservationsHolder', 'updatePrimitiveCodedObs: Not updating because answerSource is manual');
|
|
307
307
|
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
concept.isCodedConcept() ? this.addOrUpdateCodedObs(concept, value, fe.isSingleSelect()) : this.addOrUpdatePrimitiveObs(concept, value,
|
|
311
|
+
concept.isCodedConcept() ? this.addOrUpdateCodedObs(concept, value, fe.isSingleSelect()) : this.addOrUpdatePrimitiveObs(concept, value, _General.default.AnswerSource.Auto);
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
});
|
package/dist/ProgramEncounter.js
CHANGED
|
@@ -145,6 +145,10 @@ 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
|
+
|
|
148
152
|
}
|
|
149
153
|
|
|
150
154
|
_defineProperty(ProgramEncounter, "fieldKeys", {
|
package/dist/ProgramEnrolment.js
CHANGED
|
@@ -591,6 +591,15 @@ class ProgramEnrolment extends _BaseEntity.default {
|
|
|
591
591
|
this.that.latestEntityApprovalStatus = this.fromObject(entityApprovalStatus);
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
+
getApprovalDescendantsWithLatestStatus(approvalStatus_status) {
|
|
595
|
+
let descendants = _EntityApprovalStatus.default.getMatchingApprovalStatusEntity(this.nonVoidedEncounters(), approvalStatus_status);
|
|
596
|
+
|
|
597
|
+
this.checklists.filter(x => !x.voided).forEach(x => {
|
|
598
|
+
descendants = descendants.concat(x.getApprovalDescendantsWithLatestStatus(approvalStatus_status));
|
|
599
|
+
});
|
|
600
|
+
return descendants;
|
|
601
|
+
}
|
|
602
|
+
|
|
594
603
|
toJSON() {
|
|
595
604
|
return {
|
|
596
605
|
uuid: this.uuid,
|
|
@@ -611,6 +620,10 @@ class ProgramEnrolment extends _BaseEntity.default {
|
|
|
611
620
|
};
|
|
612
621
|
}
|
|
613
622
|
|
|
623
|
+
getSchemaName() {
|
|
624
|
+
return _SchemaNames.default.ProgramEnrolment;
|
|
625
|
+
}
|
|
626
|
+
|
|
614
627
|
}
|
|
615
628
|
|
|
616
629
|
_defineProperty(ProgramEnrolment, "schema", {
|
|
@@ -11,6 +11,8 @@ 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
|
+
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
18
|
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; }
|
|
@@ -110,6 +112,10 @@ class StandardReportCardType extends _BaseEntity.default {
|
|
|
110
112
|
return _.includes(this.defaultTypes(), this.name);
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
getApprovalStatusForType() {
|
|
116
|
+
return typeToStatusMap[this.name];
|
|
117
|
+
}
|
|
118
|
+
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
_defineProperty(StandardReportCardType, "schema", {
|
|
@@ -145,5 +151,10 @@ _defineProperty(StandardReportCardType, "type", {
|
|
|
145
151
|
DueChecklist: "Due checklist"
|
|
146
152
|
});
|
|
147
153
|
|
|
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
|
+
};
|
|
148
159
|
var _default = StandardReportCardType;
|
|
149
160
|
exports.default = _default;
|
|
@@ -60,7 +60,9 @@ class RealmResultsProxy {
|
|
|
60
60
|
|
|
61
61
|
filtered(query, ...args) {
|
|
62
62
|
if (this.logQueries) console.log(this.entityClass, query, ...args);
|
|
63
|
-
|
|
63
|
+
const realmResultsProxy = RealmResultsProxy.create(this.realmCollection.filtered(query, ...args), this.entityClass);
|
|
64
|
+
realmResultsProxy.setLogQueries(this.logQueries);
|
|
65
|
+
return realmResultsProxy;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
getAt(index) {
|
|
@@ -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 _General = _interopRequireDefault(require("../utility/General"));
|
|
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 = _General.default.AnswerSource.Manual) {
|
|
18
18
|
this.answer = _lodash.default.isNil(answer) ? [] : answer;
|
|
19
19
|
this.answerSource = answerSource;
|
|
20
20
|
}
|
|
@@ -13,12 +13,10 @@ var _moment = _interopRequireDefault(require("moment"));
|
|
|
13
13
|
|
|
14
14
|
var _General = _interopRequireDefault(require("../utility/General"));
|
|
15
15
|
|
|
16
|
-
var _Observation = _interopRequireDefault(require("../Observation"));
|
|
17
|
-
|
|
18
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
17
|
|
|
20
18
|
class PrimitiveValue {
|
|
21
|
-
constructor(value, datatype, answerSource =
|
|
19
|
+
constructor(value, datatype, answerSource = _General.default.AnswerSource.Manual) {
|
|
22
20
|
this.value = value;
|
|
23
21
|
this.datatype = datatype;
|
|
24
22
|
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 _General = _interopRequireDefault(require("../utility/General"));
|
|
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 = _General.default.AnswerSource.Manual) {
|
|
16
16
|
this.answer = answerUUID;
|
|
17
17
|
this.answerSource = answerSource;
|
|
18
18
|
}
|
package/dist/utility/General.js
CHANGED