google / google/transit

Semantics of attribution_id uniqueness for identical attributions

Open
#589 0 comments 0 reactions 0 assignees View on GitHub
Change type: Functional GTFS Schedule
Dominant language
No language data
Stars
1.1k
Forks
225
Avg merge
7d 17h
Merged PRs (30d)
3

Description

### Describe the problem

In the [attributions specification](https://gtfs.org/documentation/schedule/reference/#attributionstxt), the optional `attribution_id` field is declared as a primary key.

Since the `attributions.txt` table defines both the objects and the links (it act as a primary table **and** a link table), and many identical attributions will be duplicated in this table (for example for declaring the same attribution to many routes or trips), it's not clear if having duplicated `attribution_id` is allowed for the same attribution (that is attribution having all identical value fields: type, name, url, phone, email).

Currently the official GTFS validator does not allow it, for example the following data is raising a "duplicated ID error":

```
attribution_id,agency_id,route_id,trip_id,organization_name,is_producer,is_operator,is_authority,attribution_url,,attribution_email,attribution_phone
OP1,,CITY,,Operator of the route CITY and AB,,1,,https://operator.com/,email@operator.com,+1 0967 5656
OP1,,AB ,,Operator of the route CITY and AB,,1,,https://operator.com/,email@operator.com,+1 0967 5656
```

Having this restriction (ID unique for each row) is not very handy, as the simple case of having the same attribute defined for hundreds of trips will require hundreds of different (arbitrary) IDs, also multiplying the required number of translations.

### Use cases

Added value of this proposal / refinement:

- Clarify the current specification (semantics of attribution_id uniqueness is not really clear)
- Minimize the number of required data (translations)
- Simplify the work of data producer and consumer (do not require to create many arbitrary IDs)

### Proposed solution

It could be nice to allow duplicated IDs *for identical attributions* (that is attribution having all value fields the same).

That is allowing the following data:

```
attribution_id,agency_id,route_id,trip_id,organization_name,is_producer,is_operator,is_authority,attribution_url,,attribution_email,attribution_phone
OP1,,CITY,,Operator of the route CITY and AB,,1,,https://operator.com/,email@operator.com,+1 0967 5656
OP1,,AB ,,Operator of the route CITY and AB,,1,,https://operator.com/,email@operator.com,+1 0967 5656
```

### Additional information

In addition, if this would be allowed, we could also allow declaring only once the attribution values for identical IDs, for example having:

```
attribution_id,trip_id,is_operator,organization_name,attribution_url,,attribution_email,attribution_phone
OP1,T1,1,Operator first,https://operatorfirst.com/,email@operatorfirst.com,+1 0967 5656
OP1,T2,,,,
OP1,T3,,,,
OP1,T4,,,,
OP1,T5,,,,
OP1,T6,,,,
OP2,T7,1,Operator second,https://operatorsecond.com/,email@operatorsecond.com,+1 0968 5657
OP2,T8,,,,
(...)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.