ISFDB talk:Bad ISBN List

From ISFDB
Jump to navigation Jump to search

Here is the python function used to generate the bad ISBN list:

def CheckISBNs():
       query = "select pub_isbn from pubs where pub_isbn is not NULL"
       db.query(query)
       result = db.store_result()
       record = result.fetch_row()
       while record:
               isbn = record[0][0]
               try:
                       if isbn[0] != '#':
                               isbn = string.replace(isbn, '-', )
                               isbn = string.replace(isbn, ' ', )
                               if len(isbn) != 10:
                                       print "* ISBN, bad length:", isbn
                               else:
                                       counter = 0
                                       sum = 0
                                       mult = 1
                                       while counter < 9:
                                               sum += (mult * int(isbn[counter]))
                                               mult += 1
                                               counter += 1
                                       remain = sum % 11
                                       if remain == 10:
                                               if int(isbn[9]) != 'X':
                                                       isbn2 = isbn
                                                       isbn2[9] = 'X'
                                                       print "* Bad Checksum=%s Corrected=%s" % (isbn, isbn2)
                                       else:
                                               if int(isbn[9]) != remain:
                                                       isbn2 = '%s%d' % (isbn[0:9], remain)
                                                       print "* Bad Checksum=%s Corrected=%s" % (isbn, isbn2)
               except:
                       pass
               record = result.fetch_row()

Length as test?

Back in May, we talked about taking the "#" out of the catalog numbers. If we are going to do that, then I'd assume we can't use the length test as you have it here? I see you test for that "#"; I have been deleting that as I edit existing pubs. Mike Christie (talk) 13:56, 18 Dec 2006 (CST)

FWIW - Not too long ago Amazon did exactly this (I can pin down a more precise date if there's interest) in that they "corrected" all of the ISBNs in their system to have the correct checksum. I suspect they lost more than they gained as most of the ISBNs were probably wrong somewhere before the checksum than in the checksum itself.
I believe rather than just correcting the ISBNs that it would be helpful to indicate in the publication record that the ISBN’s checksum is wrong. This would give someone verifying the record a heads-up to double check the ISBN and perhaps to add a note that yes, it’s printed wrong in the book. I’m not even sure I’d show the ISBN with the corrected checksum because I would not want someone without a copy of the book to be “helpful” and to just copy/paste the “correct” ISBN into ISFDB.
I personally would like to see the ISBNs displayed with hyphens. It is painful for me to verify an unformatted 10 character string (not to mention ISBN13). As it is, I had a 30+ minute conversation this week with a store’s customer service rep because my “In-Store Customer Alternate ID,” aka my phone number, was formatted without hyphens and the customer service rep. could not see anything wrong with it despite my insistence that it was wrong and that I could not sign in when at their stores. After she let me into the web site it took a bit of staring before I realized my own phone # was wrong by one digit. Marc Kupper 20:37, 18 Dec 2006 (CST)