Skip to content

feat: add transfer risk logic - #62

Merged
reidzeibel merged 2 commits into
mainfrom
ridwan/interchange-risk
Sep 3, 2026
Merged

feat: add transfer risk logic#62
reidzeibel merged 2 commits into
mainfrom
ridwan/interchange-risk

Conversation

@reidzeibel

Copy link
Copy Markdown
Member

Part of https://github.com/AtB-AS/kundevendt/issues/24416

This will add interchange risk rule function, which will be used by both BFF and Planner-Web, while the App consumes the data from BFF.

Comment thread src/interchange-risk/types.ts Outdated
Comment on lines +2 to +5
export const InterchangeRisk = {
Uncertain: 'uncertain',
Unlikely: 'unlikely',
} as const;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit of using const value objects instead of just using union types?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was thinking that we can use InterchangeRisk.Uncertain with the const instead of union types, and const keeps the value in runtime?

* Classifies the gap between arriving and the next departure. Zero counts as
* uncertain; a non-finite gap yields undefined.
*/
export const getInterchangeRisk = (

@gorandalum gorandalum Sep 3, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like generally using the term transfer instead of interchange would be beneficial, since this logic doesn't just apply when there are interchanges?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is called interchange because it was "overgang", and I was thinking we already have "korrespondanse" for guaranteed interchange.

I'll just rename it 👍🏼

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think transfer is more fitting, it is the term Entur uses for this, for example in parameters like transferSlack and transferPenalty.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed everything to transfer, except interchangeTo since it is Entur keyword

@reidzeibel reidzeibel changed the title feat: add interchange risk logic feat: add transfer risk logic Sep 3, 2026
@reidzeibel
reidzeibel merged commit 835bd75 into main Sep 3, 2026
2 checks passed
@reidzeibel
reidzeibel deleted the ridwan/interchange-risk branch September 3, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants