ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Evidox/GapReport.py
Revision: 665
Committed: Thu Dec 12 21:18:26 2019 UTC (6 years, 3 months ago) by nino.borges
Content type: text/x-python
File size: 1390 byte(s)
Log Message:
Simple program for detecting gaps in bates number lists

File Contents

# User Rev Content
1 nino.borges 665 """
2    
3     GapReport
4    
5     Created by
6     Emanuel Borges
7     04.27.2018
8    
9     Simple program for detecting gaps in a list of bates number sets (BegNo, EndNo)
10    
11     Covert Unicode to ASCII first!
12    
13     """
14     import sys
15     sys.path.append(r"C:\\Users\\eborges\\Dropbox\\NinoCode\\Active_prgs\\Summation\\Summation_functions")
16    
17     import FixBatesRange_func
18    
19     if __name__ == '__main__':
20     batesMatrix = {}
21     datFile = r"C:\Test-PY\Bielins-1-Export.dat"
22    
23     ## Grab the begno and endno fields, starting with 0 place
24     begNoColumn = 1
25     endNoColumn = 2
26    
27     delim = '\x14'
28     quoteChar = '\xfe'
29    
30     contents = open(datFile).readlines()
31     for line in contents[1:]:
32     line = line.replace("\n","")
33     line = line.replace(quoteChar, "")
34     line = line.split(delim)
35     begNo = line[begNoColumn]
36     endNo = line[endNoColumn]
37     batesMatrix[begNo] = endNo
38    
39    
40     begBatesList = batesMatrix.keys()
41     begBatesList.sort()
42    
43     endNoBuffer = ""
44     for begBates in begBatesList:
45     if endNoBuffer:
46     pageGap = FixBatesRange_func.EnumerateBates(endNoBuffer, begBates)
47     if len(pageGap) > 2:
48     print "A %d page gap exists between EndNo of %s and BegNo of %s"% (len(pageGap),endNoBuffer, begBates)
49     endNoBuffer = batesMatrix[begBates]
50     else:
51     endNoBuffer = batesMatrix[begBates]