Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Policy: add "rates" (fees + subsidies) #484

Merged
merged 24 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a17acb9
Merge pull request #4 from CityOfLosAngeles/master
Jun 6, 2019
9ecff7c
Merge remote-tracking branch 'upstream/dev' into dev
quicklywilliam Apr 17, 2020
417db32
Add rate rule, rate rule type, rate rule units
quicklywilliam Apr 17, 2020
1ee42cd
typo fixes
quicklywilliam Apr 17, 2020
86288b8
underscores in rule units
quicklywilliam Apr 17, 2020
9eddd9b
add per_hour rule units
quicklywilliam Apr 17, 2020
0ddfbd7
small copy change
quicklywilliam Apr 18, 2020
d1734b2
add rate_recurrence
quicklywilliam Apr 19, 2020
825addd
clarify language in rte_recurrences
quicklywilliam Apr 19, 2020
29798aa
copy tweaks, moved rate recurrences table
quicklywilliam Apr 19, 2020
a01e402
clarify copy
quicklywilliam Apr 20, 2020
da3383f
added language specifying how time_units are measured against local time
quicklywilliam Apr 20, 2020
d389d95
copy tweak
quicklywilliam Apr 20, 2020
640ac45
styling tweak
quicklywilliam Apr 20, 2020
1c605c3
Added examples
quicklywilliam Apr 22, 2020
35bac2b
fixed example toc
quicklywilliam Apr 22, 2020
8b07a3b
toc backlinks
quicklywilliam Apr 22, 2020
824e388
copy tweaks
quicklywilliam Apr 22, 2020
c34e4de
remove accidental whitespace change
quicklywilliam Apr 22, 2020
b5cf427
fix whitespace issue
quicklywilliam Apr 22, 2020
8c52d4d
Merge remote-tracking branch 'upstream/dev' into dev
quicklywilliam May 21, 2020
3f8cbf3
add beta and city <> provider agreement language to rate rule type de…
brianellin Jun 25, 2020
be840a0
Merge remote-tracking branch 'upstream/dev' into dev
quicklywilliam Jun 29, 2020
4e71e37
merged dev to 1.0
quicklywilliam Jun 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions policy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The goal of this specification is to enable Agencies to create, revise, and publ
- Cap allowances (e.g. "Up to 500 additional scooters are permitted near train stations")
- Speed-limit restrictions (e.g. "15 mph outside of downtown, 10 mph downtown")
- Idle-time and disabled-time limitations (e.g. "5 days idle while rentable, 12 hours idle while unrentable, per device")
- Trip fees and subsidies (e.g. "A 25 cent fee applied when a trip ends downtown")

The machine-readable format allows Providers to obtain policies and compute compliance where it can be determined entirely by data obtained internally.

Expand Down Expand Up @@ -183,6 +184,7 @@ An individual `Policy` object is defined by the following fields:
| `policy_id` | UUID | Required | Unique ID of policy |
| `provider_ids` | UUID[] | Optional | Providers for whom this policy is applicable; empty arrays and `null`/absent implies all Providers |
| `description` | String | Required | Description of policy |
| `currency` | String | Optional | An ISO 4217 Alphabetic Currency Code representing the [currency](../provider#costs--currencies) of all Rules of [type](#rule-types) `rate`.|
| `start_date` | [timestamp][ts] | Required | Beginning date/time of policy enforcement |
| `end_date` | [timestamp][ts] | Optional | End date/time of policy enforcement |
| `published_date` | [timestamp][ts] | Required | Timestamp that the policy was published |
Expand All @@ -205,6 +207,8 @@ An individual `Rule` object is defined by the following fields:
| `propulsion_types` | `propulsion_type[]` | Optional | Applicable vehicle [propulsion types][propulsion-types], default "all". |
| `minimum` | integer | Optional | Minimum value, if applicable (default 0) |
| `maximum` | integer | Optional | Maximum value, if applicable (default unlimited) |
| `rate_amount` | integer | Optional | The amount of a rate applied when this rule applies, if applicable (default zero). A positive integer rate amount represents a fee, while a negative integer represents a subsidy. Rate amounts are given in the `currency` defined in the [Policy](#policy). |
| `rate_recurrence` | enum | Optional | Recurrence of the rate (see [Rate Recurrences](#rate-recurrences)) |
| `start_time` | ISO 8601 time `hh:mm:ss` | Optional | Beginning time-of-day when the rule is in effect (default 00:00:00). |
| `end_time` | ISO 8601 time `hh:mm:ss` | Optional | Ending time-of-day when the rule is in effect (default 23:59:59). |
| `days` | day[] | Optional | Days `["sun", "mon", "tue", "wed", "thu", "fri", "sat"]` when the rule is in effect (default all) |
Expand All @@ -218,6 +222,7 @@ An individual `Rule` object is defined by the following fields:
| `count` | Fleet counts based on regions. Rule `max`/`min` refers to number of devices. |
| `time` | Individual limitations on time spent in one or more vehicle-states. Rule `max`/`min` refers to increments of time in [Rule Units](#rule-units). |
| `speed` | Global or local speed limits. Rule `max`/`min` refers to speed in [Rule Units](#rule-units). |
| `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 Recurrence](#rate_recurrence). Agencies and Providers must agree on terms of use prior to utilizing the `rate` rule type. |
Copy link
Contributor

@jfh01 jfh01 Jun 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `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 Recurrence](#rate_recurrence). Agencies and Providers must agree on terms of use prior to utilizing the `rate` rule type. |
| `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 Recurrence](#rate_recurrence). As this is a beta feature, agencies are strongly advised to communicate with providers about how they intended to use the `rate` rule prior to implementation. |

Copy link
Contributor

@bhandzo bhandzo Jun 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the earlier language, but understand it may give providers more say than cities are willing to give. If "communicate" was changed to "consult" that makes it feel more like the needs of providers should be considered when implementing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Consult" sounds fine to me. We'll highlight this language for the Board too when they do their review of the release.

| `user` | Information for users, e.g. about helmet laws. Generally can't be enforced via events and telemetry. |

### Rule Units
Expand All @@ -227,9 +232,19 @@ An individual `Rule` object is defined by the following fields:
| `seconds` | Seconds |
| `minutes` | Minutes |
| `hours` | Hours |
| `days` | Days |
| `mph` | Miles per hour |
| `kph` | Kilometers per hour |

### Rate Recurrences
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.

| Name | Description |
| --------- | ------------------- |
| `once` | Rate is applied once to vehicles entering a matching status from a non-matching status. |
| `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`. |
| `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`. |

### Messages

Some Policies as established by the Agency may benefit from rider communication. This optional field contains a map of languages to messages, to be shown to the user.
Expand Down
97 changes: 97 additions & 0 deletions policy/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ This file presents a series of [Policy object](./README.md#policy) examples for
- [Provider Cap](#provider-cap)
- [Idle Time](#idle-time)
- [Speed Limits](#speed-limits)
- [Per Trip Fees](#per-trip-fees)
- [Vehicle Right of Way Fees](#vehicle-right-of-way-fees)
- [Metered Parking Fees](#metered-parking-fees)

## Prohibited Zone

Expand Down Expand Up @@ -219,5 +222,99 @@ This Policy sets a 15 MPH speed limit in greater LA, and a 10 MPH speed limit in
}]
}
```
[Top](#table-of-contents)

## Per Trip Fees
This policy sets a 25 cent per-trip fee that is applied for trips that start in the municipal boundary.


```json
{
"policy_id": "d2567b3c-3071-48a6-bbeb-3424721dbd12",
"published_date": 1586736000000,
"name": "Trip Fees",
"start_date": 1586822400000,
"end_date": 1587427200000,
"prev_policies": null,
"rules": [{
"name": "City Wide Trip Fee",
"rule_type": "rate",
"rate_amount": 25,
"rate_recurrence": "once",
"geography": MUNICIPAL_BOUNDARY_GEOGRAPHY,
"statuses": {
"trip": ["trip_start"]
}
}]
}
```
[Top](#table-of-contents)

## Vehicle Right of Way Fees
This policy sets a Right-of-Way fee that is charged once a day for vehicles deployed in a given area. It charges a 25 cents per day for vehicles deployed downtown, and 5 cents per day for vehicles deployed in a historically underserved neighborhood. In the case where a vehicle is deployed twice in both areas in the same day, the higher fee would apply (because it appears first in the rules).

```json
{
"policy_id": "4137a47c-836a-11ea-bc55-0242ac130003",
"published_date": 1586736000000,
"name": "Right of Way Fees",
"start_date": 1586822400000,
"end_date": 1587427200000,
"prev_policies": null,
"rules": [
{
"name": "Downtown Right of Way Fee",
"rule_type": "rate",
"rate_amount": 25,
"rate_recurrence": "each_time_unit",
"rule_units": "days",
"geography": DOWNTOWN_GEOGRAPHY,
"statuses": {
"available": ["service_start"]
}
},
{
"name": "Decreased Right of Way Fee",
"rule_type": "rate",
"rate_amount": 5,
"rate_recurrence": "each_time_unit",
"rule_units": "days",
"geography": HISTORICALLY_UNDERSERVED_NEIGHBORHOOD_GEOGRAPHY,
"statuses": {
"available": ["service_start"]
}
}
]
}
```
[Top](#table-of-contents)

## Metered Parking Fees
This policy sets a 10 cent per hour metered parking charge that is applied while a vehicle is parked in a congested area during rush hour.

```json
{
"policy_id": "6a3dd008-836a-11ea-bc55-0242ac130003",
"published_date": 1586736000000,
"name": "Parking Fees",
"start_date": 1586822400000,
"end_date": 1587427200000,
"prev_policies": null,
"rules": [{
"name": "Downtown Peak-Hour Parking Fee",
"rule_type": "rate",
"rate_amount": 10,
"rate_recurrence": "per_complete_time_unit",
"rule_units": "hours",
"geography": INNER_CITY_GEOGRAPHY,
"days": ["mon","tue","wed","thu","fri"],
"start_time": "7:00:00",
"end_time": "8:30:00",
"statuses": {
"available": [],
"unavailable": [],
}
}]
}
```
[Top](#table-of-contents)