ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/HW_IproExtract_B.py
Revision: 584
Committed: Thu Mar 26 13:53:01 2015 UTC (11 years ago) by nino.borges
Content type: text/x-python
File size: 2479 byte(s)
Log Message:
update before leaving

File Contents

# User Rev Content
1 nino.borges 584 """
2     HW_IproExtract
3    
4     This program will take a list of bates that we already have and compare it to a lfp from an ipro proj.
5     it will export a dat in 200k chunks for those that are in the ipro but you dont already have.
6    
7     """
8    
9     import os
10    
11     def writeValues(theList,fileCount):
12     print "200k threshold reached. writing values..."
13     filePath = r"C:\Users\eborges\Box Sync\Client\Honeywell\HOBX\Microfilm_Irrl_Export_Proj\Loads_B"
14     fileName = "load_%s"%fileCount
15     outputFile = open(os.path.join(filePath,fileName),'w')
16     for i in theList:
17     outputFile.write(i+"\n")
18     outputFile.close()
19     fileCount = fileCount+1
20     print "Values written to %s. Done."%fileCount
21     return [], fileCount
22    
23    
24    
25     if __name__=='__main__':
26     iproFilePath = r"C:\Users\eborges\Box Sync\Client\Honeywell\HOBX\Microfilm_Irrl_Export_Proj\MicroficheLFPexports\37354040_MICROFICHE_REVIEW.lfp"
27     concordanceFilePath = r"C:\Users\eborges\Box Sync\Client\Honeywell\HOBX\Microfilm_Irrl_Export_Proj\Concordance\batesList.txt"
28     kpmgFilePath = r"C:\Users\eborges\Box Sync\Client\Honeywell\HOBX\Microfilm_Irrl_Export_Proj\KPMG\kpmgList.txt"
29    
30     existingList = []
31     iproList = []
32     toBeDoneList = []
33     docCount = 0
34     fileCount = 0
35    
36    
37     print"Now creating existing list from Concordance set..."
38     contents = open(concordanceFilePath).readlines()
39     for i in contents:
40     i = i.replace("\n","")
41     existingList.append(i)
42    
43     print "Done."
44     print "Now adding KPMG set to exisitng list..."
45     contents = open(kpmgFilePath).readlines()
46     for i in contents:
47     i = i.replace("\n","")
48     existingList.append(i)
49    
50     print "Done."
51     print "Now creating Ipro list..."
52     contents = open(iproFilePath).readlines()
53     for line in contents:
54     line = line.split(",")
55     bates = line[1]
56     docQl = line[2]
57     if line[2] == "D":
58     iproList.append(bates.upper())
59     print "Done."
60     print "There are %s existing files and %s files in ipro."%(len(existingList),len(iproList))
61     print "Reversing the file."
62     iproList.reverse()
63     print "Now gathering diff..."
64     for x in iproList:
65     if x in existingList:
66     pass
67     else:
68     toBeDoneList.append(x)
69     docCount = docCount+1
70     if docCount >200000:
71     toBeDoneList,fileCount = writeValues(toBeDoneList,fileCount)
72     docCount = 0