openchs-models 1.31.88 → 1.31.91

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/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
  }
@@ -9,6 +9,8 @@ var _General = _interopRequireDefault(require("./utility/General"));
9
9
 
10
10
  var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
11
11
 
12
+ var _lodash = _interopRequireDefault(require("lodash"));
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; }
@@ -67,7 +69,7 @@ class MediaQueue extends _BaseEntity.default {
67
69
  }
68
70
 
69
71
  static create(entityUUID, entityName, fileName, type, entityTargetField, conceptUUID, uuid = _General.default.randomUUID()) {
70
- var mediaQueue = new MediaQueue();
72
+ const mediaQueue = new MediaQueue();
71
73
  mediaQueue.entityUUID = entityUUID;
72
74
  mediaQueue.uuid = uuid;
73
75
  mediaQueue.entityName = entityName;
@@ -90,6 +92,18 @@ class MediaQueue extends _BaseEntity.default {
90
92
  return mediaQueueItem;
91
93
  }
92
94
 
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
+
93
107
  }
94
108
 
95
109
  _defineProperty(MediaQueue, "schema", {
@@ -21,6 +21,8 @@ var _Program = _interopRequireDefault(require("./Program"));
21
21
 
22
22
  var _EncounterType = _interopRequireDefault(require("./EncounterType"));
23
23
 
24
+ var _Duration = _interopRequireDefault(require("./Duration"));
25
+
24
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
27
 
26
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; }
@@ -31,7 +33,6 @@ class ReportCard extends _BaseEntity.default {
31
33
  reportCard.standardReportCardInputSubjectTypes = [];
32
34
  reportCard.standardReportCardInputPrograms = [];
33
35
  reportCard.standardReportCardInputEncounterTypes = [];
34
- reportCard.standardReportCardInputRecentDuration = null;
35
36
  return reportCard;
36
37
  }
37
38
 
@@ -132,11 +133,12 @@ class ReportCard extends _BaseEntity.default {
132
133
  this.that.standardReportCardInputEncounterTypes = this.fromEntityList(x);
133
134
  }
134
135
 
135
- get standardReportCardInputRecentDurationJSON() {
136
- return JSON.parse(this.that.standardReportCardInputRecentDurationJSON);
136
+ getStandardReportCardInputRecentDuration() {
137
+ const duration = JSON.parse(this.that.standardReportCardInputRecentDurationJSON);
138
+ return new _Duration.default(duration.value, duration.unit);
137
139
  }
138
140
 
139
- set standardReportCardInputRecentDurationJSON(x) {
141
+ setStandardReportCardInputRecentDurationJSON(x) {
140
142
  this.that.standardReportCardInputRecentDurationJSON = x;
141
143
  }
142
144
  /**
@@ -177,7 +179,7 @@ class ReportCard extends _BaseEntity.default {
177
179
  resource.standardReportCardInputEncounterTypes.forEach(uuid => {
178
180
  reportCard.standardReportCardInputEncounterTypes.push(entityService.findByUUID(uuid, _EncounterType.default.schema.name));
179
181
  });
180
- reportCard.standardReportCardInputRecentDurationJSON = resource.standardReportCardInputRecentDuration;
182
+ reportCard.setStandardReportCardInputRecentDurationJSON(resource.standardReportCardInputRecentDuration);
181
183
  return reportCard;
182
184
  }
183
185
 
@@ -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; }
@@ -161,7 +163,7 @@ _defineProperty(StandardReportCardType, "type", {
161
163
  DueChecklist: "Due checklist"
162
164
  });
163
165
 
164
- _defineProperty(StandardReportCardType, "recentCardDurationUnits", ["days", "weeks", "months"]);
166
+ _defineProperty(StandardReportCardType, "recentCardDurationUnits", [_Duration.default.Day, _Duration.default.Week, _Duration.default.Month]);
165
167
 
166
168
  const typeToStatusMap = {
167
169
  [StandardReportCardType.type.PendingApproval]: _ApprovalStatus.default.statuses.Pending,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.31.88",
4
+ "version": "1.31.91",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",