public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
278 stars 54 forks source link

matchId in prodCtx as a railway network linenumber #276

Open bergmannjg opened 2 years ago

bergmannjg commented 2 years ago

In a db profile journey response the matchId in prodCtx seems to correspond to the railway network linenumber (Liniennummer) .

Can you please add the matchId to the FPTF operator object.

Here are 2 examples of the prodL parts of a journey response.

"prodL": [
    {
        "name": "IC 149",
        "number": "149",
        "icoX": 0,
        "cls": 2,
        "oprX": 0,
        "prodCtx": {
            "name": "IC   149",
            "num": "149",
            "matchId": "77",
            "catOut": "IC",
            "catOutS": "IC",
            "catOutL": "Intercity",
            "catIn": "IC",
            "catCode": "1",
            "admin": "80____"
        }
    }
]
"prodL": [
    {
        "name": "ICE 641",
        "number": "641",
        "icoX": 0,
        "cls": 1,
        "oprX": 0,
        "prodCtx": {
            "name": "ICE  641",
            "num": "641",
            "matchId": "10",
            "catOut": "ICE",
            "catOutS": "ICE",
            "catOutL": "Intercity-Express",
            "catIn": "ICE",
            "catCode": "0",
            "admin": "80____"
        }
    },
    {
        "name": "ICE 651",
        "number": "651",
        "icoX": 0,
        "cls": 1,
        "oprX": 0,
        "prodCtx": {
            "name": "ICE  651",
            "num": "651",
            "matchId": "10",
            "catOut": "ICE",
            "catOutS": "ICE",
            "catOutL": "Intercity-Express",
            "catIn": "ICE",
            "catCode": "0",
            "admin": "80____"
        }
    }
]
derhuerst commented 2 years ago

Thanks for bringing this up.

In a db profile journey response the matchId in prodCtx seems to correspond to the railway network linenumber (Liniennummer) .

Are there cases where matchId doesn't match the Liniennummer? Can you check local buses, trams, subway, ferries, etc. in some regions?

If matchId in fact turns out to (almost) always mean Liniennumber, I agree that we should let the DB profile expose it. In this case, having a more descriptive field name (e.g. liniennummer or lineName) would be more appropriate though IMO.

bergmannjg commented 2 years ago

Some journey results with different products

profile db

profile bvg

The line.name or line.fahrtnr conceptually only differs from line.matchid (or linenumber) for products nationalExpress or national.