openchs-models 1.31.84 → 1.31.86

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.
@@ -31,6 +31,7 @@ class ReportCard extends _BaseEntity.default {
31
31
  reportCard.standardReportCardInputSubjectTypes = [];
32
32
  reportCard.standardReportCardInputPrograms = [];
33
33
  reportCard.standardReportCardInputEncounterTypes = [];
34
+ reportCard.standardReportCardInputRecentDuration = null;
34
35
  return reportCard;
35
36
  }
36
37
 
@@ -130,6 +131,14 @@ class ReportCard extends _BaseEntity.default {
130
131
  set standardReportCardInputEncounterTypes(x) {
131
132
  this.that.standardReportCardInputEncounterTypes = this.fromEntityList(x);
132
133
  }
134
+
135
+ get standardReportCardInputRecentDurationJSON() {
136
+ return JSON.parse(this.that.standardReportCardInputRecentDurationJSON);
137
+ }
138
+
139
+ set standardReportCardInputRecentDurationJSON(x) {
140
+ this.that.standardReportCardInputRecentDurationJSON = x;
141
+ }
133
142
  /**
134
143
  * Helper method used to generate unique key value for Nested Report Cards using UUID and Index of the Report Card.
135
144
  * The Nested Report Card's query responses would be mapped to the corresponding Dashboard Report cards using the UUID and Index.
@@ -168,6 +177,7 @@ class ReportCard extends _BaseEntity.default {
168
177
  resource.standardReportCardInputEncounterTypes.forEach(uuid => {
169
178
  reportCard.standardReportCardInputEncounterTypes.push(entityService.findByUUID(uuid, _EncounterType.default.schema.name));
170
179
  });
180
+ reportCard.standardReportCardInputRecentDurationJSON = resource.standardReportCardInputRecentDuration;
171
181
  return reportCard;
172
182
  }
173
183
 
@@ -183,6 +193,10 @@ class ReportCard extends _BaseEntity.default {
183
193
  return this.isStandardReportType() && this.standardReportCardType.isSubjectTypeFilterSupported();
184
194
  }
185
195
 
196
+ isRecentType() {
197
+ return this.isStandardReportType() && this.standardReportCardType.isRecentType();
198
+ }
199
+
186
200
  }
187
201
 
188
202
  _defineProperty(ReportCard, "schema", {
@@ -230,6 +244,10 @@ _defineProperty(ReportCard, "schema", {
230
244
  standardReportCardInputEncounterTypes: {
231
245
  type: "list",
232
246
  objectType: "EncounterType"
247
+ },
248
+ standardReportCardInputRecentDurationJSON: {
249
+ type: "string",
250
+ optional: true
233
251
  }
234
252
  }
235
253
  });
package/dist/Schema.js CHANGED
@@ -279,7 +279,7 @@ function createRealmConfig() {
279
279
  return doCompact;
280
280
  },
281
281
  //order is important, should be arranged according to the dependency
282
- schemaVersion: 192,
282
+ schemaVersion: 193,
283
283
  onMigration: function (oldDB, newDB) {
284
284
  console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
285
285
  if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
@@ -81,7 +81,7 @@ class StandardReportCardType extends _BaseEntity.default {
81
81
  }
82
82
 
83
83
  defaultTypes() {
84
- return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.LatestRegistrations, StandardReportCardType.type.LatestEnrolments, StandardReportCardType.type.LatestVisits, StandardReportCardType.type.Total];
84
+ return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits, StandardReportCardType.type.Total];
85
85
  }
86
86
 
87
87
  isApprovalType() {
@@ -119,7 +119,11 @@ class StandardReportCardType extends _BaseEntity.default {
119
119
  }
120
120
 
121
121
  isSubjectTypeFilterSupported() {
122
- return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits].includes(this.name);
122
+ return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits].includes(this.name);
123
+ }
124
+
125
+ isRecentType() {
126
+ return [StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits].includes(this.name);
123
127
  }
124
128
 
125
129
  }
@@ -147,9 +151,9 @@ _defineProperty(StandardReportCardType, "type", {
147
151
  Rejected: "Rejected",
148
152
  ScheduledVisits: "Scheduled visits",
149
153
  OverdueVisits: "Overdue visits",
150
- LatestRegistrations: "Last 24 hours registrations",
151
- LatestEnrolments: "Last 24 hours enrolments",
152
- LatestVisits: "Last 24 hours visits",
154
+ RecentRegistrations: "Recent registrations",
155
+ RecentEnrolments: "Recent enrolments",
156
+ RecentVisits: "Recent visits",
153
157
  Total: "Total",
154
158
  Comments: "Comments",
155
159
  CallTasks: "Call tasks",
@@ -157,6 +161,8 @@ _defineProperty(StandardReportCardType, "type", {
157
161
  DueChecklist: "Due checklist"
158
162
  });
159
163
 
164
+ _defineProperty(StandardReportCardType, "recentCardDurationUnits", ["days", "weeks", "months"]);
165
+
160
166
  const typeToStatusMap = {
161
167
  [StandardReportCardType.type.PendingApproval]: _ApprovalStatus.default.statuses.Pending,
162
168
  [StandardReportCardType.type.Approved]: _ApprovalStatus.default.statuses.Approved,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.31.84",
4
+ "version": "1.31.86",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",