Skip to content

Commit f6142d4

Browse files
committed
rate_recurrences: rename 'once' to 'once_on_match', add 'once_on_unmatch'. Add example policies using rate properties with time rules.
1 parent 6e8ab41 commit f6142d4

3 files changed

Lines changed: 121 additions & 6 deletions

File tree

policy/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ An individual `Rule` object is defined by the following fields:
270270
| Name | Description |
271271
| ------- | ------------------------------------------------------------------------------------------------------------- |
272272
| `count` | Fleet counts based on regions. Rule `minimum`/`maximum` refers to number of devices in [Rule Units](#rule-units). |
273-
| `time` | Individual limitations on time spent in one or more vehicle-states. Rule `minimum`/`maximum` refers to increments of time in [Rule Units](#rule-units). |
273+
| `time` | Individual limitations or fees based upon time spent in one or more vehicle-states. Rule `minimum`/`maximum` refers to increments of time in [Rule Units](#rule-units). |
274274
| `speed` | Global or local speed limits. Rule `minimum`/`maximum` refers to speed in [Rule Units](#rule-units). |
275275
| `rate` | **[Beta feature](/general-information.md#beta-features):** *Yes (as of 1.0.0)*. Fees or subsidies based on regions and time spent in one or more vehicle-states. Rule `rate_amount` refers to the rate charged according to the [Rate Recurrences](#rate_recurrences) and the [currency requirements](/general-information.md#costs-and-currencies) in [Rule Units](#rule-units). *Prior to implementation agencies should consult with providers to discuss how the `rate` rule will be used. Most agencies do this as a matter of course, but it is particularly important to communicate in advance how frequently and in what ways rates might change over time.* |
276276
| `user` | Information for users, e.g. about helmet laws. Generally can't be enforced via events and telemetry. |
@@ -312,11 +312,12 @@ An individual `Rule` object is defined by the following fields:
312312

313313
Rate recurrences specify when a rate is applied – either once, or periodically according to a `time_unit` specified using [Rule Units](#rule-units). A `time_unit` refers to a unit of time as measured in local time for the juristiction – a day begins at midnight local time, an hour begins at the top of the hour, etc.
314314

315-
| Name | Description |
316-
| --------- | ------------------- |
317-
| `once` | Rate is applied once to vehicles entering a matching status from a non-matching status. |
318-
| `each_time_unit` | During each `time_unit`, rate is applied once to vehicles entering or remaining in a matching status. Requires a `time_unit` to be specified using `rule_units`. |
319-
| `per_complete_time_unit` | Rate is applied once per complete `time_unit` that vehicles remain in a matching status. Requires a `time_unit` to be specified using `rule_units`. |
315+
| Name | Description |
316+
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
317+
| `once_on_match` | Rate is applied once when a vehicle transitions **into** a matching status from a non-matching status. |
318+
| `once_on_unmatch` | Rate is applied once a vehicle transitions **out of** a matching status to a non-matching status. |
319+
| `each_time_unit` | During each `time_unit`, rate is applied once to vehicles entering or remaining in a matching status. Requires a `time_unit` to be specified using `rule_units`. |
320+
| `per_complete_time_unit` | Rate is applied once per complete `time_unit` that vehicles remain in a matching status. Requires a `time_unit` to be specified using `rule_units`. |
320321

321322
[Top][toc]
322323

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"updated": 0,
3+
"version": "1.2.0",
4+
"data": {
5+
"policy": [
6+
{
7+
"name": "Tiered Dwell Time Example",
8+
"description": "First hour $2, second hour $4, every hour onwards $10",
9+
"policy_id": "2800cd0a-7827-4110-9713-b9e5bf29e9a1",
10+
"start_date": 1558389669540,
11+
"publish_date": 1558389669540,
12+
"end_date": null,
13+
"prev_policies": null,
14+
"provider_ids": [],
15+
"currency": "USD",
16+
"rules": [
17+
{
18+
"name": "> 2 hours",
19+
"rule_id": "9cd1768c-ab9e-484c-93f8-72a7078aa7b9",
20+
"rule_type": "time",
21+
"rule_units": "hours",
22+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
23+
"statuses": { "available": [], "non_operational": [] },
24+
"vehicle_types": ["bicycle", "scooter"],
25+
"maximum": 2,
26+
"rate_amount": 1000,
27+
"rate_recurrence": "each_time_unit"
28+
},
29+
{
30+
"name": "1-2 Hours",
31+
"rule_id": "edd6a195-bb30-4eb5-a2cc-44e5a18798a2",
32+
"rule_type": "time",
33+
"rule_units": "hours",
34+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
35+
"statuses": { "available": [], "non_operational": [] },
36+
"vehicle_types": ["bicycle", "scooter"],
37+
"maximum": 1,
38+
"rate_amount": 400,
39+
"rate_recurrence": "each_time_unit"
40+
},
41+
{
42+
"name": "0-1 Hour",
43+
"rule_id": "6b6fe61b-dbe5-4367-8e35-84fb14d23c54",
44+
"rule_type": "time",
45+
"rule_units": "hours",
46+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
47+
"statuses": { "available": [], "non_operational": [] },
48+
"vehicle_types": ["bicycle", "scooter"],
49+
"maximum": 0,
50+
"rate_amount": 200,
51+
"rate_recurrence": "each_time_unit"
52+
}
53+
]
54+
}
55+
]
56+
}
57+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"updated": 0,
3+
"version": "1.2.0",
4+
"data": {
5+
"policy": [
6+
{
7+
"name": "Tiered Dwell Time Example",
8+
"description": "If parked for <1hr $2 upon exit, if parked for 1-2 hours $4 upon exit, if parked for longer than 2 hours $10 upon exit",
9+
"policy_id": "2800cd0a-7827-4110-9713-b9e5bf29e9a1",
10+
"start_date": 1558389669540,
11+
"publish_date": 1558389669540,
12+
"end_date": null,
13+
"prev_policies": null,
14+
"provider_ids": [],
15+
"currency": "USD",
16+
"rules": [
17+
{
18+
"name": "> 2 hours",
19+
"rule_id": "9cd1768c-ab9e-484c-93f8-72a7078aa7b9",
20+
"rule_type": "time",
21+
"rule_units": "hours",
22+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
23+
"statuses": { "available": [], "non_operational": [] },
24+
"vehicle_types": ["bicycle", "scooter"],
25+
"maximum": 2,
26+
"rate_amount": 1000,
27+
"rate_recurrence": "once_on_unmatch"
28+
},
29+
{
30+
"name": "1-2 Hours",
31+
"rule_id": "edd6a195-bb30-4eb5-a2cc-44e5a18798a2",
32+
"rule_type": "time",
33+
"rule_units": "hours",
34+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
35+
"statuses": { "available": [], "non_operational": [] },
36+
"vehicle_types": ["bicycle", "scooter"],
37+
"maximum": 1,
38+
"rate_amount": 400,
39+
"rate_recurrence": "once_on_unmatch"
40+
},
41+
{
42+
"name": "0-1 Hour",
43+
"rule_id": "6b6fe61b-dbe5-4367-8e35-84fb14d23c54",
44+
"rule_type": "time",
45+
"rule_units": "hours",
46+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
47+
"statuses": { "available": [], "non_operational": [] },
48+
"vehicle_types": ["bicycle", "scooter"],
49+
"maximum": 0,
50+
"rate_amount": 200,
51+
"rate_recurrence": "once_on_unmatch"
52+
}
53+
]
54+
}
55+
]
56+
}
57+
}

0 commit comments

Comments
 (0)