Skip to content

Commit 3e47dbd

Browse files
authored
Merge pull request #819 from populus-ai/update-policy-examples-rates
Rates updates to Policy examples
2 parents 43a9986 + e8feee0 commit 3e47dbd

1 file changed

Lines changed: 341 additions & 0 deletions

File tree

policy/examples/README.md

Lines changed: 341 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ This file presents a series of example [Policy documents](../README.md#policy) f
1212
- [Speed Limit](#speed-limit)
1313
- [Distribution Policies](#distribution-policies)
1414
- [Provider Caps or Minimums](#provider-caps-or-minimums)
15+
- [Per Trip Fees](#per-trip-fees)
16+
- [Vehicle Right of Way Fees](#vehicle-right-of-way-fees)
17+
- [Metered Parking Fees](#metered-parking-fees)
18+
- [Tiered Parking Fees Per Hour](#tiered-parking-fees-per-hour)
19+
- [Tiered Parking Fees Total](#tiered-parking-fees-total)
1520

1621
## Operating Area
1722

@@ -540,3 +545,339 @@ The maximum or minimum amount of vehicles deployed by a provider are controlled.
540545
```
541546

542547
[Top](#table-of-contents)
548+
549+
## Per Trip Fees
550+
551+
This policy sets a 25 cent per-trip fee that is applied for trips that start in the municipal boundary.
552+
553+
```json
554+
{
555+
"policy_id": "d2567b3c-3071-48a6-bbeb-3424721dbd12",
556+
"published_date": 1586736000000,
557+
"name": "Trip Fees",
558+
"description": "This policy sets a 25 cent per-trip fee that is applied for trips that start in the municipal boundary.",
559+
"start_date": 1586822400000,
560+
"end_date": 1587427200000,
561+
"prev_policies": null,
562+
"rules": [
563+
{
564+
"name": "City Wide Trip Fee",
565+
"rule_id": "4137a47c-836a-11ea-bc55-0242ac130003",
566+
"rule_type": "count",
567+
"rule_units": "devices",
568+
"rate_amount": 25,
569+
"rate_recurrence": "once_on_match",
570+
"rate_applies_when": "in_bounds",
571+
"geographies": [
572+
"b4bcc213-4888-48ce-a33d-4dd6c3384bda"
573+
],
574+
"states": {
575+
"on_trip": [
576+
"trip_start"
577+
]
578+
}
579+
}
580+
]
581+
}
582+
```
583+
584+
[Top](#table-of-contents)
585+
586+
## Vehicle Right of Way Fees
587+
588+
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).
589+
590+
```json
591+
{
592+
"policy_id": "4137a47c-836a-11ea-bc55-0242ac130003",
593+
"published_date": 1586736000000,
594+
"name": "Right of Way Fees",
595+
"description": "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.",
596+
"start_date": 1586822400000,
597+
"end_date": 1587427200000,
598+
"prev_policies": null,
599+
"rules": [
600+
{
601+
"rule_id": "96033eb2-eff7-4ed3-bb93-0101aff3bb6a",
602+
"name": "Downtown Right of Way Fee",
603+
"rule_type": "time",
604+
"rule_units": "days",
605+
"rate_amount": 25,
606+
"rate_recurrence": "each_time_unit",
607+
"rate_applies_when": "in_bounds",
608+
"geographies": [
609+
"1f943d59-ccc9-4d91-b6e2-0c5e771cbc49"
610+
],
611+
"states": {
612+
"available": [
613+
"on_hours"
614+
]
615+
}
616+
},
617+
{
618+
"rule_id": "62778174-97f6-4a2b-a949-070709b4190a",
619+
"name": "Decreased Right of Way Fee",
620+
"rule_type": "time",
621+
"rule_units": "days",
622+
"rate_amount": 5,
623+
"rate_recurrence": "each_time_unit",
624+
"rate_applies_when": "in_bounds",
625+
"geographies": [
626+
"e3ed0a0e-61d3-4887-8b6a-4af4f3769c14"
627+
],
628+
"states": {
629+
"available": [
630+
"on_hours"
631+
]
632+
}
633+
}
634+
]
635+
}
636+
```
637+
638+
[Top](#table-of-contents)
639+
640+
## Metered Parking Fees
641+
642+
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.
643+
644+
```json
645+
{
646+
"policy_id": "6a3dd008-836a-11ea-bc55-0242ac130003",
647+
"published_date": 1586736000000,
648+
"name": "Parking Fees",
649+
"description": "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.",
650+
"start_date": 1586822400000,
651+
"end_date": 1587427200000,
652+
"prev_policies": null,
653+
"rules": [
654+
{
655+
"rule_id": "0da40491-73eb-418f-9b3c-cf5f150775e8",
656+
"name": "Downtown Peak-Hour Parking Fee",
657+
"rule_type": "time",
658+
"rule_units": "hours",
659+
"rate_amount": 10,
660+
"rate_recurrence": "per_complete_time_unit",
661+
"rate_applies_when": "in_bounds",
662+
"geographies": [
663+
"5473e836-b38a-4940-8b5e-0d506ca4e4a8"
664+
],
665+
"days": [
666+
"mon",
667+
"tue",
668+
"wed",
669+
"thu",
670+
"fri"
671+
],
672+
"start_time": "07:00:00",
673+
"end_time": "08:30:00",
674+
"states": {
675+
"available": [],
676+
"non_operational": []
677+
}
678+
}
679+
]
680+
}
681+
```
682+
683+
[Top](#table-of-contents)
684+
685+
## Tiered Parking Fees Per Hour
686+
This policy states parking fees as such:
687+
- Parking for the first hour costs $2
688+
- Parking for the second hour costs $4
689+
- Parking every hour onwards costs $10
690+
691+
For example, say a vehicle is parked for 6.5 hours. It will be charged `$2 (0-1hr) + $4 (1-2hr) + $10 (2-3hr) + $10 (3-4hr) + $10 (4-5hr) + $10 (5-6hr) + $10 (6-6.5hr) = $56`
692+
693+
This policy may be specified different ways using the `rate_applies_when` field.
694+
Both examples are shown here.
695+
696+
### With default `rate_applies_when = "out_of_bounds"`
697+
698+
By default the `rate_applies_when` field has the value `out_of_bounds`,
699+
meaning the rate should take effect when an event is outside the bounds
700+
of a rule's `minimum` and `maximum` values.
701+
702+
```json
703+
{
704+
"name": "Tiered Dwell Time Example",
705+
"description": "First hour $2, second hour $4, every hour onwards $10",
706+
"policy_id": "2800cd0a-7827-4110-9713-b9e5bf29e9a1",
707+
"start_date": 1558389669540,
708+
"publish_date": 1558389669540,
709+
"end_date": null,
710+
"prev_policies": null,
711+
"provider_ids": [],
712+
"currency": "USD",
713+
"rules": [
714+
{
715+
"name": "> 2 hours",
716+
"rule_id": "9cd1768c-ab9e-484c-93f8-72a7078aa7b9",
717+
"rule_type": "time",
718+
"rule_units": "hours",
719+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
720+
"statuses": { "available": [], "non_operational": [] },
721+
"vehicle_types": ["bicycle", "scooter"],
722+
"maximum": 2,
723+
"rate_amount": 1000,
724+
"rate_recurrence": "each_time_unit"
725+
},
726+
{
727+
"name": "1-2 Hours",
728+
"rule_id": "edd6a195-bb30-4eb5-a2cc-44e5a18798a2",
729+
"rule_type": "time",
730+
"rule_units": "hours",
731+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
732+
"statuses": { "available": [], "non_operational": [] },
733+
"vehicle_types": ["bicycle", "scooter"],
734+
"maximum": 1,
735+
"rate_amount": 400,
736+
"rate_recurrence": "each_time_unit"
737+
},
738+
{
739+
"name": "0-1 Hour",
740+
"rule_id": "6b6fe61b-dbe5-4367-8e35-84fb14d23c54",
741+
"rule_type": "time",
742+
"rule_units": "hours",
743+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
744+
"statuses": { "available": [], "non_operational": [] },
745+
"vehicle_types": ["bicycle", "scooter"],
746+
"maximum": 0,
747+
"rate_amount": 200,
748+
"rate_recurrence": "each_time_unit"
749+
}
750+
]
751+
}
752+
```
753+
754+
### With `rate_applies_when = "in_bounds"`
755+
756+
When the `rate_applies_when` field has the value `in_bounds`,
757+
the rate takes effect when an event is within a rule's `minimum` and
758+
`maximum` values. Note that this also uses the `inclusive_minimum` and
759+
`inclusive_maximum` fields to create non-overlapping ranges for the rules.
760+
761+
```json
762+
{
763+
"name": "Tiered Dwell Time Example",
764+
"description": "First hour $2, second hour $4, every hour onwards $10",
765+
"policy_id": "2800cd0a-7827-4110-9713-b9e5bf29e9a1",
766+
"start_date": 1558389669540,
767+
"publish_date": 1558389669540,
768+
"end_date": null,
769+
"prev_policies": null,
770+
"provider_ids": [],
771+
"currency": "USD",
772+
"rules": [
773+
{
774+
"name": "0-1 Hour",
775+
"rule_id": "6b6fe61b-dbe5-4367-8e35-84fb14d23c54",
776+
"rule_type": "time",
777+
"rule_units": "hours",
778+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
779+
"statuses": { "available": [], "non_operational": [] },
780+
"vehicle_types": ["bicycle", "scooter"],
781+
"maximum": 1,
782+
"inclusive_maximum": false,
783+
"rate_applies_when": "in_bounds",
784+
"rate_amount": 200,
785+
"rate_recurrence": "each_time_unit"
786+
},
787+
{
788+
"name": "1-2 Hours",
789+
"rule_id": "edd6a195-bb30-4eb5-a2cc-44e5a18798a2",
790+
"rule_type": "time",
791+
"rule_units": "hours",
792+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
793+
"statuses": { "available": [], "non_operational": [] },
794+
"vehicle_types": ["bicycle", "scooter"],
795+
"minimum": 1,
796+
"maximum": 2,
797+
"inclusive_minimum": true,
798+
"inclusive_maximum": false,
799+
"rate_applies_when": "in_bounds",
800+
"rate_amount": 400,
801+
"rate_recurrence": "each_time_unit"
802+
},
803+
{
804+
"name": "> 2 hours",
805+
"rule_id": "9cd1768c-ab9e-484c-93f8-72a7078aa7b9",
806+
"rule_type": "time",
807+
"rule_units": "hours",
808+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
809+
"statuses": { "available": [], "non_operational": [] },
810+
"vehicle_types": ["bicycle", "scooter"],
811+
"minimum": 2,
812+
"inclusive_minimum": true,
813+
"rate_applies_when": "in_bounds",
814+
"rate_amount": 1000,
815+
"rate_recurrence": "each_time_unit"
816+
}
817+
]
818+
}
819+
```
820+
821+
[Top](#table-of-contents)
822+
823+
## Tiered Parking Fees Total
824+
This policy states parking fees as such:
825+
- If parked for less than an hour, $2 on exit
826+
- If parked for less than 2 hours, $4 on exit
827+
- If parked for any duration longer than 2 hours, $10 on exit
828+
829+
For example, if a vehicle is parked for 6.5 hours, it will be charged $10 on exit.
830+
831+
```json
832+
{
833+
"name": "Tiered Dwell Time Example",
834+
"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",
835+
"policy_id": "2800cd0a-7827-4110-9713-b9e5bf29e9a1",
836+
"start_date": 1558389669540,
837+
"publish_date": 1558389669540,
838+
"end_date": null,
839+
"prev_policies": null,
840+
"provider_ids": [],
841+
"currency": "USD",
842+
"rules": [
843+
{
844+
"name": "> 2 hours",
845+
"rule_id": "9cd1768c-ab9e-484c-93f8-72a7078aa7b9",
846+
"rule_type": "time",
847+
"rule_units": "hours",
848+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
849+
"statuses": { "available": [], "non_operational": [] },
850+
"vehicle_types": ["bicycle", "scooter"],
851+
"maximum": 2,
852+
"rate_amount": 1000,
853+
"rate_recurrence": "once_on_unmatch"
854+
},
855+
{
856+
"name": "1-2 Hours",
857+
"rule_id": "edd6a195-bb30-4eb5-a2cc-44e5a18798a2",
858+
"rule_type": "time",
859+
"rule_units": "hours",
860+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
861+
"statuses": { "available": [], "non_operational": [] },
862+
"vehicle_types": ["bicycle", "scooter"],
863+
"maximum": 1,
864+
"rate_amount": 400,
865+
"rate_recurrence": "once_on_unmatch"
866+
},
867+
{
868+
"name": "0-1 Hour",
869+
"rule_id": "6b6fe61b-dbe5-4367-8e35-84fb14d23c54",
870+
"rule_type": "time",
871+
"rule_units": "hours",
872+
"geographies": ["0c77c813-bece-4e8a-84fd-f99af777d198"],
873+
"statuses": { "available": [], "non_operational": [] },
874+
"vehicle_types": ["bicycle", "scooter"],
875+
"maximum": 0,
876+
"rate_amount": 200,
877+
"rate_recurrence": "once_on_unmatch"
878+
}
879+
]
880+
}
881+
```
882+
883+
[Top](#table-of-contents)

0 commit comments

Comments
 (0)