Dear monks,
I am trying to organise a number of lists of item serial numbers (stored in a small number of files). The problem I have is each unit can have up to 5 variations of it's serial number stored across the multiple files (poorly designed system but there we go). Let me provide an example below:
012212316000140 = Full 15 digit serial. This comprises of month and year (0122), core serial (1231600014), check digit (0)
01221231600014 = 14 digit version (minus the last check digit)
2212316000140 = 13 digit version 1 (minus the leading 2 month digits but including the last check digit)
1221231600014 = 13 digit version 2 (minus the leading zero for the month and minus the check digit). These entries would need to be corrected to add the leading zero and therefore become the 14 digit version
221231600014 = 12 digit version (minus both leading month and last check digit)
1231600014 = 10 digit version (just the core serial)
As you can see this is a nightmare and different areas use different versions of the serial. My first step is to try and make a hash using the base 10 digit serial as the key, and then have key value pairs for each of it's possible forms. For example:
{ '1231600014' => { '15' => '012212316000140', '14' => '01221231600014' } }
The other option which might be easier to manage within a JSON file is to store each core serial along with it's leading month and year, and check digit as seperate keys for example
{ '1231600014' => { 'check' => '0', 'month' => '01', 'year' => '22' } }
The main thing that is giving me a headache is processing each serial and working out if we already have an entry for it, as well as valid entries for each possible form
Any assistance would be greatly appreciated. I fear I am overcomplicating this in my head. I'm happy to provide more information and clarity if required
Thanks!
In reply to Merging multiple variations of a serial number by Doozer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |