openchs-models 1.33.2 → 1.33.5
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/.circleci/config.yml +15 -5
- package/.commit-message.txt +21 -0
- package/.nvmrc +1 -1
- package/Makefile +32 -10
- package/REALM_V12_NOTES.md +46 -0
- package/dist/AbstractEncounter.js +4 -105
- package/dist/AddressLevel.js +5 -62
- package/dist/ApprovalStatus.js +4 -17
- package/dist/BaseEntity.js +5 -42
- package/dist/BeneficiaryModePin.js +4 -13
- package/dist/Checklist.js +6 -52
- package/dist/ChecklistDetail.js +4 -22
- package/dist/ChecklistItem.js +16 -96
- package/dist/ChecklistItemDetail.js +4 -43
- package/dist/ChecklistItemStatus.js +4 -33
- package/dist/Comment.js +6 -51
- package/dist/CommentThread.js +4 -26
- package/dist/CompositeDuration.js +1 -18
- package/dist/Concept.js +5 -107
- package/dist/ConceptAnswer.js +4 -21
- package/dist/CustomDashboardCache.js +4 -38
- package/dist/CustomFilter.js +5 -15
- package/dist/Dashboard.js +4 -23
- package/dist/DashboardCache.js +4 -23
- package/dist/DashboardSection.js +4 -24
- package/dist/DashboardSectionCardMapping.js +4 -21
- package/dist/Displayable.js +3 -11
- package/dist/Documentation.js +4 -21
- package/dist/DocumentationItem.js +4 -20
- package/dist/Duration.js +4 -39
- package/dist/Encounter.js +6 -41
- package/dist/EncounterType.js +4 -26
- package/dist/EntityApprovalStatus.js +6 -56
- package/dist/EntityMetaData.js +7 -105
- package/dist/EntityQueue.js +4 -15
- package/dist/EntityRule.js +1 -29
- package/dist/EntitySyncStatus.js +4 -19
- package/dist/Extension.js +4 -18
- package/dist/Family.js +4 -56
- package/dist/FileFormat.js +0 -7
- package/dist/Gender.js +4 -17
- package/dist/GroupDashboard.js +4 -23
- package/dist/GroupPrivileges.js +4 -28
- package/dist/GroupRole.js +4 -34
- package/dist/GroupSubject.js +6 -59
- package/dist/Groups.js +4 -14
- package/dist/Identifier.js +4 -20
- package/dist/IdentifierAssignment.js +6 -45
- package/dist/IdentifierSource.js +4 -15
- package/dist/Individual.js +17 -265
- package/dist/LocaleMapping.js +4 -13
- package/dist/LocationHierarchy.js +4 -25
- package/dist/Media.js +35 -35
- package/dist/MediaQueue.js +4 -26
- package/dist/MigrationsHelper.js +15 -22
- package/dist/MyGroups.js +4 -14
- package/dist/News.js +4 -31
- package/dist/Observation.js +4 -54
- package/dist/ObservationsHolder.js +104 -216
- package/dist/OrganisationConfig.js +4 -19
- package/dist/PersistedObject.js +1 -19
- package/dist/PhoneNumber.js +0 -11
- package/dist/PlatformTranslation.js +4 -17
- package/dist/Privilege.js +5 -22
- package/dist/Program.js +4 -39
- package/dist/ProgramEncounter.js +6 -48
- package/dist/ProgramEnrolment.js +8 -162
- package/dist/ReferenceEntity.js +1 -10
- package/dist/ReportCard.js +5 -60
- package/dist/ResetSync.js +4 -17
- package/dist/Rule.js +4 -28
- package/dist/RuleDependency.js +4 -17
- package/dist/RuleFailureTelemetry.js +4 -36
- package/dist/Schema.js +16 -268
- package/dist/SchemaNames.js +3 -46
- package/dist/Settings.js +4 -53
- package/dist/StandardReportCardType.js +4 -39
- package/dist/SubjectMigration.js +6 -45
- package/dist/SubjectType.js +6 -72
- package/dist/SyncTelemetry.js +4 -40
- package/dist/Translation.js +4 -17
- package/dist/UserInfo.js +4 -33
- package/dist/application/DashboardCacheFilter.js +4 -24
- package/dist/application/Filter.js +3 -16
- package/dist/application/Form.js +6 -93
- package/dist/application/FormElement.js +5 -100
- package/dist/application/FormElementGroup.js +4 -75
- package/dist/application/FormElementStatus.js +1 -11
- package/dist/application/FormMapping.js +6 -44
- package/dist/application/Format.js +4 -20
- package/dist/application/KeyValue.js +4 -19
- package/dist/application/MenuItem.js +4 -35
- package/dist/application/MultiSelectFilter.js +1 -11
- package/dist/application/NullProgramEnrolment.js +0 -8
- package/dist/application/SingleSelectFilter.js +1 -12
- package/dist/application/StaticFormElementGroup.js +0 -11
- package/dist/application/StringKeyNumericValue.js +4 -17
- package/dist/application/ValidationResult.js +6 -20
- package/dist/application/ValidationResults.js +1 -14
- package/dist/application/WorkItem.js +4 -20
- package/dist/application/WorkList.js +1 -24
- package/dist/application/WorkLists.js +1 -13
- package/dist/assignment/UserSubjectAssignment.js +6 -26
- package/dist/draft/DraftEncounter.js +4 -40
- package/dist/draft/DraftSubject.js +4 -46
- package/dist/error/IgnorableSyncError.js +1 -6
- package/dist/error/SyncError.js +1 -6
- package/dist/framework/ArrayHelper.js +3 -11
- package/dist/framework/DefinedObjectSchema.js +4 -12
- package/dist/framework/RealmCollectionHelper.js +1 -9
- package/dist/framework/RealmEmbeddedObjectHandler.js +126 -0
- package/dist/framework/RealmListProxy.js +1 -10
- package/dist/framework/RealmObjectSchema.js +1 -11
- package/dist/framework/RealmProxy.js +15 -39
- package/dist/framework/RealmResultsProxy.js +3 -37
- package/dist/framework/RealmResultsProxyHandler.js +2 -5
- package/dist/geo/Point.js +4 -17
- package/dist/index.js +9 -137
- package/dist/location/Locations.js +1 -6
- package/dist/observation/MultipleCodedValues.js +1 -21
- package/dist/observation/PrimitiveValue.js +1 -17
- package/dist/observation/QuestionGroup.js +1 -36
- package/dist/observation/RepeatableQuestionGroup.js +4 -27
- package/dist/observation/SingleCodedValue.js +1 -15
- package/dist/program/SubjectProgramEligibility.js +6 -56
- package/dist/relationship/IndividualRelation.js +6 -18
- package/dist/relationship/IndividualRelationGenderMapping.js +4 -22
- package/dist/relationship/IndividualRelationship.js +6 -51
- package/dist/relationship/IndividualRelationshipType.js +4 -24
- package/dist/relationship/IndividualRelative.js +4 -31
- package/dist/reports/DashboardFilter.js +4 -20
- package/dist/reports/DashboardFilterConfig.js +5 -85
- package/dist/reports/NestedReportCardResult.js +5 -35
- package/dist/reports/Range.js +4 -13
- package/dist/reports/ReportCardResult.js +5 -24
- package/dist/service/MetaDataService.js +1 -30
- package/dist/task/Task.js +6 -62
- package/dist/task/TaskStatus.js +4 -21
- package/dist/task/TaskType.js +4 -23
- package/dist/task/TaskUnAssignment.js +6 -30
- package/dist/utility/AgeUtil.js +1 -15
- package/dist/utility/ArrayUtil.js +1 -6
- package/dist/utility/AuditUtil.js +1 -8
- package/dist/utility/DateTimeUtil.js +1 -8
- package/dist/utility/General.js +4 -71
- package/dist/utility/JsonStringify.js +15 -28
- package/dist/utility/MergeUtil.js +1 -10
- package/dist/utility/ResourceUtil.js +1 -7
- package/dist/videos/Video.js +4 -23
- package/dist/videos/VideoTelemetric.js +6 -37
- package/package.json +6 -3
- package/scripts/validateSchemas.js +40 -0
- package/tsconfig.json +1 -1
- package/yarn.lock +0 -6744
package/dist/Duration.js
CHANGED
|
@@ -4,122 +4,95 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
9
|
-
|
|
10
8
|
var _moment = _interopRequireDefault(require("moment"));
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
13
|
class Duration {
|
|
17
14
|
constructor(durationValue, durationUnit) {
|
|
18
15
|
this._durationValue = durationValue;
|
|
19
16
|
this.durationUnit = durationUnit;
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
static inDay(value) {
|
|
23
19
|
return new Duration(value, Duration.Day);
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
static inWeek(value) {
|
|
27
22
|
return new Duration(value, Duration.Week);
|
|
28
23
|
}
|
|
29
|
-
|
|
30
24
|
static inMonth(value) {
|
|
31
25
|
return new Duration(value, Duration.Month);
|
|
32
26
|
}
|
|
33
|
-
|
|
34
27
|
static inYear(value) {
|
|
35
28
|
return new Duration(value, Duration.Year);
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
static durationBetween(dateA, dateB) {
|
|
39
31
|
const diff = (0, _moment.default)(dateB).diff(dateA, "months", true);
|
|
40
|
-
|
|
41
32
|
if (diff >= 1) {
|
|
42
33
|
return new Duration(Math.round(diff * 2) / 2, Duration.Month); // round to nearest .5
|
|
43
34
|
} else {
|
|
44
35
|
return new Duration((0, _moment.default)(dateB).diff(dateA, "days"), Duration.Day);
|
|
45
36
|
}
|
|
46
37
|
}
|
|
47
|
-
|
|
48
38
|
get isInYears() {
|
|
49
39
|
return this.durationUnit === Duration.Year;
|
|
50
40
|
}
|
|
51
|
-
|
|
52
41
|
get durationValueAsString() {
|
|
53
42
|
return _lodash.default.toString(this._durationValue);
|
|
54
43
|
}
|
|
55
|
-
|
|
56
44
|
get durationValue() {
|
|
57
45
|
return this._durationValue;
|
|
58
46
|
}
|
|
59
|
-
|
|
60
47
|
toString(i18n) {
|
|
61
48
|
const durationUnitText = this._durationValue <= 1 ? this.durationUnit.substring(0, this.durationUnit.length - 1) : this.durationUnit;
|
|
62
49
|
return i18n ? `${this.durationValueAsString} ${i18n.t(durationUnitText.toLowerCase())}` : `${this.durationValueAsString} ${this.durationUnit}`;
|
|
63
50
|
}
|
|
64
|
-
|
|
65
51
|
getValue() {
|
|
66
52
|
return {
|
|
67
53
|
value: this.durationValue,
|
|
68
54
|
unit: this.durationUnit
|
|
69
55
|
};
|
|
70
56
|
}
|
|
71
|
-
|
|
72
57
|
toUnicodeString(i18n) {
|
|
73
58
|
return this.toString(i18n).replace(".5", "\u00BD");
|
|
74
59
|
}
|
|
75
|
-
|
|
76
60
|
get isEmpty() {
|
|
77
61
|
return _lodash.default.isNil(this._durationValue) || _lodash.default.isEmpty(this._durationValue);
|
|
78
62
|
}
|
|
79
|
-
|
|
80
63
|
get inYears() {
|
|
81
64
|
if (this.durationUnit === Duration.Month) return this.durationValue / 12;else return this.durationValue;
|
|
82
65
|
}
|
|
83
|
-
|
|
84
66
|
changeUnit(durationUnit) {
|
|
85
67
|
return new Duration(this.durationValue, durationUnit);
|
|
86
68
|
}
|
|
87
|
-
|
|
88
69
|
changeValue(value) {
|
|
89
70
|
return new Duration(value.replace(/[^0-9]/g, ""), this.durationUnit);
|
|
90
71
|
}
|
|
91
|
-
|
|
92
72
|
static fromDataEntryDate(durationUnit, date, dataEntryDate) {
|
|
93
73
|
const durationValue = (0, _moment.default)(dataEntryDate).diff(date, durationUnit);
|
|
94
74
|
return new Duration(durationValue, durationUnit);
|
|
95
75
|
}
|
|
96
|
-
|
|
97
76
|
cloneForEdit() {
|
|
98
77
|
return new Duration(this.durationValue, this.durationUnit);
|
|
99
78
|
}
|
|
100
|
-
|
|
101
79
|
dateInPastBasedOnToday(asPerDate) {
|
|
102
80
|
return (0, _moment.default)(asPerDate).subtract(this.durationValue, this.durationUnit).toDate();
|
|
103
81
|
}
|
|
104
|
-
|
|
105
82
|
get toResource() {
|
|
106
83
|
return `P${this.toISO}`;
|
|
107
84
|
}
|
|
108
|
-
|
|
109
85
|
get toISO() {
|
|
110
86
|
const timeDurationUnits = ["hours", "minutes", "seconds"];
|
|
111
87
|
const isoDuration = `${this._durationValue || 0}${isoMap[this.durationUnit]}`;
|
|
112
88
|
return _lodash.default.includes(timeDurationUnits, this.durationUnit) ? `T${isoDuration}` : isoDuration;
|
|
113
89
|
}
|
|
114
|
-
|
|
115
90
|
static fromObs(obs) {
|
|
116
91
|
if (typeof obs === "string") {
|
|
117
92
|
return _lodash.default.head(Duration.fromIsoObs(obs));
|
|
118
93
|
}
|
|
119
|
-
|
|
120
94
|
return new Duration(obs._durationValue, obs.durationUnit);
|
|
121
95
|
}
|
|
122
|
-
|
|
123
96
|
static fromIsoObs(obs) {
|
|
124
97
|
const iso8601DurationRegex = /(-)?P(?:([.,\d]+)Y)?(?:([.,\d]+)M)?(?:([.,\d]+)W)?(?:([.,\d]+)D)?T{0,1}(?:([.,\d]+)H)?(?:([.,\d]+)M)?(?:([.,\d]+)S)?/;
|
|
125
98
|
const matches = obs.match(iso8601DurationRegex);
|
|
@@ -146,21 +119,13 @@ class Duration {
|
|
|
146
119
|
value: matches[8]
|
|
147
120
|
}].filter(v => !_lodash.default.isEmpty(v.value)).map(opt => new Duration(opt.value, opt.unit));
|
|
148
121
|
}
|
|
149
|
-
|
|
150
122
|
}
|
|
151
|
-
|
|
152
123
|
_defineProperty(Duration, "Hour", "hours");
|
|
153
|
-
|
|
154
124
|
_defineProperty(Duration, "Minute", "minutes");
|
|
155
|
-
|
|
156
125
|
_defineProperty(Duration, "Day", "days");
|
|
157
|
-
|
|
158
126
|
_defineProperty(Duration, "Week", "weeks");
|
|
159
|
-
|
|
160
127
|
_defineProperty(Duration, "Month", "months");
|
|
161
|
-
|
|
162
128
|
_defineProperty(Duration, "Year", "years");
|
|
163
|
-
|
|
164
129
|
const isoMap = {
|
|
165
130
|
years: "Y",
|
|
166
131
|
months: "M",
|
package/dist/Encounter.js
CHANGED
|
@@ -4,89 +4,65 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _Individual = _interopRequireDefault(require("./Individual"));
|
|
9
|
-
|
|
10
8
|
var _ResourceUtil = _interopRequireDefault(require("./utility/ResourceUtil"));
|
|
11
|
-
|
|
12
9
|
var _AbstractEncounter = _interopRequireDefault(require("./AbstractEncounter"));
|
|
13
|
-
|
|
14
10
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
15
|
-
|
|
16
11
|
var _ValidationResult = _interopRequireDefault(require("./application/ValidationResult"));
|
|
17
|
-
|
|
18
12
|
var _General = _interopRequireDefault(require("./utility/General"));
|
|
19
|
-
|
|
20
13
|
var _EncounterType = _interopRequireDefault(require("./EncounterType"));
|
|
21
|
-
|
|
22
14
|
var _EntityApprovalStatus = _interopRequireDefault(require("./EntityApprovalStatus"));
|
|
23
|
-
|
|
24
15
|
var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
|
|
25
|
-
|
|
26
16
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
27
|
-
|
|
28
17
|
var _AuditUtil = require("./utility/AuditUtil");
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
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; }
|
|
37
|
-
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
38
24
|
class Encounter extends _AbstractEncounter.default {
|
|
39
25
|
constructor(that = null) {
|
|
40
26
|
super(that);
|
|
41
27
|
}
|
|
42
|
-
|
|
43
28
|
get individual() {
|
|
44
29
|
return this.toEntity("individual", _Individual.default);
|
|
45
30
|
}
|
|
46
|
-
|
|
47
31
|
set individual(x) {
|
|
48
32
|
this.that.individual = this.fromObject(x);
|
|
49
33
|
}
|
|
50
|
-
|
|
51
34
|
static create() {
|
|
52
35
|
let encounter = this.createEmptyInstance();
|
|
53
36
|
encounter.encounterType = _EncounterType.default.create();
|
|
54
37
|
return encounter;
|
|
55
38
|
}
|
|
56
|
-
|
|
57
39
|
static fromResource(resource, entityService) {
|
|
58
40
|
const encounter = super.fromResource(resource, entityService, new Encounter());
|
|
59
41
|
encounter.individual = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "individualUUID"), _Individual.default.schema.name);
|
|
60
42
|
return encounter;
|
|
61
43
|
}
|
|
62
|
-
|
|
63
44
|
get toResource() {
|
|
64
45
|
const resource = super.toResource;
|
|
65
46
|
resource.individualUUID = this.individual.uuid;
|
|
66
47
|
return resource;
|
|
67
48
|
}
|
|
68
|
-
|
|
69
49
|
cloneForEdit() {
|
|
70
50
|
const encounter = super.cloneForEdit();
|
|
71
51
|
encounter.individual = this.individual;
|
|
72
52
|
return encounter;
|
|
73
53
|
}
|
|
74
|
-
|
|
75
54
|
validate() {
|
|
76
55
|
const validationResults = super.validate();
|
|
77
56
|
if (!_lodash.default.isNil(this.encounterDateTime) && _General.default.dateAIsBeforeB(this.encounterDateTime, this.individual.registrationDate)) validationResults.push(new _ValidationResult.default(false, _AbstractEncounter.default.fieldKeys.ENCOUNTER_DATE_TIME, "encounterDateBeforeRegistrationDate"));
|
|
78
57
|
if (!_lodash.default.isNil(this.encounterDateTime) && _General.default.dateIsAfterToday(this.encounterDateTime)) validationResults.push(new _ValidationResult.default(false, _AbstractEncounter.default.fieldKeys.ENCOUNTER_DATE_TIME, "encounterDateInFuture"));
|
|
79
58
|
return validationResults;
|
|
80
59
|
}
|
|
81
|
-
|
|
82
60
|
getName() {
|
|
83
61
|
return "Encounter";
|
|
84
62
|
}
|
|
85
|
-
|
|
86
63
|
static createEmptyInstance() {
|
|
87
64
|
return _AbstractEncounter.default.createEmptyInstance(new Encounter());
|
|
88
65
|
}
|
|
89
|
-
|
|
90
66
|
static createScheduled(encounterType, individual) {
|
|
91
67
|
const encounter = Encounter.createEmptyInstance();
|
|
92
68
|
encounter.encounterType = encounterType;
|
|
@@ -94,31 +70,22 @@ class Encounter extends _AbstractEncounter.default {
|
|
|
94
70
|
encounter.encounterDateTime = null;
|
|
95
71
|
return encounter;
|
|
96
72
|
}
|
|
97
|
-
|
|
98
73
|
getAllScheduledVisits() {
|
|
99
74
|
return this.individual.getAllScheduledVisits(this);
|
|
100
75
|
}
|
|
101
|
-
|
|
102
76
|
static associateChild(child, childEntityClass, childResource, entityService) {
|
|
103
77
|
let realmEncounter = _BaseEntity.default.getParentEntity(entityService, childEntityClass, childResource, "entityUUID", Encounter.schema.name);
|
|
104
|
-
|
|
105
78
|
realmEncounter = _General.default.pick(realmEncounter, ["uuid", "latestEntityApprovalStatus"], ["approvalStatuses"]);
|
|
106
|
-
|
|
107
79
|
if (childEntityClass === _EntityApprovalStatus.default) {
|
|
108
80
|
_BaseEntity.default.addNewChild(child, realmEncounter.approvalStatuses);
|
|
109
|
-
|
|
110
81
|
realmEncounter.latestEntityApprovalStatus = _lodash.default.maxBy(realmEncounter.approvalStatuses, 'statusDateTime');
|
|
111
82
|
}
|
|
112
|
-
|
|
113
83
|
return realmEncounter;
|
|
114
84
|
}
|
|
115
|
-
|
|
116
85
|
getSchemaName() {
|
|
117
86
|
return _SchemaNames.default.Encounter;
|
|
118
87
|
}
|
|
119
|
-
|
|
120
88
|
}
|
|
121
|
-
|
|
122
89
|
_defineProperty(Encounter, "schema", {
|
|
123
90
|
name: _SchemaNames.default.Encounter,
|
|
124
91
|
primaryKey: "uuid",
|
|
@@ -194,10 +161,8 @@ _defineProperty(Encounter, "schema", {
|
|
|
194
161
|
}
|
|
195
162
|
})
|
|
196
163
|
});
|
|
197
|
-
|
|
198
164
|
_defineProperty(Encounter, "validationKeys", {
|
|
199
165
|
ENCOUNTER_LOCATION: "ENCOUNTER_LOCATION"
|
|
200
166
|
});
|
|
201
|
-
|
|
202
167
|
var _default = Encounter;
|
|
203
168
|
exports.default = _default;
|
package/dist/EncounterType.js
CHANGED
|
@@ -4,77 +4,59 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _ReferenceEntity = _interopRequireDefault(require("./ReferenceEntity"));
|
|
9
|
-
|
|
10
8
|
var _General = _interopRequireDefault(require("./utility/General"));
|
|
11
|
-
|
|
12
9
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
|
-
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
13
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
14
|
class EncounterType extends _ReferenceEntity.default {
|
|
19
15
|
constructor(that = null) {
|
|
20
16
|
super(that);
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
get name() {
|
|
24
19
|
return this.that.name;
|
|
25
20
|
}
|
|
26
|
-
|
|
27
21
|
set name(x) {
|
|
28
22
|
this.that.name = x;
|
|
29
23
|
}
|
|
30
|
-
|
|
31
24
|
get operationalEncounterTypeName() {
|
|
32
25
|
return this.that.operationalEncounterTypeName;
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
set operationalEncounterTypeName(x) {
|
|
36
28
|
this.that.operationalEncounterTypeName = x;
|
|
37
29
|
}
|
|
38
|
-
|
|
39
30
|
get displayName() {
|
|
40
31
|
return this.that.displayName;
|
|
41
32
|
}
|
|
42
|
-
|
|
43
33
|
set displayName(x) {
|
|
44
34
|
this.that.displayName = x;
|
|
45
35
|
}
|
|
46
|
-
|
|
47
36
|
get encounterEligibilityCheckRule() {
|
|
48
37
|
return this.that.encounterEligibilityCheckRule;
|
|
49
38
|
}
|
|
50
|
-
|
|
51
39
|
set encounterEligibilityCheckRule(x) {
|
|
52
40
|
this.that.encounterEligibilityCheckRule = x;
|
|
53
41
|
}
|
|
54
|
-
|
|
55
42
|
get active() {
|
|
56
43
|
return this.that.active;
|
|
57
44
|
}
|
|
58
|
-
|
|
59
45
|
set active(x) {
|
|
60
46
|
this.that.active = x;
|
|
61
47
|
}
|
|
62
|
-
|
|
63
48
|
get immutable() {
|
|
64
49
|
return this.that.immutable;
|
|
65
50
|
}
|
|
66
|
-
|
|
67
51
|
set immutable(x) {
|
|
68
52
|
this.that.immutable = x;
|
|
69
53
|
}
|
|
70
|
-
|
|
71
54
|
static create(name) {
|
|
72
55
|
let encounterType = new EncounterType();
|
|
73
56
|
encounterType.uuid = _General.default.randomUUID();
|
|
74
57
|
encounterType.name = name;
|
|
75
58
|
return encounterType;
|
|
76
59
|
}
|
|
77
|
-
|
|
78
60
|
static fromResource(operationalEncounterType) {
|
|
79
61
|
const encounterType = new EncounterType();
|
|
80
62
|
encounterType.name = operationalEncounterType.encounterTypeName;
|
|
@@ -87,13 +69,10 @@ class EncounterType extends _ReferenceEntity.default {
|
|
|
87
69
|
encounterType.immutable = operationalEncounterType.immutable;
|
|
88
70
|
return encounterType;
|
|
89
71
|
}
|
|
90
|
-
|
|
91
72
|
clone() {
|
|
92
73
|
return _General.default.assignFields(this, super.clone(new EncounterType()), ["operationalEncounterTypeName", "displayName", "immutable"]);
|
|
93
74
|
}
|
|
94
|
-
|
|
95
75
|
}
|
|
96
|
-
|
|
97
76
|
_defineProperty(EncounterType, "schema", {
|
|
98
77
|
name: 'EncounterType',
|
|
99
78
|
primaryKey: 'uuid',
|
|
@@ -123,6 +102,5 @@ _defineProperty(EncounterType, "schema", {
|
|
|
123
102
|
}
|
|
124
103
|
}
|
|
125
104
|
});
|
|
126
|
-
|
|
127
105
|
var _default = EncounterType;
|
|
128
106
|
exports.default = _default;
|
|
@@ -4,33 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
9
|
-
|
|
10
8
|
var _General = _interopRequireDefault(require("./utility/General"));
|
|
11
|
-
|
|
12
9
|
var _ResourceUtil = _interopRequireDefault(require("./utility/ResourceUtil"));
|
|
13
|
-
|
|
14
10
|
var _ApprovalStatus = _interopRequireDefault(require("./ApprovalStatus"));
|
|
15
|
-
|
|
16
11
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
17
|
-
|
|
18
12
|
var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
|
|
19
|
-
|
|
20
13
|
var _AuditUtil = require("./utility/AuditUtil");
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
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; }
|
|
29
|
-
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
30
20
|
function getMatchingApprovalStatusEntities(entities, approvalStatus_status) {
|
|
31
21
|
return entities.filter(x => !_lodash.default.isNil(x.latestEntityApprovalStatus) && x.latestEntityApprovalStatus.hasStatus(approvalStatus_status));
|
|
32
22
|
}
|
|
33
|
-
|
|
34
23
|
class EntityApprovalStatus extends _BaseEntity.default {
|
|
35
24
|
static addMatchingApprovalStatusEntity(entities, approvalStatus_status, list, groupingByPath) {
|
|
36
25
|
Object.values(_lodash.default.groupBy(entities, x => _lodash.default.get(x, groupingByPath))).forEach(y => {
|
|
@@ -38,127 +27,97 @@ class EntityApprovalStatus extends _BaseEntity.default {
|
|
|
38
27
|
list.push(...latestEntitiesOfSameType.map(x => _lodash.default.identity(x)));
|
|
39
28
|
});
|
|
40
29
|
}
|
|
41
|
-
|
|
42
30
|
static getApprovalEntitiesSchema() {
|
|
43
31
|
return [_SchemaNames.default.Individual, _SchemaNames.default.ProgramEncounter, _SchemaNames.default.Encounter, _SchemaNames.default.ProgramEnrolment, _SchemaNames.default.ChecklistItem];
|
|
44
32
|
}
|
|
45
|
-
|
|
46
33
|
getApprovedEntitySchema() {
|
|
47
34
|
if (this.entityType === EntityApprovalStatus.entityType.Subject) return _SchemaNames.default.Individual;
|
|
48
35
|
return _SchemaNames.default[this.entityType];
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
constructor(that = null) {
|
|
52
38
|
super(that);
|
|
53
39
|
}
|
|
54
|
-
|
|
55
40
|
get entityUUID() {
|
|
56
41
|
return this.that.entityUUID;
|
|
57
42
|
}
|
|
58
|
-
|
|
59
43
|
set entityUUID(x) {
|
|
60
44
|
this.that.entityUUID = x;
|
|
61
45
|
}
|
|
62
|
-
|
|
63
46
|
get entityTypeUuid() {
|
|
64
47
|
return this.that.entityTypeUuid;
|
|
65
48
|
}
|
|
66
|
-
|
|
67
49
|
set entityTypeUuid(x) {
|
|
68
50
|
this.that.entityTypeUuid = x;
|
|
69
51
|
}
|
|
70
|
-
|
|
71
52
|
get entityType() {
|
|
72
53
|
return this.that.entityType;
|
|
73
54
|
}
|
|
74
|
-
|
|
75
55
|
set entityType(x) {
|
|
76
56
|
this.that.entityType = x;
|
|
77
57
|
}
|
|
78
|
-
|
|
79
58
|
get approvalStatus() {
|
|
80
59
|
return this.toEntity("approvalStatus", _ApprovalStatus.default);
|
|
81
60
|
}
|
|
82
|
-
|
|
83
61
|
set approvalStatus(x) {
|
|
84
62
|
this.that.approvalStatus = this.fromObject(x);
|
|
85
63
|
}
|
|
86
|
-
|
|
87
64
|
get approvalStatusComment() {
|
|
88
65
|
return this.that.approvalStatusComment;
|
|
89
66
|
}
|
|
90
|
-
|
|
91
67
|
set approvalStatusComment(x) {
|
|
92
68
|
this.that.approvalStatusComment = x;
|
|
93
69
|
}
|
|
94
|
-
|
|
95
70
|
get statusDateTime() {
|
|
96
71
|
return this.that.statusDateTime;
|
|
97
72
|
}
|
|
98
|
-
|
|
99
73
|
set statusDateTime(x) {
|
|
100
74
|
this.that.statusDateTime = x;
|
|
101
75
|
}
|
|
102
|
-
|
|
103
76
|
get autoApproved() {
|
|
104
77
|
return this.that.autoApproved;
|
|
105
78
|
}
|
|
106
|
-
|
|
107
79
|
set autoApproved(x) {
|
|
108
80
|
this.that.autoApproved = x;
|
|
109
81
|
}
|
|
110
|
-
|
|
111
82
|
get createdBy() {
|
|
112
83
|
return this.that.createdBy;
|
|
113
84
|
}
|
|
114
|
-
|
|
115
85
|
set createdBy(x) {
|
|
116
86
|
this.that.createdBy = x;
|
|
117
87
|
}
|
|
118
|
-
|
|
119
88
|
get lastModifiedBy() {
|
|
120
89
|
return this.that.lastModifiedBy;
|
|
121
90
|
}
|
|
122
|
-
|
|
123
91
|
set lastModifiedBy(x) {
|
|
124
92
|
this.that.lastModifiedBy = x;
|
|
125
93
|
}
|
|
126
|
-
|
|
127
94
|
get createdByUUID() {
|
|
128
95
|
return this.that.createdByUUID;
|
|
129
96
|
}
|
|
130
|
-
|
|
131
97
|
set createdByUUID(x) {
|
|
132
98
|
this.that.createdByUUID = x;
|
|
133
99
|
}
|
|
134
|
-
|
|
135
100
|
get lastModifiedByUUID() {
|
|
136
101
|
return this.that.lastModifiedByUUID;
|
|
137
102
|
}
|
|
138
|
-
|
|
139
103
|
set lastModifiedByUUID(x) {
|
|
140
104
|
this.that.lastModifiedByUUID = x;
|
|
141
105
|
}
|
|
142
|
-
|
|
143
106
|
get toResource() {
|
|
144
107
|
const resource = _lodash.default.pick(this, ["uuid", "entityType", "approvalStatusComment", "autoApproved", "voided"]);
|
|
145
|
-
|
|
146
108
|
resource["approvalStatusUuid"] = this.approvalStatus.uuid;
|
|
147
109
|
resource["entityUuid"] = this.entityUUID;
|
|
148
110
|
resource["entityTypeUuid"] = this.entityTypeUuid;
|
|
149
111
|
resource.statusDateTime = _General.default.isoFormat(this.statusDateTime);
|
|
150
112
|
return resource;
|
|
151
113
|
}
|
|
152
|
-
|
|
153
114
|
static fromResource(resource, entityService) {
|
|
154
115
|
const entityApprovalStatus = _General.default.assignFields(resource, new EntityApprovalStatus(), ["uuid", "entityType", "approvalStatusComment", "autoApproved", "voided", "entityTypeUuid"], ["statusDateTime"]);
|
|
155
|
-
|
|
156
116
|
entityApprovalStatus.approvalStatus = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(resource, "approvalStatusUUID"), _ApprovalStatus.default.schema.name);
|
|
157
117
|
entityApprovalStatus.entityUUID = _ResourceUtil.default.getUUIDFor(resource, "entityUUID");
|
|
158
118
|
(0, _AuditUtil.mapAuditFields)(entityApprovalStatus, resource);
|
|
159
119
|
return entityApprovalStatus;
|
|
160
120
|
}
|
|
161
|
-
|
|
162
121
|
static create(entityUUID, entityType, approvalStatus, approvalStatusComment, autoApproved, entityTypeUuid) {
|
|
163
122
|
const entityApprovalStatus = new EntityApprovalStatus();
|
|
164
123
|
entityApprovalStatus.uuid = _General.default.randomUUID();
|
|
@@ -171,7 +130,6 @@ class EntityApprovalStatus extends _BaseEntity.default {
|
|
|
171
130
|
entityApprovalStatus.statusDateTime = new Date();
|
|
172
131
|
return entityApprovalStatus;
|
|
173
132
|
}
|
|
174
|
-
|
|
175
133
|
static getSchemaEntityTypeList() {
|
|
176
134
|
return [{
|
|
177
135
|
schema: _SchemaNames.default.Individual,
|
|
@@ -190,25 +148,19 @@ class EntityApprovalStatus extends _BaseEntity.default {
|
|
|
190
148
|
entityType: EntityApprovalStatus.entityType.ChecklistItem
|
|
191
149
|
}];
|
|
192
150
|
}
|
|
193
|
-
|
|
194
151
|
hasStatus(status) {
|
|
195
152
|
return this.approvalStatus.status === status;
|
|
196
153
|
}
|
|
197
|
-
|
|
198
154
|
get isRejected() {
|
|
199
155
|
return this.approvalStatus.isRejected;
|
|
200
156
|
}
|
|
201
|
-
|
|
202
157
|
get isApproved() {
|
|
203
158
|
return this.approvalStatus.isApproved;
|
|
204
159
|
}
|
|
205
|
-
|
|
206
160
|
get isPending() {
|
|
207
161
|
return this.approvalStatus.isPending;
|
|
208
162
|
}
|
|
209
|
-
|
|
210
163
|
}
|
|
211
|
-
|
|
212
164
|
_defineProperty(EntityApprovalStatus, "schema", {
|
|
213
165
|
name: _SchemaNames.default.EntityApprovalStatus,
|
|
214
166
|
primaryKey: "uuid",
|
|
@@ -239,7 +191,6 @@ _defineProperty(EntityApprovalStatus, "schema", {
|
|
|
239
191
|
}
|
|
240
192
|
}, _AuditUtil.AuditFields)
|
|
241
193
|
});
|
|
242
|
-
|
|
243
194
|
_defineProperty(EntityApprovalStatus, "entityType", {
|
|
244
195
|
Subject: "Subject",
|
|
245
196
|
ProgramEnrolment: "ProgramEnrolment",
|
|
@@ -247,6 +198,5 @@ _defineProperty(EntityApprovalStatus, "entityType", {
|
|
|
247
198
|
Encounter: "Encounter",
|
|
248
199
|
ChecklistItem: "ChecklistItem"
|
|
249
200
|
});
|
|
250
|
-
|
|
251
201
|
var _default = EntityApprovalStatus;
|
|
252
202
|
exports.default = _default;
|