Hi Linus,
Sorry for not replying; I must have missed your other message. This is
very complicated stuff and I wouldn't 100% trust the public version of
the librailfare code on what it does here; my understanding of how this
all works has gradually evolved over the years and still occasionally
tweaks are needed.
I haven't read that code again recently but as I said above please tread
carefully; it may be wrong. For some fares you do need to add on the
value shown - it compensates for the fact that a railcard or child
discount may only be available on the National Rail part of the journey
but not on the add-on part (e.g. inclusive admission to an attraction,
or travel by ferry, bus etc.).
> My understanding is that some ticket type codes cannot have a
> railcard applied to them (e.g. FOS or FOR tickets). I originally
> thought that there would be something in the fares feed to indicate
> whether a ticket type could have a railcard applied to it but I
> haven't found anything. My next instinct was that the ticket type
> discount category would not have a corresponding status discount for
> any railcard status. Looking at the data FOS has a discount category
> of "01" which has some corresponding records for status code "003"
> (YNG railcard). I might be wrong but I didn't think YNG railcards
> could be applied to first class tickets. My question is how can I
> know what railcards can be applied to what ticket types?
It sounds very much to me that you have got the general principle right
here. You maybe just need to look at how the discount category and the
status discount records interact, and check you've got that right. Two
interesting railcard codes to try for this are D34 and D50, which are
available for passengers travelling in a wheelchair who need to remain
in it for the journey. They can sometimes offer a better discount than a
disabled railcard but the list of fares they apply to is esoteric. Some
of the local railcards (Highland comes to mind, possibly also Cambrian
or Cotswold) offer unusual discount percentages across different ticket
types.
> In what circumstances would you use a non standard discount as
> opposed to a non-derivable fare? I thought a NDF was basically used
> to manually set a fare price when applying a railcard. Non-standard
> discounts seem complex in comparison and I of thought the same thing
> could be achieved using NDFs.
It's hard to know when non-standard discount records should be applied.
There is a flag in the flow record that says when they should be, but
then there are records in the non-standard discounts file that clearly
are intended to be used (some Manchester Metrolink fares, for example,
which are very restrictive about the railcard discounts they allow) but
the relevant flows don't have the flag set. It's all just a big mess,
really.
Interesting also what you said about the missing manual. I suspect there
is some "green screen" mainframe interface somewhere that contains the
definitive logic for how the records are supposed to interact, but that
nobody has ever extracted it and documented it. My understanding is that
all the data files in the fares feed (with the possible exception of the
NFO file) are extracted from the mainframe system - but it's then left
up to each ticket system supplier to define their own logic for how to
interpret the data!
Paul