openchs-models 1.30.32 → 1.30.34
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 +0 -3
- package/dist/EntityMetaData.js +66 -46
- package/dist/Individual.js +40 -16
- package/dist/Schema.js +1 -7
- package/dist/index.js +7 -9
- package/package.json +1 -1
- package/.github/add_to_project.yml +0 -16
- package/.github/workflows/add_to_project.yml +0 -18
- package/dist/utility/AgeUtil.js +0 -59
package/Makefile
CHANGED
|
@@ -15,9 +15,6 @@ release:
|
|
|
15
15
|
git pull --tags
|
|
16
16
|
git pull --rebase
|
|
17
17
|
@echo "Ensure version changes follow semantic versioning - https://classic.yarnpkg.com/en/docs/dependency-versions#toc-semantic-versioning"
|
|
18
|
-
@echo "\033[1mLatest openchs-models version across branches:"
|
|
19
|
-
npm view openchs-models version
|
|
20
|
-
@echo "\033[0m"
|
|
21
18
|
yarn version
|
|
22
19
|
@echo " Now please run \nmake publish"
|
|
23
20
|
|
package/dist/EntityMetaData.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = void 0;
|
|
6
|
+
exports.default = exports.EntityApprovalStatusMetaData = void 0;
|
|
7
7
|
|
|
8
8
|
var _Concept = _interopRequireDefault(require("./Concept"));
|
|
9
9
|
|
|
@@ -167,9 +167,7 @@ const refData = (clazz, {
|
|
|
167
167
|
translated,
|
|
168
168
|
parent,
|
|
169
169
|
syncWeight,
|
|
170
|
-
resUrl
|
|
171
|
-
syncPushRequired = true,
|
|
172
|
-
syncPullRequired = true
|
|
170
|
+
resUrl
|
|
173
171
|
} = {}) => ({
|
|
174
172
|
schemaName: clazz.schema.name,
|
|
175
173
|
entityName: clazz.schema.name,
|
|
@@ -180,9 +178,7 @@ const refData = (clazz, {
|
|
|
180
178
|
resourceSearchFilterURL: filter,
|
|
181
179
|
parent: parent,
|
|
182
180
|
syncWeight: syncWeight,
|
|
183
|
-
resourceUrl: resUrl
|
|
184
|
-
syncPushRequired,
|
|
185
|
-
syncPullRequired
|
|
181
|
+
resourceUrl: resUrl
|
|
186
182
|
});
|
|
187
183
|
|
|
188
184
|
const refDataNameTranslated = (clazz, attrs = {}) => refData(clazz, _objectSpread({}, attrs, {
|
|
@@ -190,7 +186,6 @@ const refDataNameTranslated = (clazz, attrs = {}) => refData(clazz, _objectSprea
|
|
|
190
186
|
}));
|
|
191
187
|
|
|
192
188
|
const txData = (clazz, {
|
|
193
|
-
entityName,
|
|
194
189
|
res,
|
|
195
190
|
resUrl,
|
|
196
191
|
parent,
|
|
@@ -201,13 +196,10 @@ const txData = (clazz, {
|
|
|
201
196
|
privilegeName,
|
|
202
197
|
queryParam,
|
|
203
198
|
hasMoreThanOneAssociation,
|
|
204
|
-
apiQueryParams
|
|
205
|
-
apiQueryParamKey,
|
|
206
|
-
syncPushRequired = true,
|
|
207
|
-
syncPullRequired = true
|
|
199
|
+
apiQueryParams
|
|
208
200
|
} = {}) => ({
|
|
209
201
|
schemaName: clazz.schema.name,
|
|
210
|
-
entityName:
|
|
202
|
+
entityName: clazz.schema.name,
|
|
211
203
|
entityClass: clazz,
|
|
212
204
|
resourceName: res || _lodash.default.camelCase(clazz.schema.name),
|
|
213
205
|
resourceUrl: resUrl,
|
|
@@ -221,10 +213,41 @@ const txData = (clazz, {
|
|
|
221
213
|
privilegeName,
|
|
222
214
|
queryParam,
|
|
223
215
|
hasMoreThanOneAssociation: !!hasMoreThanOneAssociation,
|
|
216
|
+
apiQueryParams
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const virtualTxData = (clazz, {
|
|
220
|
+
res,
|
|
221
|
+
entityName,
|
|
222
|
+
resUrl,
|
|
223
|
+
parent,
|
|
224
|
+
apiVersion,
|
|
225
|
+
syncWeight,
|
|
226
|
+
privilegeParam,
|
|
227
|
+
privilegeEntity,
|
|
228
|
+
privilegeName,
|
|
229
|
+
queryParam,
|
|
230
|
+
hasMoreThanOneAssociation,
|
|
224
231
|
apiQueryParams,
|
|
225
|
-
apiQueryParamKey
|
|
226
|
-
|
|
227
|
-
|
|
232
|
+
apiQueryParamKey
|
|
233
|
+
} = {}) => ({
|
|
234
|
+
schemaName: clazz.schema.name,
|
|
235
|
+
entityName: entityName,
|
|
236
|
+
entityClass: clazz,
|
|
237
|
+
resourceName: res || _lodash.default.camelCase(clazz.schema.name),
|
|
238
|
+
resourceUrl: resUrl,
|
|
239
|
+
type: "virtualTx",
|
|
240
|
+
nameTranslated: false,
|
|
241
|
+
parent: parent,
|
|
242
|
+
apiVersion,
|
|
243
|
+
syncWeight: syncWeight,
|
|
244
|
+
privilegeParam,
|
|
245
|
+
privilegeEntity,
|
|
246
|
+
privilegeName,
|
|
247
|
+
queryParam,
|
|
248
|
+
hasMoreThanOneAssociation: !!hasMoreThanOneAssociation,
|
|
249
|
+
apiQueryParams,
|
|
250
|
+
apiQueryParamKey
|
|
228
251
|
});
|
|
229
252
|
|
|
230
253
|
const checklistDetail = refData(_ChecklistDetail.default, {
|
|
@@ -386,13 +409,11 @@ const groupSubject = txData(_GroupSubject.default, {
|
|
|
386
409
|
const videoTelemetric = txData(_VideoTelemetric.default, {
|
|
387
410
|
res: "videotelemetric",
|
|
388
411
|
parent: video,
|
|
389
|
-
syncWeight: 0
|
|
390
|
-
syncPullRequired: false
|
|
412
|
+
syncWeight: 0
|
|
391
413
|
});
|
|
392
414
|
const syncTelemetry = txData(_SyncTelemetry.default, {
|
|
393
415
|
resUrl: "syncTelemetry",
|
|
394
|
-
syncWeight: 1
|
|
395
|
-
syncPullRequired: false
|
|
416
|
+
syncWeight: 1
|
|
396
417
|
});
|
|
397
418
|
const userInfo = txData(_UserInfo.default, {
|
|
398
419
|
resUrl: "me",
|
|
@@ -404,8 +425,7 @@ const identifierAssignment = txData(_IdentifierAssignment.default, {
|
|
|
404
425
|
});
|
|
405
426
|
const ruleFailureTelemetry = txData(_RuleFailureTelemetry.default, {
|
|
406
427
|
resUrl: "ruleFailureTelemetry",
|
|
407
|
-
syncWeight: 0
|
|
408
|
-
syncPullRequired: false
|
|
428
|
+
syncWeight: 0
|
|
409
429
|
});
|
|
410
430
|
const groups = refData(_Groups.default, {
|
|
411
431
|
res: "groups",
|
|
@@ -470,7 +490,12 @@ const groupDashboard = refData(_GroupDashboard.default, {
|
|
|
470
490
|
res: "groupDashboard",
|
|
471
491
|
syncWeight: 0
|
|
472
492
|
});
|
|
473
|
-
const
|
|
493
|
+
const EntityApprovalStatusMetaData = txData(_EntityApprovalStatus.default, {
|
|
494
|
+
res: "entityApprovalStatus",
|
|
495
|
+
entityName: "EntityApprovalStatus"
|
|
496
|
+
});
|
|
497
|
+
exports.EntityApprovalStatusMetaData = EntityApprovalStatusMetaData;
|
|
498
|
+
const subjectEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.default, {
|
|
474
499
|
res: "entityApprovalStatus",
|
|
475
500
|
resUrl: "entityApprovalStatus",
|
|
476
501
|
entityName: 'SubjectEntityApprovalStatus',
|
|
@@ -482,10 +507,9 @@ const subjectEntityApprovalStatus = txData(_EntityApprovalStatus.default, {
|
|
|
482
507
|
privilegeEntity: _Privilege.default.privilegeEntityType.subject,
|
|
483
508
|
privilegeName: _Privilege.default.privilegeName.viewSubject,
|
|
484
509
|
parent: individual,
|
|
485
|
-
syncWeight: 2
|
|
486
|
-
syncPushRequired: false
|
|
510
|
+
syncWeight: 2
|
|
487
511
|
});
|
|
488
|
-
const encounterEntityApprovalStatus =
|
|
512
|
+
const encounterEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.default, {
|
|
489
513
|
res: "entityApprovalStatus",
|
|
490
514
|
resUrl: "entityApprovalStatus",
|
|
491
515
|
entityName: 'EncounterEntityApprovalStatus',
|
|
@@ -497,10 +521,9 @@ const encounterEntityApprovalStatus = txData(_EntityApprovalStatus.default, {
|
|
|
497
521
|
privilegeEntity: _Privilege.default.privilegeEntityType.encounter,
|
|
498
522
|
privilegeName: _Privilege.default.privilegeName.viewVisit,
|
|
499
523
|
parent: encounter,
|
|
500
|
-
syncWeight: 2
|
|
501
|
-
syncPushRequired: false
|
|
524
|
+
syncWeight: 2
|
|
502
525
|
});
|
|
503
|
-
const programEncounterEntityApprovalStatus =
|
|
526
|
+
const programEncounterEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.default, {
|
|
504
527
|
res: "entityApprovalStatus",
|
|
505
528
|
resUrl: "entityApprovalStatus",
|
|
506
529
|
entityName: 'ProgramEncounterEntityApprovalStatus',
|
|
@@ -512,10 +535,9 @@ const programEncounterEntityApprovalStatus = txData(_EntityApprovalStatus.defaul
|
|
|
512
535
|
privilegeEntity: _Privilege.default.privilegeEntityType.encounter,
|
|
513
536
|
privilegeName: _Privilege.default.privilegeName.viewVisit,
|
|
514
537
|
parent: programEncounter,
|
|
515
|
-
syncWeight: 2
|
|
516
|
-
syncPushRequired: false
|
|
538
|
+
syncWeight: 2
|
|
517
539
|
});
|
|
518
|
-
const programEnrolmentEntityApprovalStatus =
|
|
540
|
+
const programEnrolmentEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.default, {
|
|
519
541
|
res: "entityApprovalStatus",
|
|
520
542
|
resUrl: "entityApprovalStatus",
|
|
521
543
|
entityName: 'ProgramEnrolmentEntityApprovalStatus',
|
|
@@ -527,10 +549,9 @@ const programEnrolmentEntityApprovalStatus = txData(_EntityApprovalStatus.defaul
|
|
|
527
549
|
privilegeEntity: _Privilege.default.privilegeEntityType.enrolment,
|
|
528
550
|
privilegeName: _Privilege.default.privilegeName.viewEnrolmentDetails,
|
|
529
551
|
parent: programEnrolment,
|
|
530
|
-
syncWeight: 2
|
|
531
|
-
syncPushRequired: false
|
|
552
|
+
syncWeight: 2
|
|
532
553
|
});
|
|
533
|
-
const checklistItemEntityApprovalStatus =
|
|
554
|
+
const checklistItemEntityApprovalStatus = virtualTxData(_EntityApprovalStatus.default, {
|
|
534
555
|
res: "entityApprovalStatus",
|
|
535
556
|
resUrl: "entityApprovalStatus",
|
|
536
557
|
entityName: 'ChecklistItemEntityApprovalStatus',
|
|
@@ -542,13 +563,7 @@ const checklistItemEntityApprovalStatus = txData(_EntityApprovalStatus.default,
|
|
|
542
563
|
privilegeEntity: _Privilege.default.privilegeEntityType.checklist,
|
|
543
564
|
privilegeName: _Privilege.default.privilegeName.viewChecklist,
|
|
544
565
|
parent: checklistItem,
|
|
545
|
-
syncWeight: 2
|
|
546
|
-
syncPushRequired: false
|
|
547
|
-
});
|
|
548
|
-
const entityApprovalStatus = txData(_EntityApprovalStatus.default, {
|
|
549
|
-
res: 'entityApprovalStatus',
|
|
550
|
-
syncWeight: 1,
|
|
551
|
-
syncPullRequired: false
|
|
566
|
+
syncWeight: 2
|
|
552
567
|
});
|
|
553
568
|
const news = txData(_News.default, {
|
|
554
569
|
syncWeight: 0
|
|
@@ -630,7 +645,7 @@ class EntityMetaData {
|
|
|
630
645
|
|
|
631
646
|
//order is important. last entity in each (tx and ref) with be executed first. parent should be synced before the child.
|
|
632
647
|
static model() {
|
|
633
|
-
return [groupDashboard, approvalStatus, dashboardSectionCardMapping, dashboardSection, dashboardFilter, dashboard, reportCard, standardReportCardType, menuItem, locationHierarchy, video, checklistItemDetail, checklistDetail, rule, ruleDependency, individualRelationshipType, individualRelationGenderMapping, individualRelation, programConfig, formMapping, formElement, formElementGroup, form, documentationItem, documentation, identifierSource, organisationConfig, platformTranslation, translation, locationMapping, addressLevel, taskStatus, taskType, encounterType, program, programOutcome, gender, groupRole, subjectType, conceptAnswer, concept, myGroups, groupPrivileges, groups, privilege, resetSync, subjectMigration, userSubjectAssignment, task, taskUnAssigment, subjectProgramEligibility, news, videoTelemetric, groupSubject, comment, commentThread,
|
|
648
|
+
return [groupDashboard, approvalStatus, dashboardSectionCardMapping, dashboardSection, dashboardFilter, dashboard, reportCard, standardReportCardType, menuItem, locationHierarchy, video, checklistItemDetail, checklistDetail, rule, ruleDependency, individualRelationshipType, individualRelationGenderMapping, individualRelation, programConfig, formMapping, formElement, formElementGroup, form, documentationItem, documentation, identifierSource, organisationConfig, platformTranslation, translation, locationMapping, addressLevel, taskStatus, taskType, encounterType, program, programOutcome, gender, groupRole, subjectType, conceptAnswer, concept, myGroups, groupPrivileges, groups, privilege, resetSync, subjectMigration, userSubjectAssignment, task, taskUnAssigment, subjectProgramEligibility, news, videoTelemetric, groupSubject, comment, commentThread, subjectEntityApprovalStatus, encounterEntityApprovalStatus, programEncounterEntityApprovalStatus, programEnrolmentEntityApprovalStatus, checklistItemEntityApprovalStatus, individualRelationship, checklistItem, checklist, encounter, identifierAssignment, programEncounter, programEnrolment, individual, extension, userInfo, syncTelemetry, ruleFailureTelemetry];
|
|
634
649
|
}
|
|
635
650
|
|
|
636
651
|
static entitiesLoadedFromServer() {
|
|
@@ -638,11 +653,16 @@ class EntityMetaData {
|
|
|
638
653
|
}
|
|
639
654
|
|
|
640
655
|
static findByName(entityName) {
|
|
641
|
-
return
|
|
656
|
+
return EntityMetaData.findByNameIn(entityName, EntityMetaData.model());
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
static findByNameIn(entityName, modelCollection) {
|
|
660
|
+
return _lodash.default.find(modelCollection, //TODO check if this works
|
|
661
|
+
entityMetadata => entityMetadata.entityName === entityName);
|
|
642
662
|
}
|
|
643
663
|
|
|
644
|
-
static
|
|
645
|
-
return _lodash.default.
|
|
664
|
+
static allModels() {
|
|
665
|
+
return _lodash.default.concat(EntityApprovalStatusMetaData, EntityMetaData.model());
|
|
646
666
|
}
|
|
647
667
|
|
|
648
668
|
}
|
package/dist/Individual.js
CHANGED
|
@@ -51,8 +51,6 @@ 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
|
-
|
|
56
54
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
57
55
|
|
|
58
56
|
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; }
|
|
@@ -405,21 +403,23 @@ class Individual extends _BaseEntity.default {
|
|
|
405
403
|
this.name = this.nameString;
|
|
406
404
|
}
|
|
407
405
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
getAgeInYears(asOnDate = (0, _moment.default)(), precise = false) {
|
|
414
|
-
return _AgeUtil.default.getAgeInYears(this.dateOfBirth, asOnDate, precise);
|
|
415
|
-
}
|
|
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();
|
|
416
409
|
|
|
417
|
-
|
|
418
|
-
|
|
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
|
+
}
|
|
419
418
|
}
|
|
420
419
|
|
|
421
|
-
|
|
422
|
-
return
|
|
420
|
+
getAgeAndDateOfBirthDisplay(i18n) {
|
|
421
|
+
if (this.dateOfBirthVerified) return `${this.getDisplayAge(i18n)} (${_General.default.toDisplayDate(this.dateOfBirth)})`;
|
|
422
|
+
return this.getDisplayAge(i18n);
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
getAge(asOnDate = (0, _moment.default)()) {
|
|
@@ -448,6 +448,22 @@ class Individual extends _BaseEntity.default {
|
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
|
|
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
|
+
|
|
451
467
|
toSummaryString() {
|
|
452
468
|
return `${this.name}, Age: ${this.getAge().toString()}, ${this.gender.name}`;
|
|
453
469
|
}
|
|
@@ -802,14 +818,22 @@ class Individual extends _BaseEntity.default {
|
|
|
802
818
|
}
|
|
803
819
|
|
|
804
820
|
userProfileSubtext2(i18n) {
|
|
805
|
-
return this.isPerson() ?
|
|
821
|
+
return this.isPerson() ? this.getDisplayAge(i18n) : "";
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
subjectAddressText(i18n) {
|
|
825
|
+
const parentAddress = _lodash.default.get(this, 'lowestAddressLevel.locationMappings[0].parent.name');
|
|
826
|
+
|
|
827
|
+
let addressText = i18n.t(this.lowestAddressLevel.name);
|
|
828
|
+
if (!_lodash.default.isNil(parentAddress)) addressText += ', ' + i18n.t(parentAddress);
|
|
829
|
+
return addressText;
|
|
806
830
|
} //TODO these methods are slightly differece because of differece in UI on search result and my dashboard listing. Not taking the hit right now.
|
|
807
831
|
|
|
808
832
|
|
|
809
833
|
detail1(i18n) {
|
|
810
834
|
return this.isPerson() ? {
|
|
811
835
|
label: "Age",
|
|
812
|
-
value:
|
|
836
|
+
value: this.getDisplayAge(i18n)
|
|
813
837
|
} : {};
|
|
814
838
|
}
|
|
815
839
|
|
package/dist/Schema.js
CHANGED
|
@@ -200,7 +200,7 @@ const entities = [_DashboardFilter.default, _LocaleMapping.default, _Settings.de
|
|
|
200
200
|
function createRealmConfig() {
|
|
201
201
|
return {
|
|
202
202
|
//order is important, should be arranged according to the dependency
|
|
203
|
-
schemaVersion:
|
|
203
|
+
schemaVersion: 177,
|
|
204
204
|
migration: function (oldDB, newDB) {
|
|
205
205
|
console.log("[AvniModels.Schema]", `Running migration with old schema version: ${oldDB.schemaVersion} and new schema version: ${newDB.schemaVersion}`);
|
|
206
206
|
|
|
@@ -761,12 +761,6 @@ function createRealmConfig() {
|
|
|
761
761
|
}
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
|
-
|
|
765
|
-
if (oldDB.schemaVersion < 178) {
|
|
766
|
-
const pushOnlyEntities = oldDB.objects(_EntitySyncStatus.default.schema.name).filtered("entityName = 'EntityApprovalStatus' OR entityName = 'SyncTelemetry' OR entityName = 'VideoTelemetric' OR entityName = 'RuleFailureTelemetry'");
|
|
767
|
-
|
|
768
|
-
_lodash.default.forEach(pushOnlyEntities, pushOnlyEntity => newDB.delete(pushOnlyEntity));
|
|
769
|
-
}
|
|
770
764
|
}
|
|
771
765
|
};
|
|
772
766
|
}
|
package/dist/index.js
CHANGED
|
@@ -105,6 +105,12 @@ 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
|
+
});
|
|
108
114
|
Object.defineProperty(exports, "EntityQueue", {
|
|
109
115
|
enumerable: true,
|
|
110
116
|
get: function () {
|
|
@@ -789,12 +795,6 @@ Object.defineProperty(exports, "DateTimeUtil", {
|
|
|
789
795
|
return _DateTimeUtil.default;
|
|
790
796
|
}
|
|
791
797
|
});
|
|
792
|
-
Object.defineProperty(exports, "AgeUtil", {
|
|
793
|
-
enumerable: true,
|
|
794
|
-
get: function () {
|
|
795
|
-
return _AgeUtil.default;
|
|
796
|
-
}
|
|
797
|
-
});
|
|
798
798
|
Object.defineProperty(exports, "CustomDashboardCache", {
|
|
799
799
|
enumerable: true,
|
|
800
800
|
get: function () {
|
|
@@ -834,7 +834,7 @@ var _Encounter = _interopRequireDefault(require("./Encounter"));
|
|
|
834
834
|
|
|
835
835
|
var _EncounterType = _interopRequireDefault(require("./EncounterType"));
|
|
836
836
|
|
|
837
|
-
var _EntityMetaData =
|
|
837
|
+
var _EntityMetaData = _interopRequireWildcard(require("./EntityMetaData"));
|
|
838
838
|
|
|
839
839
|
var _EntityQueue = _interopRequireDefault(require("./EntityQueue"));
|
|
840
840
|
|
|
@@ -1058,8 +1058,6 @@ var _ArrayUtil = _interopRequireDefault(require("./utility/ArrayUtil"));
|
|
|
1058
1058
|
|
|
1059
1059
|
var _DateTimeUtil = _interopRequireDefault(require("./utility/DateTimeUtil"));
|
|
1060
1060
|
|
|
1061
|
-
var _AgeUtil = _interopRequireDefault(require("./utility/AgeUtil"));
|
|
1062
|
-
|
|
1063
1061
|
var _CustomDashboardCache = _interopRequireDefault(require("./CustomDashboardCache"));
|
|
1064
1062
|
|
|
1065
1063
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
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 }}
|
|
@@ -1,18 +0,0 @@
|
|
|
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 }}
|
package/dist/utility/AgeUtil.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
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;
|