Detta inlägg är gammalt och kan innehålla inaktuell information.

Missing category in departureBoard

When searching for departures from "Ekelöv östra (Kungälv kn)" (GTFS stop id 740060029) the returned result contains some bus entries with unset Departure.[].ProductAtStop.catOut and erroneously set Departure.[].ProductAtStop.catCode making it difficult to categorize them.

Example:

curl 'https://api.resrobot.se/v2.1/departureBoard?accessId=XXX&date=2022-06-08&duration=180&format=json&id=740060029&time=12%3A20' -o - | jq '.Departure | .[] | .ProductAtStop | select(.catOut == null)'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 17247 100 17247 0 0 34772 0 --:--:-- --:--:-- --:--:-- 34702
{
"icon": {
"res": "prod_gen"
},
"name": "BLT Buss MEXP",
"internalName": "BLT Buss MEXP",
"displayNumber": "Buss MEXP",
"num": "Buss MEXP",
"line": "Buss MEXP",
"catIn": "BLT",
"catCode": "7",
"cls": "128",
"catOutS": "BLT",
"catOutL": "BLT",
"operatorCode": "279",
"operator": "LT Västtrafik",
"admin": "______"
}
{
"icon": {
"res": "prod_gen"
},
"name": "BLT Buss MEXP",
"internalName": "BLT Buss MEXP",
"displayNumber": "Buss MEXP",
"num": "Buss MEXP",
"line": "Buss MEXP",
"catIn": "BLT",
"catCode": "7",
"cls": "128",
"catOutS": "BLT",
"catOutL": "BLT",
"operatorCode": "279",
"operator": "LT Västtrafik",
"admin": "______"
}

The result contains two entries that don't have a 'catOut' attribute, the openapi spec does not mention 'catOut' as being optional. They also contain '"catCode": "7"' which corresponds to the GTFS route type 7 (Funicular. Any rail system designed for steep inclines) which is incorrect. Maybe the "catCode" was meant to be the extended GTFS route type "700" (Bus Service). It also looks like the category code has found its way into the 'name' of the product. Clicking the stop in Resrobot's departures web page also displays the name with the category code included, "i.e. "BLT Buss MEXP". Unfortunately I'm unable to link to the search result on the web page.

BR
Alex
Alexander Perlman

Kommentarer

  • Hi Alexander,

    Catcode 7 corresponds to busses, the entire list of values can be found here: https://www.trafiklab.se/api/trafiklab-apis/resrobot-v21/common/. The openAPI documentation has been corrected to include this information.

    Regarding the missing catOut, this seems to be either a data issue or a bug in the API. As a workaround I'd suggest using catOutS, which should contain the same data.

    Regards,
    Bert
    Bert på Trafiklab

Kommentera eller skriv ett nytt inlägg

Ditt namn och inlägg kan ses av alla. Din e-post visas aldrig publikt.