openchs-models 1.30.24 → 1.30.26
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/.github/add_to_project.yml +16 -0
- package/.github/workflows/add_to_project.yml +18 -0
- package/dist/CustomDashboardCache.js +152 -0
- package/dist/EntityMetaData.js +2 -15
- package/dist/Individual.js +9 -37
- package/dist/Schema.js +4 -2
- package/dist/index.js +17 -7
- package/dist/reports/DashboardFilterConfig.js +5 -1
- package/dist/utility/AgeUtil.js +59 -0
- package/dist/utility/DateTimeUtil.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
name: Add to Product board
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issues:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
add-to-project:
|
|
10
|
+
name: Add all issues created in this repository to the Avni product board
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/add-to-project@v0.5.0
|
|
14
|
+
with:
|
|
15
|
+
project-url: https://github.com/orgs/avniproject/projects/2
|
|
16
|
+
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Automatically add items to project
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issues:
|
|
5
|
+
types:
|
|
6
|
+
- opened
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
add-to-project:
|
|
10
|
+
name: Add issue to project
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/add-to-project@v0.5.0
|
|
14
|
+
with:
|
|
15
|
+
# You can target a project in a different organization
|
|
16
|
+
# to the issue
|
|
17
|
+
project-url: https://github.com/orgs/avniproject/projects/2/
|
|
18
|
+
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _BaseEntity = _interopRequireDefault(require("./BaseEntity"));
|
|
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 CustomDashboardCache extends _BaseEntity.default {
|
|
15
|
+
constructor(that = null) {
|
|
16
|
+
super(that);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get checksum() {
|
|
20
|
+
return this.that.checksum;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
set checksum(x) {
|
|
24
|
+
this.that.checksum = x;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get updatedAt() {
|
|
28
|
+
return this.that.updatedAt;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
set updatedAt(x) {
|
|
32
|
+
this.that.updatedAt = x;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get selectedValuesJSON() {
|
|
36
|
+
return this.that.selectedValuesJSON;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
set selectedValuesJSON(x) {
|
|
40
|
+
this.that.selectedValuesJSON = x;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get filterApplied() {
|
|
44
|
+
return this.that.filterApplied;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
set filterApplied(x) {
|
|
48
|
+
this.that.filterApplied = x;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get filterErrorsJSON() {
|
|
52
|
+
return this.that.filterErrorsJSON;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
set filterErrorsJSON(x) {
|
|
56
|
+
this.that.filterErrorsJSON = x;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get ruleInputJSON() {
|
|
60
|
+
return this.that.ruleInputJSON;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
set ruleInputJSON(x) {
|
|
64
|
+
this.that.ruleInputJSON = x;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get transformedFiltersJSON() {
|
|
68
|
+
return this.that.transformedFiltersJSON;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
set transformedFiltersJSON(x) {
|
|
72
|
+
this.that.transformedFiltersJSON = x;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static create(uuid, checksum, updatedAt, selectedValuesJSON, filterApplied, filterErrorsJSON, ruleInputJSON, transformedFiltersJSON) {
|
|
76
|
+
const customDashboardCache = new CustomDashboardCache();
|
|
77
|
+
customDashboardCache.uuid = uuid;
|
|
78
|
+
customDashboardCache.checksum = checksum;
|
|
79
|
+
customDashboardCache.updatedAt = updatedAt;
|
|
80
|
+
customDashboardCache.selectedValuesJSON = selectedValuesJSON;
|
|
81
|
+
customDashboardCache.filterApplied = filterApplied;
|
|
82
|
+
customDashboardCache.filterErrorsJSON = filterErrorsJSON;
|
|
83
|
+
customDashboardCache.ruleInputJSON = ruleInputJSON;
|
|
84
|
+
customDashboardCache.transformedFiltersJSON = transformedFiltersJSON;
|
|
85
|
+
return customDashboardCache;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static getSelectedValuesFromState(state) {
|
|
89
|
+
const filterCache = {
|
|
90
|
+
date: state.date,
|
|
91
|
+
applied: false,
|
|
92
|
+
selectedLocations: state.selectedLocations,
|
|
93
|
+
selectedCustomFilters: state.selectedCustomFilters,
|
|
94
|
+
selectedGenders: state.selectedGenders
|
|
95
|
+
};
|
|
96
|
+
return filterCache;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static createEmptyInstance() {
|
|
100
|
+
return new CustomDashboardCache();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
getChecksum() {
|
|
104
|
+
return this.checksum;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
getSelectedValues() {
|
|
108
|
+
return this.selectedValuesJSON && JSON.parse(this.selectedValuesJSON) || {};
|
|
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
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
getTransformedFilters() {
|
|
122
|
+
return this.transformedFiltersJSON && JSON.parse(this.transformedFiltersJSON) || {
|
|
123
|
+
date: new Date(),
|
|
124
|
+
applied: false,
|
|
125
|
+
selectedLocations: [],
|
|
126
|
+
selectedCustomFilters: [],
|
|
127
|
+
selectedGenders: []
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
_defineProperty(CustomDashboardCache, "schema", {
|
|
134
|
+
name: "CustomDashboardCache",
|
|
135
|
+
primaryKey: "uuid",
|
|
136
|
+
properties: {
|
|
137
|
+
uuid: "string",
|
|
138
|
+
checksum: "string",
|
|
139
|
+
updatedAt: "date",
|
|
140
|
+
selectedValuesJSON: "string",
|
|
141
|
+
filterApplied: {
|
|
142
|
+
type: "bool",
|
|
143
|
+
default: false
|
|
144
|
+
},
|
|
145
|
+
filterErrorsJSON: "string",
|
|
146
|
+
ruleInputJSON: "string",
|
|
147
|
+
transformedFiltersJSON: "string"
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
var _default = CustomDashboardCache;
|
|
152
|
+
exports.default = _default;
|
package/dist/EntityMetaData.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _Concept = _interopRequireDefault(require("./Concept"));
|
|
9
9
|
|
|
@@ -490,11 +490,6 @@ const groupDashboard = refData(_GroupDashboard.default, {
|
|
|
490
490
|
res: "groupDashboard",
|
|
491
491
|
syncWeight: 0
|
|
492
492
|
});
|
|
493
|
-
const EntityApprovalStatusMetaData = txData(_EntityApprovalStatus.default, {
|
|
494
|
-
res: "entityApprovalStatus",
|
|
495
|
-
entityName: "EntityApprovalStatus"
|
|
496
|
-
});
|
|
497
|
-
exports.EntityApprovalStatusMetaData = EntityApprovalStatusMetaData;
|
|
498
493
|
const subjectEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.default, {
|
|
499
494
|
res: "entityApprovalStatus",
|
|
500
495
|
resUrl: "entityApprovalStatus",
|
|
@@ -653,18 +648,10 @@ class EntityMetaData {
|
|
|
653
648
|
}
|
|
654
649
|
|
|
655
650
|
static findByName(entityName) {
|
|
656
|
-
return
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
static findByNameIn(entityName, modelCollection) {
|
|
660
|
-
return _lodash.default.find(modelCollection, //TODO check if this works
|
|
651
|
+
return _lodash.default.find(EntityMetaData.model(), //TODO check if this works
|
|
661
652
|
entityMetadata => entityMetadata.entityName === entityName);
|
|
662
653
|
}
|
|
663
654
|
|
|
664
|
-
static allModels() {
|
|
665
|
-
return _lodash.default.concat(EntityApprovalStatusMetaData, EntityMetaData.model());
|
|
666
|
-
}
|
|
667
|
-
|
|
668
655
|
}
|
|
669
656
|
|
|
670
657
|
var _default = EntityMetaData;
|
package/dist/Individual.js
CHANGED
|
@@ -51,6 +51,8 @@ var _ArrayHelper = _interopRequireDefault(require("./framework/ArrayHelper"));
|
|
|
51
51
|
|
|
52
52
|
var _MergeUtil = _interopRequireDefault(require("./utility/MergeUtil"));
|
|
53
53
|
|
|
54
|
+
var _AgeUtil = _interopRequireDefault(require("./utility/AgeUtil"));
|
|
55
|
+
|
|
54
56
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
55
57
|
|
|
56
58
|
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; }
|
|
@@ -403,28 +405,14 @@ class Individual extends _BaseEntity.default {
|
|
|
403
405
|
this.name = this.nameString;
|
|
404
406
|
}
|
|
405
407
|
|
|
406
|
-
getDisplayAge(i18n) {
|
|
407
|
-
//Keeping date of birth to be always entered and displayed as per the current date. It would be perhaps more error prone for users to put themselves in the past and enter age as of that date
|
|
408
|
-
const ageInYears = this.getAgeInYears();
|
|
409
|
-
|
|
410
|
-
if (ageInYears < 1) {
|
|
411
|
-
let ageInWeeks = (0, _moment.default)().diff(this.dateOfBirth, "weeks");
|
|
412
|
-
return ageInWeeks === 0 ? _Duration.default.inDay((0, _moment.default)().diff(this.dateOfBirth, "days")).toString(i18n) : _Duration.default.inWeek(ageInWeeks).toString(i18n);
|
|
413
|
-
} else if (ageInYears < 2) {
|
|
414
|
-
return _Duration.default.inMonth((0, _moment.default)().diff(this.dateOfBirth, "months")).toString(i18n);
|
|
415
|
-
} else {
|
|
416
|
-
return _Duration.default.inYear(ageInYears).toString(i18n);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
408
|
getAgeAndDateOfBirthDisplay(i18n) {
|
|
421
|
-
if (this.dateOfBirthVerified) return `${
|
|
422
|
-
return
|
|
409
|
+
if (this.dateOfBirthVerified) return `${_AgeUtil.default.getDisplayAge(this.dateOfBirth, i18n)} (${_General.default.toDisplayDate(this.dateOfBirth)})`;
|
|
410
|
+
return _AgeUtil.default.getDisplayAge(this.dateOfBirth, i18n);
|
|
423
411
|
}
|
|
424
412
|
|
|
425
413
|
getAge(asOnDate = (0, _moment.default)()) {
|
|
426
|
-
if (
|
|
427
|
-
if (
|
|
414
|
+
if (_AgeUtil.default.getAgeInYears(this.dateOfBirth, asOnDate) > 0) return _Duration.default.inYear(_AgeUtil.default.getAgeInYears(this.dateOfBirth));
|
|
415
|
+
if (_AgeUtil.default.getAgeInMonths(this.dateOfBirth, asOnDate) > 0) return _Duration.default.inMonth(asOnDate.diff(this.dateOfBirth, "months"));
|
|
428
416
|
return _Duration.default.inYear(0);
|
|
429
417
|
}
|
|
430
418
|
|
|
@@ -448,22 +436,6 @@ class Individual extends _BaseEntity.default {
|
|
|
448
436
|
}
|
|
449
437
|
}
|
|
450
438
|
|
|
451
|
-
getAgeIn(unit) {
|
|
452
|
-
return (asOnDate = (0, _moment.default)(), precise = false) => (0, _moment.default)(asOnDate).diff(this.dateOfBirth, unit, precise);
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
getAgeInMonths(asOnDate = (0, _moment.default)(), precise = false) {
|
|
456
|
-
return this.getAgeIn("months")(asOnDate, precise);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
getAgeInWeeks(asOnDate, precise) {
|
|
460
|
-
return this.getAgeIn("weeks")(asOnDate, precise);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
getAgeInYears(asOnDate = (0, _moment.default)(), precise = false) {
|
|
464
|
-
return this.getAgeIn("years")(asOnDate, precise);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
439
|
toSummaryString() {
|
|
468
440
|
return `${this.name}, Age: ${this.getAge().toString()}, ${this.gender.name}`;
|
|
469
441
|
}
|
|
@@ -483,7 +455,7 @@ class Individual extends _BaseEntity.default {
|
|
|
483
455
|
return _ValidationResult.default.failure(Individual.validationKeys.DOB, "emptyValidationMessage");
|
|
484
456
|
} else if (!(0, _moment.default)(this.dateOfBirth).isValid()) {
|
|
485
457
|
return _ValidationResult.default.failure(Individual.validationKeys.DOB, "invalidDateFormat");
|
|
486
|
-
} else if (
|
|
458
|
+
} else if (_AgeUtil.default.getAgeInYears(this.dateOfBirth) > 120) {
|
|
487
459
|
return _ValidationResult.default.failure(Individual.validationKeys.DOB, "ageTooHigh");
|
|
488
460
|
} else if (this.isRegistrationBeforeDateOfBirth) {
|
|
489
461
|
return _ValidationResult.default.failure(Individual.validationKeys.DOB, "registrationBeforeDateOfBirth");
|
|
@@ -818,14 +790,14 @@ class Individual extends _BaseEntity.default {
|
|
|
818
790
|
}
|
|
819
791
|
|
|
820
792
|
userProfileSubtext2(i18n) {
|
|
821
|
-
return this.isPerson() ?
|
|
793
|
+
return this.isPerson() ? _AgeUtil.default.getDisplayAge(this.dateOfBirth, i18n) : "";
|
|
822
794
|
} //TODO these methods are slightly differece because of differece in UI on search result and my dashboard listing. Not taking the hit right now.
|
|
823
795
|
|
|
824
796
|
|
|
825
797
|
detail1(i18n) {
|
|
826
798
|
return this.isPerson() ? {
|
|
827
799
|
label: "Age",
|
|
828
|
-
value:
|
|
800
|
+
value: _AgeUtil.default.getDisplayAge(this.dateOfBirth, i18n)
|
|
829
801
|
} : {};
|
|
830
802
|
}
|
|
831
803
|
|
package/dist/Schema.js
CHANGED
|
@@ -187,18 +187,20 @@ var _SchemaNames = _interopRequireDefault(require("./SchemaNames"));
|
|
|
187
187
|
|
|
188
188
|
var _DashboardFilter = _interopRequireDefault(require("./reports/DashboardFilter"));
|
|
189
189
|
|
|
190
|
+
var _CustomDashboardCache = _interopRequireDefault(require("./CustomDashboardCache"));
|
|
191
|
+
|
|
190
192
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
191
193
|
|
|
192
194
|
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; }
|
|
193
195
|
|
|
194
196
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
195
197
|
|
|
196
|
-
const entities = [_DashboardFilter.default, _LocaleMapping.default, _Settings.default, _ConceptAnswer.default, _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, _UserSubjectAssignment.default];
|
|
198
|
+
const entities = [_DashboardFilter.default, _LocaleMapping.default, _Settings.default, _ConceptAnswer.default, _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, _CustomDashboardCache.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, _UserSubjectAssignment.default];
|
|
197
199
|
|
|
198
200
|
function createRealmConfig() {
|
|
199
201
|
return {
|
|
200
202
|
//order is important, should be arranged according to the dependency
|
|
201
|
-
schemaVersion:
|
|
203
|
+
schemaVersion: 177,
|
|
202
204
|
migration: function (oldDB, newDB) {
|
|
203
205
|
console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
|
|
204
206
|
|
package/dist/index.js
CHANGED
|
@@ -105,12 +105,6 @@ Object.defineProperty(exports, "EntityMetaData", {
|
|
|
105
105
|
return _EntityMetaData.default;
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
|
-
Object.defineProperty(exports, "EntityApprovalStatusMetaData", {
|
|
109
|
-
enumerable: true,
|
|
110
|
-
get: function () {
|
|
111
|
-
return _EntityMetaData.EntityApprovalStatusMetaData;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
108
|
Object.defineProperty(exports, "EntityQueue", {
|
|
115
109
|
enumerable: true,
|
|
116
110
|
get: function () {
|
|
@@ -795,6 +789,18 @@ Object.defineProperty(exports, "DateTimeUtil", {
|
|
|
795
789
|
return _DateTimeUtil.default;
|
|
796
790
|
}
|
|
797
791
|
});
|
|
792
|
+
Object.defineProperty(exports, "AgeUtil", {
|
|
793
|
+
enumerable: true,
|
|
794
|
+
get: function () {
|
|
795
|
+
return _AgeUtil.default;
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
Object.defineProperty(exports, "CustomDashboardCache", {
|
|
799
|
+
enumerable: true,
|
|
800
|
+
get: function () {
|
|
801
|
+
return _CustomDashboardCache.default;
|
|
802
|
+
}
|
|
803
|
+
});
|
|
798
804
|
|
|
799
805
|
var _AbstractEncounter = _interopRequireDefault(require("./AbstractEncounter"));
|
|
800
806
|
|
|
@@ -828,7 +834,7 @@ var _Encounter = _interopRequireDefault(require("./Encounter"));
|
|
|
828
834
|
|
|
829
835
|
var _EncounterType = _interopRequireDefault(require("./EncounterType"));
|
|
830
836
|
|
|
831
|
-
var _EntityMetaData =
|
|
837
|
+
var _EntityMetaData = _interopRequireDefault(require("./EntityMetaData"));
|
|
832
838
|
|
|
833
839
|
var _EntityQueue = _interopRequireDefault(require("./EntityQueue"));
|
|
834
840
|
|
|
@@ -1052,6 +1058,10 @@ var _ArrayUtil = _interopRequireDefault(require("./utility/ArrayUtil"));
|
|
|
1052
1058
|
|
|
1053
1059
|
var _DateTimeUtil = _interopRequireDefault(require("./utility/DateTimeUtil"));
|
|
1054
1060
|
|
|
1061
|
+
var _AgeUtil = _interopRequireDefault(require("./utility/AgeUtil"));
|
|
1062
|
+
|
|
1063
|
+
var _CustomDashboardCache = _interopRequireDefault(require("./CustomDashboardCache"));
|
|
1064
|
+
|
|
1055
1065
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
1056
1066
|
|
|
1057
1067
|
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; }
|
|
@@ -186,10 +186,14 @@ class DashboardFilterConfig {
|
|
|
186
186
|
validate(filterValue) {
|
|
187
187
|
const inputDataType = this.getInputDataType();
|
|
188
188
|
|
|
189
|
-
if ([_Concept.default.dataType.Date, _Concept.default.dataType.DateTime
|
|
189
|
+
if ([_Concept.default.dataType.Date, _Concept.default.dataType.DateTime].includes(inputDataType) && this.widget === _CustomFilter.default.widget.Range) {
|
|
190
190
|
return _DateTimeUtil.default.validateDateRange(filterValue.minValue, filterValue.maxValue);
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
if (_Concept.default.dataType.Time === inputDataType && this.widget === _CustomFilter.default.widget.Range) {
|
|
194
|
+
return _DateTimeUtil.default.validateTimeRange(filterValue.minValue, filterValue.maxValue);
|
|
195
|
+
}
|
|
196
|
+
|
|
193
197
|
return [true];
|
|
194
198
|
}
|
|
195
199
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _Duration = _interopRequireDefault(require("../Duration"));
|
|
9
|
+
|
|
10
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
11
|
+
|
|
12
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
class AgeUtil {
|
|
17
|
+
static getDisplayAge(dateOfBirth, i18n) {
|
|
18
|
+
//Keeping date of birth to be always entered and displayed as per the current date. It would be perhaps more error prone for users to put themselves in the past and enter age as of that date
|
|
19
|
+
const ageInYears = this.getAgeInYears(dateOfBirth);
|
|
20
|
+
|
|
21
|
+
if (ageInYears < 1) {
|
|
22
|
+
let ageInWeeks = this.getAgeInWeeks(dateOfBirth);
|
|
23
|
+
return ageInWeeks === 0 ? _Duration.default.inDay((0, _moment.default)().diff(dateOfBirth, "days")).toString(i18n) : _Duration.default.inWeek(ageInWeeks).toString(i18n);
|
|
24
|
+
} else if (ageInYears < 2) {
|
|
25
|
+
return _Duration.default.inMonth(this.getAgeInMonths(dateOfBirth)).toString(i18n);
|
|
26
|
+
} else if (ageInYears < 6) {
|
|
27
|
+
let ageInMonths = this.getAgeInMonths(dateOfBirth);
|
|
28
|
+
|
|
29
|
+
let noOfYears = _lodash.default.toInteger(ageInMonths / 12);
|
|
30
|
+
|
|
31
|
+
let noOfMonths = ageInMonths % 12;
|
|
32
|
+
let durationInYears = `${_Duration.default.inYear(noOfYears).toString(i18n)}`;
|
|
33
|
+
if (noOfMonths > 0) return `${durationInYears} ${_Duration.default.inMonth(noOfMonths).toString(i18n)}`;
|
|
34
|
+
return durationInYears;
|
|
35
|
+
} else {
|
|
36
|
+
return _Duration.default.inYear(ageInYears).toString(i18n);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static getAgeInYears(dateOfBirth, asOnDate = (0, _moment.default)(), precise = false) {
|
|
41
|
+
return this.getAgeIn(dateOfBirth, "years")(asOnDate, precise);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static getAgeInMonths(dateOfBirth, asOnDate = (0, _moment.default)(), precise = false) {
|
|
45
|
+
return this.getAgeIn(dateOfBirth, "months")(asOnDate, precise);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static getAgeInWeeks(dateOfBirth, asOnDate, precise) {
|
|
49
|
+
return this.getAgeIn(dateOfBirth, "weeks")(asOnDate, precise);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static getAgeIn(dateOfBirth, unit) {
|
|
53
|
+
return (asOnDate = (0, _moment.default)(), precise = false) => (0, _moment.default)(asOnDate).diff(dateOfBirth, unit, precise);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var _default = AgeUtil;
|
|
59
|
+
exports.default = _default;
|
|
@@ -19,6 +19,13 @@ class DateTimeUtil {
|
|
|
19
19
|
return [true];
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
static validateTimeRange(fromTime, toTime) {
|
|
23
|
+
if (_lodash.default.isNil(toTime) && _lodash.default.isNil(fromTime)) return [true];
|
|
24
|
+
if (_lodash.default.isNil(toTime) || _lodash.default.isNil(fromTime)) return [false, 'bothTimeShouldBeSelectedError'];
|
|
25
|
+
if (!(0, _moment.default)(fromTime, 'HH:mm').isSameOrBefore((0, _moment.default)(toTime, 'HH:mm'))) return [false, 'startTimeGreaterThanEndError'];
|
|
26
|
+
return [true];
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
var _default = DateTimeUtil;
|