hafas-client icon indicating copy to clipboard operation
hafas-client copied to clipboard

Expose warning status of remarks

Open debfx opened this issue 5 years ago • 3 comments

The DB website shows some status remarks with a red exclamation icon instead of a gray one. However the hafas-client journeys() response doesn't expose this distinction.

Example:

"remL": [
	// ...
	{
		"type":"M",
		"code":"",
		"icoX":5,
		"txtS":"ICE 9572: Karlsruhe Hbf: Störung.",
		"txtN":"Aufgrund eines Notarzteinsatzes am Gleis in Vaihingen(Enz) kommt es zu erheblichen Beeinträchtigungen. Der Zug umgeleitet. Mit einer Reisezeitverlängerung von bis zu 910 Minuten muss gerechnet werden. Auch müssen Sie mit Teilausfällen rechnen Bitte prüfen Sie Ihre Reiseverbindung. (Letzte Aktualisierung 14:25)",
		"sIdx":0
	}
	// ...
]

Corresponding icon: {"res":"HimWarn"}

hafas-client response:

            {
              "type": "status",
              "summary": "ICE 9572: Stuttgart Hbf->Karlsruhe Hbf: Störung.",
              "code": null,
              "text": "Aufgrund eines Notarzteinsatzes am Gleis in Vaihingen(Enz) kommt es zu erheblichen Beeinträchtigungen. Der Zug umgeleitet. Mit einer Reisezeitverlängerung von bis zu 910 Minuten muss gerechnet werden. Auch müssen Sie mit Teilausfällen rechnen Bitte prüfen Sie Ihre Reiseverbindung. (Letzte Aktualisierung 14:25)"
            }

The easiest solution would be to add HimWarn: 'warning' to codesByIcon in parse/hint.js but I'm not sure if this would be appropriate to put it into the code field.

debfx avatar Nov 24 '19 14:11 debfx

Thanks for reporting this, I'd definitely like to expose the info that the remark is something like a "warning"!

The easiest solution would be to add HimWarn: 'warning' to codesByIcon in parse/hint.js but I'm not sure if this would be appropriate to put it into the code field.

In type, I wanted to try to answer the question "What is the remark about?". Having type: 'warning' wouldn't tell me that the remark is about the status of a train/connection, even though the content of the remark might actually be.

But right now, hafas-client doesn't parse the remarks in a meaningful way, and I'm planning to overhaul the remarks parsing anyways in order to handle the sheer variety of messages out there. See #5, #90 and #131.

derhuerst avatar Nov 25 '19 09:11 derhuerst

PR welcome!

derhuerst avatar Nov 25 '19 09:11 derhuerst

related: The Deutsche Bahn official Timetable API docs have codes on the last 2 pages.

derhuerst avatar Sep 16 '20 18:09 derhuerst