-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from yetanalytics/time-bounds-fixes
Time bounds fixes + updates
- Loading branch information
Showing
13 changed files
with
268 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,33 +82,29 @@ and `weight` values (as described under `verbs`). | |
- `patterns`: An array of objects with Pattern `id` and the following additional optional values: | ||
- `weights`: An array of child Pattern/Template `id` and `weight` values. Each weight affects how likely each of the Pattern's child patterns are chosen (for `alternates`) or how likely the child Pattern will be selected at all (for `optional`, for these `null` is also a valid option). This has no effect on `sequence`, `zeroOrMore`, or `oneOrMore` Patterns. | ||
- `repeat-max`: A positive integer representing the maximum number of times (exclusive) the child pattern can be generated. Only affects `zeroOrMore` and `oneOrMore` patterns. | ||
- `bounds`: An array of objects containing key-value pairs where each value is an array of singular values (e.g. `"January"`) or pair arrays of start and end values (e.g. `["January", "October"]`). For example `{"years": [2023], "months": [[1 5]]}` describes an inclusive bound from January to May 2023. If not present, indicates an infinite bound, such that any timestamp is valid. The following are valid bound values: | ||
- `bounds`: An array of objects containing key-value pairs where each value is an array of singular values (e.g. `"January"`) or arrays of start, end, and optional step values (e.g. `["January", "October"]`). For example `{"years": [2023], "months": [[1, 5]]}` describes an inclusive bound from January to May 2023; making the `months` bound `[[1, 5, 2]]` would have restricted it to only January, March, and May 2023. If not present, `bounds` indicates an infinite bound, such that any timestamp is valid. The following are valid bound values: | ||
- `years`: Any positive integer | ||
- `months`: `1` to `12`, or their name equivalents, i.e. `"January"` to `"December"` | ||
- `daysOfMonth:` `1` to `31` (though `29` or `30` are skipped at runtime for months that do not include these days) | ||
- `daysOfWeek`: `0` to `6`, or their name equivalents, i.e. `"Sunday"` to `"Saturday"` | ||
- `hours`: `0` to `23` | ||
- `minutes`: `0` to `59` | ||
- `seconds`: `0` to `59` | ||
- `periods`: an array of objects that specify the amount of time between generated Statements. Only the first valid period in the array will be applied to generate the next Statement (see `bounds` property). Each period object has the following optional properties: | ||
- `boundRetries`: An array of Pattern IDs to retry if the timestamp violates `bounds`. The top-most Pattern in `boundRetries` will be tried, e.g. if Pattern A is a parent of Pattern B and both are listed in `boundRetries`, it will be Pattern A that is retried. If `boundRetries` is empty or not present, or if none of the ancestor Patterns are included, then Statement generation will continue at its current point. | ||
- `periods`: An array of objects that specify the amount of time between generated Statements. Only the first valid period in the array will be applied to generate the next Statement (see `bounds` property). Each period object has the following optional properties: | ||
- `min`: a minimum amount of time between Statements; default is `0` | ||
- `mean` the average amount of time between Statements (added on top of `min`); default is `1` | ||
- `fixed`: a fixed amount of time between Statements; overrides `min` and `mean` | ||
- `unit`: the time unit for all temporal values. Valid values are `millis`, `seconds`, `minutes`, `hours`, `days`, and `weeks`; the default is `minutes` | ||
- `bounds`: an array of the temporal bounds the period can apply in. During generation, the current Statement timestamp is checked against each period's `bounds`, and the first period whose bound satisfies the timestamp will be used to generate the next Statement timestamp. A nonexisting `bounds` value indicates an infinite bound, i.e. any timestamp is always valid. The syntax is the same as the top-level `bounds` array. At least one period must not have a `bounds` value, so it can act as the default period. | ||
- `retry`: One of four options that determine Statement generation retry behavior in the event where a time bound is exceeded: | ||
- `null` (or not present): Terminate the generation on the current Pattern immediately, and move again with the next Pattern's generation. | ||
- `"pattern"`: Retry generation of this Pattern if this Pattern's bound is exceeded. | ||
- `"child"`: Retry generation of whichever child Pattern or Statement Template in which this Pattern's bound is exceeded. | ||
- `"template"`: Retry generation of the Statement Template that exceeded this Pattern's bound. | ||
- `templates`: An array of objects with Statement Template `id` and optional `bounds`, `period`, and `retry` values, as explained above in `patterns`. Note that `weights` and `repeat-max` do not apply here. | ||
- `templates`: An array of objects with Statement Template `id` and optional `bounds`, `boundRetries`, and `period` properties, as explained above in `patterns`. Note that `weights` and `repeat-max` do not apply here. | ||
- `objectOverrides`: An array of objects containing (xAPI) `object` and `weight`. If present, these objects will overwrite any that would have been set by the Profile. | ||
|
||
An example of a model array with valid `personae`, `verbs`, and `templates` is shown below: | ||
|
||
```json | ||
[ | ||
{ | ||
[ | ||
{ | ||
"personae": [ | ||
{ | ||
"id": "mbox::mailto:[email protected]", | ||
|
@@ -130,15 +126,18 @@ An example of a model array with valid `personae`, `verbs`, and `templates` is s | |
"months": [["January", "May"]] | ||
} | ||
], | ||
"boundRetries": [ | ||
"https://w3id.org/xapi/cmi5#toplevel" | ||
], | ||
"period": { | ||
"min": 1, | ||
"mean": 2.0, | ||
"unit": "second" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
``` | ||
|
||
#### Simulation Parameters | ||
|
@@ -151,9 +150,11 @@ The simulation parameters input covers the details of the simulation not covered | |
"end": "2019-11-19T11:38:39.219768Z", | ||
"max": 200, | ||
"timezone": "America/New_York", | ||
"seed": 42 | ||
"seed": 42, | ||
"max-retries": 10 | ||
} | ||
``` | ||
Note the `max-retries` parameter; this is to limit the amount of times a particular Pattern is repeated when a `bounds` is violated. | ||
|
||
#### (Alternatively) Simulation Specification | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.