ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Evidox/GapReport.py
Revision: 746
Committed: Thu Apr 15 20:11:16 2021 UTC (4 years, 11 months ago) by nino.borges
Content type: text/x-python
File size: 1408 byte(s)
Log Message:
Updated to be compatible with python3, which made the bak files.

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 nino.borges 717 #import sys
15     #sys.path.append(r"C:\\Users\\eborges\\Dropbox\\NinoCode\\Active_prgs\\Summation\\Summation_functions")
16 nino.borges 665
17 nino.borges 717 import BatesRangeFunctions
18 nino.borges 665
19     if __name__ == '__main__':
20     batesMatrix = {}
21 nino.borges 717 datFile = r"C:\Temp\Lee-Mercer\LeeRoomTest-BAD.dat"
22 nino.borges 665
23     ## Grab the begno and endno fields, starting with 0 place
24 nino.borges 717 begNoColumn = 2
25     endNoColumn = 3
26 nino.borges 665
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 nino.borges 746 begBatesList = list(batesMatrix.keys())
41 nino.borges 665 begBatesList.sort()
42    
43     endNoBuffer = ""
44     for begBates in begBatesList:
45     if endNoBuffer:
46 nino.borges 717 pageGap = BatesRangeFunctions.EnumerateBates(endNoBuffer, begBates)
47 nino.borges 665 if len(pageGap) > 2:
48 nino.borges 746 print("A %d page gap exists between EndNo of %s and BegNo of %s"% (len(pageGap),endNoBuffer, begBates))
49 nino.borges 665 endNoBuffer = batesMatrix[begBates]
50     else:
51     endNoBuffer = batesMatrix[begBates]