openchs-models 1.29.4 → 1.29.6

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.
@@ -22,6 +22,14 @@ class DashboardFilter extends _BaseEntity.default {
22
22
  super(that);
23
23
  }
24
24
 
25
+ get name() {
26
+ return this.that.name;
27
+ }
28
+
29
+ set name(x) {
30
+ this.that.name = x;
31
+ }
32
+
25
33
  get dashboard() {
26
34
  return this.toEntity("dashboard", _Dashboard.default);
27
35
  }
@@ -30,18 +38,18 @@ class DashboardFilter extends _BaseEntity.default {
30
38
  this.that.dashboard = this.fromObject(x);
31
39
  }
32
40
 
33
- get filter() {
34
- return this.that.filter;
41
+ get filterConfig() {
42
+ return this.that.filterConfig;
35
43
  }
36
44
 
37
- set filter(x) {
38
- this.that.filter = x;
45
+ set filterConfig(x) {
46
+ this.that.filterConfig = x;
39
47
  }
40
48
 
41
49
  static fromResource(resource, entityService) {
42
- const dashboardFilter = _General.default.assignFields(resource, new DashboardFilter(), ["uuid", "voided"]);
50
+ const dashboardFilter = _General.default.assignFields(resource, new DashboardFilter(), ["uuid", "voided", "name"]);
43
51
 
44
- dashboardFilter.filter = JSON.stringify(resource["filter"]);
52
+ dashboardFilter.filterConfig = JSON.stringify(resource["filterConfig"]);
45
53
  dashboardFilter.dashboard = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "dashboardUUID"), _Dashboard.default.schema.name);
46
54
  return dashboardFilter;
47
55
  }
@@ -43,7 +43,7 @@ class ObservationBasedFilter {
43
43
  toServerRequest() {
44
44
  return {
45
45
  scope: this.scope,
46
- concept: this.concept.uuid,
46
+ conceptUUID: this.concept.uuid,
47
47
  programUUIDs: this.programs.map(x => x.uuid),
48
48
  encounterTypeUUIDs: this.encounterTypes.map(x => x.uuid)
49
49
  };
@@ -105,6 +105,7 @@ class GroupSubjectTypeFilter {
105
105
  }
106
106
 
107
107
  exports.GroupSubjectTypeFilter = GroupSubjectTypeFilter;
108
+ const dateFilterTypes = [_CustomFilter.default.type.RegistrationDate, _CustomFilter.default.type.EnrolmentDate, _CustomFilter.default.type.EncounterDate, _CustomFilter.default.type.ProgramEncounterDate];
108
109
 
109
110
  class DashboardFilterConfig {
110
111
  constructor() {
@@ -119,6 +120,18 @@ class DashboardFilterConfig {
119
120
  _defineProperty(this, "observationBasedFilter", void 0);
120
121
  }
121
122
 
123
+ getInputDataType() {
124
+ if (this.isConceptTypeFilter()) {
125
+ return this.observationBasedFilter.concept.datatype;
126
+ } else if (this.isGroupSubjectTypeFilter()) {
127
+ return _Concept.default.dataType.Subject;
128
+ } else if (dateFilterTypes.includes(this.type)) {
129
+ return _Concept.default.dataType.Date;
130
+ } else {
131
+ return this.type;
132
+ }
133
+ }
134
+
122
135
  isConceptTypeFilter() {
123
136
  return this.type === _CustomFilter.default.type.Concept;
124
137
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.29.4",
4
+ "version": "1.29.6",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",