Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Merging multiple variations of a serial number

by Anonymous Monk
on Jul 28, 2022 at 15:33 UTC ( [id://11145817]=note: print w/replies, xml ) Need Help??


in reply to Merging multiple variations of a serial number

I do not believe the use of JSON as a serialization format should influence your choice of internal data structures. Nor should you assume that the data structures you use to sort this mess out are the ones you want to serialize.

If you could fully parse all the forms this would be easy. The problem is the 13-digit one. This one can probably be disambiguated if you can compute the check digit from the core serial. The problem is that 1/10 chance that the serial could be read both ways.

What I think I would try first is building two hashes. One would be keyed by core serial and contain all the variants that were found of it (including fact that the core variant was found). The other would simply record 13-digit serials that can not be disambiguated. Once you have all the core serials you can make a pass through the 13-digit serials and try to match them up. Important: your code should check for the case that one of these 13-digit serials can not be disambiguated even after all core serials are known, and complain mightily about all such found.

  • Comment on Re: Merging multiple variations of a serial number

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145817]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-26 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found