openchs-models 1.31.87 → 1.31.90
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 +37 -71
- package/dist/CustomFilter.js +3 -1
- package/dist/Dashboard.js +8 -0
- package/dist/Duration.js +5 -7
- package/dist/MediaQueue.js +1 -15
- package/dist/Observation.js +2 -6
- package/dist/ReportCard.js +90 -7
- package/dist/Schema.js +5 -1
- package/dist/StandardReportCardType.js +16 -4
- package/dist/index.js +16 -0
- package/dist/location/Locations.js +21 -0
- package/dist/reports/DashboardFilterConfig.js +139 -10
- package/dist/reports/Range.js +37 -0
- package/dist/service/MetaDataService.js +6 -2
- package/package.json +1 -1
|
@@ -7,6 +7,10 @@ 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
|
+
|
|
10
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
15
|
|
|
12
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; }
|
|
@@ -16,14 +20,6 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
16
20
|
super(that);
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
get checksum() {
|
|
20
|
-
return this.that.checksum;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
set checksum(x) {
|
|
24
|
-
this.that.checksum = x;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
23
|
get updatedAt() {
|
|
28
24
|
return this.that.updatedAt;
|
|
29
25
|
}
|
|
@@ -48,84 +44,59 @@ class CustomDashboardCache extends _BaseEntity.default {
|
|
|
48
44
|
this.that.filterApplied = x;
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
get
|
|
52
|
-
return this.
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
set filterErrorsJSON(x) {
|
|
56
|
-
this.that.filterErrorsJSON = x;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get ruleInputJSON() {
|
|
60
|
-
return this.that.ruleInputJSON;
|
|
47
|
+
get dashboard() {
|
|
48
|
+
return this.toEntity("dashboard", _Dashboard.default);
|
|
61
49
|
}
|
|
62
50
|
|
|
63
|
-
set
|
|
64
|
-
this.that.
|
|
51
|
+
set dashboard(x) {
|
|
52
|
+
this.that.dashboard = this.fromObject(x);
|
|
65
53
|
}
|
|
66
54
|
|
|
67
|
-
get
|
|
68
|
-
return this.that.
|
|
55
|
+
get dashboardFiltersHash() {
|
|
56
|
+
return this.that.dashboardFiltersHash;
|
|
69
57
|
}
|
|
70
58
|
|
|
71
|
-
set
|
|
72
|
-
this.that.
|
|
59
|
+
set dashboardFiltersHash(x) {
|
|
60
|
+
this.that.dashboardFiltersHash = x;
|
|
73
61
|
}
|
|
74
62
|
|
|
75
|
-
static create(uuid,
|
|
63
|
+
static create(uuid, updatedAt, selectedValuesJSON = '{}', filterApplied) {
|
|
76
64
|
const customDashboardCache = new CustomDashboardCache();
|
|
77
65
|
customDashboardCache.uuid = uuid;
|
|
78
|
-
customDashboardCache.checksum = checksum;
|
|
79
66
|
customDashboardCache.updatedAt = updatedAt;
|
|
80
67
|
customDashboardCache.selectedValuesJSON = selectedValuesJSON;
|
|
81
68
|
customDashboardCache.filterApplied = filterApplied;
|
|
82
|
-
customDashboardCache.filterErrorsJSON = filterErrorsJSON;
|
|
83
|
-
customDashboardCache.ruleInputJSON = ruleInputJSON;
|
|
84
|
-
customDashboardCache.transformedFiltersJSON = transformedFiltersJSON;
|
|
85
69
|
return customDashboardCache;
|
|
86
70
|
}
|
|
87
71
|
|
|
88
|
-
static
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
selectedGenders: state.selectedGenders
|
|
95
|
-
};
|
|
96
|
-
return filterCache;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
static createEmptyInstance() {
|
|
100
|
-
return new CustomDashboardCache();
|
|
72
|
+
static newInstance(dashboard, dashboardFiltersHash) {
|
|
73
|
+
const customDashboardCache = new CustomDashboardCache();
|
|
74
|
+
customDashboardCache.uuid = _General.default.randomUUID();
|
|
75
|
+
customDashboardCache.dashboard = dashboard;
|
|
76
|
+
customDashboardCache.reset(dashboardFiltersHash);
|
|
77
|
+
return customDashboardCache;
|
|
101
78
|
}
|
|
102
79
|
|
|
103
|
-
|
|
104
|
-
|
|
80
|
+
reset(dashboardFiltersHash) {
|
|
81
|
+
this.filterApplied = false;
|
|
82
|
+
this.selectedValuesJSON = JSON.stringify({});
|
|
83
|
+
this.dashboardFiltersHash = dashboardFiltersHash;
|
|
84
|
+
this.updatedAt = new Date();
|
|
105
85
|
}
|
|
106
86
|
|
|
107
87
|
getSelectedValues() {
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
getFilterErrors() {
|
|
112
|
-
return this.filterErrorsJSON && JSON.parse(this.filterErrorsJSON) || {};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
getRuleInput() {
|
|
116
|
-
return this.ruleInputJSON && JSON.parse(this.ruleInputJSON) || {
|
|
117
|
-
ruleInputArray: null
|
|
118
|
-
};
|
|
88
|
+
return JSON.parse(this.selectedValuesJSON);
|
|
119
89
|
}
|
|
120
90
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
91
|
+
clone() {
|
|
92
|
+
const customDashboardCache = new CustomDashboardCache();
|
|
93
|
+
customDashboardCache.uuid = this.uuid;
|
|
94
|
+
customDashboardCache.dashboard = this.dashboard;
|
|
95
|
+
customDashboardCache.updatedAt = this.updatedAt;
|
|
96
|
+
customDashboardCache.selectedValuesJSON = this.selectedValuesJSON;
|
|
97
|
+
customDashboardCache.filterApplied = this.filterApplied;
|
|
98
|
+
customDashboardCache.dashboardFiltersHash = this.dashboardFiltersHash;
|
|
99
|
+
return customDashboardCache;
|
|
129
100
|
}
|
|
130
101
|
|
|
131
102
|
}
|
|
@@ -135,16 +106,11 @@ _defineProperty(CustomDashboardCache, "schema", {
|
|
|
135
106
|
primaryKey: "uuid",
|
|
136
107
|
properties: {
|
|
137
108
|
uuid: "string",
|
|
138
|
-
|
|
109
|
+
dashboard: "Dashboard",
|
|
139
110
|
updatedAt: "date",
|
|
140
111
|
selectedValuesJSON: "string",
|
|
141
|
-
filterApplied:
|
|
142
|
-
|
|
143
|
-
default: false
|
|
144
|
-
},
|
|
145
|
-
filterErrorsJSON: "string",
|
|
146
|
-
ruleInputJSON: "string",
|
|
147
|
-
transformedFiltersJSON: "string"
|
|
112
|
+
filterApplied: "bool",
|
|
113
|
+
dashboardFiltersHash: "string"
|
|
148
114
|
}
|
|
149
115
|
});
|
|
150
116
|
|
package/dist/CustomFilter.js
CHANGED
|
@@ -41,7 +41,9 @@ _defineProperty(CustomFilter, "type", {
|
|
|
41
41
|
EncounterDate: "EncounterDate",
|
|
42
42
|
Address: "Address",
|
|
43
43
|
Concept: "Concept",
|
|
44
|
-
GroupSubject: "GroupSubject"
|
|
44
|
+
GroupSubject: "GroupSubject",
|
|
45
|
+
SubjectType: "SubjectType",
|
|
46
|
+
AsOnDate: "AsOnDate"
|
|
45
47
|
});
|
|
46
48
|
|
|
47
49
|
_defineProperty(CustomFilter, "scope", {
|
package/dist/Dashboard.js
CHANGED
|
@@ -36,6 +36,14 @@ 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
|
+
|
|
39
47
|
static fromResource(resource) {
|
|
40
48
|
return _General.default.assignFields(resource, new Dashboard(), ["uuid", "name", "description", "voided"]);
|
|
41
49
|
}
|
package/dist/Duration.js
CHANGED
|
@@ -9,13 +9,16 @@ var _lodash = _interopRequireDefault(require("lodash"));
|
|
|
9
9
|
|
|
10
10
|
var _moment = _interopRequireDefault(require("moment"));
|
|
11
11
|
|
|
12
|
-
var _SingleCodedValue = _interopRequireDefault(require("./observation/SingleCodedValue"));
|
|
13
|
-
|
|
14
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
13
|
|
|
16
14
|
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
15
|
|
|
18
16
|
class Duration {
|
|
17
|
+
constructor(durationValue, durationUnit) {
|
|
18
|
+
this._durationValue = durationValue;
|
|
19
|
+
this.durationUnit = durationUnit;
|
|
20
|
+
}
|
|
21
|
+
|
|
19
22
|
static inDay(value) {
|
|
20
23
|
return new Duration(value, Duration.Day);
|
|
21
24
|
}
|
|
@@ -42,11 +45,6 @@ class Duration {
|
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
constructor(durationValue, durationUnit) {
|
|
46
|
-
this._durationValue = durationValue;
|
|
47
|
-
this.durationUnit = durationUnit;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
48
|
get isInYears() {
|
|
51
49
|
return this.durationUnit === Duration.Year;
|
|
52
50
|
}
|
package/dist/MediaQueue.js
CHANGED
|
@@ -9,8 +9,6 @@ var _General = _interopRequireDefault(require("./utility/General"));
|
|
|
9
9
|
|
|
10
10
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
11
11
|
|
|
12
|
-
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
|
-
|
|
14
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
13
|
|
|
16
14
|
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; }
|
|
@@ -69,7 +67,7 @@ class MediaQueue extends _BaseEntity.default {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
static create(entityUUID, entityName, fileName, type, entityTargetField, conceptUUID, uuid = _General.default.randomUUID()) {
|
|
72
|
-
|
|
70
|
+
var mediaQueue = new MediaQueue();
|
|
73
71
|
mediaQueue.entityUUID = entityUUID;
|
|
74
72
|
mediaQueue.uuid = uuid;
|
|
75
73
|
mediaQueue.entityName = entityName;
|
|
@@ -92,18 +90,6 @@ class MediaQueue extends _BaseEntity.default {
|
|
|
92
90
|
return mediaQueueItem;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
getDisplayText() {
|
|
96
|
-
// generate safe to string
|
|
97
|
-
let str = "";
|
|
98
|
-
if (!_lodash.default.isNil(this.entityName)) str += "EntityName: " + this.entityName + ", ";
|
|
99
|
-
if (!_lodash.default.isNil(this.entityUUID)) str += "EntityUUID: " + this.entityUUID + ", ";
|
|
100
|
-
if (!_lodash.default.isNil(this.entityTargetField)) str += "EntityTargetField: " + this.entityTargetField + ", ";
|
|
101
|
-
if (!_lodash.default.isNil(this.fileName)) str += "FileName: " + this.fileName + ", ";
|
|
102
|
-
if (!_lodash.default.isNil(this.type)) str += "Type: " + this.type + ", ";
|
|
103
|
-
if (!_lodash.default.isNil(this.conceptUUID)) str += "ConceptUUID: " + this.conceptUUID;
|
|
104
|
-
return str;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
93
|
}
|
|
108
94
|
|
|
109
95
|
_defineProperty(MediaQueue, "schema", {
|
package/dist/Observation.js
CHANGED
|
@@ -21,19 +21,16 @@ 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) {
|
|
25
25
|
const observation = new Observation();
|
|
26
26
|
observation.concept = concept;
|
|
27
27
|
observation.valueJSON = valueJSON;
|
|
28
|
-
observation.abnormal = abnormal;
|
|
29
28
|
return observation;
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
class Observation extends _PersistedObject.default {
|
|
33
32
|
constructor(that = null) {
|
|
34
33
|
super(that);
|
|
35
|
-
|
|
36
|
-
_defineProperty(this, "abnormal", void 0);
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
get concept() {
|
|
@@ -52,11 +49,10 @@ class Observation extends _PersistedObject.default {
|
|
|
52
49
|
this.that.valueJSON = x;
|
|
53
50
|
}
|
|
54
51
|
|
|
55
|
-
static create(concept, value
|
|
52
|
+
static create(concept, value) {
|
|
56
53
|
const observation = new Observation();
|
|
57
54
|
observation.concept = concept;
|
|
58
55
|
observation.valueJSON = value;
|
|
59
|
-
observation.abnormal = abnormal;
|
|
60
56
|
return observation;
|
|
61
57
|
}
|
|
62
58
|
|
package/dist/ReportCard.js
CHANGED
|
@@ -15,15 +15,27 @@ 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
|
+
|
|
18
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
27
|
|
|
20
28
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
21
29
|
|
|
22
|
-
function throwInvalidIndexError(index, reportCardsLength) {
|
|
23
|
-
throw new Error(`Invalid index ${index} specified for reportCard with length ${reportCardsLength}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
30
|
class ReportCard extends _BaseEntity.default {
|
|
31
|
+
static newReportCard() {
|
|
32
|
+
const reportCard = new ReportCard();
|
|
33
|
+
reportCard.standardReportCardInputSubjectTypes = [];
|
|
34
|
+
reportCard.standardReportCardInputPrograms = [];
|
|
35
|
+
reportCard.standardReportCardInputEncounterTypes = [];
|
|
36
|
+
return reportCard;
|
|
37
|
+
}
|
|
38
|
+
|
|
27
39
|
constructor(that = null) {
|
|
28
40
|
super(that);
|
|
29
41
|
}
|
|
@@ -96,6 +108,39 @@ class ReportCard extends _BaseEntity.default {
|
|
|
96
108
|
get textColor() {
|
|
97
109
|
return _lodash.default.isNil(this.standardReportCardType) ? '#ffffff' : this.standardReportCardType.textColor;
|
|
98
110
|
}
|
|
111
|
+
|
|
112
|
+
get standardReportCardInputSubjectTypes() {
|
|
113
|
+
return this.toEntityList("standardReportCardInputSubjectTypes", _SubjectType.default);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
set standardReportCardInputSubjectTypes(x) {
|
|
117
|
+
this.that.standardReportCardInputSubjectTypes = this.fromEntityList(x);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
get standardReportCardInputPrograms() {
|
|
121
|
+
return this.toEntityList("standardReportCardInputPrograms", _Program.default);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
set standardReportCardInputPrograms(x) {
|
|
125
|
+
this.that.standardReportCardInputPrograms = this.fromEntityList(x);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
get standardReportCardInputEncounterTypes() {
|
|
129
|
+
return this.toEntityList("standardReportCardInputEncounterTypes", _EncounterType.default);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
set standardReportCardInputEncounterTypes(x) {
|
|
133
|
+
this.that.standardReportCardInputEncounterTypes = this.fromEntityList(x);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
getStandardReportCardInputRecentDuration() {
|
|
137
|
+
const duration = JSON.parse(this.that.standardReportCardInputRecentDurationJSON);
|
|
138
|
+
return new _Duration.default(duration.value, duration.unit);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
setStandardReportCardInputRecentDurationJSON(x) {
|
|
142
|
+
this.that.standardReportCardInputRecentDurationJSON = x;
|
|
143
|
+
}
|
|
99
144
|
/**
|
|
100
145
|
* Helper method used to generate unique key value for Nested Report Cards using UUID and Index of the Report Card.
|
|
101
146
|
* The Nested Report Card's query responses would be mapped to the corresponding Dashboard Report cards using the UUID and Index.
|
|
@@ -122,9 +167,19 @@ class ReportCard extends _BaseEntity.default {
|
|
|
122
167
|
}
|
|
123
168
|
|
|
124
169
|
static fromResource(resource, entityService) {
|
|
125
|
-
const reportCard = _General.default.assignFields(resource,
|
|
170
|
+
const reportCard = _General.default.assignFields(resource, ReportCard.newReportCard(), ["uuid", "name", "query", "description", "colour", "voided", "nested", "countOfCards"]);
|
|
126
171
|
|
|
127
172
|
reportCard.standardReportCardType = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "standardReportCardUUID"), _StandardReportCardType.default.schema.name);
|
|
173
|
+
resource.standardReportCardInputSubjectTypes.forEach(uuid => {
|
|
174
|
+
reportCard.standardReportCardInputSubjectTypes.push(entityService.findByUUID(uuid, _SubjectType.default.schema.name));
|
|
175
|
+
});
|
|
176
|
+
resource.standardReportCardInputPrograms.forEach(uuid => {
|
|
177
|
+
reportCard.standardReportCardInputPrograms.push(entityService.findByUUID(uuid, _Program.default.schema.name));
|
|
178
|
+
});
|
|
179
|
+
resource.standardReportCardInputEncounterTypes.forEach(uuid => {
|
|
180
|
+
reportCard.standardReportCardInputEncounterTypes.push(entityService.findByUUID(uuid, _EncounterType.default.schema.name));
|
|
181
|
+
});
|
|
182
|
+
reportCard.setStandardReportCardInputRecentDurationJSON(resource.standardReportCardInputRecentDuration);
|
|
128
183
|
return reportCard;
|
|
129
184
|
}
|
|
130
185
|
|
|
@@ -132,6 +187,18 @@ class ReportCard extends _BaseEntity.default {
|
|
|
132
187
|
return _lodash.default.isNil(this.standardReportCardType) ? false : this.standardReportCardType.isTaskType();
|
|
133
188
|
}
|
|
134
189
|
|
|
190
|
+
isStandardReportType() {
|
|
191
|
+
return !_lodash.default.isNil(this.standardReportCardType);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
isSubjectTypeFilterSupported() {
|
|
195
|
+
return this.isStandardReportType() && this.standardReportCardType.isSubjectTypeFilterSupported();
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
isRecentType() {
|
|
199
|
+
return this.isStandardReportType() && this.standardReportCardType.isRecentType();
|
|
200
|
+
}
|
|
201
|
+
|
|
135
202
|
}
|
|
136
203
|
|
|
137
204
|
_defineProperty(ReportCard, "schema", {
|
|
@@ -166,8 +233,24 @@ _defineProperty(ReportCard, "schema", {
|
|
|
166
233
|
type: "int",
|
|
167
234
|
default: 1,
|
|
168
235
|
optional: true
|
|
169
|
-
}
|
|
170
|
-
|
|
236
|
+
},
|
|
237
|
+
//Used only by nested ReportCards
|
|
238
|
+
standardReportCardInputSubjectTypes: {
|
|
239
|
+
type: "list",
|
|
240
|
+
objectType: "SubjectType"
|
|
241
|
+
},
|
|
242
|
+
standardReportCardInputPrograms: {
|
|
243
|
+
type: "list",
|
|
244
|
+
objectType: "Program"
|
|
245
|
+
},
|
|
246
|
+
standardReportCardInputEncounterTypes: {
|
|
247
|
+
type: "list",
|
|
248
|
+
objectType: "EncounterType"
|
|
249
|
+
},
|
|
250
|
+
standardReportCardInputRecentDurationJSON: {
|
|
251
|
+
type: "string",
|
|
252
|
+
optional: true
|
|
253
|
+
}
|
|
171
254
|
}
|
|
172
255
|
});
|
|
173
256
|
|
package/dist/Schema.js
CHANGED
|
@@ -279,7 +279,7 @@ function createRealmConfig() {
|
|
|
279
279
|
return doCompact;
|
|
280
280
|
},
|
|
281
281
|
//order is important, should be arranged according to the dependency
|
|
282
|
-
schemaVersion:
|
|
282
|
+
schemaVersion: 193,
|
|
283
283
|
onMigration: function (oldDB, newDB) {
|
|
284
284
|
console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
|
|
285
285
|
if (oldDB.schemaVersion === VersionWithEmbeddedMigrationProblem) throw new Error(`Update from schema version ${VersionWithEmbeddedMigrationProblem} is not allowed. Please uninstall and install app.`);
|
|
@@ -913,6 +913,10 @@ function createRealmConfig() {
|
|
|
913
913
|
if (oldDB.schemaVersion < 190) {// PlaceHolder for SubjectType.User changes, so that people with previous version of client
|
|
914
914
|
// are not able to use fastSync of version 190 and above
|
|
915
915
|
}
|
|
916
|
+
|
|
917
|
+
if (oldDB.schemaVersion < 191) {
|
|
918
|
+
newDB.delete(newDB.objects("CustomDashboardCache"));
|
|
919
|
+
}
|
|
916
920
|
}
|
|
917
921
|
};
|
|
918
922
|
}
|
|
@@ -15,6 +15,8 @@ var _ApprovalStatus = _interopRequireDefault(require("./ApprovalStatus"));
|
|
|
15
15
|
|
|
16
16
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
17
17
|
|
|
18
|
+
var _Duration = _interopRequireDefault(require("./Duration"));
|
|
19
|
+
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
20
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; }
|
|
@@ -81,7 +83,7 @@ class StandardReportCardType extends _BaseEntity.default {
|
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
defaultTypes() {
|
|
84
|
-
return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.
|
|
86
|
+
return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits, StandardReportCardType.type.Total];
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
isApprovalType() {
|
|
@@ -118,6 +120,14 @@ class StandardReportCardType extends _BaseEntity.default {
|
|
|
118
120
|
return typeToStatusMap[this.name];
|
|
119
121
|
}
|
|
120
122
|
|
|
123
|
+
isSubjectTypeFilterSupported() {
|
|
124
|
+
return [StandardReportCardType.type.ScheduledVisits, StandardReportCardType.type.OverdueVisits, StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits].includes(this.name);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
isRecentType() {
|
|
128
|
+
return [StandardReportCardType.type.RecentRegistrations, StandardReportCardType.type.RecentEnrolments, StandardReportCardType.type.RecentVisits].includes(this.name);
|
|
129
|
+
}
|
|
130
|
+
|
|
121
131
|
}
|
|
122
132
|
|
|
123
133
|
_defineProperty(StandardReportCardType, "schema", {
|
|
@@ -143,9 +153,9 @@ _defineProperty(StandardReportCardType, "type", {
|
|
|
143
153
|
Rejected: "Rejected",
|
|
144
154
|
ScheduledVisits: "Scheduled visits",
|
|
145
155
|
OverdueVisits: "Overdue visits",
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
156
|
+
RecentRegistrations: "Recent registrations",
|
|
157
|
+
RecentEnrolments: "Recent enrolments",
|
|
158
|
+
RecentVisits: "Recent visits",
|
|
149
159
|
Total: "Total",
|
|
150
160
|
Comments: "Comments",
|
|
151
161
|
CallTasks: "Call tasks",
|
|
@@ -153,6 +163,8 @@ _defineProperty(StandardReportCardType, "type", {
|
|
|
153
163
|
DueChecklist: "Due checklist"
|
|
154
164
|
});
|
|
155
165
|
|
|
166
|
+
_defineProperty(StandardReportCardType, "recentCardDurationUnits", [_Duration.default.Day, _Duration.default.Week, _Duration.default.Month]);
|
|
167
|
+
|
|
156
168
|
const typeToStatusMap = {
|
|
157
169
|
[StandardReportCardType.type.PendingApproval]: _ApprovalStatus.default.statuses.Pending,
|
|
158
170
|
[StandardReportCardType.type.Approved]: _ApprovalStatus.default.statuses.Approved,
|
package/dist/index.js
CHANGED
|
@@ -789,6 +789,18 @@ 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
|
+
});
|
|
792
804
|
|
|
793
805
|
var _AbstractEncounter = _interopRequireDefault(require("./AbstractEncounter"));
|
|
794
806
|
|
|
@@ -1042,6 +1054,10 @@ var _DashboardCacheFilter = _interopRequireDefault(require("./application/Dashbo
|
|
|
1042
1054
|
|
|
1043
1055
|
var _JsonStringify = require("./utility/JsonStringify");
|
|
1044
1056
|
|
|
1057
|
+
var _Locations = _interopRequireDefault(require("./location/Locations"));
|
|
1058
|
+
|
|
1059
|
+
var _Range = _interopRequireDefault(require("./reports/Range"));
|
|
1060
|
+
|
|
1045
1061
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
1046
1062
|
|
|
1047
1063
|
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; }
|
|
@@ -0,0 +1,21 @@
|
|
|
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;
|
|
@@ -13,11 +13,23 @@ 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
|
+
|
|
16
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
25
|
|
|
18
26
|
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; }
|
|
19
27
|
|
|
20
28
|
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
|
+
};
|
|
21
33
|
|
|
22
34
|
class ObservationBasedFilter {
|
|
23
35
|
constructor() {
|
|
@@ -42,6 +54,15 @@ class ObservationBasedFilter {
|
|
|
42
54
|
return !_lodash.default.isNil(concept) && (!_lodash.default.isEmpty(programs) || !_lodash.default.isEmpty(encounterTypes) || this.scope === _CustomFilter.default.scope.Registration);
|
|
43
55
|
}
|
|
44
56
|
|
|
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
|
+
|
|
45
66
|
toServerRequest() {
|
|
46
67
|
return {
|
|
47
68
|
scope: this.scope,
|
|
@@ -107,10 +128,29 @@ class GroupSubjectTypeFilter {
|
|
|
107
128
|
}
|
|
108
129
|
|
|
109
130
|
exports.GroupSubjectTypeFilter = GroupSubjectTypeFilter;
|
|
110
|
-
const dateFilterTypes = [_CustomFilter.default.type.RegistrationDate, _CustomFilter.default.type.EnrolmentDate, _CustomFilter.default.type.EncounterDate, _CustomFilter.default.type.ProgramEncounterDate];
|
|
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
|
+
}
|
|
111
149
|
|
|
112
150
|
class DashboardFilterConfig {
|
|
113
151
|
constructor() {
|
|
152
|
+
_defineProperty(this, "subjectType", void 0);
|
|
153
|
+
|
|
114
154
|
_defineProperty(this, "type", void 0);
|
|
115
155
|
|
|
116
156
|
_defineProperty(this, "widget", void 0);
|
|
@@ -120,26 +160,104 @@ class DashboardFilterConfig {
|
|
|
120
160
|
_defineProperty(this, "observationBasedFilter", void 0);
|
|
121
161
|
}
|
|
122
162
|
|
|
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
|
+
|
|
123
181
|
getInputDataType() {
|
|
124
182
|
if (this.isConceptTypeFilter()) {
|
|
125
183
|
return this.observationBasedFilter.concept.datatype;
|
|
126
|
-
} else if (this.
|
|
127
|
-
return
|
|
128
|
-
} else if (dateFilterTypes.includes(this.type)) {
|
|
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()) {
|
|
129
187
|
return _Concept.default.dataType.Date;
|
|
130
|
-
} else {
|
|
131
|
-
return
|
|
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];
|
|
132
240
|
}
|
|
241
|
+
|
|
242
|
+
throw new Error("Unsupported filter type: " + this.type);
|
|
133
243
|
}
|
|
134
244
|
|
|
135
245
|
isConceptTypeFilter() {
|
|
136
246
|
return this.type === _CustomFilter.default.type.Concept;
|
|
137
247
|
}
|
|
138
248
|
|
|
249
|
+
isNonCodedObservationDataType() {
|
|
250
|
+
return this.isConceptTypeFilter() && this.observationBasedFilter.concept.datatype !== _Concept.default.dataType.Coded;
|
|
251
|
+
}
|
|
252
|
+
|
|
139
253
|
isGroupSubjectTypeFilter() {
|
|
140
254
|
return this.type === _CustomFilter.default.type.GroupSubject;
|
|
141
255
|
}
|
|
142
256
|
|
|
257
|
+
requiresSpecificSubjectType() {
|
|
258
|
+
return ![_CustomFilter.default.type.SubjectType, _CustomFilter.default.type.AsOnDate].includes(this.type);
|
|
259
|
+
}
|
|
260
|
+
|
|
143
261
|
isValid() {
|
|
144
262
|
const valid = !_lodash.default.isNil(this.type);
|
|
145
263
|
if (!valid) return valid;
|
|
@@ -149,6 +267,7 @@ class DashboardFilterConfig {
|
|
|
149
267
|
toServerRequest() {
|
|
150
268
|
const request = {
|
|
151
269
|
type: this.type,
|
|
270
|
+
subjectTypeUUID: this.subjectType && this.subjectType.uuid,
|
|
152
271
|
widget: this.widget
|
|
153
272
|
};
|
|
154
273
|
if (this.isConceptTypeFilter()) request.observationBasedFilter = this.observationBasedFilter.toServerRequest();else if (this.isGroupSubjectTypeFilter()) request.groupSubjectTypeFilter = this.groupSubjectTypeFilter.toServerRequest();
|
|
@@ -175,6 +294,12 @@ class DashboardFilterConfig {
|
|
|
175
294
|
return [RegistrationDate, EnrolmentDate, ProgramEncounterDate, EncounterDate].includes(this.type) || this.isConceptTypeFilter() && this.observationBasedFilter.isWidgetRequired();
|
|
176
295
|
}
|
|
177
296
|
|
|
297
|
+
setSubjectType(subjectType) {
|
|
298
|
+
if (_lodash.default.get(subjectType, "uuid") !== _lodash.default.get(this.subjectType, "uuid")) {
|
|
299
|
+
this.subjectType = subjectType;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
178
303
|
willObservationBeInScopeOfProgramEnrolment() {
|
|
179
304
|
return this.isConceptTypeFilter() && this.observationBasedFilter.willObservationBeInScopeOfProgramEnrolment();
|
|
180
305
|
}
|
|
@@ -184,13 +309,11 @@ class DashboardFilterConfig {
|
|
|
184
309
|
}
|
|
185
310
|
|
|
186
311
|
validate(filterValue) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if ([_Concept.default.dataType.Date, _Concept.default.dataType.DateTime].includes(inputDataType) && this.widget === _CustomFilter.default.widget.Range) {
|
|
312
|
+
if (this.isDateRangeFilterType()) {
|
|
190
313
|
return _DateTimeUtil.default.validateDateRange(filterValue.minValue, filterValue.maxValue);
|
|
191
314
|
}
|
|
192
315
|
|
|
193
|
-
if (
|
|
316
|
+
if (this.isTimeRangeFilterType()) {
|
|
194
317
|
return _DateTimeUtil.default.validateTimeRange(filterValue.minValue, filterValue.maxValue);
|
|
195
318
|
}
|
|
196
319
|
|
|
@@ -200,6 +323,7 @@ class DashboardFilterConfig {
|
|
|
200
323
|
clone() {
|
|
201
324
|
const clone = new DashboardFilterConfig();
|
|
202
325
|
clone.type = this.type;
|
|
326
|
+
clone.subjectType = this.subjectType;
|
|
203
327
|
clone.widget = this.widget;
|
|
204
328
|
clone.groupSubjectTypeFilter = this.groupSubjectTypeFilter;
|
|
205
329
|
clone.observationBasedFilter = this.observationBasedFilter;
|
|
@@ -208,5 +332,10 @@ class DashboardFilterConfig {
|
|
|
208
332
|
|
|
209
333
|
}
|
|
210
334
|
|
|
335
|
+
_defineProperty(DashboardFilterConfig, "dataTypes", {
|
|
336
|
+
array: "array",
|
|
337
|
+
formMetaData: "formMetaData"
|
|
338
|
+
});
|
|
339
|
+
|
|
211
340
|
var _default = DashboardFilterConfig;
|
|
212
341
|
exports.default = _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
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;
|
|
@@ -99,6 +99,10 @@ 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
|
+
|
|
102
106
|
static getProgramsForSubjectType(allPrograms, subjectType, formMappings) {
|
|
103
107
|
if (_lodash.default.isNil(subjectType)) return allPrograms;
|
|
104
108
|
|
|
@@ -116,9 +120,9 @@ class MetaDataService {
|
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
static getEncounterTypesForPrograms(allEncounterTypes, programs, formMappings) {
|
|
119
|
-
const programEncounterTypeMappings = MetaDataService.
|
|
123
|
+
const programEncounterTypeMappings = MetaDataService.getProgramEncounterFormMappingsForFormType(formMappings, _Form.default.formTypes.ProgramEncounter);
|
|
120
124
|
|
|
121
|
-
const encounterTypeMappingsForPrograms = _lodash.default.
|
|
125
|
+
const encounterTypeMappingsForPrograms = _lodash.default.filter(programEncounterTypeMappings, formMapping => _lodash.default.some(programs, program => formMapping.programUUID === program.uuid));
|
|
122
126
|
|
|
123
127
|
return encounterTypeMappingsForPrograms.map(x => _lodash.default.find(allEncounterTypes, et => et.uuid === x.encounterTypeUUID));
|
|
124
128
|
}
|