Skip to content

Commit

Permalink
feat: add product brand dataset
Browse files Browse the repository at this point in the history
Signed-off-by: The one with the braid <[email protected]>
  • Loading branch information
TheOneWithTheBraid committed Jan 3, 2025
1 parent 9855f25 commit d965299
Show file tree
Hide file tree
Showing 16 changed files with 2,819 additions and 2,503 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ jobs:
run: php test.php
- name: Validate line-colors.csv
working-directory: ./validation
run: php check.php
run: php check-lines.php
- name: Validate product-brands.csv
working-directory: ./validation
run: php check-products.php
- name: Install svgcleaner and rsvg
run: sudo apt update && sudo apt install -y -qq wget librsvg2-bin && wget https://github.com/RazrFalcon/svgcleaner/releases/download/v0.9.5/svgcleaner_linux_x86_64_0.9.5.tar.gz && tar -xf svgcleaner_linux_*.tar.gz && sudo mv svgcleaner /usr/local/bin && rm -f svgcleaner svgcleaner_linux_*.tar.gz
- name: Ensure all product icons are cleaned and resized
working-directory: ./products
run: for product in *.svg; do rsvg-convert -f svg -a -h 24 -o clean-$product $product && svgcleaner clean-$product clean-$product && diff -u $product clean-$product || exit 1 ; done && rm clean-*.svg

deploy:
needs: [validate]
Expand All @@ -32,6 +40,17 @@ jobs:
with:
php-version: 8.2

- name: Install svgcleaner and rsvg
run: sudo apt update && sudo apt install -y -qq wget librsvg2-bin && wget https://github.com/RazrFalcon/svgcleaner/releases/download/v0.9.5/svgcleaner_linux_x86_64_0.9.5.tar.gz && tar -xf svgcleaner_linux_*.tar.gz && sudo mv svgcleaner /usr/local/bin && rm -f svgcleaner svgcleaner_linux_*.tar.gz

- name: Generate product assets
working-directory: ./validation
run: php product-assets.php

- name: Bundle product assets
working-directory: ./website/assets/products
run: zip ../../product-brands.zip *

- name: Write out Website
working-directory: ./website
run: php index.php > index.html && rm index.php
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
vendor/
.idea/
.idea/

website/index.html
website/assets/products/
website/assets/product-brands.zip

32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
This repository is made for collecting line colors in public transport lines,
so they can be displayed on systems using DB HAFAS.

## Structure
## Contents

- [Line Colors](#line-colors)
- [Product Brands](#product-brands)

## Line Colors

### Structure

The `line-colors.csv` contains several columns:
- `shortOperatorName`: Short operator name (i.e. vehicle keeper marking/"Halterkürzel" or another identifier for EVU) and a local transport network abbreviation
Expand All @@ -20,8 +27,9 @@ The `line-colors.csv` contains several columns:
- `pill`: Rectangle with completely rounded corners
- `trapezoid` A trapezoid shape with a broad top and a narrow bottom side
- `wikidataQid`: Wikidata QID for the line (if available, can be empty)
- `productBrand`: An optional `productBrand` from the product brands database in order to manually assign a particular product brand override. This is useful if e.g. an operator runs a single line entering another traffic association using different branding, such as DB Regio operating for Austrian S-Bahn networks.

## Contributing
### Contributing

If a line operates in a local transport network/"Verkehrsverbund", the network's line color shall be preferred.<br>
Local transport networks usually have line colors for:
Expand Down Expand Up @@ -54,7 +62,7 @@ Please keep the PR's small. If possible, create a small PR for each operator. <b
- You can use [this list](https://www.wikidata.org/wiki/User:Mkkagain/Verkehrslinien_in_Deutschland) to find the QID
- if there is no Wikidata item for the line, it would be great if you could [create one](https://www.wikidata.org/wiki/Special:NewItem)

## Examples
### Examples

### Die Länderbahn GmbH DLB, RE72

Expand Down Expand Up @@ -156,3 +164,21 @@ Entry: `hvv-hha,X35,,5-hvvhha-x35,#eb452e,#ffffff,,hexagon,`
- `wikidataQid` *not available*

Entry: `liege-s,S41,sncb,4-88-41,#0f6030,#ffffff,#ffffff,circle,`

## Product Brands (alpha)

In addition to the line schematics, this repository also collects product branding data for transport operators.

This is particularly useful when applications want to provide an authentic look and feel about train or transport
categories to users - independent of individual lines.

### Structure

- `shortOperatorName`: a meaningful name matching the product brand, such as `cd-railjet`, `sncf-ouigo` or `s-bahn-at`
- `hafasOperatorCode`: the operator code as in HAFAS. An empty String will *never* match (useful for manual assignments).
- `product`: the product String from HAFAS, such as `suburban`, `national` or `bus`. An empty String will *never* match (useful for manual assignments).
- `productName`: the productName String from HAFAS, such as `TGV` or `S`. An empty String will *never* match (useful for manual assignments).
- `shortName`: should be empty. An *optional* override to the [Wikidata short name](https://www.wikidata.org/wiki/Property:P1813). Only specify if unavailable in Wikidata or not meaningful.
- `iconName`: should be empty. An *optional* override for the [Wikidata logo image](https://www.wikidata.org/wiki/Property:P154). Only specify if unavailable in Wikidata or not meaningful. In case specified, the icon **must** be included into the [`icon-sources.json`](icon-sources.json) with corresponding source and attribution.
- `wikidataQid`: **mandatory** Wikidata QID for the product or anything to be considered as data source. If you don't find anything, maybe just create the dataset.

82 changes: 82 additions & 0 deletions icon-sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[
{
"iconName": "oebb-nightjet",
"contributors": [
{
"github": "TheOneWithTheBraid"
}
],
"sources": [
{
"name": "Wikimedia Commons",
"source": "https://commons.wikimedia.org/wiki/File:Nightjet_logo.svg",
"author": "Österreichische Bundesbahnen",
"license": "PD"
}
]
},
{
"iconName": "regio-s-bahn-bw",
"contributors": [
{
"github": "TheOneWithTheBraid"
}
],
"sources": [
{
"name": "Wikimedia Commons",
"source": "https://rsbahn.de/#downloads",
"author": "The one with the braid",
"license": "PD"
}
]
},
{
"iconName": "rer-ch-fribourg",
"contributors": [
{
"github": "TheOneWithTheBraid"
}
],
"sources": [
{
"name": "Wikimedia Commons",
"source": "https://commons.wikimedia.org/wiki/File:RER_Fribourg_Freiburg.svg",
"author": "SBB CFF FFS",
"license": "PD"
}
]
},
{
"iconName": "rer-ch-vaud",
"contributors": [
{
"github": "TheOneWithTheBraid"
}
],
"sources": [
{
"name": "Wikimedia Commons",
"source": "https://commons.wikimedia.org/wiki/File:RER_Vaudois.png",
"author": "SBB CFF FFS",
"license": "PD"
}
]
},
{
"iconName": "s-bahn-at",
"contributors": [
{
"github": "TheOneWithTheBraid"
}
],
"sources": [
{
"name": "Wikimedia Commons",
"source": "https://commons.wikimedia.org/wiki/File:S-Bahn_Austria.svg",
"author": "Siegele Roland & Jonathan Haas",
"license": "PD"
}
]
}
]
Loading

0 comments on commit d965299

Please sign in to comment.