openchs-models 1.25.1 → 1.25.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/Makefile +4 -1
- package/dist/Schema.js +1 -1
- package/dist/application/MenuItem.js +40 -2
- package/dist/program/SubjectProgramEligibility.js +28 -0
- package/package.json +1 -1
package/Makefile
CHANGED
|
@@ -34,7 +34,10 @@ copy-dist-to-avni-client:
|
|
|
34
34
|
deploy-to-avni-client:
|
|
35
35
|
$(if $(local),$(call _deploy,$(local)/packages/openchs-android/node_modules/openchs-models))
|
|
36
36
|
|
|
37
|
-
deploy-
|
|
37
|
+
deploy-to-avni-web:
|
|
38
|
+
$(if $(local),$(call _deploy,$(local)/node_modules/openchs-models))
|
|
39
|
+
|
|
40
|
+
deploy-as-source-to-avni-client:
|
|
38
41
|
$(if $(local),$(call _deploy_as_source,$(local)/packages/openchs-android/node_modules/openchs-models))
|
|
39
42
|
|
|
40
43
|
define _deploy_as_source
|
package/dist/Schema.js
CHANGED
|
@@ -188,7 +188,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
188
188
|
var _default = {
|
|
189
189
|
//order is important, should be arranged according to the dependency
|
|
190
190
|
schema: [_LocaleMapping.default, _Settings.default, _Concept.ConceptAnswer, _Concept.default, _EncounterType.default, _Gender.default, _UserDefinedIndividualProperty.default, _AddressLevel.LocationMapping, _AddressLevel.default, _KeyValue.default, _Form.default, _FormMapping.default, _FormElementGroup.default, _FormElement.default, _SubjectType.default, _Individual.default, _ProgramOutcome.default, _Program.default, _ProgramEnrolment.default, _Observation.default, _ProgramEncounter.default, _Encounter.default, _EntitySyncStatus.default, _EntityQueue.default, _ConfigFile.default, _Checklist.default, _ChecklistItem.default, _Format.default, _UserInfo.default, _StringKeyNumericValue.default, _VisitScheduleInterval.default, _VisitScheduleConfig.default, _ProgramConfig.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, _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],
|
|
191
|
-
schemaVersion:
|
|
191
|
+
schemaVersion: 165,
|
|
192
192
|
migration: function (oldDB, newDB) {
|
|
193
193
|
if (oldDB.schemaVersion < 10) {
|
|
194
194
|
const oldObjects = oldDB.objects("DecisionConfig");
|
|
@@ -12,8 +12,44 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
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
13
|
|
|
14
14
|
class MenuItem {
|
|
15
|
+
constructor() {
|
|
16
|
+
_defineProperty(this, "uuid", void 0);
|
|
17
|
+
|
|
18
|
+
_defineProperty(this, "displayKey", void 0);
|
|
19
|
+
|
|
20
|
+
_defineProperty(this, "type", void 0);
|
|
21
|
+
|
|
22
|
+
_defineProperty(this, "icon", void 0);
|
|
23
|
+
|
|
24
|
+
_defineProperty(this, "group", void 0);
|
|
25
|
+
|
|
26
|
+
_defineProperty(this, "linkFunction", void 0);
|
|
27
|
+
|
|
28
|
+
_defineProperty(this, "voided", void 0);
|
|
29
|
+
}
|
|
30
|
+
|
|
15
31
|
static fromResource(resource, entityService) {
|
|
16
|
-
return _General.default.assignFields(resource, new MenuItem(), ['uuid', 'displayKey', 'type', 'icon', "voided", "group", "
|
|
32
|
+
return _General.default.assignFields(resource, new MenuItem(), ['uuid', 'displayKey', 'type', 'icon', "voided", "group", "linkFunction"]);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static fromDb(obj) {
|
|
36
|
+
return MenuItem.fromResource(obj);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
toString() {
|
|
40
|
+
return `uuid:${this.uuid}; displayKey:${this.displayKey}; type:${this.type}; group:${this.group}; voided:${this.voided}`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
isLinkType() {
|
|
44
|
+
return this.type === MenuItem.HyperlinkTypeName;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static getAllGroups() {
|
|
48
|
+
return [this.FunctionalityGroupName, this.SyncGroupName, this.UserGroupName, this.SupportGroupName];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static getAllTypes() {
|
|
52
|
+
return [this.HyperlinkTypeName];
|
|
17
53
|
}
|
|
18
54
|
|
|
19
55
|
}
|
|
@@ -26,6 +62,8 @@ _defineProperty(MenuItem, "UserGroupName", "User");
|
|
|
26
62
|
|
|
27
63
|
_defineProperty(MenuItem, "SupportGroupName", "Support");
|
|
28
64
|
|
|
65
|
+
_defineProperty(MenuItem, "HyperlinkTypeName", "Link");
|
|
66
|
+
|
|
29
67
|
_defineProperty(MenuItem, "schema", {
|
|
30
68
|
name: "MenuItem",
|
|
31
69
|
primaryKey: "uuid",
|
|
@@ -38,7 +76,7 @@ _defineProperty(MenuItem, "schema", {
|
|
|
38
76
|
optional: true
|
|
39
77
|
},
|
|
40
78
|
group: "string",
|
|
41
|
-
|
|
79
|
+
linkFunction: {
|
|
42
80
|
type: "string",
|
|
43
81
|
optional: true
|
|
44
82
|
},
|
|
@@ -42,6 +42,16 @@ class SubjectProgramEligibility extends _BaseEntity.default {
|
|
|
42
42
|
_defineProperty(this, "observations", void 0);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
static createEmptyInstance(program, subject) {
|
|
46
|
+
const subjectProgramEligibility = new SubjectProgramEligibility();
|
|
47
|
+
subjectProgramEligibility.checkDate = new Date();
|
|
48
|
+
subjectProgramEligibility.uuid = _General.default.randomUUID();
|
|
49
|
+
subjectProgramEligibility.observations = [];
|
|
50
|
+
subjectProgramEligibility.program = program;
|
|
51
|
+
subjectProgramEligibility.subject = subject;
|
|
52
|
+
return subjectProgramEligibility;
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
get toResource() {
|
|
46
56
|
const resource = _lodash.default.pick(this, ["uuid", "voided", "eligible"]);
|
|
47
57
|
|
|
@@ -108,6 +118,24 @@ class SubjectProgramEligibility extends _BaseEntity.default {
|
|
|
108
118
|
return subjectProgramEligibility;
|
|
109
119
|
}
|
|
110
120
|
|
|
121
|
+
getObservationReadableValue(conceptNameOrUuid, parentConceptNameOrUuid) {
|
|
122
|
+
const observationForConcept = this.findObservation(conceptNameOrUuid, parentConceptNameOrUuid);
|
|
123
|
+
return _lodash.default.isEmpty(observationForConcept) ? observationForConcept : observationForConcept.getReadableValue();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
findObservation(conceptNameOrUuid, parentConceptNameOrUuid) {
|
|
127
|
+
const observations = _lodash.default.isNil(parentConceptNameOrUuid) ? this.observations : this.findGroupedObservation(parentConceptNameOrUuid);
|
|
128
|
+
return _lodash.default.find(observations, observation => {
|
|
129
|
+
return observation.concept.name === conceptNameOrUuid || observation.concept.uuid === conceptNameOrUuid;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
findGroupedObservation(parentConceptNameOrUuid) {
|
|
134
|
+
const groupedObservations = _lodash.default.find(this.observations, observation => observation.concept.name === parentConceptNameOrUuid || observation.concept.uuid === parentConceptNameOrUuid);
|
|
135
|
+
|
|
136
|
+
return _lodash.default.isEmpty(groupedObservations) ? [] : groupedObservations.getValue();
|
|
137
|
+
}
|
|
138
|
+
|
|
111
139
|
}
|
|
112
140
|
|
|
113
141
|
_defineProperty(SubjectProgramEligibility, "schema", {
|