ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/RandomCodeRequests/Narco_reqs.txt
Revision: 494
Committed: Thu Dec 19 17:01:14 2013 UTC (12 years, 3 months ago) by nino.borges
Content type: text/plain
File size: 2717 byte(s)
Log Message:
code changed

File Contents

# User Rev Content
1 nino.borges 480 """ In this project, I was asked to compare teh ssn column to two ssn columns in a separate sheet.
2     I also had to normalize the ssn to look for hyphens"""
3    
4     >>> contents = open(r"W:\Manny\Client\Narco\Acclaim New File for OST10242013\Acclaim New File for OST10242013.txt").readlines()
5     >>> masterList = []
6     >>> for line in contents:
7     ... line = line.replace("\n","")
8     ... line = line.split("\t")
9     ... ssn1 = line[10]
10     ... ssn2 = line[11]
11     ... ssn1 = ssn1.replace("-","")
12     ... ssn2 = ssn2.replace("-","")
13     ... if ssn1 == ssn2:
14     ... masterList.append(ssn1)
15     ... else:
16     ... masterList.append(ssn1)
17     ... masterList.append(ssn2)
18     ...
19     >>> len(masterList)
20     231683
21    
22    
23     contents = open(r"W:\Manny\Client\Narco\PEC_Internal_Report for 1125 CRMC claims - UAT 11.5.2013.txt").readlines()
24    
25     checkList = []
26    
27     outputFile = open(r"W:\Manny\Client\Narco\PEC_Internal_Report for 1125 CRMC claims - UAT 11.5.2013_Output.txt",'w')
28    
29     >>> for line in contents:
30     ... line = line.replace("\n","")
31     ... ssn = line.split("\t")[3]
32     ... if ssn in masterList:
33     ... outputFile.write(line + "\tYES\n")
34     ... else:
35     ... outputFile.write(line + "\tNO\n")
36     ...
37 nino.borges 494 >>> outputFile.close()
38    
39    
40     """ In this one, she wanted me to cross ref an access table with an excel. (Excel converted to tab delm but access
41     I left in mdb, since exporting was super messy."""
42    
43     import os,sys, win32com.client
44     >>> daoDB = daoEngine.OpenDatabase(r"W:\Manny\Client\Narco\Summation.mdb")
45     >>> daoRSObj = daoDB.OpenRecordset("SELECT SUM_SSN FROM Summation")
46     >>> daoRSObj.MoveLast()
47     >>> fullCount = daoRSObj.RecordCount
48     >>> daoRSObj.MoveFirst()
49     >>> newList = []
50     >>> for i in range(fullCount):
51     ... newList.append(daoRSObj.Fields('SUM_SSN').Value)
52     ... daoRSObj.MoveNext()
53     ...
54     >>> daoRSObj.Close()
55     >>> len(newList)
56     138407
57     >>> newList.sort()
58     >>> fullList = []
59     fullList = []
60     >>> for i in newList:
61     ... if i:
62     ... if i == "0":
63     ... pass
64     ... else:
65     ... fullList.append(str(i))
66     ...
67     >>> len(fullList)
68     82527
69     >>> fullList.append('363107041')
70     >>> fullList.append('464528121')
71     >>> fullList.sort()
72     >>> fullList[400]
73     '035207139'
74    
75     >>> contents = open(r"W:\Manny\Client\Narco\20131105_Request\PEC_Internal_Report for 1125 CRMC claims - UAT 11.5.2013.txt").readlines()
76     >>> masterMatrix = {}
77     >>> for i in contents:
78     ... parts = i.split("\t")
79     ... masterMatrix[parts[3]] = i
80     ...
81     >>> len(masterMatrix.keys())
82    
83     headder = contents[0]
84     >>> outputFile = open(r"W:\Manny\Client\Narco\20131105_Request\PEC_Summation_Crossref_output.txt",'w')
85     >>> outputFile.write(headder)
86     >>> for ssn in fullList:
87     ... if ssn in masterMatrix.keys():
88     ... outputFile.write(masterMatrix[ssn])
89     ...
90     >>> outputFile.close()