From d2ffb081e8e606395d393c4d3d071d2d9d08bf03 Mon Sep 17 00:00:00 2001 From: Tzu-Jen Chan <126435471+tzujenchanmbd@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:54:44 -0400 Subject: [PATCH 1/4] Add nonconsecutive_transfer_allowed field --- gtfs/spec/en/reference.md | 1 + 1 file changed, 1 insertion(+) diff --git a/gtfs/spec/en/reference.md b/gtfs/spec/en/reference.md index 8489f357..da5e916a 100644 --- a/gtfs/spec/en/reference.md +++ b/gtfs/spec/en/reference.md @@ -521,6 +521,7 @@ To process the cost of a multi-leg journey: | `duration_limit` | Positive integer | Optional | Defines the duration limit of the transfer.

Must be expressed in integer increments of seconds.

If there is no duration limit, `fare_transfer_rules.duration_limit` must be empty. | | `duration_limit_type` | Enum | **Conditionally Required** | Defines the relative start and end of `fare_transfer_rules.duration_limit`.

Valid options are:
`0` - Between the departure fare validation of the current leg and the arrival fare validation of the next leg.
`1` - Between the departure fare validation of the current leg and the departure fare validation of the next leg.
`2` - Between the arrival fare validation of the current leg and the departure fare validation of the next leg.
`3` - Between the arrival fare validation of the current leg and the arrival fare validation of the next leg.

Conditionally Required:
- **Required** if `fare_transfer_rules.duration_limit` is defined.
- **Forbidden** if `fare_transfer_rules.duration_limit` is empty. | | `fare_transfer_type` | Enum | **Required** | Indicates the cost processing method of transferring between legs in a journey:
![](examples/2-leg.svg)
Valid options are:
`0` - From-leg `fare_leg_rules.fare_product_id` plus `fare_transfer_rules.fare_product_id`; A + AB.
`1` - From-leg `fare_leg_rules.fare_product_id` plus `fare_transfer_rules.fare_product_id` plus to-leg `fare_leg_rules.fare_product_id`; A + AB + B.
`2` - `fare_transfer_rules.fare_product_id`; AB.

Cost processing interactions between multiple transfers in a journey:
![](examples/3-leg.svg)
`fare_transfer_type`Processing A > BProcessing B > C
`0`A + ABS + BC
`1`A + AB +BS + BC + C
`2`ABS + BC
Where S indicates the total processed cost of the preceding leg(s) and transfer(s). | +| `nonconsecutive_transfer_allowed` | Enum | Optional | Indicates whether the transfer rule allows non-consecutive transfers.

Valid options are:
`0` or empty - The transfer rule applies only to consecutive transfers.
`1` - The transfer rule applies to both consecutive and non-consecutive transfers. | | `fare_product_id` | Foreign ID referencing `fare_products.fare_product_id` | Optional | The fare product required to transfer between two fare legs. If empty, the cost of the transfer rule is 0.| From 741c0e24e1fe6874b8299c3ec580f432d611bf3e Mon Sep 17 00:00:00 2001 From: Tzu-Jen Chan <126435471+tzujenchanmbd@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:57:28 -0400 Subject: [PATCH 2/4] Add nonconsecutive diagrams --- gtfs/spec/en/examples/3-legs-nonconsecutive-comparison.svg | 4 ++++ gtfs/spec/en/examples/3-legs-nonconsecutive.svg | 4 ++++ 2 files changed, 8 insertions(+) create mode 100644 gtfs/spec/en/examples/3-legs-nonconsecutive-comparison.svg create mode 100644 gtfs/spec/en/examples/3-legs-nonconsecutive.svg diff --git a/gtfs/spec/en/examples/3-legs-nonconsecutive-comparison.svg b/gtfs/spec/en/examples/3-legs-nonconsecutive-comparison.svg new file mode 100644 index 00000000..d1a2e395 --- /dev/null +++ b/gtfs/spec/en/examples/3-legs-nonconsecutive-comparison.svg @@ -0,0 +1,4 @@ + + + +
B
A
C
B
A
C
AB
AB
AC
BC
\ No newline at end of file diff --git a/gtfs/spec/en/examples/3-legs-nonconsecutive.svg b/gtfs/spec/en/examples/3-legs-nonconsecutive.svg new file mode 100644 index 00000000..9ae16062 --- /dev/null +++ b/gtfs/spec/en/examples/3-legs-nonconsecutive.svg @@ -0,0 +1,4 @@ + + + +
B
A
C
\ No newline at end of file From 9f969a7f77c2503027cd9151b8b5a12a7d1ae15f Mon Sep 17 00:00:00 2001 From: Tzu-Jen Chan <126435471+tzujenchanmbd@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:01:41 -0400 Subject: [PATCH 3/4] Update fare_transfer_type --- gtfs/spec/en/reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtfs/spec/en/reference.md b/gtfs/spec/en/reference.md index da5e916a..d426efa0 100644 --- a/gtfs/spec/en/reference.md +++ b/gtfs/spec/en/reference.md @@ -520,7 +520,7 @@ To process the cost of a multi-leg journey: | `transfer_count` | Non-zero integer | **Conditionally Forbidden** | Defines how many consecutive transfers the transfer rule may be applied to.

Valid options are:
`-1` - No limit.
`1` or more - Defines how many transfers the transfer rule may span.

If a sub-journey matches multiple records with different `transfer_count`s, then the rule with the minimum `transfer_count` that is greater than or equal to the current transfer count of the sub-journey is to be selected.

Conditionally Forbidden:
- **Forbidden** if `fare_transfer_rules.from_leg_group_id` does not equal `fare_transfer_rules.to_leg_group_id`.
- **Required** if `fare_transfer_rules.from_leg_group_id` equals `fare_transfer_rules.to_leg_group_id`. | | `duration_limit` | Positive integer | Optional | Defines the duration limit of the transfer.

Must be expressed in integer increments of seconds.

If there is no duration limit, `fare_transfer_rules.duration_limit` must be empty. | | `duration_limit_type` | Enum | **Conditionally Required** | Defines the relative start and end of `fare_transfer_rules.duration_limit`.

Valid options are:
`0` - Between the departure fare validation of the current leg and the arrival fare validation of the next leg.
`1` - Between the departure fare validation of the current leg and the departure fare validation of the next leg.
`2` - Between the arrival fare validation of the current leg and the departure fare validation of the next leg.
`3` - Between the arrival fare validation of the current leg and the arrival fare validation of the next leg.

Conditionally Required:
- **Required** if `fare_transfer_rules.duration_limit` is defined.
- **Forbidden** if `fare_transfer_rules.duration_limit` is empty. | -| `fare_transfer_type` | Enum | **Required** | Indicates the cost processing method of transferring between legs in a journey:
![](examples/2-leg.svg)
Valid options are:
`0` - From-leg `fare_leg_rules.fare_product_id` plus `fare_transfer_rules.fare_product_id`; A + AB.
`1` - From-leg `fare_leg_rules.fare_product_id` plus `fare_transfer_rules.fare_product_id` plus to-leg `fare_leg_rules.fare_product_id`; A + AB + B.
`2` - `fare_transfer_rules.fare_product_id`; AB.

Cost processing interactions between multiple transfers in a journey:
![](examples/3-leg.svg)
`fare_transfer_type`Processing A > BProcessing B > C
`0`A + ABS + BC
`1`A + AB +BS + BC + C
`2`ABS + BC
Where S indicates the total processed cost of the preceding leg(s) and transfer(s). | +| `fare_transfer_type` | Enum | **Required** | Indicates the cost processing method of transferring between legs in a journey:
![](examples/2-leg.svg)
Valid options are:
`0` - From-leg `fare_leg_rules.fare_product_id` plus `fare_transfer_rules.fare_product_id`; A + AB.
`1` - From-leg `fare_leg_rules.fare_product_id` plus `fare_transfer_rules.fare_product_id` plus to-leg `fare_leg_rules.fare_product_id`; A + AB + B.
`2` - `fare_transfer_rules.fare_product_id`; AB.

Cost processing interactions between multiple transfers in a journey:
![](examples/3-leg.svg)
`fare_transfer_type`Processing A > BProcessing B > C
`0`A + ABS + BC
`1`A + AB +BS + BC + C
`2`ABS + BC
When a non-consecutive transfer rule applies to the cost calculation:
![](examples/3-legs-nonconsecutive.svg)
`fare_transfer_type`Processing A > BProcessing B > C, using transfer rule from A to C
`0`A + ABS + AC
`1`A + AB +BS + AC + C
`2`ABS + AC
Where S indicates the total processed cost of the preceding leg(s) and transfer(s). When calculating the cumulative cost S, the `fare_transfer_type` of the preceding legs must be considered, if applicable. For example, for a journey A>B>C where `fare_transfer_type=1` for A>B and `fare_transfer_type=0` for B>C, the total cost of the journey is calculated as A + AB +B + BC.
![](examples/3-legs-nonconsecutive-comparison.svg)
For a multi-leg journey, multiple transfer rules may apply to a single leg. As shown in the figure above, both the consecutive transfer rule BC and the non-consecutive transfer rule AC apply when transferring to leg C. Data consumers should consider all applicable transfer rules to calculate the total journey cost. | | `nonconsecutive_transfer_allowed` | Enum | Optional | Indicates whether the transfer rule allows non-consecutive transfers.

Valid options are:
`0` or empty - The transfer rule applies only to consecutive transfers.
`1` - The transfer rule applies to both consecutive and non-consecutive transfers. | | `fare_product_id` | Foreign ID referencing `fare_products.fare_product_id` | Optional | The fare product required to transfer between two fare legs. If empty, the cost of the transfer rule is 0.| From c507de7a6bfa1b84a29e68897583ed7833cd1820 Mon Sep 17 00:00:00 2001 From: Tzu-Jen Chan <126435471+tzujenchanmbd@users.noreply.github.com> Date: Tue, 17 Sep 2024 19:03:50 -0400 Subject: [PATCH 4/4] Update nonconsecutive field desc --- gtfs/spec/en/reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtfs/spec/en/reference.md b/gtfs/spec/en/reference.md index d426efa0..c62210f9 100644 --- a/gtfs/spec/en/reference.md +++ b/gtfs/spec/en/reference.md @@ -521,7 +521,7 @@ To process the cost of a multi-leg journey: | `duration_limit` | Positive integer | Optional | Defines the duration limit of the transfer.

Must be expressed in integer increments of seconds.

If there is no duration limit, `fare_transfer_rules.duration_limit` must be empty. | | `duration_limit_type` | Enum | **Conditionally Required** | Defines the relative start and end of `fare_transfer_rules.duration_limit`.

Valid options are:
`0` - Between the departure fare validation of the current leg and the arrival fare validation of the next leg.
`1` - Between the departure fare validation of the current leg and the departure fare validation of the next leg.
`2` - Between the arrival fare validation of the current leg and the departure fare validation of the next leg.
`3` - Between the arrival fare validation of the current leg and the arrival fare validation of the next leg.

Conditionally Required:
- **Required** if `fare_transfer_rules.duration_limit` is defined.
- **Forbidden** if `fare_transfer_rules.duration_limit` is empty. | | `fare_transfer_type` | Enum | **Required** | Indicates the cost processing method of transferring between legs in a journey:
![](examples/2-leg.svg)
Valid options are:
`0` - From-leg `fare_leg_rules.fare_product_id` plus `fare_transfer_rules.fare_product_id`; A + AB.
`1` - From-leg `fare_leg_rules.fare_product_id` plus `fare_transfer_rules.fare_product_id` plus to-leg `fare_leg_rules.fare_product_id`; A + AB + B.
`2` - `fare_transfer_rules.fare_product_id`; AB.

Cost processing interactions between multiple transfers in a journey:
![](examples/3-leg.svg)
`fare_transfer_type`Processing A > BProcessing B > C
`0`A + ABS + BC
`1`A + AB +BS + BC + C
`2`ABS + BC
When a non-consecutive transfer rule applies to the cost calculation:
![](examples/3-legs-nonconsecutive.svg)
`fare_transfer_type`Processing A > BProcessing B > C, using transfer rule from A to C
`0`A + ABS + AC
`1`A + AB +BS + AC + C
`2`ABS + AC
Where S indicates the total processed cost of the preceding leg(s) and transfer(s). When calculating the cumulative cost S, the `fare_transfer_type` of the preceding legs must be considered, if applicable. For example, for a journey A>B>C where `fare_transfer_type=1` for A>B and `fare_transfer_type=0` for B>C, the total cost of the journey is calculated as A + AB +B + BC.
![](examples/3-legs-nonconsecutive-comparison.svg)
For a multi-leg journey, multiple transfer rules may apply to a single leg. As shown in the figure above, both the consecutive transfer rule BC and the non-consecutive transfer rule AC apply when transferring to leg C. Data consumers should consider all applicable transfer rules to calculate the total journey cost. | -| `nonconsecutive_transfer_allowed` | Enum | Optional | Indicates whether the transfer rule allows non-consecutive transfers.

Valid options are:
`0` or empty - The transfer rule applies only to consecutive transfers.
`1` - The transfer rule applies to both consecutive and non-consecutive transfers. | +| `nonconsecutive_transfer_allowed` | Enum | Optional | Indicates whether the transfer rule is allowed to apply to non-consecutive transfers.

Valid options are:
`0` or empty - The transfer rule applies only to consecutive transfers.
`1` - The transfer rule applies to both consecutive and non-consecutive transfers. | | `fare_product_id` | Foreign ID referencing `fare_products.fare_product_id` | Optional | The fare product required to transfer between two fare legs. If empty, the cost of the transfer rule is 0.|