Extract trenitalia coach number from the barcode instead of using regular expressions on the pdf
Needs ReviewPublic

Authored by ddomenichelli on Sep 10 2019, 9:05 AM.



Instead of using regular expressions on the pdf, extract the coach from the barcode that is stored as a 4 bit unsigned int in bits 30:6-31:1

Diff Detail

R1003 KItinerary: Travel Reservation handling library
trenitalia_coach_number (branched from master)
No Linters Available
No Unit Test Coverage
Build Status
Buildable 16308
Build 16326: arc lint + arc unit
ddomenichelli requested review of this revision.Sep 10 2019, 9:05 AM
ddomenichelli created this revision.

From all the samples that I was able to find, the only ones that do not match are the ones in Coach "11", where this area contains "1". All the other barcodes match. I think this could correspond to the less significant digit, and that the most significant one might be encoded somewhere else. I don't think there is any train that has more that 19 coaches, therefore this digit could be encoded in just one bit. I have a candidate (30:4), this matches with all my samples, but I don't have enough 2-digits-coach ticket to validate this hypothesis. Also I could not understand the meaning of bit 30:5 (that would be between the most significant digit and the last one)

Retried this with more samples: using 30:4 or even 30:3-30:4 for the second digit of the coach number on top of this yields correct results. However, this would mean coach number 9 cannot be represented, which seems very weird. 30:5 would be the natural place for that, but that's '1' for most of my small coach number samples.