Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
24fb00d
Add image_url to alert
gcamp Sep 8, 2021
b3cb3e5
Add details about essential information in the image
gcamp Sep 8, 2021
f183864
Add notice about mainly text
gcamp Sep 21, 2021
3033eaa
Update discouraged image list
gcamp Sep 22, 2021
e2b9e80
Support list of images
gcamp Sep 27, 2021
36ecabe
Fix typo
gcamp Sep 27, 2021
a4162ec
Fix typo
gcamp Sep 27, 2021
bee0b8d
Revert table of content
gcamp Sep 27, 2021
9a5dfd6
Merge branch 'feature/image_in_alerts' of github.com:TransitApp/trans…
gcamp Sep 27, 2021
d9902eb
Add media type, alt text
gcamp Oct 20, 2021
172c85d
Merge and fix conflicts
gcamp Oct 20, 2021
401aede
Fix URL writing
gcamp Oct 26, 2021
3d711b2
Fix text reference in TranlatedImage
gcamp Oct 26, 2021
06b17e8
Fix copy/paste error
gcamp Oct 26, 2021
6dffdcb
Clarify langage about image selection
gcamp Oct 26, 2021
6c518e1
Clarify alt text description
gcamp Oct 26, 2021
3fbbbec
Update gtfs-realtime/proto/gtfs-realtime.proto
gcamp Oct 26, 2021
49518bc
Use RFC 2119 definition for requirement description
gcamp Oct 27, 2021
124614a
Add missing extension attribute in TranslatedImage
gcamp Oct 27, 2021
b76a38b
Revert editorial changes
gcamp Nov 3, 2021
506b365
Revert editorial changes
gcamp Nov 3, 2021
0de4cbc
Max size to 2MB
gcamp Nov 8, 2021
1f4fa39
Add note about URL needing changing if the image changes
gcamp Nov 8, 2021
1b0d6a0
Use MUST for the size limit
gcamp Nov 8, 2021
ec2d42a
Move alternative_text into the parent alert
gcamp Nov 8, 2021
0899f9f
Add missing experimenal note for image_alternative_text
gcamp Nov 8, 2021
e143763
Add note about image orderign
gcamp Nov 9, 2021
56fa28d
Only allow one image
gcamp Nov 12, 2021
1274fad
Fix image text
gcamp Nov 12, 2021
df127da
Add mention of URL escaping, mirroring the one in GTFS static
gcamp Nov 23, 2021
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
55 changes: 55 additions & 0 deletions gtfs-realtime/proto/gtfs-realtime.proto
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,11 @@ message Alert {

optional SeverityLevel severity_level = 14 [default = UNKNOWN_SEVERITY];

// List of TranslatedImage to be displayed along the alert text. Used to explain visually the alert effect of a detour, station closure, etc. The image must enhance the understanding of the alert. Any essential information communicated within the image must also be contained in the alert text.
// The following types of images are discouraged : image containing mainly text, marketing or branded images that add no additional information.
// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
repeated TranslatedImage image = 15;

// The extensions namespace allows 3rd-party developers to extend the
// GTFS Realtime Specification in order to add and evaluate new features
// and modifications to the spec.
Expand Down Expand Up @@ -906,6 +911,56 @@ message TranslatedString {
extensions 9000 to 9999;
}

// An internationalized image containing per-language versions of a URL linking to an image
// along with meta information
// Only one of the images from a message will be retained by consumers. The resolution proceeds
// as follows:
// 1. If the UI language matches the language code of a translation,
// the first matching translation is picked.
// 2. If a default UI language (e.g., English) matches the language code of a
// translation, the first matching translation is picked.
// 3. If some translation has an unspecified language code, that translation is
// picked.
// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
message TranslatedImage {
Comment thread
gcamp marked this conversation as resolved.
message LocalizedImage {
// String containing a fully qualified URL linking to an image
// The image linked needs to be less than 500kB.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's unclear whether the 500kb size limit is a recommendation or it is enforced?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lets to the must/should here too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes my intent was that is enforced. I can change to SHOULD.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes my intent was that is enforced. I can change to SHOULD.

Do you mean it's a requirement? If so, it should be a MUST.

required string url = 1;

// A UTF-8 string describing the appearance of the linked image (e.g., in case the image can't be displayed
// or the user can't see the image for accessibility reasons). See the HTML spec for alt image text - https://html.spec.whatwg.org/#alt.
optional string alternative_text = 2;

// IANA media type as to specify the type of image to be displayed.
// The type must start with "image/"
required string media_type = 3;

// BCP-47 language code. Can be omitted if the language is unknown or if
// no i18n is done at all for the feed. At most one translation is
// allowed to have an unspecified language tag.
optional string language = 4;


// The extensions namespace allows 3rd-party developers to extend the
Comment thread
gcamp marked this conversation as resolved.
// GTFS Realtime Specification in order to add and evaluate new features and
// modifications to the spec.
extensions 1000 to 1999;

// The following extension IDs are reserved for private use by any organization.
extensions 9000 to 9999;
}
// At least one localized image must be provided.
repeated LocalizedImage localized_image = 1;

// The extensions namespace allows 3rd-party developers to extend the
// GTFS Realtime Specification in order to add and evaluate new features and
// modifications to the spec.
extensions 1000 to 1999;

// The following extension IDs are reserved for private use by any organization.
extensions 9000 to 9999;
}

// Describes the physical path that a vehicle takes when it's not part of the (CSV) GTFS,
// such as for a detour. Shapes belong to Trips, and consist of a sequence of shape points.
Expand Down
24 changes: 23 additions & 1 deletion gtfs-realtime/spec/en/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ An alert, indicating some sort of incident in the public transit network.
| **tts_header_text** | [TranslatedString](#message-translatedstring) | Optional | One | Text containing the alert's header to be used for text-to-speech implementations. This field is the text-to-speech version of header_text. It should contain the same information as header_text but formatted such that it can read as text-to-speech (for example, abbreviations removed, numbers spelled out, etc.) |
| **tts_description_text** | [TranslatedString](#message-translatedstring) | Optional | One | Text containing a description for the alert to be used for text-to-speech implementations. This field is the text-to-speech version of description_text. It should contain the same information as description_text but formatted such that it can be read as text-to-speech (for example, abbreviations removed, numbers spelled out, etc.) |
| **severity_level** | [SeverityLevel](#enum-severitylevel) | Optional | One | Severity of the alert. |
| **image** | [TranslatedImage](#message-translatedimage) | Optional | Many | List of TranslatedImage to be displayed along the alert text. Used to explain visually the alert effect of a detour, station closure, etc. The image should enhance the understanding of the alert and must not be the only location of essential information. The following types of images are discouraged : image containing mainly text, marketing or branded images that add no additional information. <br><br>**Caution:** this field is still **experimental**, and subject to change. It may be formally adopted in the future. |

## _enum_ Cause

Expand Down Expand Up @@ -502,11 +503,32 @@ An internationalized message containing per-language versions of a snippet of te

A localized string mapped to a language.

| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
|------------------|------------|----------------|-------------------|-------------------|
| **text** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | A UTF-8 string containing the message. |
| **language** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Conditionally required | One | BCP-47 language code. Can be omitted if the language is unknown or if no internationalization is done at all for the feed. At most one translation is allowed to have an unspecified language tag - if there is more than one translation, the language must be provided. |
Comment thread
gcamp marked this conversation as resolved.

## _message_ TranslatedImage

An internationalized message containing per-language versions of an image. One of the images from a message will be picked up. The resolution proceeds as follows: If the UI language matches the language code of a translation, the first matching translation is picked. If a default UI language (e.g., English) matches the language code of a translation, the first matching translation is picked. If some translation has an unspecified language code, that translation is picked.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I completely understand the intent of this sentence, but I think the wording is not correct. This sounds line a consumer's api documentation, while we mainly are talking about how to produce these files. So all the "is picked" should be changed IMHO. Maybe to something that makes it as a recommendation to the consumers. Or maybe a bit stricter than that... like "should be picked"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is text copied + adapted from TranslatedString. I'm for clarifying this but maybe that can be done in an other PR and fix both at the same time?


**Caution:** this message is still **experimental**, and subject to change. It may be formally adopted in the future.

#### Fields

| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
|------------------|------------|----------------|-------------------|-------------------|
| **text** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | A UTF-8 string containing the message. |
| **localized_image** | [LocalizedImage](#message-localizedimage) | Required | Many | At least one localized image must be provided. |

## _message_ LocalizedImage

A localized image URL mapped to a language.

| _**Field Name**_ | _**Type**_ | _**Required**_ | _**Cardinality**_ | _**Description**_ |
|------------------|------------|----------------|-------------------|-------------------|
| **url** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | String containing a fully qualified URL linking to an image. The image linked needs to be less than 500kB. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry for the late comment, I didn't think of this until now - I wonder if we should strongly encourage the producer to support (and consumer to use) If-Modified-Since HTTP headers for this URL.

I could see producers swapping out the image at the URL for incidents as they develop and are more fully understood, and we really don't want people downloading a .5 MB file repeatedly just to see if it changed.

I suppose this applies to anything hosted at URLs (including the feeds themselves), but given the potentially large-ish file size here it seems more relevant.

| **alternative_text** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Optional | One | Text describing the appearance of the linked image if the image can't be displayed or the user can't see the image for accessiblity reasons |
| **media_type** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Required | One | IANA media type as to specify the type of image to be displayed. The type must start with "image/" |
| **language** | [string](https://developers.google.com/protocol-buffers/docs/proto#scalar) | Conditionally required | One | BCP-47 language code. Can be omitted if the language is unknown or if no internationalization is done at all for the feed. At most one translation is allowed to have an unspecified language tag - if there is more than one translation, the language must be provided. |

## _message_ Shape
Expand Down