openchs-models 1.27.17 → 1.27.19

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.
@@ -947,6 +947,14 @@ class Individual extends _BaseEntity.default {
947
947
  }
948
948
  }
949
949
 
950
+ hasProgramEncounterOfType(encounterTypes) {
951
+ return _lodash.default.some(this.enrolments, enrolment => _lodash.default.some(enrolment.encounters, encounter => _lodash.default.some(encounterTypes, encounterType => encounterType.uuid === encounter.encounterType.uuid)));
952
+ }
953
+
954
+ hasEncounterOfType(encounterTypes) {
955
+ return _lodash.default.some(this.encounters, encounter => _lodash.default.some(encounterTypes, encounterType => encounterType.uuid === encounter.encounterType.uuid));
956
+ }
957
+
950
958
  toJSON() {
951
959
  return {
952
960
  uuid: this.uuid,
@@ -532,6 +532,11 @@ class ObservationsHolder {
532
532
  display += `${I18n.t(obs.concept.name)}: ${obs.getReadableValue()}\n`;
533
533
  });
534
534
  return display;
535
+ } // it uses only underlying realm model and not avni model
536
+
537
+
538
+ static hasAnyAnswer(obsHolder, conceptUuid, answerUuids) {
539
+ return _lodash.default.some(obsHolder.observations, obs => obs.concept.uuid === conceptUuid && obs.valueJSON && _lodash.default.some(answerUuids, ansUuid => obs.valueJSON.includes(ansUuid)));
535
540
  }
536
541
 
537
542
  }
@@ -141,12 +141,16 @@ _defineProperty(ProgramEncounter, "schema", {
141
141
  name: _SchemaNames.default.ProgramEncounter,
142
142
  primaryKey: "uuid",
143
143
  properties: {
144
- uuid: "string",
144
+ uuid: {
145
+ type: "string"
146
+ },
145
147
  name: {
146
148
  type: "string",
147
149
  optional: true
148
150
  },
149
- encounterType: "EncounterType",
151
+ encounterType: {
152
+ type: "EncounterType"
153
+ },
150
154
  earliestVisitDateTime: {
151
155
  type: "date",
152
156
  optional: true
@@ -45,6 +45,14 @@ class RealmResultsProxy {
45
45
  this.materialiseArray();
46
46
  return this.array.filter(predicate, thisArg);
47
47
  }
48
+ /*
49
+ Uses underlying collection. The objects would not have access to business methods on avni model
50
+ */
51
+
52
+
53
+ filterInternal(predicate, thisArg) {
54
+ return this.realmCollection.filter(predicate, thisArg);
55
+ }
48
56
 
49
57
  filtered(query, ...args) {
50
58
  return RealmResultsProxy.create(this.realmCollection.filtered(query, ...args), this.entityClass);
@@ -73,6 +81,16 @@ class RealmResultsProxy {
73
81
  return callback(this.createEntity(object), index, this);
74
82
  }, thisArg);
75
83
  }
84
+ /*
85
+ Uses underlying collection. The objects would not have access to business methods on avni model
86
+ */
87
+
88
+
89
+ mapInternal(callback, thisArg) {
90
+ return this.realmCollection.map((object, index) => {
91
+ return callback(object, index, this);
92
+ }, thisArg);
93
+ }
76
94
 
77
95
  max(property) {
78
96
  return this.realmCollection.max(property);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.27.17",
4
+ "version": "1.27.19",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",