openchs-models 1.31.95 → 1.31.97

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.
@@ -7,16 +7,6 @@ exports.default = void 0;
7
7
 
8
8
  var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
9
9
 
10
- var _Dashboard = _interopRequireDefault(require("./Dashboard"));
11
-
12
- var _General = _interopRequireDefault(require("./utility/General"));
13
-
14
- var _ReportCardResult = _interopRequireDefault(require("./reports/ReportCardResult"));
15
-
16
- var _NestedReportCardResult = _interopRequireDefault(require("./reports/NestedReportCardResult"));
17
-
18
- var _lodash = _interopRequireDefault(require("lodash"));
19
-
20
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
11
 
22
12
  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; }
@@ -26,6 +16,14 @@ class CustomDashboardCache extends _BaseEntity.default {
26
16
  super(that);
27
17
  }
28
18
 
19
+ get checksum() {
20
+ return this.that.checksum;
21
+ }
22
+
23
+ set checksum(x) {
24
+ this.that.checksum = x;
25
+ }
26
+
29
27
  get updatedAt() {
30
28
  return this.that.updatedAt;
31
29
  }
@@ -50,102 +48,84 @@ class CustomDashboardCache extends _BaseEntity.default {
50
48
  this.that.filterApplied = x;
51
49
  }
52
50
 
53
- get dashboard() {
54
- return this.toEntity("dashboard", _Dashboard.default);
55
- }
56
-
57
- set dashboard(x) {
58
- this.that.dashboard = this.fromObject(x);
51
+ get filterErrorsJSON() {
52
+ return this.that.filterErrorsJSON;
59
53
  }
60
54
 
61
- get dashboardFiltersHash() {
62
- return this.that.dashboardFiltersHash;
55
+ set filterErrorsJSON(x) {
56
+ this.that.filterErrorsJSON = x;
63
57
  }
64
58
 
65
- set dashboardFiltersHash(x) {
66
- this.that.dashboardFiltersHash = x;
59
+ get ruleInputJSON() {
60
+ return this.that.ruleInputJSON;
67
61
  }
68
62
 
69
- get reportCardResults() {
70
- return this.toEntityList("reportCardResults", _ReportCardResult.default);
63
+ set ruleInputJSON(x) {
64
+ this.that.ruleInputJSON = x;
71
65
  }
72
66
 
73
- set reportCardResults(x) {
74
- this.that.reportCardResults = this.fromEntityList(x);
67
+ get transformedFiltersJSON() {
68
+ return this.that.transformedFiltersJSON;
75
69
  }
76
70
 
77
- get nestedReportCardResults() {
78
- return this.toEntityList("nestedReportCardResults", _NestedReportCardResult.default);
71
+ set transformedFiltersJSON(x) {
72
+ this.that.transformedFiltersJSON = x;
79
73
  }
80
74
 
81
- set nestedReportCardResults(x) {
82
- this.that.nestedReportCardResults = this.fromEntityList(x);
83
- }
84
-
85
- static newInstance(dashboard, dashboardFiltersHash) {
75
+ static create(uuid, checksum, updatedAt, selectedValuesJSON, filterApplied, filterErrorsJSON, ruleInputJSON, transformedFiltersJSON) {
86
76
  const customDashboardCache = new CustomDashboardCache();
87
- customDashboardCache.uuid = _General.default.randomUUID();
88
- customDashboardCache.dashboard = dashboard;
89
- customDashboardCache.reset(dashboardFiltersHash);
77
+ customDashboardCache.uuid = uuid;
78
+ customDashboardCache.checksum = checksum;
79
+ customDashboardCache.updatedAt = updatedAt;
80
+ customDashboardCache.selectedValuesJSON = selectedValuesJSON;
81
+ customDashboardCache.filterApplied = filterApplied;
82
+ customDashboardCache.filterErrorsJSON = filterErrorsJSON;
83
+ customDashboardCache.ruleInputJSON = ruleInputJSON;
84
+ customDashboardCache.transformedFiltersJSON = transformedFiltersJSON;
90
85
  return customDashboardCache;
91
86
  }
92
87
 
93
- reset(dashboardFiltersHash) {
94
- this.filterApplied = false;
95
- this.selectedValuesJSON = JSON.stringify({});
96
- this.dashboardFiltersHash = dashboardFiltersHash;
97
- this.updatedAt = null;
98
- this.reportCardResults = [];
99
- this.nestedReportCardResults = [];
100
- }
101
-
102
- getSelectedValues() {
103
- return JSON.parse(this.selectedValuesJSON);
88
+ static getSelectedValuesFromState(state) {
89
+ const filterCache = {
90
+ date: state.date,
91
+ applied: false,
92
+ selectedLocations: state.selectedLocations,
93
+ selectedCustomFilters: state.selectedCustomFilters,
94
+ selectedGenders: state.selectedGenders
95
+ };
96
+ return filterCache;
104
97
  }
105
98
 
106
- getReportCardResult(reportCard) {
107
- const result = this.reportCardResults.find(reportCardResult => reportCardResult.reportCard === reportCard.uuid && reportCardResult.dashboard === this.dashboard.uuid);
108
-
109
- if (_lodash.default.isNil(result)) {
110
- return result;
111
- } else {
112
- result.clickable = true;
113
- result.hasErrorMsg = false;
114
- return result;
115
- }
99
+ static createEmptyInstance() {
100
+ return new CustomDashboardCache();
116
101
  }
117
102
 
118
- getNestedReportCardResults(reportCard) {
119
- return this.nestedReportCardResults.filter(nestedReportCardResult => nestedReportCardResult.reportCard === reportCard.uuid && nestedReportCardResult.dashboard === this.dashboard.uuid).map(x => {
120
- x.clickable = true;
121
- x.hasErrorMsg = false;
122
- return x;
123
- });
103
+ getChecksum() {
104
+ return this.checksum;
124
105
  }
125
106
 
126
- clone() {
127
- const customDashboardCache = new CustomDashboardCache();
128
- customDashboardCache.uuid = this.uuid;
129
- customDashboardCache.dashboard = this.dashboard;
130
- customDashboardCache.updatedAt = this.updatedAt;
131
- customDashboardCache.selectedValuesJSON = this.selectedValuesJSON;
132
- customDashboardCache.filterApplied = this.filterApplied;
133
- customDashboardCache.dashboardFiltersHash = this.dashboardFiltersHash;
134
- customDashboardCache.reportCardResults = this.reportCardResults;
135
- customDashboardCache.nestedReportCardResults = this.nestedReportCardResults;
136
- return customDashboardCache;
107
+ getSelectedValues() {
108
+ return this.selectedValuesJSON && JSON.parse(this.selectedValuesJSON) || {};
137
109
  }
138
110
 
139
- matchNestedReportCardResult(nestedReportCardResult) {
140
- return this.nestedReportCardResults.find(x => x.reportCard === nestedReportCardResult.reportCard && x.itemKey === nestedReportCardResult.itemKey && x.dashboard === this.dashboard.uuid);
111
+ getFilterErrors() {
112
+ return this.filterErrorsJSON && JSON.parse(this.filterErrorsJSON) || {};
141
113
  }
142
114
 
143
- matchReportCardResult(reportCardResult) {
144
- return this.reportCardResults.find(x => x.reportCard === reportCardResult.reportCard && x.dashboard === this.dashboard.uuid);
115
+ getRuleInput() {
116
+ return this.ruleInputJSON && JSON.parse(this.ruleInputJSON) || {
117
+ ruleInputArray: null
118
+ };
145
119
  }
146
120
 
147
- isCachePopulated() {
148
- return _lodash.default.isNil(this.updatedAt);
121
+ getTransformedFilters() {
122
+ return this.transformedFiltersJSON && JSON.parse(this.transformedFiltersJSON) || {
123
+ date: new Date(),
124
+ applied: false,
125
+ selectedLocations: [],
126
+ selectedCustomFilters: [],
127
+ selectedGenders: []
128
+ };
149
129
  }
150
130
 
151
131
  }
@@ -155,22 +135,16 @@ _defineProperty(CustomDashboardCache, "schema", {
155
135
  primaryKey: "uuid",
156
136
  properties: {
157
137
  uuid: "string",
158
- dashboard: "Dashboard",
159
- updatedAt: {
160
- type: "date",
161
- optional: true
162
- },
138
+ checksum: "string",
139
+ updatedAt: "date",
163
140
  selectedValuesJSON: "string",
164
- filterApplied: "bool",
165
- dashboardFiltersHash: "string",
166
- reportCardResults: {
167
- type: "list",
168
- objectType: "ReportCardResult"
141
+ filterApplied: {
142
+ type: "bool",
143
+ default: false
169
144
  },
170
- nestedReportCardResults: {
171
- type: "list",
172
- objectType: "NestedReportCardResult"
173
- }
145
+ filterErrorsJSON: "string",
146
+ ruleInputJSON: "string",
147
+ transformedFiltersJSON: "string"
174
148
  }
175
149
  });
176
150
 
@@ -41,9 +41,7 @@ _defineProperty(CustomFilter, "type", {
41
41
  EncounterDate: "EncounterDate",
42
42
  Address: "Address",
43
43
  Concept: "Concept",
44
- GroupSubject: "GroupSubject",
45
- SubjectType: "SubjectType",
46
- AsOnDate: "AsOnDate"
44
+ GroupSubject: "GroupSubject"
47
45
  });
48
46
 
49
47
  _defineProperty(CustomFilter, "scope", {
package/dist/Dashboard.js CHANGED
@@ -36,14 +36,6 @@ class Dashboard extends _BaseEntity.default {
36
36
  this.that.description = x;
37
37
  }
38
38
 
39
- get filters() {
40
- return this.toEntityList("filters", _DashboardFilter.default);
41
- }
42
-
43
- set filters(x) {
44
- this.that.filters = this.fromEntityList(x);
45
- }
46
-
47
39
  static fromResource(resource) {
48
40
  return _General.default.assignFields(resource, new Dashboard(), ["uuid", "name", "description", "voided"]);
49
41
  }
package/dist/Duration.js CHANGED
@@ -9,16 +9,13 @@ var _lodash = _interopRequireDefault(require("lodash"));
9
9
 
10
10
  var _moment = _interopRequireDefault(require("moment"));
11
11
 
12
+ var _SingleCodedValue = _interopRequireDefault(require("./observation/SingleCodedValue"));
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
14
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; }
15
17
 
16
18
  class Duration {
17
- constructor(durationValue, durationUnit) {
18
- this._durationValue = durationValue;
19
- this.durationUnit = durationUnit;
20
- }
21
-
22
19
  static inDay(value) {
23
20
  return new Duration(value, Duration.Day);
24
21
  }
@@ -45,6 +42,11 @@ class Duration {
45
42
  }
46
43
  }
47
44
 
45
+ constructor(durationValue, durationUnit) {
46
+ this._durationValue = durationValue;
47
+ this.durationUnit = durationUnit;
48
+ }
49
+
48
50
  get isInYears() {
49
51
  return this.durationUnit === Duration.Year;
50
52
  }
@@ -21,16 +21,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
21
21
 
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
- const clone = function (concept, valueJSON) {
24
+ const clone = function (concept, valueJSON, abnormal) {
25
25
  const observation = new Observation();
26
26
  observation.concept = concept;
27
27
  observation.valueJSON = valueJSON;
28
+ observation.abnormal = abnormal;
28
29
  return observation;
29
30
  };
30
31
 
31
32
  class Observation extends _PersistedObject.default {
32
33
  constructor(that = null) {
33
34
  super(that);
35
+
36
+ _defineProperty(this, "abnormal", void 0);
34
37
  }
35
38
 
36
39
  get concept() {
@@ -49,10 +52,11 @@ class Observation extends _PersistedObject.default {
49
52
  this.that.valueJSON = x;
50
53
  }
51
54
 
52
- static create(concept, value) {
55
+ static create(concept, value, abnormal = false) {
53
56
  const observation = new Observation();
54
57
  observation.concept = concept;
55
58
  observation.valueJSON = value;
59
+ observation.abnormal = abnormal;
56
60
  return observation;
57
61
  }
58
62
 
@@ -492,6 +492,8 @@ class ObservationsHolder {
492
492
 
493
493
  const oldValueIndex = _lodash.default.indexOf(answers, oldValue);
494
494
 
495
+ if (oldValueIndex < 0) return; // due to race condition the old value might have been removed
496
+
495
497
  const newAnswers = _lodash.default.reject(answers, answer => answer === oldValue);
496
498
 
497
499
  newAnswers.splice(oldValueIndex, 0, newValue);
@@ -15,29 +15,15 @@ var _StandardReportCardType = _interopRequireDefault(require("./StandardReportCa
15
15
 
16
16
  var _lodash = _interopRequireDefault(require("lodash"));
17
17
 
18
- var _SubjectType = _interopRequireDefault(require("./SubjectType"));
19
-
20
- var _Program = _interopRequireDefault(require("./Program"));
21
-
22
- var _EncounterType = _interopRequireDefault(require("./EncounterType"));
23
-
24
- var _Duration = _interopRequireDefault(require("./Duration"));
25
-
26
- var _NestedReportCardResult = _interopRequireDefault(require("./reports/NestedReportCardResult"));
27
-
28
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
19
 
30
20
  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; }
31
21
 
32
- class ReportCard extends _BaseEntity.default {
33
- static newReportCard() {
34
- const reportCard = new ReportCard();
35
- reportCard.standardReportCardInputSubjectTypes = [];
36
- reportCard.standardReportCardInputPrograms = [];
37
- reportCard.standardReportCardInputEncounterTypes = [];
38
- return reportCard;
39
- }
22
+ function throwInvalidIndexError(index, reportCardsLength) {
23
+ throw new Error(`Invalid index ${index} specified for reportCard with length ${reportCardsLength}`);
24
+ }
40
25
 
26
+ class ReportCard extends _BaseEntity.default {
41
27
  constructor(that = null) {
42
28
  super(that);
43
29
  }
@@ -110,39 +96,6 @@ class ReportCard extends _BaseEntity.default {
110
96
  get textColor() {
111
97
  return _lodash.default.isNil(this.standardReportCardType) ? '#ffffff' : this.standardReportCardType.textColor;
112
98
  }
113
-
114
- get standardReportCardInputSubjectTypes() {
115
- return this.toEntityList("standardReportCardInputSubjectTypes", _SubjectType.default);
116
- }
117
-
118
- set standardReportCardInputSubjectTypes(x) {
119
- this.that.standardReportCardInputSubjectTypes = this.fromEntityList(x);
120
- }
121
-
122
- get standardReportCardInputPrograms() {
123
- return this.toEntityList("standardReportCardInputPrograms", _Program.default);
124
- }
125
-
126
- set standardReportCardInputPrograms(x) {
127
- this.that.standardReportCardInputPrograms = this.fromEntityList(x);
128
- }
129
-
130
- get standardReportCardInputEncounterTypes() {
131
- return this.toEntityList("standardReportCardInputEncounterTypes", _EncounterType.default);
132
- }
133
-
134
- set standardReportCardInputEncounterTypes(x) {
135
- this.that.standardReportCardInputEncounterTypes = this.fromEntityList(x);
136
- }
137
-
138
- getStandardReportCardInputRecentDuration() {
139
- const duration = JSON.parse(this.that.standardReportCardInputRecentDurationJSON);
140
- return new _Duration.default(duration.value, duration.unit);
141
- }
142
-
143
- setStandardReportCardInputRecentDurationJSON(x) {
144
- this.that.standardReportCardInputRecentDurationJSON = x;
145
- }
146
99
  /**
147
100
  * Helper method used to generate unique key value for Nested Report Cards using UUID and Index of the Report Card.
148
101
  * The Nested Report Card's query responses would be mapped to the corresponding Dashboard Report cards using the UUID and Index.
@@ -169,19 +122,9 @@ class ReportCard extends _BaseEntity.default {
169
122
  }
170
123
 
171
124
  static fromResource(resource, entityService) {
172
- const reportCard = _General.default.assignFields(resource, ReportCard.newReportCard(), ["uuid", "name", "query", "description", "colour", "voided", "nested", "countOfCards"]);
125
+ const reportCard = _General.default.assignFields(resource, new ReportCard(), ["uuid", "name", "query", "description", "colour", "voided", "nested", "countOfCards"]);
173
126
 
174
127
  reportCard.standardReportCardType = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "standardReportCardUUID"), _StandardReportCardType.default.schema.name);
175
- resource.standardReportCardInputSubjectTypes.forEach(uuid => {
176
- reportCard.standardReportCardInputSubjectTypes.push(entityService.findByUUID(uuid, _SubjectType.default.schema.name));
177
- });
178
- resource.standardReportCardInputPrograms.forEach(uuid => {
179
- reportCard.standardReportCardInputPrograms.push(entityService.findByUUID(uuid, _Program.default.schema.name));
180
- });
181
- resource.standardReportCardInputEncounterTypes.forEach(uuid => {
182
- reportCard.standardReportCardInputEncounterTypes.push(entityService.findByUUID(uuid, _EncounterType.default.schema.name));
183
- });
184
- reportCard.setStandardReportCardInputRecentDurationJSON(resource.standardReportCardInputRecentDuration);
185
128
  return reportCard;
186
129
  }
187
130
 
@@ -189,42 +132,6 @@ class ReportCard extends _BaseEntity.default {
189
132
  return _lodash.default.isNil(this.standardReportCardType) ? false : this.standardReportCardType.isTaskType();
190
133
  }
191
134
 
192
- isStandardReportType() {
193
- return !_lodash.default.isNil(this.standardReportCardType);
194
- }
195
-
196
- isSubjectTypeFilterSupported() {
197
- return this.isStandardReportType() && this.standardReportCardType.isSubjectTypeFilterSupported();
198
- }
199
-
200
- isRecentType() {
201
- return this.isStandardReportType() && this.standardReportCardType.isRecentType();
202
- }
203
-
204
- hasInputForSubject() {
205
- return this.standardReportCardInputSubjectTypes.length > 0;
206
- }
207
-
208
- hasInputForEnrolment() {
209
- return this.standardReportCardInputPrograms.length > 0;
210
- }
211
-
212
- hasInputForProgramEncounter() {
213
- return this.hasInputForEnrolment() && this.standardReportCardInputEncounterTypes.length > 0;
214
- }
215
-
216
- hasInputForGeneralEncounter() {
217
- return this.standardReportCardInputEncounterTypes.length > 0;
218
- }
219
-
220
- createNestedErrorResults(primaryValue, secondaryValue) {
221
- const reportCard = this;
222
- return Array(this.card.countOfCards).map(index => {
223
- const itemKey = reportCard.getCardId(index);
224
- return _NestedReportCardResult.default.create(primaryValue, secondaryValue, false, true, itemKey);
225
- });
226
- }
227
-
228
135
  }
229
136
 
230
137
  _defineProperty(ReportCard, "schema", {
@@ -259,24 +166,8 @@ _defineProperty(ReportCard, "schema", {
259
166
  type: "int",
260
167
  default: 1,
261
168
  optional: true
262
- },
263
- //Used only by nested ReportCards
264
- standardReportCardInputSubjectTypes: {
265
- type: "list",
266
- objectType: "SubjectType"
267
- },
268
- standardReportCardInputPrograms: {
269
- type: "list",
270
- objectType: "Program"
271
- },
272
- standardReportCardInputEncounterTypes: {
273
- type: "list",
274
- objectType: "EncounterType"
275
- },
276
- standardReportCardInputRecentDurationJSON: {
277
- type: "string",
278
- optional: true
279
- }
169
+ } //Used only by nested ReportCards
170
+
280
171
  }
281
172
  });
282
173
 
package/dist/Schema.js CHANGED
@@ -183,17 +183,13 @@ var _MigrationsHelper = _interopRequireDefault(require("./MigrationsHelper"));
183
183
 
184
184
  var _MetaDataService = _interopRequireDefault(require("./service/MetaDataService"));
185
185
 
186
- var _ReportCardResult = _interopRequireDefault(require("./reports/ReportCardResult"));
187
-
188
- var _NestedReportCardResult = _interopRequireDefault(require("./reports/NestedReportCardResult"));
189
-
190
186
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
191
187
 
192
188
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
193
189
 
194
190
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
195
191
 
196
- const entities = [_ReportCardResult.default, _NestedReportCardResult.default, _DashboardFilter.default, _LocaleMapping.default, _Settings.default, _ConceptAnswer.default, _Concept.default, _EncounterType.default, _Gender.default, _AddressLevel.LocationMapping, _AddressLevel.default, _KeyValue.default, _Form.default, _FormMapping.default, _FormElementGroup.default, _FormElement.default, _SubjectType.default, _Individual.default, _Program.default, _ProgramEnrolment.default, _Observation.default, _ProgramEncounter.default, _Encounter.default, _EntitySyncStatus.default, _EntityQueue.default, _Checklist.default, _ChecklistItem.default, _Format.default, _UserInfo.default, _StringKeyNumericValue.default, _Family.default, _IndividualRelation.default, _IndividualRelationGenderMapping.default, _IndividualRelationshipType.default, _IndividualRelationship.default, _RuleDependency.default, _Rule.default, _ChecklistItemStatus.default, _ChecklistDetail.default, _ChecklistItemDetail.default, _VideoTelemetric.default, _Video.default, _MediaQueue.default, _Point.default, _SyncTelemetry.default, _IdentifierSource.default, _IdentifierAssignment.default, _RuleFailureTelemetry.default, _BeneficiaryModePin.default, _OrganisationConfig.default, _PlatformTranslation.default, _Translation.default, _Groups.default, _MyGroups.default, _GroupPrivileges.default, _Privilege.default, _GroupRole.default, _GroupSubject.default, _DashboardCache.default, _CustomDashboardCache.default, _LocationHierarchy.default, _ReportCard.default, _Dashboard.default, _DashboardSectionCardMapping.default, _DraftSubject.default, _StandardReportCardType.default, _ApprovalStatus.default, _EntityApprovalStatus.default, _GroupDashboard.default, _DashboardSection.default, _News.default, _Comment.default, _CommentThread.default, _Extension.default, _SubjectMigration.default, _ResetSync.default, _Documentation.default, _DocumentationItem.default, _TaskType.default, _TaskStatus.default, _Task.default, _TaskUnAssignment.default, _DraftEncounter.default, _SubjectProgramEligibility.default, _MenuItem.default, _UserSubjectAssignment.default];
192
+ const entities = [_DashboardFilter.default, _LocaleMapping.default, _Settings.default, _ConceptAnswer.default, _Concept.default, _EncounterType.default, _Gender.default, _AddressLevel.LocationMapping, _AddressLevel.default, _KeyValue.default, _Form.default, _FormMapping.default, _FormElementGroup.default, _FormElement.default, _SubjectType.default, _Individual.default, _Program.default, _ProgramEnrolment.default, _Observation.default, _ProgramEncounter.default, _Encounter.default, _EntitySyncStatus.default, _EntityQueue.default, _Checklist.default, _ChecklistItem.default, _Format.default, _UserInfo.default, _StringKeyNumericValue.default, _Family.default, _IndividualRelation.default, _IndividualRelationGenderMapping.default, _IndividualRelationshipType.default, _IndividualRelationship.default, _RuleDependency.default, _Rule.default, _ChecklistItemStatus.default, _ChecklistDetail.default, _ChecklistItemDetail.default, _VideoTelemetric.default, _Video.default, _MediaQueue.default, _Point.default, _SyncTelemetry.default, _IdentifierSource.default, _IdentifierAssignment.default, _RuleFailureTelemetry.default, _BeneficiaryModePin.default, _OrganisationConfig.default, _PlatformTranslation.default, _Translation.default, _Groups.default, _MyGroups.default, _GroupPrivileges.default, _Privilege.default, _GroupRole.default, _GroupSubject.default, _DashboardCache.default, _CustomDashboardCache.default, _LocationHierarchy.default, _ReportCard.default, _Dashboard.default, _DashboardSectionCardMapping.default, _DraftSubject.default, _StandardReportCardType.default, _ApprovalStatus.default, _EntityApprovalStatus.default, _GroupDashboard.default, _DashboardSection.default, _News.default, _Comment.default, _CommentThread.default, _Extension.default, _SubjectMigration.default, _ResetSync.default, _Documentation.default, _DocumentationItem.default, _TaskType.default, _TaskStatus.default, _Task.default, _TaskUnAssignment.default, _DraftEncounter.default, _SubjectProgramEligibility.default, _MenuItem.default, _UserSubjectAssignment.default];
197
193
 
198
194
  function migrateObjectTypeFieldToEmbedded(newDB, oldDB, schemaName, field, creatorFn) {
199
195
  console.log(`schema: ${schemaName}, field: ${field}`);
@@ -283,7 +279,7 @@ function createRealmConfig() {
283
279
  return doCompact;
284
280
  },
285
281
  //order is important, should be arranged according to the dependency
286
- schemaVersion: 196,
282
+ schemaVersion: 190,
287
283
  onMigration: function (oldDB, newDB) {
288
284
  console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
289
285
  if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
@@ -917,10 +913,6 @@ function createRealmConfig() {
917
913
  if (oldDB.schemaVersion < 190) {// PlaceHolder for SubjectType.User changes, so that people with previous version of client
918
914
  // are not able to use fastSync of version 190 and above
919
915
  }
920
-
921
- if (oldDB.schemaVersion < 191) {
922
- newDB.delete(newDB.objects("CustomDashboardCache"));
923
- }
924
916
  }
925
917
  };
926
918
  }
@@ -15,8 +15,6 @@ var _ApprovalStatus = _interopRequireDefault(require("./ApprovalStatus"));
15
15
 
16
16
  var _lodash = _interopRequireDefault(require("lodash"));
17
17
 
18
- var _Duration = _interopRequireDefault(require("./Duration"));
19
-
20
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
19
 
22
20
  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; }
@@ -83,7 +81,7 @@ class StandardReportCardType extends _BaseEntity.default {
83
81
  }
84
82
 
85
83
  defaultTypes() {
86
- return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits, StandardReportCardType.type.Total];
84
+ return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.LatestRegistrations, StandardReportCardType.type.LatestEnrolments, StandardReportCardType.type.LatestVisits, StandardReportCardType.type.Total];
87
85
  }
88
86
 
89
87
  isApprovalType() {
@@ -120,14 +118,6 @@ class StandardReportCardType extends _BaseEntity.default {
120
118
  return typeToStatusMap[this.name];
121
119
  }
122
120
 
123
- isSubjectTypeFilterSupported() {
124
- return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits, StandardReportCardType.type.Total].includes(this.name);
125
- }
126
-
127
- isRecentType() {
128
- return [StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits].includes(this.name);
129
- }
130
-
131
121
  }
132
122
 
133
123
  _defineProperty(StandardReportCardType, "schema", {
@@ -153,9 +143,9 @@ _defineProperty(StandardReportCardType, "type", {
153
143
  Rejected: "Rejected",
154
144
  ScheduledVisits: "Scheduled visits",
155
145
  OverdueVisits: "Overdue visits",
156
- RecentRegistrations: "Recent registrations",
157
- RecentEnrolments: "Recent enrolments",
158
- RecentVisits: "Recent visits",
146
+ LatestRegistrations: "Last 24 hours registrations",
147
+ LatestEnrolments: "Last 24 hours enrolments",
148
+ LatestVisits: "Last 24 hours visits",
159
149
  Total: "Total",
160
150
  Comments: "Comments",
161
151
  CallTasks: "Call tasks",
@@ -163,8 +153,6 @@ _defineProperty(StandardReportCardType, "type", {
163
153
  DueChecklist: "Due checklist"
164
154
  });
165
155
 
166
- _defineProperty(StandardReportCardType, "recentCardDurationUnits", [_Duration.default.Day, _Duration.default.Week, _Duration.default.Month]);
167
-
168
156
  const typeToStatusMap = {
169
157
  [StandardReportCardType.type.PendingApproval]: _ApprovalStatus.default.statuses.Pending,
170
158
  [StandardReportCardType.type.Approved]: _ApprovalStatus.default.statuses.Approved,
@@ -226,11 +226,7 @@ class FormElementGroup extends _BaseEntity.default {
226
226
  }
227
227
 
228
228
  nonVoidedFormElements() {
229
- return _lodash.default.filter(this.formElements, formElement => {
230
- let parentFormElement;
231
- if (!_lodash.default.isNil(formElement.groupUuid)) parentFormElement = _lodash.default.find(this.formElements, fe => fe.uuid === formElement.groupUuid);
232
- return !formElement.voided && (_lodash.default.isNil(parentFormElement) || !parentFormElement.voided);
233
- });
229
+ return _lodash.default.filter(this.formElements, formElement => !formElement.voided);
234
230
  }
235
231
 
236
232
  getFormElements() {
package/dist/index.js CHANGED
@@ -789,30 +789,6 @@ Object.defineProperty(exports, "JSONStringify", {
789
789
  return _JsonStringify.JSONStringify;
790
790
  }
791
791
  });
792
- Object.defineProperty(exports, "Locations", {
793
- enumerable: true,
794
- get: function () {
795
- return _Locations.default;
796
- }
797
- });
798
- Object.defineProperty(exports, "Range", {
799
- enumerable: true,
800
- get: function () {
801
- return _Range.default;
802
- }
803
- });
804
- Object.defineProperty(exports, "ReportCardResult", {
805
- enumerable: true,
806
- get: function () {
807
- return _ReportCardResult.default;
808
- }
809
- });
810
- Object.defineProperty(exports, "NestedReportCardResult", {
811
- enumerable: true,
812
- get: function () {
813
- return _NestedReportCardResult.default;
814
- }
815
- });
816
792
 
817
793
  var _AbstractEncounter = _interopRequireDefault(require("./AbstractEncounter"));
818
794
 
@@ -1066,14 +1042,6 @@ var _DashboardCacheFilter = _interopRequireDefault(require("./application/Dashbo
1066
1042
 
1067
1043
  var _JsonStringify = require("./utility/JsonStringify");
1068
1044
 
1069
- var _Locations = _interopRequireDefault(require("./location/Locations"));
1070
-
1071
- var _Range = _interopRequireDefault(require("./reports/Range"));
1072
-
1073
- var _ReportCardResult = _interopRequireDefault(require("./reports/ReportCardResult"));
1074
-
1075
- var _NestedReportCardResult = _interopRequireDefault(require("./reports/NestedReportCardResult"));
1076
-
1077
1045
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
1078
1046
 
1079
1047
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -13,23 +13,11 @@ var _lodash = _interopRequireDefault(require("lodash"));
13
13
 
14
14
  var _DateTimeUtil = _interopRequireDefault(require("../utility/DateTimeUtil"));
15
15
 
16
- var _Range = _interopRequireDefault(require("./Range"));
17
-
18
- var _Gender = _interopRequireDefault(require("../Gender"));
19
-
20
- var _AddressLevel = _interopRequireDefault(require("../AddressLevel"));
21
-
22
- var _Individual = _interopRequireDefault(require("../Individual"));
23
-
24
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
17
 
26
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; }
27
19
 
28
20
  const widgetConceptDataTypes = [_Concept.default.dataType.Date, _Concept.default.dataType.DateTime, _Concept.default.dataType.Time, _Concept.default.dataType.Numeric];
29
- const conceptEntityTypes = {
30
- [_Concept.default.dataType.Coded]: _Concept.default.schema.name,
31
- [_Concept.default.dataType.Location]: _AddressLevel.default.schema.name
32
- };
33
21
 
34
22
  class ObservationBasedFilter {
35
23
  constructor() {
@@ -54,15 +42,6 @@ class ObservationBasedFilter {
54
42
  return !_lodash.default.isNil(concept) && (!_lodash.default.isEmpty(programs) || !_lodash.default.isEmpty(encounterTypes) || this.scope === _CustomFilter.default.scope.Registration);
55
43
  }
56
44
 
57
- isMultiEntityType() {
58
- return [_Concept.default.dataType.Coded, _Concept.default.dataType.Location].includes(this.concept.datatype);
59
- }
60
-
61
- getEntityType() {
62
- if (this.isMultiEntityType()) return conceptEntityTypes[this.concept.datatype];
63
- throw new Error("Unsupported concept data type for getting entity type: " + this.concept.datatype);
64
- }
65
-
66
45
  toServerRequest() {
67
46
  return {
68
47
  scope: this.scope,
@@ -128,29 +107,10 @@ class GroupSubjectTypeFilter {
128
107
  }
129
108
 
130
109
  exports.GroupSubjectTypeFilter = GroupSubjectTypeFilter;
131
- const dateFilterTypes = [_CustomFilter.default.type.RegistrationDate, _CustomFilter.default.type.EnrolmentDate, _CustomFilter.default.type.EncounterDate, _CustomFilter.default.type.ProgramEncounterDate, _CustomFilter.default.type.AsOnDate];
132
- const entityTypes = {
133
- [_CustomFilter.default.type.Gender]: _Gender.default.schema.name,
134
- [_CustomFilter.default.type.Address]: _AddressLevel.default.schema.name,
135
- [_CustomFilter.default.type.GroupSubject]: _Individual.default.schema.name
136
- };
137
-
138
- function isDateDataType(dashboardFilterConfig) {
139
- return dateFilterTypes.includes(dashboardFilterConfig.type) || dashboardFilterConfig.isConceptTypeFilter() && dashboardFilterConfig.observationBasedFilter.concept.datatype === _Concept.default.dataType.Date;
140
- }
141
-
142
- function isDateTimeDataType(dashboardFilterConfig) {
143
- return dashboardFilterConfig.isConceptTypeFilter() && dashboardFilterConfig.observationBasedFilter.concept.datatype === _Concept.default.dataType.DateTime;
144
- }
145
-
146
- function isTimeDataType(dashboardFilterConfig) {
147
- return dashboardFilterConfig.isConceptTypeFilter() && dashboardFilterConfig.observationBasedFilter.concept.datatype === _Concept.default.dataType.Time;
148
- }
110
+ const dateFilterTypes = [_CustomFilter.default.type.RegistrationDate, _CustomFilter.default.type.EnrolmentDate, _CustomFilter.default.type.EncounterDate, _CustomFilter.default.type.ProgramEncounterDate];
149
111
 
150
112
  class DashboardFilterConfig {
151
113
  constructor() {
152
- _defineProperty(this, "subjectType", void 0);
153
-
154
114
  _defineProperty(this, "type", void 0);
155
115
 
156
116
  _defineProperty(this, "widget", void 0);
@@ -160,104 +120,26 @@ class DashboardFilterConfig {
160
120
  _defineProperty(this, "observationBasedFilter", void 0);
161
121
  }
162
122
 
163
- toDisplayText() {
164
- let s = `Type: ${this.type}.`;
165
-
166
- if (this.isRangeWidget()) {
167
- s += ` Widget: ${this.widget}.`;
168
- }
169
-
170
- if (this.isConceptTypeFilter()) {
171
- s += ` Concept: ${this.observationBasedFilter.concept.name}. DataType: ${this.observationBasedFilter.concept.datatype}.`;
172
- }
173
-
174
- return s;
175
- }
176
-
177
- isRangeWidget() {
178
- return this.widget === _CustomFilter.default.widget.Range;
179
- }
180
-
181
123
  getInputDataType() {
182
124
  if (this.isConceptTypeFilter()) {
183
125
  return this.observationBasedFilter.concept.datatype;
184
- } else if ([_CustomFilter.default.type.Gender, _CustomFilter.default.type.Address, _CustomFilter.default.type.GroupSubject].includes(this.type)) {
185
- return DashboardFilterConfig.dataTypes.array;
186
- } else if (dateFilterTypes.includes(this.type) && !this.isRangeWidget()) {
126
+ } else if (this.isGroupSubjectTypeFilter()) {
127
+ return _Concept.default.dataType.Subject;
128
+ } else if (dateFilterTypes.includes(this.type)) {
187
129
  return _Concept.default.dataType.Date;
188
- } else if (dateFilterTypes.includes(this.type) && this.isRangeWidget()) {
189
- return _Range.default.DateRange;
190
- } else if (this.type === _CustomFilter.default.type.SubjectType) {
191
- return DashboardFilterConfig.dataTypes.formMetaData;
192
- }
193
-
194
- throw new Error("Unsupported filter type: " + this.type);
195
- }
196
-
197
- isDateFilterType() {
198
- return isDateDataType(this) && !this.isRangeWidget();
199
- }
200
-
201
- isDateRangeFilterType() {
202
- return isDateDataType(this) && this.isRangeWidget();
203
- }
204
-
205
- isDateTimeFilterType() {
206
- return isDateTimeDataType(this) && !this.isRangeWidget();
207
- }
208
-
209
- isDateTimeRangeFilterType() {
210
- return isDateTimeDataType(this) && this.isRangeWidget();
211
- }
212
-
213
- isTimeFilterType() {
214
- return isTimeDataType(this) && !this.isRangeWidget();
215
- }
216
-
217
- isTimeRangeFilterType() {
218
- return isTimeDataType(this) && this.isRangeWidget();
219
- }
220
-
221
- isNumericRangeFilterType() {
222
- return this.isConceptTypeFilter() && this.observationBasedFilter.concept.datatype === _Concept.default.dataType.Numeric && this.isRangeWidget();
223
- }
224
-
225
- isDateLikeFilterType() {
226
- return this.isDateFilterType() || this.isDateTimeFilterType() || this.isTimeFilterType();
227
- }
228
-
229
- isDateLikeRangeFilterType() {
230
- return this.isDateRangeFilterType() || this.isDateTimeRangeFilterType() || this.isTimeRangeFilterType();
231
- }
232
-
233
- isMultiEntityType() {
234
- return [_CustomFilter.default.type.Gender, _CustomFilter.default.type.Address, _CustomFilter.default.type.GroupSubject].includes(this.type) || this.isConceptTypeFilter() && this.observationBasedFilter.isMultiEntityType();
235
- }
236
-
237
- getEntityType() {
238
- if (this.isMultiEntityType()) {
239
- return _lodash.default.isNil(entityTypes[this.type]) ? this.observationBasedFilter.getEntityType() : entityTypes[this.type];
130
+ } else {
131
+ return this.type;
240
132
  }
241
-
242
- throw new Error("Unsupported filter type: " + this.type);
243
133
  }
244
134
 
245
135
  isConceptTypeFilter() {
246
136
  return this.type === _CustomFilter.default.type.Concept;
247
137
  }
248
138
 
249
- isNonCodedObservationDataType() {
250
- return this.isConceptTypeFilter() && this.observationBasedFilter.concept.datatype !== _Concept.default.dataType.Coded;
251
- }
252
-
253
139
  isGroupSubjectTypeFilter() {
254
140
  return this.type === _CustomFilter.default.type.GroupSubject;
255
141
  }
256
142
 
257
- requiresSpecificSubjectType() {
258
- return ![_CustomFilter.default.type.SubjectType, _CustomFilter.default.type.AsOnDate].includes(this.type);
259
- }
260
-
261
143
  isValid() {
262
144
  const valid = !_lodash.default.isNil(this.type);
263
145
  if (!valid) return valid;
@@ -267,7 +149,6 @@ class DashboardFilterConfig {
267
149
  toServerRequest() {
268
150
  const request = {
269
151
  type: this.type,
270
- subjectTypeUUID: this.subjectType && this.subjectType.uuid,
271
152
  widget: this.widget
272
153
  };
273
154
  if (this.isConceptTypeFilter()) request.observationBasedFilter = this.observationBasedFilter.toServerRequest();else if (this.isGroupSubjectTypeFilter()) request.groupSubjectTypeFilter = this.groupSubjectTypeFilter.toServerRequest();
@@ -294,12 +175,6 @@ class DashboardFilterConfig {
294
175
  return [RegistrationDate, EnrolmentDate, ProgramEncounterDate, EncounterDate].includes(this.type) || this.isConceptTypeFilter() && this.observationBasedFilter.isWidgetRequired();
295
176
  }
296
177
 
297
- setSubjectType(subjectType) {
298
- if (_lodash.default.get(subjectType, "uuid") !== _lodash.default.get(this.subjectType, "uuid")) {
299
- this.subjectType = subjectType;
300
- }
301
- }
302
-
303
178
  willObservationBeInScopeOfProgramEnrolment() {
304
179
  return this.isConceptTypeFilter() && this.observationBasedFilter.willObservationBeInScopeOfProgramEnrolment();
305
180
  }
@@ -309,11 +184,13 @@ class DashboardFilterConfig {
309
184
  }
310
185
 
311
186
  validate(filterValue) {
312
- if (this.isDateRangeFilterType()) {
187
+ const inputDataType = this.getInputDataType();
188
+
189
+ if ([_Concept.default.dataType.Date, _Concept.default.dataType.DateTime].includes(inputDataType) && this.widget === _CustomFilter.default.widget.Range) {
313
190
  return _DateTimeUtil.default.validateDateRange(filterValue.minValue, filterValue.maxValue);
314
191
  }
315
192
 
316
- if (this.isTimeRangeFilterType()) {
193
+ if (_Concept.default.dataType.Time === inputDataType && this.widget === _CustomFilter.default.widget.Range) {
317
194
  return _DateTimeUtil.default.validateTimeRange(filterValue.minValue, filterValue.maxValue);
318
195
  }
319
196
 
@@ -323,7 +200,6 @@ class DashboardFilterConfig {
323
200
  clone() {
324
201
  const clone = new DashboardFilterConfig();
325
202
  clone.type = this.type;
326
- clone.subjectType = this.subjectType;
327
203
  clone.widget = this.widget;
328
204
  clone.groupSubjectTypeFilter = this.groupSubjectTypeFilter;
329
205
  clone.observationBasedFilter = this.observationBasedFilter;
@@ -332,10 +208,5 @@ class DashboardFilterConfig {
332
208
 
333
209
  }
334
210
 
335
- _defineProperty(DashboardFilterConfig, "dataTypes", {
336
- array: "array",
337
- formMetaData: "formMetaData"
338
- });
339
-
340
211
  var _default = DashboardFilterConfig;
341
212
  exports.default = _default;
@@ -99,10 +99,6 @@ class MetaDataService {
99
99
  return _lodash.default.filter(formMappings, formMapping => formMapping.formType === _Form.default.formTypes.ProgramEncounter || formMapping.formType === _Form.default.formTypes.ProgramEncounterCancellation);
100
100
  }
101
101
 
102
- static getProgramEncounterFormMappingsForFormType(formMappings, formType) {
103
- return _lodash.default.filter(formMappings, formMapping => formMapping.formType === formType);
104
- }
105
-
106
102
  static getProgramsForSubjectType(allPrograms, subjectType, formMappings) {
107
103
  if (_lodash.default.isNil(subjectType)) return allPrograms;
108
104
 
@@ -120,9 +116,9 @@ class MetaDataService {
120
116
  }
121
117
 
122
118
  static getEncounterTypesForPrograms(allEncounterTypes, programs, formMappings) {
123
- const programEncounterTypeMappings = MetaDataService.getProgramEncounterFormMappingsForFormType(formMappings, _Form.default.formTypes.ProgramEncounter);
119
+ const programEncounterTypeMappings = MetaDataService.getProgramEncounterFormMappings(formMappings);
124
120
 
125
- const encounterTypeMappingsForPrograms = _lodash.default.filter(programEncounterTypeMappings, formMapping => _lodash.default.some(programs, program => formMapping.programUUID === program.uuid));
121
+ const encounterTypeMappingsForPrograms = _lodash.default.intersectionWith(programEncounterTypeMappings, programs, (etMapping, program) => etMapping.programUUID === program.uuid);
126
122
 
127
123
  return encounterTypeMappingsForPrograms.map(x => _lodash.default.find(allEncounterTypes, et => et.uuid === x.encounterTypeUUID));
128
124
  }
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.95",
4
+ "version": "1.31.97",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _lodash = _interopRequireDefault(require("lodash"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- // AddressLevel = Location
13
- class Locations {
14
- static getUniqueLevels(locations) {
15
- return _lodash.default.uniq(locations.map(x => x.level));
16
- }
17
-
18
- }
19
-
20
- var _default = Locations;
21
- exports.default = _default;
@@ -1,145 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _lodash = _interopRequireDefault(require("lodash"));
9
-
10
- var _BaseEntity = _interopRequireDefault(require("../BaseEntity"));
11
-
12
- var _General = _interopRequireDefault(require("../utility/General"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
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; }
17
-
18
- class NestedReportCardResult extends _BaseEntity.default {
19
- // transient state
20
- constructor(that) {
21
- super(that);
22
-
23
- _defineProperty(this, "clickable", void 0);
24
-
25
- _defineProperty(this, "hasErrorMsg", void 0);
26
- }
27
-
28
- static create(primaryValue, secondaryValue, clickable, hasErrorMsg, itemKey) {
29
- const nestedReportCardResult = new NestedReportCardResult();
30
- nestedReportCardResult.uuid = _General.default.randomUUID();
31
- nestedReportCardResult.primaryValue = _lodash.default.toString(primaryValue);
32
- nestedReportCardResult.secondaryValue = _lodash.default.toString(secondaryValue);
33
- nestedReportCardResult.clickable = clickable;
34
- nestedReportCardResult.hasErrorMsg = hasErrorMsg;
35
- nestedReportCardResult.itemKey = itemKey;
36
- return nestedReportCardResult;
37
- }
38
-
39
- get dashboard() {
40
- return this.that.dashboard;
41
- }
42
-
43
- set dashboard(x) {
44
- this.that.dashboard = x;
45
- }
46
-
47
- get reportCard() {
48
- return this.that.reportCard;
49
- }
50
-
51
- set reportCard(x) {
52
- this.that.reportCard = x;
53
- }
54
-
55
- get primaryValue() {
56
- return this.that.primaryValue;
57
- }
58
-
59
- set primaryValue(x) {
60
- this.that.primaryValue = x;
61
- }
62
-
63
- get secondaryValue() {
64
- return this.that.secondaryValue;
65
- }
66
-
67
- set secondaryValue(x) {
68
- this.that.secondaryValue = x;
69
- }
70
-
71
- get itemKey() {
72
- return this.that.itemKey;
73
- }
74
-
75
- set itemKey(x) {
76
- this.that.itemKey = x;
77
- }
78
-
79
- get cardName() {
80
- return this.that.cardName;
81
- }
82
-
83
- set cardName(x) {
84
- this.that.cardName = x;
85
- }
86
-
87
- get cardColor() {
88
- return this.that.cardColor;
89
- }
90
-
91
- set cardColor(x) {
92
- this.that.cardColor = x;
93
- }
94
-
95
- get textColor() {
96
- return this.that.textColor;
97
- }
98
-
99
- set textColor(x) {
100
- this.that.textColor = x;
101
- }
102
-
103
- get reportCardUUID() {
104
- return this.that.reportCardUUID;
105
- }
106
-
107
- set reportCardUUID(x) {
108
- this.that.reportCardUUID = x;
109
- }
110
-
111
- static fromQueryResult(ruleResult, reportCard, index) {
112
- const nestedReportCardResult = NestedReportCardResult.create(ruleResult.primaryValue, ruleResult.secondaryValue, _lodash.default.isFunction(ruleResult.lineListFunction), ruleResult.hasErrorMsg, reportCard.getCardId(index));
113
-
114
- if (ruleResult.hasErrorMsg) {
115
- return nestedReportCardResult;
116
- }
117
-
118
- nestedReportCardResult.cardName = ruleResult.cardName;
119
- nestedReportCardResult.cardColor = _lodash.default.isNil(ruleResult.cardColor) ? reportCard.colour : ruleResult.cardColor;
120
- nestedReportCardResult.textColor = ruleResult.textColor;
121
- nestedReportCardResult.reportCardUUID = reportCard.uuid;
122
- return nestedReportCardResult;
123
- }
124
-
125
- }
126
-
127
- _defineProperty(NestedReportCardResult, "schema", {
128
- name: "NestedReportCardResult",
129
- embedded: true,
130
- properties: {
131
- uuid: "string",
132
- dashboard: "string",
133
- reportCard: "string",
134
- primaryValue: "string",
135
- secondaryValue: "string",
136
- itemKey: "string",
137
- cardName: "string",
138
- cardColor: "string",
139
- textColor: "string",
140
- reportCardUUID: "string"
141
- }
142
- });
143
-
144
- var _default = NestedReportCardResult;
145
- exports.default = _default;
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _lodash = _interopRequireDefault(require("lodash"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- 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; }
13
-
14
- class Range {
15
- constructor(minValue, maxValue) {
16
- _defineProperty(this, "minValue", void 0);
17
-
18
- _defineProperty(this, "maxValue", void 0);
19
-
20
- this.minValue = minValue;
21
- this.maxValue = maxValue;
22
- }
23
-
24
- static empty() {
25
- return new Range(null, null);
26
- }
27
-
28
- isEmpty() {
29
- return _lodash.default.isNil(this.minValue) || _lodash.default.isNil(this.maxValue);
30
- }
31
-
32
- }
33
-
34
- _defineProperty(Range, "DateRange", "DateRange");
35
-
36
- var _default = Range;
37
- exports.default = _default;
@@ -1,93 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _lodash = _interopRequireDefault(require("lodash"));
9
-
10
- var _BaseEntity = _interopRequireDefault(require("../BaseEntity"));
11
-
12
- var _General = _interopRequireDefault(require("../utility/General"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
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; }
17
-
18
- class ReportCardResult extends _BaseEntity.default {
19
- // transient state
20
- constructor(that) {
21
- super(that);
22
-
23
- _defineProperty(this, "clickable", void 0);
24
-
25
- _defineProperty(this, "hasErrorMsg", void 0);
26
- }
27
-
28
- get primaryValue() {
29
- return this.that.primaryValue;
30
- }
31
-
32
- set primaryValue(x) {
33
- this.that.primaryValue = x;
34
- }
35
-
36
- get secondaryValue() {
37
- return this.that.secondaryValue;
38
- }
39
-
40
- set secondaryValue(x) {
41
- this.that.secondaryValue = x;
42
- }
43
-
44
- get dashboard() {
45
- return this.that.dashboard;
46
- }
47
-
48
- set dashboard(x) {
49
- this.that.dashboard = x;
50
- }
51
-
52
- get reportCard() {
53
- return this.that.reportCard;
54
- }
55
-
56
- set reportCard(x) {
57
- this.that.reportCard = x;
58
- }
59
-
60
- static create(primaryValue, secondaryValue, clickable, hasErrorMsg = false) {
61
- const reportCardResult = new ReportCardResult();
62
- reportCardResult.uuid = _General.default.randomUUID();
63
- reportCardResult.primaryValue = _lodash.default.toString(primaryValue);
64
- reportCardResult.secondaryValue = _lodash.default.toString(secondaryValue);
65
- reportCardResult.clickable = clickable;
66
- reportCardResult.hasErrorMsg = hasErrorMsg;
67
- return reportCardResult;
68
- }
69
-
70
- static fromQueryResult(result) {
71
- return ReportCardResult.create(result.primaryValue, result.secondaryValue, _lodash.default.isFunction(result.lineListFunction), result.hasErrorMsg);
72
- }
73
-
74
- get lineListFunction() {
75
- return _lodash.default.noop;
76
- }
77
-
78
- }
79
-
80
- _defineProperty(ReportCardResult, "schema", {
81
- name: "ReportCardResult",
82
- embedded: true,
83
- properties: {
84
- uuid: "string",
85
- dashboard: "string",
86
- reportCard: "string",
87
- primaryValue: "string",
88
- secondaryValue: "string"
89
- }
90
- });
91
-
92
- var _default = ReportCardResult;
93
- exports.default = _default;