ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Redgrave/Amazon-PastFlaggedNamesCheck.py
Revision: 840
Committed: Fri Dec 6 21:46:10 2024 UTC (15 months, 2 weeks ago) by nino.borges
Content type: text/x-python
File size: 2721 byte(s)
Log Message:
This very simple program will attempt to locate, using just first name and last name, any names that have been flagged in the past as non-attorneys.

File Contents

# Content
1 """
2
3 Amazon-PastFlaggedNamesCheck
4
5 Created by:
6 Emanuel Borges
7 12.3.2024
8
9 This very simple program will attempt to locate, using just first name and last name, any names that have been flagged in the past as non-attorneys.
10
11 """
12
13
14 def PerformFullFieldSearch(lastName, firstName, line, outputFileObj):
15 """Once a line is confirmed to have a particular name, this function will do the deeper field by field search."""
16 lineMatchFlag = False
17 line = line.split("|")
18 for field in line:
19 itemsInField = field.split(";")
20 for singleItem in itemsInField:
21 if lastName in singleItem:
22 #print("match")
23 if "*" in singleItem:
24 #print("match")
25 #print(firstName[:2], lastName)
26 if f"{firstName[:2]}" in singleItem:
27 #print("match")
28 lineMatchFlag = True
29 if lineMatchFlag == True:
30 outputFileObj.write(f"{firstName} {lastName} could be in:|{'|'.join(line)}\n")
31
32
33
34 if __name__ == '__main__':
35 cleanedDatExportFileName = r"C:\Users\eborges\OneDrive - Redgrave LLP\Documents\Cases\Amazon\_PrivLogQCProcess\Data Exports\VEAS\VEAS_Log_Data_Export_Converted.txt"
36 #cleanedDatExportFileName = r"C:\Users\eborges\OneDrive - Redgrave LLP\Documents\Cases\Amazon\_PrivLogQCProcess\20241202 - FTC-CID\PLOG All IDs (20241203)\PLOG All IDs (20241203)_Converted_SubSetOnly.txt"
37 pastIncorrectNamesFileName = r"C:\Users\eborges\OneDrive - Redgrave LLP\Documents\Cases\Amazon\_PrivLogQCProcess\PastIncorrectNames.txt"
38 #outputFile = open(r"C:\Users\eborges\OneDrive - Redgrave LLP\Documents\Cases\Amazon\_PrivLogQCProcess\20241202 - FTC-CID\PLOG All IDs (20241203)\PotentialIssuesFound.txt",'w', encoding = 'UTF-8')
39 outputFile = open(r"C:\Users\eborges\OneDrive - Redgrave LLP\Documents\Cases\Amazon\_PrivLogQCProcess\Data Exports\VEAS\PreviousFlaggedNameCheck.txt",'w', encoding = 'UTF-8')
40
41
42 pastIncorrectLastNamesList = []
43 contents = open(pastIncorrectNamesFileName).readlines()
44 for line in contents:
45 line = line.replace("\n","")
46 line = line.split(" ")
47 pastIncorrectLastNamesList.append((line[0].upper(),line[-1].upper()))
48
49 contents = open(cleanedDatExportFileName, encoding = 'UTF-8').readlines()
50 for line in contents:
51 line = line.replace("\n","")
52 line = line.upper()
53 for fullName in pastIncorrectLastNamesList:
54 firstName, lastName = fullName
55 if lastName in line:
56 #print("match")
57 PerformFullFieldSearch(lastName, firstName, line, outputFile)
58
59 outputFile.close()