openchs-models 1.33.55 → 1.33.57
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/AttendanceRecord.js +12 -0
- package/dist/ReportCard.js +20 -1
- package/dist/Schema.js +14 -1
- package/dist/Session.js +3 -3
- package/package.json +1 -1
package/dist/AttendanceRecord.js
CHANGED
|
@@ -48,6 +48,12 @@ class AttendanceRecord extends _BaseEntity.default {
|
|
|
48
48
|
set followUpEncounterUUID(x) {
|
|
49
49
|
this.that.followUpEncounterUUID = x;
|
|
50
50
|
}
|
|
51
|
+
get needsFollowUp() {
|
|
52
|
+
return this.that.needsFollowUp;
|
|
53
|
+
}
|
|
54
|
+
set needsFollowUp(x) {
|
|
55
|
+
this.that.needsFollowUp = x;
|
|
56
|
+
}
|
|
51
57
|
get createdBy() {
|
|
52
58
|
return this.that.createdBy;
|
|
53
59
|
}
|
|
@@ -86,6 +92,7 @@ class AttendanceRecord extends _BaseEntity.default {
|
|
|
86
92
|
record.status = resource.status;
|
|
87
93
|
record.reasonConceptUUID = resource.reasonConceptUUID || null;
|
|
88
94
|
record.followUpEncounterUUID = resource.followUpEncounterUUID || null;
|
|
95
|
+
record.needsFollowUp = !!resource.needsFollowUp;
|
|
89
96
|
record.voided = !!resource.voided;
|
|
90
97
|
(0, _AuditUtil.mapAuditFields)(record, resource);
|
|
91
98
|
return record;
|
|
@@ -94,6 +101,7 @@ class AttendanceRecord extends _BaseEntity.default {
|
|
|
94
101
|
const resource = _lodash.default.pick(this, ["uuid", "sessionUUID", "subjectUUID", "status", "voided"]);
|
|
95
102
|
resource.reasonConceptUUID = this.reasonConceptUUID || null;
|
|
96
103
|
resource.followUpEncounterUUID = this.followUpEncounterUUID || null;
|
|
104
|
+
resource.needsFollowUp = !!this.needsFollowUp;
|
|
97
105
|
return resource;
|
|
98
106
|
}
|
|
99
107
|
}
|
|
@@ -113,6 +121,10 @@ _defineProperty(AttendanceRecord, "schema", {
|
|
|
113
121
|
type: "string",
|
|
114
122
|
optional: true
|
|
115
123
|
},
|
|
124
|
+
needsFollowUp: {
|
|
125
|
+
type: "bool",
|
|
126
|
+
default: false
|
|
127
|
+
},
|
|
116
128
|
voided: {
|
|
117
129
|
type: "bool",
|
|
118
130
|
default: false
|
package/dist/ReportCard.js
CHANGED
|
@@ -15,6 +15,7 @@ var _EncounterType = _interopRequireDefault(require("./EncounterType"));
|
|
|
15
15
|
var _Duration = _interopRequireDefault(require("./Duration"));
|
|
16
16
|
var _NestedReportCardResult = _interopRequireDefault(require("./reports/NestedReportCardResult"));
|
|
17
17
|
var _CustomCardConfig = _interopRequireDefault(require("./CustomCardConfig"));
|
|
18
|
+
var _AttendanceType = _interopRequireDefault(require("./AttendanceType"));
|
|
18
19
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
20
|
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; }
|
|
20
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
@@ -151,6 +152,9 @@ class ReportCard extends _BaseEntity.default {
|
|
|
151
152
|
if (resource.actionDetail.encounterTypeUUID) {
|
|
152
153
|
reportCard.actionDetailEncounterType = entityService.findByUUID(resource.actionDetail.encounterTypeUUID, _EncounterType.default.schema.name);
|
|
153
154
|
}
|
|
155
|
+
if (resource.actionDetail.attendanceTypeUUID) {
|
|
156
|
+
reportCard.actionDetailAttendanceType = entityService.findByUUID(resource.actionDetail.attendanceTypeUUID, _AttendanceType.default.schema.name);
|
|
157
|
+
}
|
|
154
158
|
reportCard.actionDetailVisitType = resource.actionDetail.visitType || null;
|
|
155
159
|
}
|
|
156
160
|
reportCard.customCardConfig = entityService.findByUUID(_ResourceUtil.default.getUUIDFor(resource, "customCardConfigUUID"), _CustomCardConfig.default.schema.name);
|
|
@@ -217,6 +221,12 @@ class ReportCard extends _BaseEntity.default {
|
|
|
217
221
|
set actionDetailVisitType(x) {
|
|
218
222
|
this.that.actionDetailVisitType = x;
|
|
219
223
|
}
|
|
224
|
+
get actionDetailAttendanceType() {
|
|
225
|
+
return this.toEntity("actionDetailAttendanceType", _AttendanceType.default);
|
|
226
|
+
}
|
|
227
|
+
set actionDetailAttendanceType(x) {
|
|
228
|
+
this.that.actionDetailAttendanceType = this.fromObject(x);
|
|
229
|
+
}
|
|
220
230
|
get onActionCompletion() {
|
|
221
231
|
return this.that.onActionCompletion;
|
|
222
232
|
}
|
|
@@ -226,6 +236,9 @@ class ReportCard extends _BaseEntity.default {
|
|
|
226
236
|
isActionDoVisit() {
|
|
227
237
|
return this.action === ReportCard.actionTypes.DoVisit;
|
|
228
238
|
}
|
|
239
|
+
isActionMarkAttendance() {
|
|
240
|
+
return this.action === ReportCard.actionTypes.MarkAttendance;
|
|
241
|
+
}
|
|
229
242
|
isScheduledVisitType() {
|
|
230
243
|
return this.actionDetailVisitType === ReportCard.visitTypes.Scheduled;
|
|
231
244
|
}
|
|
@@ -252,7 +265,8 @@ _defineProperty(ReportCard, "cardTypes", {
|
|
|
252
265
|
});
|
|
253
266
|
_defineProperty(ReportCard, "actionTypes", {
|
|
254
267
|
ViewSubjectProfile: "ViewSubjectProfile",
|
|
255
|
-
DoVisit: "DoVisit"
|
|
268
|
+
DoVisit: "DoVisit",
|
|
269
|
+
MarkAttendance: "MarkAttendance"
|
|
256
270
|
});
|
|
257
271
|
_defineProperty(ReportCard, "visitTypes", {
|
|
258
272
|
Scheduled: "Scheduled",
|
|
@@ -336,6 +350,11 @@ _defineProperty(ReportCard, "schema", {
|
|
|
336
350
|
type: "string",
|
|
337
351
|
optional: true
|
|
338
352
|
},
|
|
353
|
+
actionDetailAttendanceType: {
|
|
354
|
+
type: "object",
|
|
355
|
+
objectType: "AttendanceType",
|
|
356
|
+
optional: true
|
|
357
|
+
},
|
|
339
358
|
onActionCompletion: {
|
|
340
359
|
type: "string",
|
|
341
360
|
optional: true
|
package/dist/Schema.js
CHANGED
|
@@ -186,7 +186,7 @@ function createRealmConfig() {
|
|
|
186
186
|
return doCompact;
|
|
187
187
|
},
|
|
188
188
|
//order is important, should be arranged according to the dependency
|
|
189
|
-
schemaVersion:
|
|
189
|
+
schemaVersion: 214,
|
|
190
190
|
onMigration: function (oldDB, newDB) {
|
|
191
191
|
console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
|
|
192
192
|
if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
|
|
@@ -823,6 +823,19 @@ function createRealmConfig() {
|
|
|
823
823
|
// (bool default false). Realm backfills the new boolean and the new
|
|
824
824
|
// schemas have no pre-existing rows.
|
|
825
825
|
}
|
|
826
|
+
if (oldDB.schemaVersion < 213) {
|
|
827
|
+
// Additive: ReportCard.actionDetailAttendanceType (optional ref to
|
|
828
|
+
// AttendanceType) for the new MarkAttendance action. Existing rows
|
|
829
|
+
// remain null.
|
|
830
|
+
}
|
|
831
|
+
if (oldDB.schemaVersion < 214) {
|
|
832
|
+
// Backfill AttendanceRecord.needsFollowUp from existing follow-up
|
|
833
|
+
// linkage so historical follow-ups survive the first re-save under
|
|
834
|
+
// the new flag-based rule.
|
|
835
|
+
_lodash.default.forEach(newDB.objects(_SchemaNames.default.AttendanceRecord), rec => {
|
|
836
|
+
rec.needsFollowUp = !_lodash.default.isNil(rec.followUpEncounterUUID);
|
|
837
|
+
});
|
|
838
|
+
}
|
|
826
839
|
}
|
|
827
840
|
};
|
|
828
841
|
}
|
package/dist/Session.js
CHANGED
|
@@ -170,11 +170,11 @@ class Session extends _BaseEntity.default {
|
|
|
170
170
|
_lodash.default.forEach(attendanceRecords || [], record => {
|
|
171
171
|
if (!record) return;
|
|
172
172
|
if (record.status !== _AttendanceRecord.default.status.ABSENT) return;
|
|
173
|
-
if (!
|
|
173
|
+
if (!record.needsFollowUp) return;
|
|
174
174
|
// Re-mark path: an existing AttendanceRecord may already point at a
|
|
175
175
|
// previously-created follow-up encounter. Don't create a second one —
|
|
176
176
|
// leave the link in place; voidStaleFollowUps handles the inverse case
|
|
177
|
-
// (
|
|
177
|
+
// (needsFollowUp cleared while still Absent).
|
|
178
178
|
if (record.followUpEncounterUUID) return;
|
|
179
179
|
const student = studentLookup ? studentLookup(record.subjectUUID) : null;
|
|
180
180
|
if (!student) return;
|
|
@@ -221,7 +221,7 @@ class Session extends _BaseEntity.default {
|
|
|
221
221
|
_lodash.default.forOwn(prevByStudent, (prev, studentUUID) => {
|
|
222
222
|
if (!prev || !prev.followUpEncounterUUID) return;
|
|
223
223
|
const next = newByStudent[studentUUID];
|
|
224
|
-
const stillNeedsFollowUp = next && next.status === _AttendanceRecord.default.status.ABSENT &&
|
|
224
|
+
const stillNeedsFollowUp = next && next.status === _AttendanceRecord.default.status.ABSENT && next.needsFollowUp;
|
|
225
225
|
if (stillNeedsFollowUp) return;
|
|
226
226
|
const encounter = encounterLookup ? encounterLookup(prev.followUpEncounterUUID) : null;
|
|
227
227
|
if (!encounter) return;
|