Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add informations prognosisType and occupancy from API #200

Open
gekberlin opened this issue Feb 9, 2024 · 1 comment
Open

Add informations prognosisType and occupancy from API #200

gekberlin opened this issue Feb 9, 2024 · 1 comment

Comments

@gekberlin
Copy link

gekberlin commented Feb 9, 2024

Hi there,

It would be great to add the information prognosisType and occupancy that are both provided from the v6.bvg api on which the hafas-client is deployed on.

prognosisType has different states, depending on whether real-time information is given or not. Most of the time trips that are cancelled are not officially cancelled in the systems, but you could still point them out because there is obviously no real-time data available, so prognosisType would be null. If we could get that information, we could mark those departures as different from those that are fitted with real-time data.
It would be great to make that an option in the configuration.
E.g., the well-known navigator app for iOS makes use of that information and displays departures with prognosisType: "calculated" (real-time information given) in italic and those without real-time information given (prognosisType: "null") in normal font.

image

occupancy is of course self-explanatory and it would be great to have the possibility to get another column with the information for each departure, including how full the train is expected to be.

e.g. output from https://v6.bvg.transport.rest/stops/900140518/departures?duration=120:

{
            "tripId": "1|42447|8|86|9022024",
            "stop": {
                "type": "stop",
                "id": "900140518",
                "name": "Sulzfelder Str. (Berlin)",
                "location": {
                    "type": "location",
                    "id": "900140518",
                    "latitude": 52.553312,
                    "longitude": 13.475765
                },
                "products": {
                    "suburban": false,
                    "subway": false,
                    "tram": true,
                    "bus": true,
                    "ferry": false,
                    "express": false,
                    "regional": false
                },
                "stationDHID": "de:11000:900140518"
            },
            "when": "2024-02-09T23:36:00+01:00",
            "plannedWhen": "2024-02-09T23:36:00+01:00",
            "delay": 0,
            "platform": null,
            "plannedPlatform": null,
            **"prognosisType": "calculated",**
            "direction": "Krankenhaus Köpenick",
            "provenance": null,
            "line": {
                "type": "line",
                "id": "27",
                "fahrtNr": "2100",
                "name": "27",
                "public": true,
                "adminCode": "BVT---",
                "productName": "Tram",
                "mode": "train",
                "product": "tram",
                "operator": {
                    "type": "operator",
                    "id": "berliner-verkehrsbetriebe",
                    "name": "Berliner Verkehrsbetriebe"
                }
            },
            "remarks": [
                {
                    "type": "hint",
                    "code": "FK",
                    "text": "Bicycle conveyance"
                }
            ],
            "origin": null,
            "destination": {
                "type": "stop",
                "id": "900180022",
                "name": "Krankenhaus Köpenick/Südseite (Berlin)",
                "location": {
                    "type": "location",
                    "id": "900180022",
                    "latitude": 52.438718,
                    "longitude": 13.592445
                },
                "products": {
                    "suburban": false,
                    "subway": false,
                    "tram": true,
                    "bus": true,
                    "ferry": false,
                    "express": false,
                    "regional": false
                },
                "stationDHID": "de:11000:900180022"
            },
            **"occupancy": "low"**
        },
        {
            "tripId": "1|59904|6|86|9022024",
            "stop": {
                "type": "stop",
                "id": "900140518",
                "name": "Sulzfelder Str. (Berlin)",
                "location": {
                    "type": "location",
                    "id": "900140518",
                    "latitude": 52.553312,
                    "longitude": 13.475765
                },
                "products": {
                    "suburban": false,
                    "subway": false,
                    "tram": true,
                    "bus": true,
                    "ferry": false,
                    "express": false,
                    "regional": false
                },
                "stationDHID": "de:11000:900140518"
            },
            "when": "2024-02-09T23:37:00+01:00",
            "plannedWhen": "2024-02-09T23:37:00+01:00",
            "delay": null,
            "platform": null,
            "plannedPlatform": null,
            **"prognosisType": null,**
            "direction": "Hohenschönhausen, Zingster Str.",
            "provenance": null,
            "line": {
                "type": "line",
                "id": "m4",
                "fahrtNr": "5846",
                "name": "M4",
                "public": true,
                "adminCode": "BVT---",
                "productName": "Tram",
                "mode": "train",
                "product": "tram",
                "operator": {
                    "type": "operator",
                    "id": "berliner-verkehrsbetriebe",
                    "name": "Berliner Verkehrsbetriebe"
                }
            },
            "remarks": [
                {
                    "type": "hint",
                    "code": "FK",
                    "text": "Bicycle conveyance"
                }
            ],
            "origin": null,
            "destination": {
                "type": "stop",
                "id": "900151003",
                "name": "Zingster Str. (Berlin)",
                "location": {
                    "type": "location",
                    "id": "900151003",
                    "latitude": 52.57236,
                    "longitude": 13.495164
                },
                "products": {
                    "suburban": false,
                    "subway": false,
                    "tram": true,
                    "bus": false,
                    "ferry": false,
                    "express": false,
                    "regional": false
                },
                "stationDHID": "de:11000:900151003"
            },
            "occupancy": "medium"
        },
        {
            "tripId": "1|44270|7|86|9022024",
            "stop": {
                "type": "stop",
                "id": "900140518",
                "name": "Sulzfelder Str. (Berlin)",
                "location": {
                    "type": "location",
                    "id": "900140518",
                    "latitude": 52.553312,
                    "longitude": 13.475765
                },
                "products": {
                    "suburban": false,
                    "subway": false,
                    "tram": true,
                    "bus": true,
                    "ferry": false,
                    "express": false,
                    "regional": false
                },
                "stationDHID": "de:11000:900140518"
            },
            "when": "2024-02-09T23:41:00+01:00",
            "plannedWhen": "2024-02-09T23:41:00+01:00",
            "delay": 0,
            "platform": null,
            "plannedPlatform": null,
            "prognosisType": "calculated",
            "direction": "S Hackescher Markt",
            "provenance": null,
            "line": {
                "type": "line",
                "id": "m4",
                "fahrtNr": "5242",
                "name": "M4",
                "public": true,
                "adminCode": "BVT---",
                "productName": "Tram",
                "mode": "train",
                "product": "tram",
                "operator": {
                    "type": "operator",
                    "id": "berliner-verkehrsbetriebe",
                    "name": "Berliner Verkehrsbetriebe"
                }
            },
            "remarks": [
                {
                    "type": "hint",
                    "code": "FK",
                    "text": "Bicycle conveyance"
                }
            ],
            "origin": null,
            "destination": {
                "type": "stop",
                "id": "900100002",
                "name": "S Hackescher Markt (Berlin)",
                "location": {
                    "type": "location",
                    "id": "900100002",
                    "latitude": 52.522605,
                    "longitude": 13.402359
                },
                "products": {
                    "suburban": true,
                    "subway": false,
                    "tram": true,
                    "bus": true,
                    "ferry": false,
                    "express": false,
                    "regional": false
                },
                "stationDHID": "de:11000:900100002"
            },
            "occupancy": "low"
        },
        {
            "tripId": "1|44377|5|86|9022024",
            "stop": {
                "type": "stop",
                "id": "900140518",
                "name": "Sulzfelder Str. (Berlin)",
                "location": {
                    "type": "location",
                    "id": "900140518",
                    "latitude": 52.553312,
                    "longitude": 13.475765
                },
                "products": {
                    "suburban": false,
                    "subway": false,
                    "tram": true,
                    "bus": true,
                    "ferry": false,
                    "express": false,
                    "regional": false
                },
                "stationDHID": "de:11000:900140518"
            },
            "when": "2024-02-09T23:43:00+01:00",
            "plannedWhen": "2024-02-09T23:43:00+01:00",
            "delay": 0,
            "platform": null,
            "plannedPlatform": null,
            "prognosisType": "calculated",
            "direction": "Falkenberg",
            "provenance": null,
            "line": {
                "type": "line",
                "id": "m4",
                "fahrtNr": "5438",
                "name": "M4",
                "public": true,
                "adminCode": "BVT---",
                "productName": "Tram",
                "mode": "train",
                "product": "tram",
                "operator": {
                    "type": "operator",
                    "id": "berliner-verkehrsbetriebe",
                    "name": "Berliner Verkehrsbetriebe"
                }
            },
            "remarks": [
                {
                    "type": "hint",
                    "code": "FK",
                    "text": "Bicycle conveyance"
                }
            ],
            "origin": null,
            "destination": {
                "type": "stop",
                "id": "900152007",
                "name": "Falkenberg (Berlin)",
                "location": {
                    "type": "location",
                    "id": "900152007",
                    "latitude": 52.570212,
                    "longitude": 13.526815
                },
                "products": {
                    "suburban": false,
                    "subway": false,
                    "tram": true,
                    "bus": true,
                    "ferry": false,
                    "express": false,
                    "regional": false
                },
                "stationDHID": "de:11000:900152007"
            },
            "occupancy": "medium"
        },
@KristjanESPERANTO
Copy link
Collaborator

Thanks for the suggestion! ⭐ It sounds useful and doable. Would you like to create a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants