@d4l/collect-lib 1.20.1 → 1.21.0
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/README.md +90 -27
- package/dist/index.d.mts +145 -53
- package/dist/index.d.ts +145 -53
- package/dist/index.js +185 -167
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +194 -176
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ Update the types by running `yarn run readme:update`.
|
|
|
41
41
|
| content | true | [ProgramContent](#ProgramContent) | Contains all the relevant content properties of the program. |
|
|
42
42
|
| endDate | false | ISO 8601 date with timezone | Date the program should finish for all users. |
|
|
43
43
|
| tags | false | [ProgramTag](#ProgramTag)[] | List of supported tags including their configuration |
|
|
44
|
-
| publishedAt |
|
|
44
|
+
| publishedAt | false | ISO 8601 date with timezone | Date the program was published (used to determine program state). |
|
|
45
45
|
| featured | true | [ProgramFeatured](#ProgramFeatured) | Describes the featured state of the program. |
|
|
46
46
|
| theme | false | 'D4L', 'GREEN', 'PURPLE', 'OLIVE' or 'BLUE' | The theme to be used for the program in the app |
|
|
47
47
|
|
|
@@ -132,32 +132,91 @@ Update the types by running `yarn run readme:update`.
|
|
|
132
132
|
|
|
133
133
|
### StepCondition
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
|
|
|
158
|
-
|
|
|
159
|
-
|
|
160
|
-
|
|
135
|
+
#### Base
|
|
136
|
+
|
|
137
|
+
| Properties | Required | Type | Description |
|
|
138
|
+
| ---------- | -------- | ------------------------------- | ----------------------------------------------------------------------------- |
|
|
139
|
+
| type | true | [ConditionType](#ConditionType) | Type of the condition (determines which other attributes are applicable) |
|
|
140
|
+
| offset | false | ISO 8601 duration string | Adds additional offset duration to conditions outcome. (e.g. x plus two days) |
|
|
141
|
+
|
|
142
|
+
#### DateCondition
|
|
143
|
+
|
|
144
|
+
| Properties | Required | Type | Description |
|
|
145
|
+
| ---------- | -------- | ------------------- | --------------------------------------------------------------- |
|
|
146
|
+
| type | true | `date` | Condition that requires a date to have passed |
|
|
147
|
+
| date | true | string (YYYY-MM-DD) | Timestamp that needs to be passed for the condition to be true. |
|
|
148
|
+
|
|
149
|
+
#### QuestionCondition
|
|
150
|
+
|
|
151
|
+
| Properties | Required | Type | Description |
|
|
152
|
+
| ------------ | -------- | ----------------------------------- | ------------------------------------------------------------------------------- |
|
|
153
|
+
| type | true | `question` | Condition that requires a specific answer from a previous survey |
|
|
154
|
+
| questionType | true | `coding` | Condition that uses authored date of the response fulfilling the code condition |
|
|
155
|
+
| surveyName | true | string | Identifier of the survey |
|
|
156
|
+
| linkID | true | string | Identifier of the question |
|
|
157
|
+
| operand | false | string | (unless operator is `exists`). Used as `<answer>` `<operator>` `<operand>`. |
|
|
158
|
+
| operator | true | `exists`,`=`,`!=`,`>`,`<`,`>=`,`<=` | Used as `<answer>` `<operator>` `<operand>`. |
|
|
159
|
+
|
|
160
|
+
#### QuestionCondition
|
|
161
|
+
|
|
162
|
+
| Properties | Required | Type | Description |
|
|
163
|
+
| ------------ | -------- | ---------- | --------------------------------------------------------------------- |
|
|
164
|
+
| type | true | `question` | Condition that requires a specific answer from a previous survey |
|
|
165
|
+
| questionType | true | `date` | Condition that uses the answer of a date question as fulfillment date |
|
|
166
|
+
| surveyName | true | string | Identifier of the survey |
|
|
167
|
+
| linkID | true | string | Identifier of the question |
|
|
168
|
+
|
|
169
|
+
#### SurveyCondition
|
|
170
|
+
|
|
171
|
+
| Properties | Required | Type | Description |
|
|
172
|
+
| ---------- | -------- | -------- | ---------------------------------------------------------------- |
|
|
173
|
+
| type | true | `survey` | Condition that requires a previous survey to have been completed |
|
|
174
|
+
| surveyName | true | string | Identifier of the survey |
|
|
175
|
+
|
|
176
|
+
#### RoutineCondition
|
|
177
|
+
|
|
178
|
+
| Properties | Required | Type | Description |
|
|
179
|
+
| ----------- | -------- | --------- | ----------------------------------------------------------------- |
|
|
180
|
+
| type | true | `routine` | Condition that requires a previous routine to have been completed |
|
|
181
|
+
| routineName | true | string | Identifier of the routine |
|
|
182
|
+
|
|
183
|
+
#### ConsentCondition
|
|
184
|
+
|
|
185
|
+
| Properties | Required | Type | Description |
|
|
186
|
+
| ---------- | -------- | --------- | ------------------------------------------------------------------------------ |
|
|
187
|
+
| type | true | `consent` | Condition that require a specific consent to be given |
|
|
188
|
+
| consentKey | true | string | Reference to the consent that must have been granted to fulfill the condition. |
|
|
189
|
+
|
|
190
|
+
#### ResponseCondition
|
|
191
|
+
|
|
192
|
+
| Properties | Required | Type | Description |
|
|
193
|
+
| ------------ | -------- | ---------- | -------------------------------------------------------------------------------- |
|
|
194
|
+
| type | true | `response` | Condition that require a specific response to be received |
|
|
195
|
+
| responseName | true | string | Reference to the response that must have been received to fulfill the condition. |
|
|
196
|
+
|
|
197
|
+
#### AndCondition
|
|
198
|
+
|
|
199
|
+
| Properties | Required | Type | Description |
|
|
200
|
+
| ---------- | -------- | -------------------- | -------------------------------------------------------------------------------- |
|
|
201
|
+
| type | true | `and` | Condition that requires all subconditions to be fulfilled |
|
|
202
|
+
| items | true | StepCondition[] | List of conditions that must all be fulfilled. |
|
|
203
|
+
| sorting | false | `earliest`, `latest` | Determines which resulting dates of the items gets picked. Defaults to `latest`. |
|
|
204
|
+
|
|
205
|
+
#### OrCondition
|
|
206
|
+
|
|
207
|
+
| Properties | Required | Type | Description |
|
|
208
|
+
| ---------- | -------- | -------------------- | ---------------------------------------------------------------------------------- |
|
|
209
|
+
| type | true | `or` | Condition that requires one subcondition to be fulfilled |
|
|
210
|
+
| items | true | StepCondition[] | List of conditions where at least one must be fulfilled. |
|
|
211
|
+
| sorting | false | `earliest`, `latest` | Determines which resulting dates of the items gets picked. Defaults to `earliest`. |
|
|
212
|
+
|
|
213
|
+
#### OffsetCondition
|
|
214
|
+
|
|
215
|
+
| Properties | Required | Type | Description |
|
|
216
|
+
| ---------- | -------- | ------------------------ | ----------------------------------------------------------------------------------- |
|
|
217
|
+
| type | true | `offset` | Condition that adds a date offset to the fulfillment date of the given subcondition |
|
|
218
|
+
| offset | true | ISO 8601 duration string | Offset as duration, can be negative. |
|
|
219
|
+
| item | true | StepCondition | Condition to apply the additional offset to. |
|
|
161
220
|
|
|
162
221
|
### ProgramDonation
|
|
163
222
|
|
|
@@ -228,6 +287,7 @@ Update the types by running `yarn run readme:update`.
|
|
|
228
287
|
| content | true | [SurveyContent](#SurveyContent) | Defines the texts, images and icons that need to be displayed for the survey |
|
|
229
288
|
| reminder | false | [TaskReminder](#TaskReminder) | Defines if and when a reminder should be sent for the task (only for one-time and recurring tasks) |
|
|
230
289
|
| template | false | string | Name of the template used for the questionnaire (templated surveys don't allow questions to be changed) |
|
|
290
|
+
| publishedAt | false | ISO 8601 date with timezone | Date the survey was published. |
|
|
231
291
|
|
|
232
292
|
#### TaskFrequency
|
|
233
293
|
|
|
@@ -252,6 +312,7 @@ Update the types by running `yarn run readme:update`.
|
|
|
252
312
|
|
|
253
313
|
| Properties | Required | Type | Description |
|
|
254
314
|
| --------------- | -------- | --------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
315
|
+
| eligibility | false | boolean | Indicates if the scoring is suitable for eligibility. |
|
|
255
316
|
| scores | true | object | Defines how the questions will be scored |
|
|
256
317
|
| scores.valueset | false | {valuesetURL: {answerCode: score}} | For questions that use valuesets scores are assigned to each code of the valuesets |
|
|
257
318
|
| scores.number | false | {linkId: [ScoreThreshold](#ScoreThreshold)[]} | For numeric questions we define scoring conditions per question |
|
|
@@ -302,6 +363,7 @@ Update the types by running `yarn run readme:update`.
|
|
|
302
363
|
| devices | true | string[] | Lists the devices used in the routine |
|
|
303
364
|
| duration | ISO 8601 duration String | Defines the duration of the routine |
|
|
304
365
|
| reminder | false | [TaskReminder](#TaskReminder) | Defines if and when a reminder should be sent for the task (only for one-time and recurring tasks) |
|
|
366
|
+
| publishedAt | false | ISO 8601 date with timezone | Date the routine was published. |
|
|
305
367
|
|
|
306
368
|
#### ProgramDevice
|
|
307
369
|
|
|
@@ -341,6 +403,7 @@ Update the types by running `yarn run readme:update`.
|
|
|
341
403
|
| frequency | true | [TaskFrequency](#TaskFrequency) | Defines in which frequency the questionnaire occurs |
|
|
342
404
|
| content | true | [DisplayContent](#DisplayContent) | Defines the texts, images and icons that need to be displayed for the display |
|
|
343
405
|
| charts | false | { [key in ProgramDeviceType]?: ProgramDevicesDataType[] } | List of devices and their data types that are relevant for the display |
|
|
406
|
+
| publishedAt | false | ISO 8601 date with timezone | Date the display was published. |
|
|
344
407
|
|
|
345
408
|
#### DisplayContent
|
|
346
409
|
|
package/dist/index.d.mts
CHANGED
|
@@ -32,6 +32,7 @@ type Survey = {
|
|
|
32
32
|
content: SurveyContent;
|
|
33
33
|
reminder?: TaskReminder;
|
|
34
34
|
template?: string;
|
|
35
|
+
publishedAt?: string;
|
|
35
36
|
};
|
|
36
37
|
type TaskFrequency = {
|
|
37
38
|
type: FrequencyType;
|
|
@@ -47,6 +48,7 @@ type TaskReminder = {
|
|
|
47
48
|
frequency: ReminderFrequencyType;
|
|
48
49
|
};
|
|
49
50
|
type SurveyScoring = {
|
|
51
|
+
eligibility?: boolean;
|
|
50
52
|
scores: {
|
|
51
53
|
valueset?: {
|
|
52
54
|
[valuesetURL: string]: {
|
|
@@ -84,6 +86,7 @@ type Display = {
|
|
|
84
86
|
charts?: {
|
|
85
87
|
[key in ProgramDeviceType]?: ProgramDevicesDataType[];
|
|
86
88
|
};
|
|
89
|
+
publishedAt?: string;
|
|
87
90
|
};
|
|
88
91
|
type DisplayType = 'report' | 'recommendation' | 'end-of-participation';
|
|
89
92
|
type DisplayContent = {
|
|
@@ -155,6 +158,27 @@ interface SeenMessage {
|
|
|
155
158
|
blocks?: ContentBlock[];
|
|
156
159
|
}
|
|
157
160
|
|
|
161
|
+
interface Notification {
|
|
162
|
+
name: string;
|
|
163
|
+
programName: string;
|
|
164
|
+
recipients?: string[];
|
|
165
|
+
notificationKey: string;
|
|
166
|
+
createdAt?: string;
|
|
167
|
+
updatedAt?: string;
|
|
168
|
+
sentAt?: string;
|
|
169
|
+
}
|
|
170
|
+
type ResponseTimes = {
|
|
171
|
+
[key: string]: Date | null;
|
|
172
|
+
};
|
|
173
|
+
interface NotificationRecipient {
|
|
174
|
+
notificationName: string;
|
|
175
|
+
programName: string;
|
|
176
|
+
subjectID: string;
|
|
177
|
+
sentAt?: string;
|
|
178
|
+
pushedAt?: string;
|
|
179
|
+
readAt?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
158
182
|
interface QuestionnaireScore {
|
|
159
183
|
/**
|
|
160
184
|
* The actual survey name
|
|
@@ -260,21 +284,61 @@ type ProgramSensorStep = ProgramStepBase & {
|
|
|
260
284
|
type: 'sensor';
|
|
261
285
|
devices: ProgramDevice[];
|
|
262
286
|
};
|
|
263
|
-
type StepCondition =
|
|
287
|
+
type StepCondition = DateCondition | CodeQuestionCondition | DateQuestionCondition | SurveyCondition | RoutineCondition | ConsentCondition | ResponseCondition | AndCondition | OrCondition | OffsetCondition;
|
|
288
|
+
type StepConditionBase = {
|
|
264
289
|
type: ConditionType;
|
|
265
|
-
surveyName?: string;
|
|
266
|
-
routineName?: string;
|
|
267
|
-
linkID?: string;
|
|
268
|
-
questionType?: ConditionQuestionType;
|
|
269
|
-
operand?: string;
|
|
270
|
-
operator?: ConditionOperatorType;
|
|
271
290
|
offset?: string;
|
|
272
|
-
|
|
273
|
-
|
|
291
|
+
};
|
|
292
|
+
type DateCondition = StepConditionBase & {
|
|
293
|
+
type: 'date';
|
|
294
|
+
date: string;
|
|
295
|
+
};
|
|
296
|
+
type CodeQuestionCondition = StepConditionBase & {
|
|
297
|
+
type: 'question';
|
|
298
|
+
questionType: 'coding';
|
|
299
|
+
surveyName: string;
|
|
300
|
+
linkID: string;
|
|
301
|
+
operand?: string;
|
|
302
|
+
operator: ConditionOperatorType;
|
|
303
|
+
};
|
|
304
|
+
type DateQuestionCondition = StepConditionBase & {
|
|
305
|
+
type: 'question';
|
|
306
|
+
questionType: 'date';
|
|
307
|
+
surveyName: string;
|
|
308
|
+
linkID: string;
|
|
309
|
+
};
|
|
310
|
+
type SurveyCondition = StepConditionBase & {
|
|
311
|
+
type: 'survey';
|
|
312
|
+
surveyName: string;
|
|
313
|
+
};
|
|
314
|
+
type RoutineCondition = StepConditionBase & {
|
|
315
|
+
type: 'routine';
|
|
316
|
+
routineName: string;
|
|
317
|
+
};
|
|
318
|
+
type ConsentCondition = StepConditionBase & {
|
|
319
|
+
type: 'consent';
|
|
320
|
+
consentKey: string;
|
|
321
|
+
};
|
|
322
|
+
type ResponseCondition = StepConditionBase & {
|
|
323
|
+
type: 'response';
|
|
324
|
+
responseName: string;
|
|
325
|
+
};
|
|
326
|
+
type AndCondition = StepConditionBase & {
|
|
327
|
+
type: 'and';
|
|
328
|
+
items: StepCondition[];
|
|
274
329
|
sorting?: ConditionSorting;
|
|
275
|
-
consentKey?: string;
|
|
276
330
|
};
|
|
277
|
-
type
|
|
331
|
+
type OrCondition = StepConditionBase & {
|
|
332
|
+
type: 'or';
|
|
333
|
+
items: StepCondition[];
|
|
334
|
+
sorting?: ConditionSorting;
|
|
335
|
+
};
|
|
336
|
+
type OffsetCondition = StepConditionBase & {
|
|
337
|
+
type: 'offset';
|
|
338
|
+
offset: string;
|
|
339
|
+
item: StepCondition;
|
|
340
|
+
};
|
|
341
|
+
type ConditionType = 'date' | 'question' | 'survey' | 'routine' | 'and' | 'or' | 'offset' | 'consent' | 'response';
|
|
278
342
|
type ConditionQuestionType = 'coding' | 'date';
|
|
279
343
|
type ConditionOperatorType = fhir5.QuestionnaireItemEnableWhen['operator'];
|
|
280
344
|
type ConditionSorting = 'earliest' | 'latest';
|
|
@@ -520,6 +584,7 @@ type Routine = {
|
|
|
520
584
|
devices: ProgramDevice[];
|
|
521
585
|
duration?: string;
|
|
522
586
|
reminder?: TaskReminder;
|
|
587
|
+
publishedAt?: string;
|
|
523
588
|
};
|
|
524
589
|
type ProgramDevice = {
|
|
525
590
|
type: ProgramDeviceType;
|
|
@@ -1231,31 +1296,53 @@ declare const isYearString: (year: string) => boolean;
|
|
|
1231
1296
|
|
|
1232
1297
|
declare const isScoreEligible: (step: ProgramEligibilityStep, score?: number) => boolean;
|
|
1233
1298
|
|
|
1299
|
+
type GuardParameters = {
|
|
1300
|
+
multiAnswers?: MultiAnswers;
|
|
1301
|
+
consentTimes?: ConsentTimes;
|
|
1302
|
+
routineTimes?: RoutineTimes;
|
|
1303
|
+
responseTimes?: ResponseTimes;
|
|
1304
|
+
};
|
|
1305
|
+
type GuardContext = {
|
|
1306
|
+
guard: Guard;
|
|
1307
|
+
surveyNames?: string[];
|
|
1308
|
+
routineNames?: string[];
|
|
1309
|
+
consentKeys?: string[];
|
|
1310
|
+
responseNames?: string[];
|
|
1311
|
+
};
|
|
1234
1312
|
/**
|
|
1235
1313
|
* Checks if a given condition is fulfilled by evaluating the answers of a questionnaire response.
|
|
1236
1314
|
*/
|
|
1237
1315
|
interface Guard {
|
|
1238
1316
|
/**
|
|
1239
1317
|
* Evaluates if the guard is fulfilled with the given answers
|
|
1318
|
+
* Used for questionnaire conditions (FHIR based)
|
|
1240
1319
|
* @param answers Dictionary of question id -> answers value
|
|
1241
1320
|
*/
|
|
1242
1321
|
evaluate(answers: Answers): boolean;
|
|
1243
1322
|
/**
|
|
1244
1323
|
* Evaluates if the guard is fulfilled and returns since when it counts as fulfilled.
|
|
1245
1324
|
* Returns null if it is not fulfilled
|
|
1246
|
-
*
|
|
1247
|
-
* @param
|
|
1248
|
-
* @param consentTimes Dictionary of consentKey -> date of the given consent (or null)
|
|
1249
|
-
* @param routineTimes Dictionary of routine names -> date when the last recording for the routine was done (or null)
|
|
1325
|
+
* Used for step conditions
|
|
1326
|
+
* @param params map of parameters to calculate fulfillment
|
|
1250
1327
|
*/
|
|
1251
|
-
getFulfillmentDate(
|
|
1328
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1329
|
+
}
|
|
1330
|
+
declare class AnswerCodeGuard implements Guard {
|
|
1331
|
+
surveyName?: string;
|
|
1332
|
+
questionID: string;
|
|
1333
|
+
operand?: string;
|
|
1334
|
+
operator: ConditionOperatorType;
|
|
1335
|
+
offset: Duration;
|
|
1336
|
+
constructor(questionID: string, operator: ConditionOperatorType, operand?: string, surveyName?: string, offset?: string);
|
|
1337
|
+
evaluate(answers: Answers): boolean;
|
|
1338
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1252
1339
|
}
|
|
1253
1340
|
/**
|
|
1254
1341
|
* Assumption: Date answers in the questionnaire are formatted like this: YYYY-MM-DD
|
|
1255
1342
|
* For questionnaires returns the evaluation of <answer> <operator> <operand>.
|
|
1256
1343
|
* For steps returns the <answer>+<offset> of the answer
|
|
1257
1344
|
*/
|
|
1258
|
-
declare class
|
|
1345
|
+
declare class AnswerDateGuard implements Guard {
|
|
1259
1346
|
surveyName?: string;
|
|
1260
1347
|
questionID: string;
|
|
1261
1348
|
operand?: Date;
|
|
@@ -1263,56 +1350,46 @@ declare class DateCondition implements Guard {
|
|
|
1263
1350
|
offset: Duration;
|
|
1264
1351
|
constructor(questionID: string, operand: string, operator: ConditionOperatorType, surveyName?: string, offset?: string);
|
|
1265
1352
|
evaluate(answers: Answers): boolean;
|
|
1266
|
-
getFulfillmentDate(
|
|
1353
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1267
1354
|
}
|
|
1268
1355
|
/**
|
|
1269
1356
|
* Wrapper around the constructor for the creation of the stepcondition version
|
|
1270
1357
|
* Does not need operator and operand as it just returns a given date answer
|
|
1271
1358
|
*/
|
|
1272
|
-
declare const
|
|
1359
|
+
declare const newStepDateGuard: (questionID: string, surveyName: string, offset?: string) => AnswerDateGuard;
|
|
1273
1360
|
/**
|
|
1274
1361
|
* Assumption: Year answers in the questionnaire are formatted like this: YYYY
|
|
1275
1362
|
*/
|
|
1276
|
-
declare class
|
|
1363
|
+
declare class YearGuard implements Guard {
|
|
1277
1364
|
questionID: string;
|
|
1278
1365
|
operand?: number;
|
|
1279
1366
|
operator: ConditionOperatorType;
|
|
1280
1367
|
constructor(questionID: string, operand: string, operator: ConditionOperatorType);
|
|
1281
1368
|
evaluate(answers: Answers): boolean;
|
|
1282
|
-
getFulfillmentDate(
|
|
1369
|
+
getFulfillmentDate(_params: GuardParameters): Date | null;
|
|
1283
1370
|
}
|
|
1284
|
-
declare class
|
|
1285
|
-
surveyName?: string;
|
|
1286
|
-
questionID: string;
|
|
1287
|
-
operand?: string;
|
|
1288
|
-
operator: ConditionOperatorType;
|
|
1289
|
-
offset: Duration;
|
|
1290
|
-
constructor(questionID: string, operand: string, operator: ConditionOperatorType, surveyName?: string, offset?: string);
|
|
1291
|
-
evaluate(answers: Answers): boolean;
|
|
1292
|
-
getFulfillmentDate(multiAnswers: MultiAnswers): Date | null;
|
|
1293
|
-
}
|
|
1294
|
-
declare class DecimalCondition implements Guard {
|
|
1371
|
+
declare class DecimalGuard implements Guard {
|
|
1295
1372
|
questionID: string;
|
|
1296
1373
|
operand?: number;
|
|
1297
1374
|
operator: ConditionOperatorType;
|
|
1298
1375
|
constructor(questionID: string, operand: fhir5.QuestionnaireItemEnableWhen['answerDecimal'], operator: ConditionOperatorType);
|
|
1299
1376
|
evaluate(answers: Answers): boolean;
|
|
1300
|
-
getFulfillmentDate(
|
|
1377
|
+
getFulfillmentDate(_params: GuardParameters): Date | null;
|
|
1301
1378
|
}
|
|
1302
|
-
declare class
|
|
1379
|
+
declare class ExistsGuard implements Guard {
|
|
1303
1380
|
questionID: string;
|
|
1304
1381
|
constructor(questionID: string);
|
|
1305
1382
|
evaluate(answers: Answers): boolean;
|
|
1306
|
-
getFulfillmentDate(
|
|
1383
|
+
getFulfillmentDate(_params: GuardParameters): Date | null;
|
|
1307
1384
|
}
|
|
1308
1385
|
/**
|
|
1309
1386
|
* Checks if a condition is true or false
|
|
1310
1387
|
*/
|
|
1311
|
-
declare class
|
|
1388
|
+
declare class BoolGuard implements Guard {
|
|
1312
1389
|
condition: boolean;
|
|
1313
1390
|
constructor(condition: boolean);
|
|
1314
1391
|
evaluate(_answers: Answers): boolean;
|
|
1315
|
-
getFulfillmentDate(
|
|
1392
|
+
getFulfillmentDate(_params: GuardParameters): Date | null;
|
|
1316
1393
|
}
|
|
1317
1394
|
/**
|
|
1318
1395
|
* Combines a set of Guards with AND
|
|
@@ -1322,7 +1399,7 @@ declare class Conjunction implements Guard {
|
|
|
1322
1399
|
sorting: ConditionSorting;
|
|
1323
1400
|
constructor(conditions: Guard[], sorting?: ConditionSorting);
|
|
1324
1401
|
evaluate(answers: Answers): boolean;
|
|
1325
|
-
getFulfillmentDate(
|
|
1402
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1326
1403
|
}
|
|
1327
1404
|
/**
|
|
1328
1405
|
* Combines a set of Guards with OR
|
|
@@ -1332,7 +1409,7 @@ declare class Disjunction implements Guard {
|
|
|
1332
1409
|
sorting: ConditionSorting;
|
|
1333
1410
|
constructor(conditions: Guard[], sorting?: ConditionSorting);
|
|
1334
1411
|
evaluate(answers: Answers): boolean;
|
|
1335
|
-
getFulfillmentDate(
|
|
1412
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1336
1413
|
}
|
|
1337
1414
|
/**
|
|
1338
1415
|
* Adds an offset to getFulfillmentDate of the encapsuled item.
|
|
@@ -1343,42 +1420,57 @@ declare class Offset implements Guard {
|
|
|
1343
1420
|
offset: Duration;
|
|
1344
1421
|
constructor(condition: Guard, offset?: string);
|
|
1345
1422
|
evaluate(answers: Answers): boolean;
|
|
1346
|
-
getFulfillmentDate(
|
|
1423
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1347
1424
|
}
|
|
1348
|
-
declare class
|
|
1425
|
+
declare class ConsentGuard implements Guard {
|
|
1349
1426
|
consentKey: string;
|
|
1350
1427
|
offset: Duration;
|
|
1351
1428
|
constructor(consentKey: string, offset?: string);
|
|
1352
1429
|
evaluate(_answers: Answers): boolean;
|
|
1353
|
-
getFulfillmentDate(
|
|
1430
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1354
1431
|
}
|
|
1355
1432
|
/**
|
|
1356
1433
|
* Checks if the survey was answered
|
|
1357
1434
|
*/
|
|
1358
|
-
declare class
|
|
1435
|
+
declare class SurveyGuard implements Guard {
|
|
1359
1436
|
surveyName: string;
|
|
1360
1437
|
offset: Duration;
|
|
1361
1438
|
constructor(surveyName: string, offset?: string);
|
|
1362
1439
|
evaluate(_answers: Answers): boolean;
|
|
1363
|
-
getFulfillmentDate(
|
|
1440
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1364
1441
|
}
|
|
1365
1442
|
/**
|
|
1366
1443
|
* Checks if a routine was recorded
|
|
1367
1444
|
*/
|
|
1368
|
-
declare class
|
|
1445
|
+
declare class RoutineGuard implements Guard {
|
|
1369
1446
|
routineName: string;
|
|
1370
1447
|
offset: Duration;
|
|
1371
1448
|
constructor(routineName: string, offset?: string);
|
|
1372
1449
|
evaluate(_answers: Answers): boolean;
|
|
1373
|
-
getFulfillmentDate(
|
|
1450
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Checks if a response of a certain name was received
|
|
1454
|
+
*/
|
|
1455
|
+
declare class ResponseGuard implements Guard {
|
|
1456
|
+
responseName: string;
|
|
1457
|
+
offset: Duration;
|
|
1458
|
+
constructor(responseName: string, offset?: string);
|
|
1459
|
+
evaluate(_answers: Answers): boolean;
|
|
1460
|
+
getFulfillmentDate(params: GuardParameters): Date | null;
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Checks if a given date has passed
|
|
1464
|
+
*/
|
|
1465
|
+
declare class DateGuard implements Guard {
|
|
1466
|
+
date: Date;
|
|
1467
|
+
offset: Duration;
|
|
1468
|
+
constructor(date: string, offset?: string);
|
|
1469
|
+
evaluate(_answers: Answers): boolean;
|
|
1470
|
+
getFulfillmentDate(_params: GuardParameters): Date | null;
|
|
1374
1471
|
}
|
|
1375
1472
|
declare const generateQuestionGuard: (enableWhen: fhir5.QuestionnaireItemEnableWhen[] | undefined, enableBehavior: fhir5.QuestionnaireItem["enableBehavior"]) => Guard | undefined;
|
|
1376
|
-
declare const generateStepGuard: (cond: StepCondition) =>
|
|
1377
|
-
guard: Guard;
|
|
1378
|
-
surveyNames: string[];
|
|
1379
|
-
routineNames: string[];
|
|
1380
|
-
consentKeys: string[];
|
|
1381
|
-
};
|
|
1473
|
+
declare const generateStepGuard: (cond: StepCondition) => GuardContext;
|
|
1382
1474
|
|
|
1383
1475
|
declare const ULID_REGEX: RegExp;
|
|
1384
1476
|
declare const UUID_REGEX: RegExp;
|
|
@@ -1414,4 +1506,4 @@ declare const API_TARGET_MAP: {
|
|
|
1414
1506
|
};
|
|
1415
1507
|
};
|
|
1416
1508
|
|
|
1417
|
-
export { ANDROID_SENSORS_CONSTANT_NAMES, type API, type APIConfig, type APIDeviceConfig, API_TARGET_MAP, APPLE_HEALTH_ACTIVE_ENERGY_ANNOTATION, APPLE_HEALTH_ANNOTATION_ITEM_ACTIVE_ENERGY, APPLE_HEALTH_ANNOTATION_ITEM_SLEEP_DURATION, APPLE_HEALTH_ANNOTATION_ITEM_SLEEP_STATE, APPLE_HEALTH_ANNOTATION_ITEM_STEP_COUNT, APPLE_HEALTH_ANNOTATION_ITEM_WALKING_RUNNING_DISTANCE, APPLE_HEALTH_SIGNAL_TYPE_ANNOTATIONS, APPLE_HEALTH_SLEEP_ANALYSIS_ANNOTATION, APPLE_HEALTH_SLEEP_STATE_MAP, APPLE_HEALTH_STEP_COUNT_ANNOTATION, APPLE_HEALTH_WALKING_RUNNING_DISTANCE_ANNOTATION, ASMSECGMeasurementAnnotation, ASMSSpO2MeasurementAnnotation, type Answer,
|
|
1509
|
+
export { ANDROID_SENSORS_CONSTANT_NAMES, type API, type APIConfig, type APIDeviceConfig, API_TARGET_MAP, APPLE_HEALTH_ACTIVE_ENERGY_ANNOTATION, APPLE_HEALTH_ANNOTATION_ITEM_ACTIVE_ENERGY, APPLE_HEALTH_ANNOTATION_ITEM_SLEEP_DURATION, APPLE_HEALTH_ANNOTATION_ITEM_SLEEP_STATE, APPLE_HEALTH_ANNOTATION_ITEM_STEP_COUNT, APPLE_HEALTH_ANNOTATION_ITEM_WALKING_RUNNING_DISTANCE, APPLE_HEALTH_SIGNAL_TYPE_ANNOTATIONS, APPLE_HEALTH_SLEEP_ANALYSIS_ANNOTATION, APPLE_HEALTH_SLEEP_STATE_MAP, APPLE_HEALTH_STEP_COUNT_ANNOTATION, APPLE_HEALTH_WALKING_RUNNING_DISTANCE_ANNOTATION, ASMSECGMeasurementAnnotation, ASMSSpO2MeasurementAnnotation, type AndCondition, type Answer, AnswerCodeGuard, AnswerDateGuard, type Answers, AppIDNamingSystem, type AppleHealthSleepStates, type BLEDeviceConfig, BLE_ASMS_ANNOTATION_ITEM_ECG, BLE_ASMS_ANNOTATION_ITEM_SPO2, BLE_CPMS_ANNOTATION_ITEM_ACTIVITY_TYPE, BLE_CPMS_ANNOTATION_ITEM_DAILY_CALORIES, BLE_CPMS_ANNOTATION_ITEM_DAILY_DISTANCE, BLE_CPMS_ANNOTATION_ITEM_DAILY_ELEVATION_GAIN, BLE_CPMS_ANNOTATION_ITEM_DAILY_FLOORS, BLE_CPMS_ANNOTATION_ITEM_DAILY_STEPS, BLE_PAMS_ANNOTATION_ITEM_ABSOLUTE_ELEVATION, BLE_PAMS_ANNOTATION_ITEM_AVERAGE_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_AVERAGE_SPEED, BLE_PAMS_ANNOTATION_ITEM_BYTE, BLE_PAMS_ANNOTATION_ITEM_CALORIES_TOTAL, BLE_PAMS_ANNOTATION_ITEM_DISTANCE_TOTAL, BLE_PAMS_ANNOTATION_ITEM_FLAGS_16, BLE_PAMS_ANNOTATION_ITEM_FLAGS_24, BLE_PAMS_ANNOTATION_ITEM_FLAGS_32, BLE_PAMS_ANNOTATION_ITEM_FLAGS_8, BLE_PAMS_ANNOTATION_ITEM_FLOORS_TOTAL, BLE_PAMS_ANNOTATION_ITEM_FOUR_BYTES, BLE_PAMS_ANNOTATION_ITEM_HEADER, BLE_PAMS_ANNOTATION_ITEM_HEART_RATE, BLE_PAMS_ANNOTATION_ITEM_MAXIMUM_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_MAXIMUM_SPEED, BLE_PAMS_ANNOTATION_ITEM_MINIMUM_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_MINIMUM_SPEED, BLE_PAMS_ANNOTATION_ITEM_MOTION_CADENCE, BLE_PAMS_ANNOTATION_ITEM_NEGATIVE_ELEVATION_GAIN, BLE_PAMS_ANNOTATION_ITEM_POSITIVE_ELEVATION_GAIN, BLE_PAMS_ANNOTATION_ITEM_RUNNING_STEPS_TOTAL, BLE_PAMS_ANNOTATION_ITEM_SPEED, BLE_PAMS_ANNOTATION_ITEM_STEPS_TOTAL, BLE_PAMS_ANNOTATION_ITEM_THREE_BYTES, BLE_PAMS_ANNOTATION_ITEM_TWO_BYTES, BLE_PAMS_ANNOTATION_ITEM_VO2_MAX, BLE_PSMS_ANNOTATION_ITEM_HEART_RATE, BLE_PSMS_ANNOTATION_ITEM_IBI, BLE_PSMS_ANNOTATION_ITEM_PPG_GREEN, BLE_PSMS_ANNOTATION_ITEM_PPG_IR, BLE_PSMS_ANNOTATION_ITEM_PPG_RED, BLE_PSMS_ANNOTATION_ITEM_SKIN_TEMPERATURE, type BaseDeviceConfig, type BleDeviceMetaLabel, BoolGuard, CPMSHealthServicesActivityDetectionAnnotation, CPMSHealthServicesPassiveDataAnnotation, type CodeQuestionCondition, CommunicationTypeSystem, type ComparisonOperator, type ConditionOperatorType, type ConditionQuestionType, type ConditionSorting, type ConditionType, Conjunction, type Consent, type ConsentCondition, ConsentGuard, ConsentNameSystem, type ConsentPath, type ConsentTimes, ConsentVersionSystem, type ContentBlock, type Converter, type CryptoModule, CustomExtensionDate, CustomExtensionStudyName, CustomQuestionSystem, type DEVICE_ANNOTATION, type DEVICE_ANNOTATION_DATA_FORMAT, type DEVICE_ANNOTATION_DATA_TYPE, DEVICE_ANNOTATION_HEARTRATE, type DEVICE_ANNOTATION_ITEM, DEVICE_ANNOTATION_ITEM_ACCELERATION, DEVICE_ANNOTATION_ITEM_ANGULAR_SPEED, DEVICE_ANNOTATION_ITEM_BEACON_ID, DEVICE_ANNOTATION_ITEM_DISTANCE, DEVICE_ANNOTATION_ITEM_EGVS, DEVICE_ANNOTATION_ITEM_HEARTRATE, DEVICE_ANNOTATION_ITEM_MAGNETIC_FIELD, DEVICE_ANNOTATION_ITEM_REMOTE_DISTANCE, DEVICE_ANNOTATION_ITEM_RSSI, DEVICE_ANNOTATION_ITEM_UNIX_TIMESTAMP, DEVICE_ANNOTATION_TIMESTAMP_NOTE, DEVICE_ANNOTATION_TIMESTAMP_SIZE, DEVICE_ANNOTATION_TIMESTAMP_UNIT, DEVICE_D4L_COMPANION_ANNOTATION_ITEM_DATA_TYPES_FLAG, DEVICE_D4L_COMPANION_ANNOTATION_ITEM_TIMESTAMP, DEVICE_DISPLAY_LABEL_CODING, type DEVICE_KEY, type DEVICE_KEY_API, type DEVICE_KEY_BLE, type DEVICE_KEY_INTERNAL, type DEVICE_KEY_SDK, DEVICE_KEY_TO_NAME, DEVICE_LABEL_CODING, type DEVICE_MOVELLA_PAYLOAD_MODES, DEVICE_OUTPUT_RATE_CODING, DEVICE_SENSOR_DELAY_CODING, type DEVICE_SIGNAL_TYPE, type DateBlurringFunction, type DateCondition, DateGuard, type DateQuestionCondition, DecimalGuard, type DeviceConfig, type DeviceName, Disjunction, type Display, type DisplayContent, type DisplayContentPath, type DisplayPath, type DisplayType, type DonationRecord, DonationSDK, type DonorIdentity, ERROR_CODES, ExistsGuard, type ExtendedProgramDevicesDataType, FITBIT_ANNOTATION_ITEM_BREATHING_RATE, FITBIT_ANNOTATION_ITEM_CALORIES, FITBIT_ANNOTATION_ITEM_HEART_RATE, FITBIT_ANNOTATION_ITEM_HEART_RATE_VARIABILITY, FITBIT_ANNOTATION_ITEM_SKIN_TEMPERATURE, FITBIT_ANNOTATION_ITEM_SLEEP_LEVEL, FITBIT_ANNOTATION_ITEM_SLEEP_LEVEL_DURATION, FITBIT_ANNOTATION_ITEM_SPO2, FITBIT_ANNOTATION_ITEM_STEPS, FITBIT_BREATHING_RATE_ANNOTATION, FITBIT_CALORIES_ANNOTATION, FITBIT_HEART_RATE_ANNOTATION, FITBIT_HEART_RATE_VARIABILITY_ANNOTATION, FITBIT_SIGNAL_TYPE_ANNOTATIONS, FITBIT_SKIN_TEMPERATURE_ANNOTATION, FITBIT_SLEEP_ANNOTATION, FITBIT_SLEEP_LEVEL_MAP, FITBIT_SPO2_ANNOTATION, FITBIT_STEPS_ANNOTATION, type FitbitSleepLevelTypes, type FrequencySubset, type FrequencyType, type Guard, type GuardContext, type GuardParameters, IMUAnnotation, type InternalDeviceConfig, InternalSensorAnnotationTypes, KeyHandler, MaxValueExtension, MeasurementTypeSystem, type Message, type MessagePath, type MessageRecipient, MinLengthExtension, MinValueExtension, type MultiAnswers, type Notification, type NotificationRecipient, ObservationTypeSystem, Offset, type OffsetCondition, type OrCondition, PAMSCardioVascularActivityAnnotation, PAMSGeneralActivityInstantaneousAnnotation, PAMSGeneralActivitySummaryAnnotation, PAMSStepCounterActivitySummaryAnnotation, PSMSHeartRateAnnotation, PSMSPPGGreenAnnotation, PSMSPPGIRAnnotation, PSMSPPGRedAnnotation, PSMSSkinTemperatureAnnotation, type PreviewTimeSeriesItem, type Program, type ProgramAnonymization, type ProgramClientTarget, type ProgramConsentStep, type ProgramContact, type ProgramContent, type ProgramContentPath, type ProgramDevice, type ProgramDeviceType, type ProgramDevicesDataType, type ProgramDevicesLabel, type ProgramDisplayStep, type ProgramDonation, type ProgramEligibilityStep, type ProgramFeatured, type ProgramRoutineStep, type ProgramSensorStep, type ProgramStep, type ProgramStepBase, type ProgramStepType, type ProgramSurveyStep, type ProgramTag, type ProgramTokenStep, type ProgramType, QItemControlDefinition, type QuestionInputType, type QuestionnaireResponse, type QuestionnaireScore, RECORDING_MODEL_CURRENT_VERSION, RECORDING_SIGNAL_MODEL_CURRENT_VERSION, type RecordState, type Recording, type RecordingSignal, type RecordingSignalItem, type RecordingSignalPreview, type RecordingSignalWithId, type RecordingTag, type RecursiveKeyOf, RelativeMaxValueExtension, RelativeMinValueExtension, type ReminderFrequencyType, type ReponseValue, type ResearchSubject, type ResearchSubjectProgress, type ResearchSubjectProgressState, type ResponseCondition, ResponseGuard, type ResponseMinimal, type ResponseTimes, type RestorationSize, type Routine, type RoutineCondition, type RoutineContent, type RoutineContentPath, type RoutineContentStep, RoutineGuard, RoutineIsPassiveExtension, type RoutineTimes, type SDKDeviceConfig, type SDKInterface, SIGNAL_DURATION_CODING, type ScoreThreshold, type SeenDisplay, type SeenMessage, SensorIdentifierSystem, SensorSettingsSystem, SensorTypeSystem, SignalIDSystem, type SkippedStep, SliderMaxLabelExtension, SliderMinLabelExtension, SliderStepSizeExtension, type StepCondition, type StepConditionBase, type StringTemplater, StudyNameSystem, type Survey, type SurveyCondition, type SurveyContent, type SurveyContentPath, SurveyGuard, type SurveyScoring, type Tag, type TagEffectiveType, type TaskFrequency, type TaskReminder, type Threshold, TimeFuncs, type TimeWindow, TokenNamingSystem, type TranslatedString, ULID_REGEX, ULIDtoUUID, UUID_REGEX, UUIDtoULID, WORDLIST_LANGUAGES, WearOS3AnnotationMap, WebConverter, type WordListLanguage, YearGuard, binaryStringToUint8Array, calculateQuestionnaireScoreRange, calculateScoreRangeForItem, capitalizeFirstLetter, dayFormat, extractWordsFromRecoveryPhrase, generateFHIRConsent, generateFHIRQuestionnaireScore, generateFHIRRecordingBundle, generateFHIRResearchSubject, generateFHIRResponse, generateFHIRSeenDisplay, generateFHIRSeenMessage, generateFHIRTag, generateQuestionGuard, generateStepGuard, generateUrn, get, getLanguageOfPassPhrase, getMovellaAnnotation, getText, getTimeFuncs, indexArrayBy, isBeforeStartDate, isNotAfterEndDate, isNotBeforeStartDate, isScoreEligible, isYearString, newStepDateGuard, overwriteTime, stringToDate, stringToYear, timezonelessDate, toDeviceConfig, toQuestionnaireResponseItem, uint8ArrayToBinaryString, utf8ToUint8Array, wordlists };
|