This library will validate journeys against British Rail fares using the restrictions data from DTD.
The rules around journey/fare validity are very specific to British rail and are not useful for other data sets.
The main outputs from this library are the repositories for loading restrictions and the filters that can be applied. The following filters are available:
-
FareLocationFilter
checks the journey origin/destination is valid for the fare -
OperatorFilter
checks the journey has the necessary operators for the fare (TOC specific tickets) -
RouterFilter
checks the journey follows a path that is valid for the route code -
RestrictionFilter
checks the journey against the time and train restrictions -
CrossLondonFilter
checks fares for cross London journeys have the cross London marker set or go to a zonal location -
FareClassFilter
ensures first class fares are only available on trains with first class -
GeographicalRailcardRestrictionFilter
applies additional restriction codes for certain railcards (e.g. SRN, FAM) in certian areas.
The JourneyFareValidator
provides an interface to validate outward and return journeys.
npm test
Issues and PRs are very welcome.
This software is licensed under GNU GPLv3.
Copyright 2018 Linus Norton.