openchs-models 1.32.3 → 1.32.4
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/CustomDashboardCache.js +66 -92
- package/dist/CustomFilter.js +1 -3
- package/dist/Dashboard.js +0 -16
- package/dist/Duration.js +7 -5
- package/dist/Privilege.js +3 -1
- package/dist/ReportCard.js +7 -116
- package/dist/Schema.js +2 -10
- package/dist/StandardReportCardType.js +4 -16
- package/dist/application/FormElementGroup.js +1 -5
- package/dist/index.js +0 -32
- package/dist/reports/DashboardFilterConfig.js +10 -143
- package/dist/service/MetaDataService.js +2 -6
- package/package.json +1 -1
- package/dist/location/Locations.js +0 -21
- package/dist/reports/NestedReportCardResult.js +0 -145
- package/dist/reports/Range.js +0 -37
- package/dist/reports/ReportCardResult.js +0 -93
|
@@ -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
|
|
54
|
-
return this.
|
|
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
|
-
|
|
62
|
-
|
|
55
|
+
set filterErrorsJSON(x) {
|
|
56
|
+
this.that.filterErrorsJSON = x;
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
|
|
66
|
-
this.that.
|
|
59
|
+
get ruleInputJSON() {
|
|
60
|
+
return this.that.ruleInputJSON;
|
|
67
61
|
}
|
|
68
62
|
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
set ruleInputJSON(x) {
|
|
64
|
+
this.that.ruleInputJSON = x;
|
|
71
65
|
}
|
|
72
66
|
|
|
73
|
-
|
|
74
|
-
this.that.
|
|
67
|
+
get transformedFiltersJSON() {
|
|
68
|
+
return this.that.transformedFiltersJSON;
|
|
75
69
|
}
|
|
76
70
|
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
set transformedFiltersJSON(x) {
|
|
72
|
+
this.that.transformedFiltersJSON = x;
|
|
79
73
|
}
|
|
80
74
|
|
|
81
|
-
|
|
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 =
|
|
88
|
-
customDashboardCache.
|
|
89
|
-
customDashboardCache.
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
107
|
-
|
|
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
|
-
|
|
119
|
-
return this.
|
|
120
|
-
x.clickable = true;
|
|
121
|
-
x.hasErrorMsg = false;
|
|
122
|
-
return x;
|
|
123
|
-
});
|
|
103
|
+
getChecksum() {
|
|
104
|
+
return this.checksum;
|
|
124
105
|
}
|
|
125
106
|
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
140
|
-
return this.
|
|
111
|
+
getFilterErrors() {
|
|
112
|
+
return this.filterErrorsJSON && JSON.parse(this.filterErrorsJSON) || {};
|
|
141
113
|
}
|
|
142
114
|
|
|
143
|
-
|
|
144
|
-
return this.
|
|
115
|
+
getRuleInput() {
|
|
116
|
+
return this.ruleInputJSON && JSON.parse(this.ruleInputJSON) || {
|
|
117
|
+
ruleInputArray: null
|
|
118
|
+
};
|
|
145
119
|
}
|
|
146
120
|
|
|
147
|
-
|
|
148
|
-
return
|
|
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
|
-
|
|
159
|
-
updatedAt:
|
|
160
|
-
type: "date",
|
|
161
|
-
optional: true
|
|
162
|
-
},
|
|
138
|
+
checksum: "string",
|
|
139
|
+
updatedAt: "date",
|
|
163
140
|
selectedValuesJSON: "string",
|
|
164
|
-
filterApplied:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
type: "list",
|
|
168
|
-
objectType: "ReportCardResult"
|
|
141
|
+
filterApplied: {
|
|
142
|
+
type: "bool",
|
|
143
|
+
default: false
|
|
169
144
|
},
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
145
|
+
filterErrorsJSON: "string",
|
|
146
|
+
ruleInputJSON: "string",
|
|
147
|
+
transformedFiltersJSON: "string"
|
|
174
148
|
}
|
|
175
149
|
});
|
|
176
150
|
|
package/dist/CustomFilter.js
CHANGED
|
@@ -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
|
}
|
|
@@ -56,14 +48,6 @@ class Dashboard extends _BaseEntity.default {
|
|
|
56
48
|
return dashboard;
|
|
57
49
|
}
|
|
58
50
|
|
|
59
|
-
getFilterOfType(filterType) {
|
|
60
|
-
return this.filters.find(filter => filter.filterConfig.type === filterType);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getFilter(filterUUID) {
|
|
64
|
-
return this.filters.find(filter => filter.uuid === filterUUID);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
51
|
}
|
|
68
52
|
|
|
69
53
|
_defineProperty(Dashboard, "schema", {
|
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
|
}
|
package/dist/Privilege.js
CHANGED
|
@@ -126,6 +126,7 @@ _defineProperty(Privilege, "PrivilegeType", {
|
|
|
126
126
|
EditVideo: "EditVideo",
|
|
127
127
|
EnrolSubject: "EnrolSubject",
|
|
128
128
|
ExitEnrolment: "ExitEnrolment",
|
|
129
|
+
MultiTxEntityTypeUpdate: "MultiTxEntityTypeUpdate",
|
|
129
130
|
PerformVisit: "PerformVisit",
|
|
130
131
|
PhoneVerification: "PhoneVerification",
|
|
131
132
|
RegisterSubject: "RegisterSubject",
|
|
@@ -151,7 +152,8 @@ _defineProperty(Privilege, "PrivilegeType", {
|
|
|
151
152
|
EditChecklistConfiguration: "EditChecklistConfiguration",
|
|
152
153
|
DownloadBundle: "DownloadBundle",
|
|
153
154
|
EditTaskType: "EditTaskType",
|
|
154
|
-
ViewEditEntitiesOnDataEntryApp: "ViewEditEntitiesOnDataEntryApp"
|
|
155
|
+
ViewEditEntitiesOnDataEntryApp: "ViewEditEntitiesOnDataEntryApp",
|
|
156
|
+
DeleteOrganisationConfiguration: "DeleteOrganisationConfiguration"
|
|
155
157
|
});
|
|
156
158
|
|
|
157
159
|
_defineProperty(Privilege, "privilegeEntityType", {
|
package/dist/ReportCard.js
CHANGED
|
@@ -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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
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
|
-
|
|
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 = [
|
|
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:
|
|
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.
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
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
|
|
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,108 +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 (
|
|
185
|
-
return
|
|
186
|
-
} else if (dateFilterTypes.includes(this.type)
|
|
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
|
|
189
|
-
return
|
|
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
|
-
isAsOnDateFilter() {
|
|
262
|
-
return this.type === _CustomFilter.default.type.AsOnDate;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
143
|
isValid() {
|
|
266
144
|
const valid = !_lodash.default.isNil(this.type);
|
|
267
145
|
if (!valid) return valid;
|
|
@@ -271,7 +149,6 @@ class DashboardFilterConfig {
|
|
|
271
149
|
toServerRequest() {
|
|
272
150
|
const request = {
|
|
273
151
|
type: this.type,
|
|
274
|
-
subjectTypeUUID: this.subjectType && this.subjectType.uuid,
|
|
275
152
|
widget: this.widget
|
|
276
153
|
};
|
|
277
154
|
if (this.isConceptTypeFilter()) request.observationBasedFilter = this.observationBasedFilter.toServerRequest();else if (this.isGroupSubjectTypeFilter()) request.groupSubjectTypeFilter = this.groupSubjectTypeFilter.toServerRequest();
|
|
@@ -298,12 +175,6 @@ class DashboardFilterConfig {
|
|
|
298
175
|
return [RegistrationDate, EnrolmentDate, ProgramEncounterDate, EncounterDate].includes(this.type) || this.isConceptTypeFilter() && this.observationBasedFilter.isWidgetRequired();
|
|
299
176
|
}
|
|
300
177
|
|
|
301
|
-
setSubjectType(subjectType) {
|
|
302
|
-
if (_lodash.default.get(subjectType, "uuid") !== _lodash.default.get(this.subjectType, "uuid")) {
|
|
303
|
-
this.subjectType = subjectType;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
178
|
willObservationBeInScopeOfProgramEnrolment() {
|
|
308
179
|
return this.isConceptTypeFilter() && this.observationBasedFilter.willObservationBeInScopeOfProgramEnrolment();
|
|
309
180
|
}
|
|
@@ -313,11 +184,13 @@ class DashboardFilterConfig {
|
|
|
313
184
|
}
|
|
314
185
|
|
|
315
186
|
validate(filterValue) {
|
|
316
|
-
|
|
187
|
+
const inputDataType = this.getInputDataType();
|
|
188
|
+
|
|
189
|
+
if ([_Concept.default.dataType.Date, _Concept.default.dataType.DateTime].includes(inputDataType) && this.widget === _CustomFilter.default.widget.Range) {
|
|
317
190
|
return _DateTimeUtil.default.validateDateRange(filterValue.minValue, filterValue.maxValue);
|
|
318
191
|
}
|
|
319
192
|
|
|
320
|
-
if (this.
|
|
193
|
+
if (_Concept.default.dataType.Time === inputDataType && this.widget === _CustomFilter.default.widget.Range) {
|
|
321
194
|
return _DateTimeUtil.default.validateTimeRange(filterValue.minValue, filterValue.maxValue);
|
|
322
195
|
}
|
|
323
196
|
|
|
@@ -327,7 +200,6 @@ class DashboardFilterConfig {
|
|
|
327
200
|
clone() {
|
|
328
201
|
const clone = new DashboardFilterConfig();
|
|
329
202
|
clone.type = this.type;
|
|
330
|
-
clone.subjectType = this.subjectType;
|
|
331
203
|
clone.widget = this.widget;
|
|
332
204
|
clone.groupSubjectTypeFilter = this.groupSubjectTypeFilter;
|
|
333
205
|
clone.observationBasedFilter = this.observationBasedFilter;
|
|
@@ -336,10 +208,5 @@ class DashboardFilterConfig {
|
|
|
336
208
|
|
|
337
209
|
}
|
|
338
210
|
|
|
339
|
-
_defineProperty(DashboardFilterConfig, "dataTypes", {
|
|
340
|
-
array: "array",
|
|
341
|
-
formMetaData: "formMetaData"
|
|
342
|
-
});
|
|
343
|
-
|
|
344
211
|
var _default = DashboardFilterConfig;
|
|
345
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.
|
|
119
|
+
const programEncounterTypeMappings = MetaDataService.getProgramEncounterFormMappings(formMappings);
|
|
124
120
|
|
|
125
|
-
const encounterTypeMappingsForPrograms = _lodash.default.
|
|
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,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;
|
package/dist/reports/Range.js
DELETED
|
@@ -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;
|