def attributesOnlineBillPay(p2, p4, transList): transAction = "" transSource = "" transDestination = "" transDescription = "" transCategory = "" print("\t", "billPay: transList=", transList) #Step 1: determine transSource and transDestination Values # transAction = transList[p2] + " " + transList[p2+1] + " " + \ transList[p4] transSource = varG.headerList[0] + " " + varG.headerList[3] p1 = "middle" p2 = +1 #p2 and p4 transList positions supplied by statement that invoked billpay method #p2 =s start and p4 =s stop transDestination = uETL.extractFromList(transList, p1, p2, p4) transCategory = uETL.getDictCategory(transDestination) if transAction == "": transAction = "Bill Pay" return transAction, transSource, transDestination, transDescription, \ transCategory
def extract_Social_Security(transList): extractValue1 = "" extractValue2 = "" p1 = "" p2 = 0 p4 = 0 #print("\n","\t","ssn: transList=",transList,"\n") #extractValue1 =s list values before wkValue transList[0] = "ssa1" p2 = transList.index("ssa") + 1 p1 = "right" #print("\t","\t","p1=",p1,"p2=",p2) extractValue2 = uETL.extractFromList(transList, p1, p2, p4) transList[0] = "ssa" p2 = transList.index("sec") + 1 transList = transList[:p2] p1 = "all" #print("\t","\t","p1=",p1,"p2=",p2) extractValue1 = uETL.extractFromList(transList, p1, p2, p4) #print("\t","ssn: extractValue1=",extractValue1," extractValue2=",extractValue2,"\n") return extractValue1, extractValue2
def determinePayReimb \ (transSource,transCategory,transDescription,transDate): #print('determinePayReimb: sql_outPRID=',sql_outPRID) global sql_outPRID yesPayer = False yesReimburser = False payer = "" reimburser = "" if varG.headerList[2] == 'Credit': payer, reimburser, yesPayer = \ uETL.getPayerAttributes(transSource,transDate) if yesPayer == True: transDescription = "pay for: " + payer \ + " and reimburse to: " + reimburser else: fP1 = transCategory.find("pay for") fP2 = transDescription.find("up jm savings") fP3 = transCategory.find("reimbursement") if fP1 >= 0 or fP2 >= 0: yesPayer = True payer = varG.headerList[0] + varG.headerList[3] listTC = transCategory.split(" ") reimburser = listTC[-1] elif fP3 >= 0: yesReimburser = True #if yesPayer == True: #print('determinePayReimb: payer=',payer,'reimburser=',\ # reimburser,'sql_outPRID=',sql_outPRID,\ # 'yesPayer=',yesPayer,'payer=',payer,'reimburser=',\ # reimburser,'transSource=',transSource,'transDescription=',\ # transDescription) return yesPayer, yesReimburser, payer, reimburser, transDescription
def __init__(self, iT_Lines): self.iT_Lines = iT_Lines fields = [] datePrevious = "" prevDate_Set = False #TransAnalysis setup variables descriptionTuple = () descriptionSet = set() #for loop iterates through variable lines that contains all input file data by lines for line in self.iT_Lines: #break description = "" descriptionList = [] if line == " ": break if line == '"': continue fields = line.split("\t") #date, amount, payee if fields[0] == "" or fields[0] == '"': continue #setUp headerList and starting sqlIDs via trans line with owner in fields[0] if str.isalpha(fields[0]): #header record varG.headerList = fields #hdrOwner = [0] # #hdrSource = [1] #hdrType = [2] #Debit or Credit #hdrAccount = [3] #Checking, Savings, Bank Card, Online Account #hdrAccountID = varG.headerList[0] + "-" + varG.headerList[1] \ # + "-" + varG.headerList[2] + "-" + varG.headerList[3] varG.studyOutList.append('\n' + 'owner=' + varG.headerList[0] + ' source=' + varG.headerList[1] + ' type=' + varG.headerList[2] + ' account=' + varG.headerList[3]) sql_outPRID = int(varG.recircInfoDict[varG.prRIKey][0]) if varG.headerList[2] == "Credit": prP.setPRGlobals(sql_outPRID) varG.tRIKey = varG.headerList[0] + '/' + varG.headerList[2] if varG.headerList[3] == 'Master Card': varG.tRILastRunLine = \ varG.recircInfoDict[varG.tRIKey][1] elif varG.headerList[3] == 'Visa Card': varG.tRILastRunLine = \ varG.recircInfoDict[varG.tRIKey][2] else: prSQL.setPRGlobals(sql_outPRID) print('varG.headerList=', varG.headerList) varG.tRIKey = varG.headerList[0] + '/' + varG.headerList[3] varG.tRILastRunLine = varG.recircInfoDict[varG.tRIKey][1] sql_outTransID = int(varG.recircInfoDict[varG.tRIKey][0]) tSQL.setOTGlobals(sql_outTransID) varG.studyOutList.append('\n' + 'tRILastRunLine=' + varG.tRILastRunLine) varG.studyOutList.append('\n' + 'sql_outTransID=' + str(sql_outTransID)) varG.studyOutList.append('\n' + 'sql_outPRID=' + str(sql_outPRID) + '\n') continue date = fields[0] #date: transform date into yyyy/mm/dd format with leading zeros for mm and dd ttDate = Date(date) transDate = ttDate.dateYearFirst #ensure trans line not previously loaded fields[0] = transDate p1 = 'all' p2 = 0 p4 = 0 chkLine = uETL.extractFromList(fields, p1, p2, p4) riLineL = varG.tRILastRunLine.split(' ') if fields[0] < riLineL[0]: #and fields[1] > riLineL[1]: print("\n",\ "****trans line already processed****",\ "\n","\t"," current=",fields[0],"\t",fields[1],\ "\t",fields[2], "\n","\t"," previous=",riLineL[0],"\t",riLineL[1], "\t",riLineL[2]) continue elif chkLine == varG.tRILastRunLine: print("\n","\n",\ "****trans line already processed****",\ "\n","\t"," current=",chkLine,"\n","\t",\ " previous=",varG.tRILastRunLine) continue else: varG.tRILastRunLine = chkLine #datePrevious = transDate #amount: # validation if fields[1] == "": continue amount = fields[1] # transformation ttAmt = Amount(amount) transAmount = ttAmt.amount #print('\n','transAmount=',transAmount) #description: description = fields[2] #add descriptionTuple to analysisOutSet descriptionTuple = description varG.analysisOutSet.add(descriptionTuple) #Location extract from description description = description.strip('"') description = description.rstrip() descriptionList = description.split(" ") #descriptionList = list(filter(None, descriptionList)) #print("description=",description) #print("descriptionList=",descriptionList) ttLoc = Location(description, descriptionList) transLocation = ttLoc.transLocation description = ttLoc.description descriptionList = ttLoc.descriptionList descriptionList = list(filter(None, descriptionList)) #??? #cleanse the description before creating descriptionList # if descriptionList == prev_DescriptionList: # payee = prev_payee # else: # description = UniversalB.cleanseDescription(description) # # prev_DescriptionList = descriptionList #Descriptors extract from description and transform #transAction, transSource, transDestination, transDescription \ ttDesc = Descriptors(description,descriptionList,\ transDate,transAmount,transLocation,fields) transAction = ttDesc.transAction transSource = ttDesc.transSource transDestination = ttDesc.transDestination transDescription = ttDesc.transDescription transCategory = ttDesc.transCategory opP.prepDriver(transDate,transAmount,\ transLocation,transAction,transSource,\ transDestination,transDescription,\ transCategory,sql_outTransID) opP.postTransaction()
def setCreditCardAttributes(description,descriptionList,\ transDate,transAmount,transLocation): varG.studyOutList.append("\n" + "\t" + \ " setCreditCardAttributes-S: description=" + description + \ " descriptionList=" + str(descriptionList) + \ " transDate=" + transDate + " transAmount=" + str(transAmount) + \ " transLocation=" + transLocation) #print('\n','varG.headerList=',varG.headerList) sourceSet = "" #Start of setCreditCardAttributes -->Driver Logic<-- #print("\n", "descriptionList=",descriptionList) useZvalues = "" setActions = "" transAction = "" transSource = "" transDestination = "" transDescription = "" transCategory = "" # Owner - [0] Bank - [1] Type - [2] Account - [3] transOwner = varG.headerList[0] transAccount = varG.headerList[3] transSourceList = [] transSourceLast = "" splitPos = 0 #if hdrType = "Credit": updatePayReimbTupleList = [] #print("\n","\n","\t","CrCard --->S: descriptionList=",descriptionList,\ # "\n","\t"," transAction=",transAction," transSource=",\ # transSource," transDestination=",transDestination, \ # " transDescription=",transDescription, " transOwner=",transOwner,\ # " transLocation=",transLocation,"\n") for z, iValue in enumerate(descriptionList): #print("\n","\n"," z=",z," iValue =",iValue ) countUse = 0 useValue = "" sourceSet = "" setActionList = ["", ""] iValue = iValue.lower() # When first z in list the zValue is evaluated for determining only # transSource only list value # useValue, sourceSet, countUse = return values for building tranSource if z == 0: useValue, sourceSet, countUse = dCR.First_iValue_Check(iValue,\ description) varG.studyOutList.append("\n" + "\t" + \ " setCreditCardAttributes-z-" + str(z) + ": iValue=" + iValue + \ " useValue=" + useValue + " sourceSet=" + sourceSet + \ " countUse=" + str(countUse)) if sourceSet != "": transSource = useValue setActionList = sourceSet.split("-") useZvalues = str(z) setActions = setActions + " " + str(z) + "," \ + str(setActionList[1:]) #print("\n","\t","--->0: setActionList[0]=",setActionList[0],\ # "useValue=",useValue," transSource=",transSource) if setActionList[0] == "break": break if setActionList[0] == "continue": continue #elif setActionList[0] == "reject": # continue elif z <= 3: useValue, sourceSet, countUse = dCR.Second_iValue_Check(iValue,\ transSource) if sourceSet != "": setActionList = sourceSet.split("-") useZvalues = useZvalues + " " + str(z) setActions = setActions + " " + str(z) + "," \ + str(setActionList[1:]) transSource = transSource + " " + useValue #print("\n","\t","--->1: setActionList[0]=",\ # setActionList[0],"useValue=",useValue,\ # " transSource=",transSource) if setActionList[0] == "break": break if setActionList[0] == "continue": continue #elif setActionList[0] == "reject": # continue varG.studyOutList.append("\n" + "\t" + \ " setCreditCardAttributes-z-" + str(z) + ": iValue=" + iValue + \ " useValue=" + useValue + " sourceSet=" + sourceSet + \ " countUse=" + str(countUse)) #--> wrapup attribute setting by creating necessary return variables #--> necessary prep #transAmount = float(transAmount) * -1 #--> analysis requires conversion to varG.studyOutList.append("\n" + "\t" + \ " setCreditCardAttributes-M: transSource=" + transSource + \ " sourceSet=" + sourceSet) transSource = transSource.lstrip(" ") transSource = transSource.rstrip(" ") transSourceList = transSource.split(" ") transSourceLast = transSourceList[-1].lower() transSourceLast = transSourceLast.strip() #print("\n","\n","\t","transSourceList=",transSourceList,"\n","\n",\ # " transSourceLast=",transSourceLast,"\n"," lastDropList=",\ # varG.lastDropList,"\n","\n") if transSourceLast in varG.convertContinueDict: transSourceList[-1] = varG.convertContinueDict[transSourceLast] p1 = "all" p2 = 0 p4 = 0 transSource = uETL.extractFromList(transSourceList, p1, p2, p4) #print("\t","-->sE1") elif transSourceLast in varG.lastDropList: splitPos = len(transSource) - len(transSourceList[-1]) #print("\t","transSourceLast=",transSourceLast," transSource=", # transSource," ",len(transSource),"-",\ # len(transSourceList[-1]),"-",splitPos) transSource = transSource[:splitPos] #print("\t","transSourceLast=",transSourceLast,\ # " transSource=",transSource,"\n","\n") transSource = transSource.lstrip(" ") transSource = transSource.rstrip(" ") transCategory = uETL.getDictCategoryByKey(transSource) varG.studyOutList.append("\n" + "\t" + \ " setCreditCardAttributes-M: transSource=" + transSource + \ " transCategory=" + transCategory) #print("\n","\t", \ # " transAction=",transAction," transSource=",transSource,\ # " transDestination=",transDestination," transDescription=",\ # transDescription," transCategory=",transCategory, \ # " transOwner=",transOwner," transCategory=",transCategory,\ # " transOwner=",transOwner," transLocation=",transLocation,\ # " transAccount= ", transAccount) print1 = description.ljust(120, " ") print2 = transAction.ljust(30, " ") print4 = transSource.ljust(40, " ") print5 = transDescription.ljust(40, " ") print6 = transCategory.ljust(30, " ") print7 = transOwner.ljust(20, " ") print8 = transLocation.ljust(20, " ") print9 = transAccount.ljust(40, " ") outLine = "\t" + " in-" + str(print1) + " " + str(transAmount) + "\t" + "\t" + "Act= " + str(print2) + "\t" + "\t" + "\t" + \ "Sour/Dest= " + str(print4) +"\t" + "\t" + "\t" + "Desc= " + str(print5) + \ "Cat= " + str(print6) + "Owner= " + str(print7) + "Loc= " + str(print8) + "Acct= " + str(print9) + "\n" outLine2 = str(description) + "\t" + str(transDate) + "\t" + str(transAmount) + "\t" + str(transAction) + "\t" + str(transSource) + \ "\t" + str(transSource) + \ "\t" + str(transDescription) + "\t" + str(transCategory) + "\t" + str(transOwner) + "\t" + str(transLocation) + \ "\t" + str(transAccount) + "\n" #transStudy.write(outLine2) return transAction, transSource, transDestination, transDescription, transCategory
def extract_Visa_Location(descriptionList): self.descriptionList = descriptionList saveDescriptionList = self.descriptionList nSL = 0 nLI = 0 iLL = 0 fP = 0 iL = 0 iState = "" oL = len("ovilla") rL = len("red") lvList = [] iValue = "" iL = 0 cityFirstofTwoList = ["cedar","red","glenn","waxahachie",\ "dallas","college","san"] cityCheckConvertDict = {"sta":"station","stat":"station",\ "stati":"station"} cityLastofTwoList = ["oak"] valueRejectStopList = ["oil", "qt", "ach", "inc"] embedList = ["tx","denton","austin","duncanville","carrollton",\ "waxahachie","karnes","floresville"] #establish the number of indexes within list nSL = len(self.descriptionList) - 1 #print("\n","\t","start: nSL=",nSL," self.descriptionList =",\ # self.descriptionList ) iSL = nSL #extract from uncleansed List descLSP = 0 while iSL > 0: if self.descriptionList[iSL] != "": iValue = self.descriptionList[iSL] iValue = str.lower(iValue) #print('01') #convert iValue to the correct value for city before remainig checks if iValue in cityCheckConvertDict: iValue = cityCheckConvertDict.get(iValue) #print('02') #print('nLI=',nLI,'iSL=',iSL,' nSL=',nSL,' iValue=',\ # iValue,' self.transLocation=',self.transLocation) elif len(iValue) > 2: fP = -1 fPcnt = 0 #print('nLI=',nLI,'iSL=',iSL,' nSL=',nSL,' iValue=',\ # iValue,' self.transLocation=',self.transLocation) for x, y in enumerate(embedList): fP = iValue.find(y) #print('y=',y,'fP=',fP) if fP >= 0: self.transLocation = y + " " + self.transLocation descLSP = iSL #print('02b') fPcnt += 1 #print('fPcnt=',fPcnt,'nLI=',nLI,'iSL=',iSL,' nSL=',nSL,\ # ' iValue=',iValue,' self.transLocation=',\ # self.transLocation) if fPcnt > 0: if len(iValue) > 2: break else: iState = iValue nLI = 1 iSL -= 1 continue else: y = 1 #print('nLI=',nLI,'iSL=',iSL,' nSL=',nSL,' iValue=', \ # iValue,' self.transLocation=',self.transLocation) else: iValue = self.descriptionList[iSL] #print('02d') #print('nLI=',nLI,'iSL=',iSL,' nSL=',nSL,' iValue=',iValue,\ # ' self.transLocation=',self.transLocation) iSL -= 1 continue #First Check going right to left list values if iSL == nSL: iL = len(iValue) if str.isalpha(iValue): #state abbreviation - zero or 1+ follows for transLocation if iL == 2: #to inform further checks of state placed in transLocation - no more that 2 more loads iState = iValue #state abbreviation placed in transLocation self.transLocation = iValue descLSP = iSL #print('1') else: #city 1 of 1 or 2, placed in transLocation self.transLocation = iValue descLSP = iSL #print('2') nLI = 1 iSL -= 1 continue #iValue is not valid - may want to break instead of continue - ???? else: #print('3') iSL -= 1 continue #remaining checks after First else: iL = len(iValue) if str.isalpha(iValue): if nLI == 1 and iState == "": # city double value check for indicating last value to place into transLocation if iValue in cityFirstofTwoList: self.transLocation = iValue + " " \ + self.transLocation descLSP = iSL nLI += 1 #print('4') break else: #print('5') #Location value set during First Check break elif nLI == 1 and iState != "": # state abbreviation in transLocation needing city self.transLocation = iValue + " " \ + self.transLocation descLSP = iSL nLI += 1 iSL -= 1 #print('6') continue elif nLI == 2: # city double value check for indicating last value to place into transLocation if iValue in cityFirstofTwoList: self.transLocation = iValue + " " \ + self.transLocation descLSP = iSL nLI += 1 #print('7') break else: #Location value set during First Check #print('8') break else: #transLocation is set #print('9') break else: #transLocation is set #print('10') break iSL -= 1 #print('11') self.transLocation = self.transLocation.rstrip(" ") self.transLocation = self.transLocation.lstrip(" ") if len(self.transLocation) == 2: iValue = str.lower(self.descriptionList[0]) if iValue in embedList: self.transLocation = iValue + " " + self.transLocation if self.transLocation != "": self.descriptionList = self.descriptionList[:descLSP] iValue = self.descriptionList[0] #print("\n","\t","iValue=",iValue) fP = iValue.find('"') #print('12') if fP >= 0: #value = -1 when not found fP = fP + 1 iValue = iValue[fP:] self.descriptionList[0] = iValue #print('13') #print("\n","\t","self.descriptionList[0]=",\ # self.descriptionList[0]," iValue=",iValue) #print('14') #print("\t","end: transLocation=",self.transLocation,\ # " self.descriptionList =",self.descriptionList) if self.transLocation in varG.crCardLocationRejectList: self.descriptionList = saveDescriptionList self.transLocation = "" else: self.transLocation = uETL.cleanLocation(self.transLocation) return self.transLocation, self.descriptionList
def extract_Master_Location(description): self.description = description locationDict = {"6463":"Red Oak Tx", \ "EDAR":"CEDAR","OLLEGE":"COLLEGE",\ "STATI":"STATION"} #print("\n","\t","Loc2: descriptionList=",descriptionList,\ # " description=",description) saveDescription = self.description self.transLocation = self.description[23:len(self.description)] self.description = self.description[:22] self.descriptionList = [] s_value = self.description.lstrip('"') self.descriptionList = s_value.split(" ") sl_len = len(self.descriptionList) - 1 varG.studyOutList.append("\n" + "\t" + \ " extract_Master_Location-S: transLocation=" + self.transLocation + \ " description=" + self.description + \ " descriptionList=" + str(self.descriptionList)) if sl_len > 0: #print("\n","\t","Loc2-a: self.descriptionList[0]=",self.descriptionList[0],\ # " self.descriptionList[1]=",self.descriptionList[1]) if self.descriptionList[0].isnumeric(): #print("\n","\t","Loc2-b: self.descriptionList[0]=",self.descriptionList[0]) if self.descriptionList[0] in locationDict: #print("\n","\t","Loc2-c: self.descriptionList[1]=",self.descriptionList[1]) if self.descriptionList[1] == "Dominos": #print("\n","\t","Loc2-d: locationDict[self.descriptionList[0]=",\ # locationDict[self.descriptionList[0]]) self.transLocation = locationDict[ self.descriptionList[0]] tl_list = [] tl_list = self.transLocation.split(" ") tl_len = len(tl_list) - 1 if not tl_list[0].isalpha(): if tl_len > 0: self.transLocation = uETL.extractFromList \ (tl_list,"right",1,0) else: self.transLocation = "" else: for x, y in enumerate(tl_list): if y in locationDict: tl_list[x] = locationDict[y] if tl_len > 0: self.transLocation = uETL.extractFromList\ (tl_list,"all",0,0) else: self.transLocation = tl_list[0] if self.transLocation in varG.crCardLocationRejectList: self.description = saveDescription self.transLocation = "" else: self.transLocation = uETL.cleanLocation(self.transLocation) varG.studyOutList.append("\n" + "\t" + \ " extract_Master_Location-E: transLocation=" + self.transLocation + \ " description=" + self.description + \ " descriptionList=" + str(self.descriptionList)) return self.transLocation, self.descriptionList, self.description
def setCheckingAttributes(self): global hdrSource global hdrOwnerAccount global description global descriptionList global transDate global transAmount global transLocation global transAction global transSource global transDestination global transDescription global transCategory global transOwner global transAccount lLen = 0 debitAttributeList = [] transList = [] transSource_Destination = "" transValue = "" fP1 = 0 fP2 = 0 fP3 = 0 fP4 = 0 fP5 = 0 fP6 = 0 fP7 = 0 fP8 = 0 fDeposit = "" p1 = "" p2 = 0 p3 = "" p4 = 0 amt_p1 = "" finalByPass = "" #class instantiation outStudy = Study() #-> set up #-> description split --> by "#" within value if it exists #-> creates a List with [0] and [1] if "#" debitAttributeList = description.split("#") #-> number of indexes obtained to determine if list is [0][1] or [0] # based on presence of split character "#" lLen = len(debitAttributeList) #-> [0] value converted to list for further interogation and use transValue = str(debitAttributeList[0]) transValue = transValue.rstrip(" ") transList = transValue.split(" ") varG.studyOutList.append("\n" + "->checking S: transDate=" + \ transDate + " transAmount=" + str(transAmount) + \ " description=" + description + \ " debitAttributeList=" + str(debitAttributeList) + \ " transValue=" + transValue + " transList=" + str(transList) + \ "\n") #-> deposit or withdraw determining factor #--> based on first position of transAmount #---> "-" value indicates withdraw (N) otherwise deposit #-> BRANCH --> not Negative ? ---> Yes --> Deposit ---> No ---> Withdraw amt_p1 = str(transAmount)[0] #--> first position value of transAmount if amt_p1 != "-": #--> not Negative ? #---> Yes ----> proceed with transactions that reflect a deposit "to" action #--> BRANCH ---> number of split List indeices > 1 #-----> Yes/No --> proceed with split type checks/actions based on index count if lLen > 1: #---> number of split List indeices > 1 -----> Yes #--> locates "ref" in [0] value for removal using slicing based on find position fP1 = debitAttributeList[0].find("ref ") fP2 = debitAttributeList[0].find("online transfer") fP3 = debitAttributeList[0].find("credit") if transList[0] == "edeposit" or transList[0] == "deposit": fDeposit = "yes" #print("\n","\t","--->P2: debitAttributeList[0]=",debitAttributeList[0]) #---> "ref" found ? ---> Yes ----> remove "ref" from [0] list value via splice #---> #[0] "ref" removed from [0] value #--> determined by find/position locate of value #--> not found will supply "" within attribute properties if fP1 >= 0 and fP2 >= 0: debitAttributeList[0] = debitAttributeList[0][:fP1] #print("\t","---->1: fP1=",fP1," debitAttributeList[0]=",debitAttributeList[0]) #----> [0] with removed "ref" #--> all attribute properties obtained through function #--> dDB.attributesOnlineTransfer(debitAttributeList) transAction, transSource, transDestination, \ transDescription, transCategory \ = dDB.attributesOnlineTransfer(transAmount, \ debitAttributeList) finalByPass = "******" numTransform = "\t" + "---->1:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #-----> "deposit" found? ------> Yes ------->DEPOSIT MADE IN A BRANCH/STORE elif fDeposit == "yes": transAction, transSource, transDestination, \ transDescription, transCategory, transLocation \ = dDB.extract_eDeposit(debitAttributeList,transAmount) finalByPass = "******" numTransform = "\t" + "---->2:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #-----> "credit" found? ------> Yes ------->PROVISIONAL CREDIT FOR CLAIM - REF elif fP3 >= 0: #--> fP3 = debitAttributeList[0].find(credit) p2 = transList.index("credit") p4 = debitAttributeList[0].find("claim") transAction = "deposit" p1 = "left" p2 = p2 - 1 transSource \ = uETL.extractFromList(transList,p1,p2,p4) transCategory = uETL.getDictCategory(transSource) transDestination = hdrOwnerAccount if p4 >= 0: p4 = transList.index("claim") + 1 #p2 = p2 + 1 p1 = "middle" transDescription \ = uETL.extractFromList(transList,p1,p2,p4) else: transDescription = debitAttributeList[0] transCategory = "unknown" numTransform = "\t" + "---->3:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #--> list [0] created --> "#" NOT FOUND in description else: varG.studyOutList.append("\n" + "\t" + \ "--->only[0]-1: debitAttributeList=" + \ debitAttributeList[0] + "\n") fP2 = transValue.find("irs treas ") fP3 = transValue.find("bill pay return") fP4 = transValue.find("bill pay") fP5 = transValue.find("interest payment") fP6 = transValue.find("on-line") fP7 = transValue.find("opening deposit") #---> transOwner ----> IRS TREAS 310 TAX REF 091218 XXXXXXXXXX00999 # last, first middle -----> transformation to first, middle, last if fP5 == -1: varG.studyOutList.append("\n" + "\t" + \ "--->only[0]-2a: Not interest payment" + \ " transList=" + str(transList) + "\n") p1 = transList[-3] p2 = p1.find(',') if p2 >= 0: p1 = p1[:-1] p3 = transList[-1] p4 = p3.find('"') if p4 >= 0: p3 = p3[:p2] transOwner = p1 + " " + transList[-1] + " " + p3 varG.studyOutList.append("\n" + "\t" + \ "--->only[0]-2b: transOwner" + \ " transOwner=" + transList + "\n") #---> "irs treas" found ? ----> #Yes -----> transSource_Destination, transOwner, transAction, transDescription if fP2 >= 0: p1 = "left" #----> "ref" found ? ----> Yes -----> get ------> transLocation p2 = transValue.find(" ref ") if p2 >= 0: transSource = "IRS Treasury" transDestination = hdrOwnerAccount transOwner = transList[-3] + " " + transList[-2] + " " +\ transList[-1] transAction = "draft deposit" transDescription = "irs tax refund" transCategory = uETL.getDictCategory(transDescription) finalByPass = "******" varG.studyOutList.append("\t" + "---->5: transValue=" + \ transValue + "transValue[:p2]" + \ transValue[:p2] + " transList=" + transList) numTransform = "\t" + "---->5:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #----> "bill pay return" found elif fP3 >= 0: p2 = transList.index("return") transAction = "bill pay return" transDestination = varG.headerList[0] + " " + \ varG.headerList[3] if fP6 >= 0: transAction = "on-line " + transAction p4 = transList.index("on-line") - 1 p1 = "middle" p2 = +2 transSource = uETL.extractFromList( transList, p1, p2, p4) transDescription = "returned bill payment" transCategory = "bill payment error" else: p1 = "right" p2 = +1 transDescription \ = uETL.extractFromList(transList,p1,p2,p4) transOwner = varG.headerList[0] + " " + varG.headerList[3] numTransform = "\t" + "---->6a:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #----> "bill pay return" found elif fP4 >= 0: p2 = transList.index("bill") transAction = "deposit" transDestination = varG.headerList[0] + " " + \ varG.headerList[3] if fP6 >= 0: p4 = transList.index("on-line") transDescription = transList[p4] + " " +\ transList[p2] + " " + transList[p2+1] + " " +\ transList[p2+2] p1 = "middle" p2 = +2 transSource = uETL.extractFromList( transList, p1, p2, p4) else: p1 = "right" p2 = +1 transDescription \ = uETL.extractFromList(transList,p1,p2,p4) transOwner = varG.headerList[0] + " " + varG.headerList[3] numTransform = "\t" + "---->6b:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) elif fP7 >= 0: transAction = "acct open" transSource = varG.headerList[0] transDestination = varG.headerList[ 0] + " " + varG.headerList[3] transDescription = transValue transCategory = "Account Opening Balance" transOwner = transDestination #---> "irs treas" found ? ----> No -----> else: fP2 = transValue.find(" sys ") fP3 = debitAttributeList[0].find("bill pay") #----> " sys " found ? ----> Yes -----> TEACHER RET SYS TRSANNUITY # --- - if fP2 >= 0: transAction = "draft deposit" transDescription = "teacher retirement check" transCategory = uETL.getDictCategory(transDescription) transDestination = hdrOwnerAccount #------> " 1" found? ------> Yes -------> left keep/slice fP2 = transValue.find(" 1") if fP2 >= 0: transValue = transValue[:fP2] transList = transValue.split(" ") transSource = transList[-1] else: transSource = transValue[:fP2] finalByPass = "******" varG.studyOutList.append("\t" + "------>7: transValue=" + transValue + \ "transValue[:fP2]" + transValue[:fP2] + \ " transList=" + transList) numTransform = "\t" + "---->7:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #-----> "deposit" found? ------> Yes ------->DEPOSIT MADE IN A BRANCH/STORE elif transList[0] == "edeposit": transOwner = "" transAction, transSource, transDestination, \ transDescription, transCategory, transLocation \ = dDB.extract_eDeposit(debitAttributeList,\ transAmount) finalByPass = "******" numTransform = "\t" + "---->8:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #-----> "safe" found? ------> Yes -------> SAFE DEPOSIT BOX AUTO DEBIT REFUND elif transList[0] == "safe": transSource = varG.headerList[1] transDestination = hdrOwnerAccount transOwner = "" transAction = "draft deposit" transDescription = transValue transCategory = uETL.getDictCategory(transDescription) finalByPass = "******" numTransform = "\t" + "------>9:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #default will supply default values #N-> transAmount is negative --> determined by useing first position value of transAmount else: print("\n","\t","->N: debitAttributeList=",debitAttributeList, \ " transList=", transList) fP1 = debitAttributeList[0].find("ref ") fP2 = debitAttributeList[0].find(" check ") fP3 = debitAttributeList[0].find("bill pay") fP4 = debitAttributeList[0].find("chase credit") fP5 = debitAttributeList[0].find("equitable") fP6 = debitAttributeList[0].find("cpenergy") fP7 = debitAttributeList[0].find("paypal credit") fP8 = debitAttributeList[0].find("catholic life") fP9 = debitAttributeList[0].find("online transfer") fP10 = debitAttributeList[0].find("purchase auth") #N--> "ref" found ? ---> Yes ----> remove "ref" from [0] list value via splice if fP1 >= 0 and fP9 >= 0: debitAttributeList[0] = debitAttributeList[0][:fP1] #print("\t","N-->a/t: debitAttributeList[0]=",debitAttributeList[0]) #N----> [0] with removed "ref" #--> all attribute properties obtained through function transAction, transSource, transDestination, transDescription, \ transCategory \ = dDB.attributesOnlineTransfer(transAmount, \ debitAttributeList) finalByPass = "******" numTransform = "\t" + "N---->1:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N----> "check" found ---> Yes elif fP2 >= 0: #--> fP2 = debitAttributeList[0].find(" check ") #---> "check" found ? ----> Yes -----> get transaction attributes: p2 = transList.index("check") - 1 p5 = transValue.find("bcp pay ") p6 = transValue.find("bcf pay ") if p5 >= 0 or p6 >= 0: transAction = transValue[:7] p1 = "middle" p4 = p2 + 1 p2 = 1 transDestination = uETL.extractFromList( transList, p1, p2, p4) p1 = "right" p2 = p4 + 1 transDescription = uETL.extractFromList( transList, p1, p2, p4) transCategory = uETL.getDictCategory(transDescription) else: transAction = "withdraw" p1 = "left" transDestination = uETL.extractFromList( transList, p1, p2, p4) p1 = "right" transDescription = uETL.extractFromList( transList, p1, p2, p4) transCategory = uETL.getDictCategory(transDestination) transSource = hdrOwnerAccount transOwner = varG.headerList[0] + " " + varG.headerList[3] numTransform = "\t" + "N---->2:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N----> "bill pay" found elif fP3 >= 0: p2 = transList.index("bill") p4 = debitAttributeList[0].find("on-line") p5 = debitAttributeList[0].find("- on-line") if p4 >= 0: p4 = transList.index("on-line") if p5 != -1: p4 -= 1 transAction, transSource, transDestination, \ transDescription, transCategory \ = dDB.attributesOnlineBillPay(p2, p4, transList) finalByPass = "******" else: # may need to be included with attributeOnLine p1 = "right" p2 = +1 transDescription = uETL.extractFromList( transList, p1, p2, p4) transCategory = uETL.getDictCategory(transDestination) numTransform = "\t" + "N---->3:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N----> "chase credit" found elif fP4 >= 0: p2 = transList.index("chase") p4 = debitAttributeList[0].find("autopay") transAction = "withdraw" transSource = hdrOwnerAccount transDestination = transList[p2] + " bank" transDescription = "credit card bill pay" transCategory = uETL.getDictCategory(transDestination) transOwner = "" numTransform = "\t" + "N---->4:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N----> "equitable" found elif fP5 >= 0: p2 = transList.index("equitable") p4 = debitAttributeList[0].find("renew") transAction = "withdraw" transSource = hdrOwnerAccount transDestination = transList[p2] + " insurance" if p4 >= 0: p4 = transList.index("renew") p1 = "middle" p2 = +1 transDescription = uETL.extractFromList( transList, p1, p2, p4) else: p1 = "right to not alpha" p2 = +1 transDescription = uETL.extractFromList( transList, p1, p2, p4) transOwner = "" transCategory = uETL.getDictCategory(transDestination) numTransform = "\t" + "N---->5:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N----> "cpenergy" found elif fP6 >= 0: p2 = transList.index("cpenergy") p4 = debitAttributeList[0].find("renew") transAction = "withdraw" transSource = hdrOwnerAccount transDestination = transList[p2] transDescription = "autopay gas bill" transCategory = uETL.getDictCategory(transDestination) transOwner = "" numTransform = "\t" + "N---->6:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N----> "paypal credit" found elif fP7 >= 0: p2 = transList.index("paypal") transAction = "withdraw" transSource = hdrOwnerAccount transDestination = transList[p2] + " " + transList[p2 + 1] p1 = "not alpha right to end" transDescription = uETL.extractFromList(transList, p1, p2, p4) transDescription = transDescription + " " + "bill payment" transCategory = uETL.getDictCategory(transDestination) transOwner = "" numTransform = "\t" + "N---->7:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N----> "catholic life" found elif fP8 >= 0: transAction = "withdraw" transSource = hdrOwnerAccount transDestination = transList[p2] + " " + \ transList[p2+1] + " insurance" transDescription = "life insurance premium payment" transCategory = uETL.getDictCategory(transDestination) transOwner = "" numTransform = "\t" + "N---->8:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N----> "purchase auth" found elif fP10 >= 0: transAction = "purchase auth" transSource = transList[-2] + " " + transList[-1] transDestination = transList[4] transDestination = transDestination.strip(" ") transDescription = "debit card purchase" transCategory = uETL.getDictCategory(transDestination) transOwner = hdrOwnerAccount finalByPass = "******" numTransform = "\t" + "N---->9:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N-----> "withdraw" found? ------> Yes ------->WITHDRAWAL MADE IN A BRANCH/STORE elif transList[0] == "withdrawal": fP1 = debitAttributeList[0].find("anch/store") if fP1 >= 0: tlSplit = transList[-1].split("/") transAction = tlSplit[0] + " " + transList[0] transDestination = varG.headerList[0] transDescription = debitAttributeList[0] transCategory = varG.headerList[0] + " " + transAction else: transAction = "withdraw" transDescription = debitAttributeList[0] transCategory = "unknown withdrawal" transSource = hdrOwnerAccount finalByPass = "******" numTransform = "\t" + "N---->10:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N-----> "safe" found? ------> Yes -------> SAFE BOX ANNUAL FEE TX-NOR01963-00417 elif transList[0] == "safe": transSource = varG.headerList[1] transDestination = hdrOwnerAccount transOwner = "" transAction = "draft withdraw" fP1 = transValue.find(" fee") if fP1 >= 0: #--> to remove --> TX-NOR01963-00417 transDescription = transValue[:fP1 + 4] else: transDescription = transValue transCategory = uETL.getDictCategory(transDescription) finalByPass = "******" print("\t","N---->11: transList[-1]=",transList[-1],\ " str.isalnum(transList[-1])=",\ str.isalnum(transList[-1])," p2=",p2," p4=",p4,\ " transValue=",transValue," transValue[:p4-p2]=",\ transValue[:p4-p2]) numTransform = "\t" + "N---->11:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N-----> DEFAULT --------> IRS USATAXPYMT 99 999 first m last # -------> HOCHHEIM PRAIRIE Hochheim 10HP 999 first m last else: transAction = "draft payment" print("\t","N----->12: transList=",transList,\ " transList[0]=",transList[0]," description=",description) fP1 = transValue.find("usataxpymt ") fP2 = transValue.find("0hp ") fP3 = transValue.find("check") if fP1 >= 0: p2 = transValue.find(" 0") transSource = hdrOwnerAccount transDestination = "irs treasury" transDescription = "irs usa tax payment" transOwner = transList[-3] + " " + transList[-2] + " " + \ transList[-1] transCategory = uETL.getDictCategory(transDescription) finalByPass = "******" numTransform = "\t" + "N---->12:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) #N-----> "0hp" --> found fP2 = transValue.find("0hp ") elif fP2 >= 0: transList = transValue[:fP2 - 2].split(" ") transDestination = transList[0] + " " + transList[1] transSource = hdrOwnerAccount transDescription = "insurance premium payment" transOwner = transList[-3] + " " + transList[-2] + " " + \ transList[-1] transCategory = uETL.get_transAction(str(transAmount)) finalByPass = "******" numTransform = "\t" + "N---->13:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) else: transAction = "withdraw" transSource = hdrOwnerAccount p1 = "right to not alpha" p2 = 0 transDestination \ = uETL.extractFromList(transList,p1,p2,p4) p4 = transDestination.find("harland") if p4 >= 0: transDescription = "checks for checking account" transCategory = uETL.getDictCategory(transDestination) numTransform = "\t" + "N---->14:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass)
def setSavingsAttributes(self): global hdrSource global hdrOwnerAccount global description global descriptionList global transDate global transAmount global transLocation global transAction global transSource global transDestination global transDescription global transCategory global transOwner global transAccount lLen = 0 debitAttributeList = [] transList = [] transSource_Destination = "" transValue = "" fP1 = 0 fP2 = 0 fP3 = 0 fP4 = 0 fP5 = 0 p1 = "" p2 = 0 p4 = 0 finalByPass = "" outStudy = Study() debitAttributeList = description.split("#") lLen = len(debitAttributeList) if lLen > 1: #---> number of split List indeices > 1 -----> Yes #--> locates "__" in [0] value for removal using slicing based on find position fP1 = debitAttributeList[0].find("ref ") fP2 = debitAttributeList[0].find("online transfer") fP3 = debitAttributeList[0].find("credit") fP4 = debitAttributeList[0].find("recurring tr") #---> #[0] "ref" removed from [0] value #--> determined by find/position locate of value #--> not found will supply "" within attribute properties if fP1 >= 0 and fP2 >= 0 or \ fP1 >= 0 and fP4 >= 0: debitAttributeList[0] = debitAttributeList[0][:fP1] #print("\t","---->1: fP1=",fP1," debitAttributeList[0]=",\ # debitAttributeList[0]) #----> [0] with removed "ref" --> all attribute properties obtained through function #--> dDB.attributesOnlineTransfer(debitAttributeList) transAction, transSource, transDestination, transDescription, \ transCategory \ = dDB.attributesOnlineTransfer(transAmount,debitAttributeList) finalByPass = "******" #change item --- may not need numTransform = "\t" + "---->1:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) else: fP1 = debitAttributeList[0].find("interest payment") fP2 = debitAttributeList[0].find(" sec ") if fP1 >= 0: transAction = "eDeposit" transSource = varG.headerList[1] transDestination = hdrOwnerAccount transDescription = varG.headerList[3] + " interest earned" transCategory = "interest earnings" finalByPass = "******" numTransform = "\t" + "---->2:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) elif fP2 >= 0: transValue = str(debitAttributeList[0]) transList = transValue.split(" ") transLocation, transOwner = dDB.extract_Social_Security( transList) transSource = transLocation + " " + transOwner transDestination = hdrOwnerAccount transAction = "eDeposit" transDescription = "social security draft auto deposit" #print ("\t","SSN: transSource=",transSource) transCategory = uETL.getDictCategory(transDescription) finalByPass = "******" print("\t", "SSN: transCategory=", transCategory) numTransform = "\t" + "---->3:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) else: transValue = str(debitAttributeList[0]) transList = transValue.split(" ") #print("\t","\t","transList=",transList," transList[0]=",\ # transList[0]," description=",description) if transList[0] == "edeposit": transAction, transSource, transDestination, \ transDescription, transCategory, transLocation \ = dDB.extract_eDeposit(debitAttributeList,transAmount) finalByPass = "******" numTransform = "\t" + "---->4:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) else: fP1 = debitAttributeList[0].find("item retn") fP2 = debitAttributeList[0].find("unpaid") fP3 = debitAttributeList[0].find("cashed") fP4 = debitAttributeList[0].find("go far rew") fP5 = debitAttributeList[0].find("service fee") finalByPass = "******" if fP1 >= 0 and fP2 >= 0: transAction = debitAttributeList[0][:fP2 + 6] transSource = hdrSource transDestination = varG.headerList[0] + " " + \ varG.headerList[3] transDescription = debitAttributeList[0] transCategory = "item return unpaid" if fP3 >= 0: transCategory = transCategory + " fee" numTransform = "\t" + "---->5:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) elif fP4 >= 0: transAction = "reward deposit" transSource = hdrSource + " credit" if transSource in varG.inTHelpersDict: transSource = varG.inTHelpersDict[transSource][0] transDestination = hdrOwnerAccount transDescription = "go for rewards" transCategory = "credit account reward" finalByPass = "******" numTransform = "\t" + "---->6:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) elif fP5 >= 0: transAction = "eWithdraw" transSource = hdrOwnerAccount transDestination = hdrSource transDescription = "monthly service fee" transCategory = "bank account fee" finalByPass = "******" numTransform = "\t" + "---->7:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) else: p1 = "all" transList = str(debitAttributeList[0]).split(" ") transDescription = uETL.extractFromList( transList, p1, p2, p4) transCategory = "unknown" if str(transAmount)[0] == "-": transAction = "withdraw" transSource = hdrOwnerAccount transDestination = "unknown" numTransform = "\t" + "---->8:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) else: transAction = "deposit" transDestination = hdrOwnerAccount transSource = "unknown" numTransform = "\t" + "---->9:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) numTransform = "\t" + "---->10:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass) numTransform = "\t" + "->sE1-n:" outStudy.formatOutTransStudy(numTransform,\ transSource_Destination,finalByPass)
def Second_iValue_Check(iValue, transSource): sourceSet = "" useValue = "" countUse = 0 firstPosValue = "" firstPosValue = iValue[:1] changeCase = "y" splitFirst = "" #print("\t","firstPosValue=", firstPosValue,"iValue =",iValue ) fP = iValue.find("'s") if fP != -1: #splitFirst = iValue[:fP] useValue = iValue for key in varG.convertStopDict: fP = iValue.find(key) if fP != -1: useValue = varG.convertStopDict[key] sourceSet = "break" + "-find-convertStop" changeCase = "" break if sourceSet == "": useValue = iValue[:fP - 1].title() + "'s" sourceSet = "continue" + "-Apostrophe-s" changeCase = "" useValue = uETL.firstPositionSplitKeepRight(useValue) #print("\t","-->2a1") elif iValue in varG.singleNameList: useValue = iValue sourceSet = "break" + varG.singleNameList[-1] #print("\t","-->2ab") elif iValue in varG.stopList: useValue = iValue sourceSet = "break" + varG.stopList[-1] #print("\t","-->2b") elif iValue in varG.rejectList: sourceSet = "continue" + varG.rejectList[-1] #print("\t","-->2c") elif iValue in varG.convertStopDict: useValue = varG.convertStopDict.get(iValue) sourceSet = "break" + "-convertStop" changeCase = "" #print("\t","-->2d") elif iValue in varG.convertContinueDict: useValue = varG.convertContinueDict.get(iValue) sourceSet = "continue" + "-convertContinue" changeCase = "" #print("\t","-->2e") elif firstPosValue in varG.firstPositionRejectStopList: if transSource == "": sourceSet = "continue" + varG.firstPositionRejectStopList[-1] else: sourceSet = "break" + varG.firstPositionRejectStopList[-1] #print("\t","-->2f") elif firstPosValue in varG.firstPositionSplitKeepRightList: iValue = iValue[1:] if str.isalpha(iValue): useValue = iValue if iValue in varG.convertStopDict: useValue = varG.convertStopDict.get(iValue) sourceSet = "break" + \ varG.firstPositionSplitKeepRightList[-1] + "-convertStop" changeCase = "" #print("\t","-->2g") else: sourceSet = "continue" + \ varG.firstPositionSplitKeepRightList[-1] #print("\t","-->2h") else: #print("\t","first-rest iValue =", iValue ) splitSource = uETL.splitCheck(iValue) useValue = splitSource if useValue in varG.convertStopDict: useValue = varG.convertStopDict.get(useValue) sourceSet = "break" + \ varG.firstPositionSplitKeepRightList[-1] + \ "-split" + "-convertStop" changeCase = "" #print("\t","-->2i-a") elif useValue in varG.stopList: sourceSet = "break" + \ varG.firstPositionSplitKeepRightList[-1] + \ "-split" + "-stopList" #print("\t","-->2i-b") else: sourceSet = "continue" + \ varG.firstPositionSplitKeepRightList[-1] + "-split" #print("\t","-->2i-c") elif str.isalpha(iValue): useValue = iValue sourceSet = "continue" + "-alpha" #print("\t","-->2k") else: for key in varG.convertStopDict: fP = iValue.find(key) if fP != -1: useValue = varG.convertStopDict[key] sourceSet = "break" + "-find-convertStop" changeCase = "" break if sourceSet == "": splitSource = uETL.splitCheck(iValue) #print("\t","splitSource=",splitSource) if splitSource != "": if splitSource in varG.convertStopDict: useValue = varG.convertStopDict.get(splitSource) sourceSet = "break" + "-split-convertStop" changeCase = "" #print("\t","-->2l") else: useValue = splitSource sourceSet = "continue" + "-split" #print("\t","-->2j") else: changeCase = "" #print("\t","-->2k") if changeCase == "y": if useValue in varG.allCapsList: useValue = useValue.upper() countUse = countUse + 1 #print("\t","-->2l") else: useValue = useValue.title() countUse = countUse + 1 #print("\t","-->2m") #print("\n","Second: countUse=",countUse,"useValue=",useValue,"\n") return useValue, sourceSet, countUse
def extract_eDeposit(debitAttributeList, transAmount): transValue = "" transList = [] p1 = "" p2 = 0 p4 = 0 fP1 = -1 fP2 = -1 #return attributes transAction = "" transSource = "" transDestination = "" transDescription = "" transCategory = "" transLocation = "" transValue = str(debitAttributeList[0]) transList = transValue.split(" ") print("\n","\t","eDeposit-IN: transList=",transList," transList[0]=",\ transList[0]," varG.headerList[0]=",varG.headerList[0]," varG.headerList[3]=",varG.headerList[3]) print("\t","\t","eDeposit-IN: transAction=",transAction," transSource=",\ transSource," transDestination=",transDestination, \ " transDescription=",transDescription," transCategory=",\ transCategory," transLocation=",transLocation) p2 = debitAttributeList[0].find("branch/store") if p2 >= 0: transList = debitAttributeList[0].split(" ") p1 = "left" p2 = transList.index("branch/store") transAction = uETL.extractFromList(transList, p1, p2, p4) fP1 = transAction.find( "depo") #transAction = "deposit" or "edeposit" print("\n","\t","find deposit: fP1=",fP1,"fP1"," transAction=",\ transAction) fP2 = transAction.find("/") if fP1 >= 0: transAction = transAction[fP1:] if fP2 >= 0: transAction = transAction[:fP2 - 1] transSource = varG.headerList[0] transCategory = uETL.getDictCategory(str(transAmount)) if transCategory != "": dictKey = transCategory + str(transAmount) transDescription = uETL.getDictCategory(dictKey) if transDescription == "": transDescription = "in Branch Fund Deposit" else: transDescription = "in Branch Fund Deposit" transCategory = "received funds deposited" print("\t", "a/f 1 transAction=", transAction) if varG.headerList[3] == "Checking": if fP1 == 0: # in transAction = "deposit" transSource = varG.headerList[0] transDescription = "in Branch Fund Deposit" transCategory = uETL.getDictCategory(str(transAmount)) if transCategory == "": transCategory = "received funds deposited" else: transSource = "BCP renters" transDescription = "renter payments" transCategory = uETL.getDictCategory(transSource) transDestination = varG.headerList[0] + " " + varG.headerList[3] fP1 = debitAttributeList[0].find(" am ") fP2 = debitAttributeList[0].find(" pm ") #print("\t","\t","fP1=",fP1," fP2=",fP2) if fP1 >= 0 or fP2 >= 0: p2 = fP1 + fP2 + 5 transLocation = debitAttributeList[0][p2:] p2 = len(transLocation) transLocation = transLocation[:p2 - 5] print("\t","\t","eDeposit-IN: transAction=",transAction," transSource=",\ transSource," transDestination=",transDestination, \ " transDescription=",transDescription," transCategory=",\ transCategory," transLocation=",transLocation) return transAction, transSource, transDestination, transDescription, \ transCategory, transLocation
def attributesOnlineTransfer(transAmount, debitAttributeList): lLen = len(debitAttributeList) transValue = "" transList = [] yAccount = "" hdrOwnerAccount = varG.headerList[0] + " " + varG.headerList[3] amt_p1 = str(transAmount)[0] #return attributes transAction = "" transSource = "" transDestination = "" transDescription = "" transCategory = "" p1 = "" p2 = 0 p4 = 0 fP1 = 0 fP2 = 0 fP3 = 0 fP4 = 0 fP5 = 0 lLen = 0 fMom = -1 transferName = "" #STATEMENTS varG.studyOutList.append("\n" + "\t" + "refSplit: amt_p1=" + amt_p1 \ + " debitAttributeList=" + str(debitAttributeList)) transValue = str(debitAttributeList[0]) transList = transValue.split(" ") varG.studyOutList.append("\t" + "\t" + "transList=" + str(transList) + " transList[0]=" + transList[0]) #transAction --> first two in transList #--> ONLINE TRANSFER TO SCHNEIDER A EVERYDAY CHECKING XXXXXX2969 p1 = "left" p2 = 1 transAction = uETL.extractFromList(transList, p1, p2, p4) varG.studyOutList.append("\t" + "\t" + "transAction=" + transAction) transAction = transAction.lstrip(" ") transAction = transAction.rstrip(" ") #trans name --> 3 #--> ONLINE TRANSFER TO MASSO J REF # EVERYDAY CHECKING TO MOMS CHKG FOR JUNE RETIREMENT p1 = "right" p2 = 3 transferName = uETL.extractFromList(transList, p1, p2, p4) transferName = transferName.rstrip(" ") transferName = transferName.lstrip(" ") varG.studyOutList.append("\t" + "\t" + "transferName=" + transferName) fP1 = debitAttributeList[1].find("to moms sav") fP2 = transferName.find("schneider a") fP3 = debitAttributeList[1].find("prime checking") if fP1 >= 0 or fP2 >= 0: if fP2 >= 0: #print("\t","\t","IFchg transferName=",transferName) tNameList = transferName.split(" ") lLen = len(tNameList) transferName = transferName[:fP2 + 11] if lLen > 2: yAccount = tNameList[-2] if fP3 == -1: if transferName in varG.convertOwnerDict: transferName = varG.convertOwnerDict[transferName] else: yAccount = "checking" varG.studyOutList.append("\t" + "\t" + "IFchg transferName=" + transferName + \ " lLen=" + str(lLen) + " yAccount=" + yAccount) tNameList = transferName.split(" ") tNLen = len(tNameList) varG.studyOutList.append("\t" + "\t" + "tNLen=" + str(tNLen) + " tNameList=" + str(tNameList)) if tNLen > 2: transferName = tNameList[0] + " " + tNameList[1] varG.studyOutList.append("\t" + "\t" + "tNl transferName=" + transferName) fP1 = debitAttributeList[0].find("checking") fP2 = debitAttributeList[0].find("savings") if yAccount == "": if fP1 >= 0: yAccount = "checking" elif fP2 >= 0: yAccount = "savings" varG.studyOutList.append("\t" + "\t" + "tNl yAccount=" + yAccount) varG.studyOutList.append("\t" + " debitAttributeList[1]=" + str(debitAttributeList[1]) + \ " varG.inTHelpersList=" + str(varG.inTHelpersList)) if lLen >= 0: for x, y in enumerate(varG.inTHelpersList): fP1 = debitAttributeList[1].find(y) varG.studyOutList.append("\t" + "\t" + "fP1=" + str(fP1) + "x=" + str(x) + " y=" + y) if fP1 >= 0: fP2 = fP1 + len(y) varG.studyOutList.append("\n" + "\t" + "fP2=" + str(fP2)) transDescription = debitAttributeList[1][fP2 + 1:] varG.studyOutList.append("\t" + "\t" + "1 transDescription=" + transDescription) y = y.lstrip(" ") y = y.rstrip(" ") fP1 = y.find(" ") yAccount = y[fP1 + 1:] varG.studyOutList.append("\t" + "\t" + "yAccount=" + yAccount) if varG.headerList[0] == "Jeanette": fMom = transDescription.find("mom") if fMom >= 0: transferName = varG.headerList[0] + "mom" if transferName in varG.convertOwnerDict: transferName = varG.convertOwnerDict[transferName] varG.studyOutList.append("\t" + "varG.headerList[0]=" + str(varG.headerList[0])) varG.studyOutList.append("\n" + "\t" + "S- varG.headerList[0]=" + str(varG.headerList[0]) + \ " transferName=" + transferName + "transSource=" + transSource + \ " transDestination=" + transDestination) if varG.headerList[0] == "JMmom" or varG.headerList[0] == "ASMom": varG.studyOutList.append("\t" + "\t" + "1 varG.headerList[0]=" + str(varG.headerList[0])) if varG.headerList[3] == "Checking": if amt_p1 == "-": if transferName in varG.inTHelpersDict: transDestination = varG.inTHelpersDict[transferName][0] + \ " " + yAccount transSource = varG.headerList[ 0] + " " + varG.headerList[3] varG.studyOutList.append("\t" + "\t" + "\t" + "a- transSource=" + transSource + \ " transDestination=" + transDestination) else: transDestination = transferName + " " + yAccount transSource = varG.headerList[ 0] + " " + varG.headerList[3] varG.studyOutList.append("\t" + "\t" + "\t" + "b- transSource=" + transSource + \ " transDestination=" + transDestination) varG.studyOutList.append("\t" + "\t" + "1- transSource=" + transSource + \ " transDestination=" + transDestination) else: if transferName in varG.inTHelpersDict: print("varG.inTHelpersDict[transferName]=",\ varG.inTHelpersDict[transferName]) transSource = varG.inTHelpersDict[transferName][0] + \ " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] else: transSource = transferName + " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] varG.studyOutList.append("\t" + "\t" + "2- transSource=" + transSource + \ " transDestination=" + transDestination) elif varG.headerList[3] == "Savings": if amt_p1 == "-": if transferName in varG.inTHelpersDict: transDestination = varG.inTHelpersDict[transferName][0] + \ " " + yAccount transSource = varG.headerList[ 0] + " " + varG.headerList[3] else: transDestination = transferName + " " + yAccount transSource = varG.headerList[ 0] + " " + varG.headerList[3] varG.studyOutList.append("\t" + "\t" + "3- transSource=" + transSource + \ " transDestination=" + transDestination) else: varG.studyOutList.append("\t" + "4-I: transferName=" + transferName) if transferName in varG.convertOwnerDict: transSource = varG.convertOwnerDict[transferName] + \ " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] elif transferName in varG.inTHelpersDict: transSource = varG.inTHelpersDict[transferName][0] + \ " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] else: transSource = transferName + " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] varG.studyOutList.append("\t" + "\t" + "4- transSource=" + transSource + \ " transDestination=" + transDestination) varG.studyOutList.append("\n" + "\t" + "F- transSource=" + transSource + " transDestination=" + \ transDestination) elif varG.headerList[0] == "Jeanette": print("\t" + "\t" + "2 varG.headerList[0]=" + str(varG.headerList[0]) + \ " transferName=" + transferName) if varG.headerList[3] == "Checking": if amt_p1 == "-": if transferName in varG.inTHelpersDict: transDestination = varG.inTHelpersDict[transferName][0] + \ " " + yAccount transSource = varG.headerList[ 0] + " " + varG.headerList[3] varG.studyOutList.append("\t" + "\t" + "\t" + "5a- transSource=" + transSource + \ " transDestination=" + transDestination) else: transDestination = transferName + " " + yAccount transSource = varG.headerList[ 0] + " " + varG.headerList[3] varG.studyOutList.append("\t" + "\t" + "\t" + "5b- transSource=" + transSource + \ " transDestination=" + transDestination) varG.studyOutList.append("\t" + "\t" + "5- transSource=" + transSource + \ " transDestination=" + transDestination) else: if transferName in varG.inTHelpersDict: varG.studyOutList.append("varG.inTHelpersDict[transferName]=" + \ str(varG.inTHelpersDict[transferName])) transSource = varG.inTHelpersDict[transferName][0] + \ " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] else: transSource = transferName + " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] varG.studyOutList.append("\t" + "\t" + "5- transSource=" + transSource + \ " transDestination=" + transDestination) elif varG.headerList[3] == "Savings": if amt_p1 == "-": if transferName in varG.inTHelpersDict: transDestination = varG.inTHelpersDict[transferName][0] + \ " " + yAccount transSource = varG.headerList[ 0] + " " + varG.headerList[3] else: transDestination = transferName + " " + yAccount transSource = varG.headerList[ 0] + " " + varG.headerList[3] varG.studyOutList.append("\t" + "\t" + "6- transSource=" + transSource + \ " transDestination=" + transDestination) else: fP10 = transDescription.find("close out") varG.studyOutList.append("\t" + "7-I: transferName=" + transferName + \ " transAction=" + transAction + " yAccount=" + yAccount) if transAction == "recurring transfer" or fP10 >= 0: tNfound = "" varG.studyOutList.append("\t" + "7-I-a: transferName=" + transferName) for key in varG.convertOwnerDict: #transferName = transferName.lstrip(" ") #transferName = transferName.rstrip(" ") varG.studyOutList.append("\t" + " transferName=" + transferName + " key=" + \ key + " varG.convertOwnerDict[key]=" + \ str(varG.convertOwnerDict[key])) if varG.convertOwnerDict[key] == transferName: transSource = key + " " + yAccount tNfound = "yes" if tNfound != "yes": transSource = transferName + " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] varG.studyOutList.append("\t" + "7-I-a: transferName=" + transferName) elif fMom >= 0 and transferName in varG.convertOwnerDict: varG.studyOutList.append("\t" + "7-I-b: transferName=" + transferName) transSource = varG.convertOwnerDict[transferName] + \ " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] varG.studyOutList.append("\t" + "7-I-b: transferName=" + transferName) elif transferName in varG.inTHelpersDict: varG.studyOutList.append("\t" + "7-I-c: transferName=" + transferName) transSource = varG.inTHelpersDict[transferName][0] + \ " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] varG.studyOutList.append("\t" + "7-I-c: transferName=" + transferName) else: if transferName in varG.convertOwnerToFirstDict: transferName = varG.convertOwnerToFirstDict[ transferName] varG.studyOutList.append("\t" + "7-I-d: transferName=" + transferName) transSource = transferName + " " + yAccount transDestination = varG.headerList[0] + " " + \ varG.headerList[3] varG.studyOutList.append("\t" + "7-I-d: transferName=" + transferName) varG.studyOutList.append("\t" + "\t" + "7- transSource=" + transSource + \ " transDestination=" + transDestination) if transSource == "Julia Checking" \ and transDestination == "ASmom checking": transDescription \ = uETL.getDictCategory(str(transAmount)) varG.studyOutList.append("\t" + "\t" + "2 transDescription=" + transDescription) transCategory = "funds to " + transDestination #transCategory = uETL.getDictCategory(transDescription, varG.inTHelpersCatDict) else: if hdrOwnerAccount == transSource \ or transDestination == "ASmom checking": transCategory \ = uETL.getDictCategory(transDestination) else: transCategory \ = uETL.getDictCategory(transSource) #transDescription ---> extract type requires qualification #--> ONLINE TRANSFER TO MASSO J REF # ---> [0] # IB04Y8GT68 EVERYDAY CHECKING JS TO MOMS CHKG RETIREMENT IN ---> [1] # -------- #--> ONLINE TRANSFER FROM MASSO J REF # # IB04TB4C33 EVERYDAY CHECKING TO JS CHKG FOR TO 500 # -------- #list [1] value --> used #--> stores list values in secondary list with each [1] value as a separate #[0...] value in secondary list #print("\t","a/t: debitAttributeList[1]=", debitAttributeList[1]) transValue = str(debitAttributeList[1]) transList = transValue.split(" ") #print("\t","\t","transList=",transList," transList[0]=",transList[0]) if "checking" in transList or "savings" in transList: fP1 = transValue.find("retirement") fP2 = transValue.find("trs and s") fP3 = transValue.find(" 500") fP4 = transValue.find("to500") fP5 = transValue.find("js chk") fP6 = transValue.find("to moms sav") fP7 = transValue.find("hocheim car claim") fP8a = transValue.find("xxxxxx2969 ref #") fP8b = transValue.find("up jm savings") fP9 = transDescription.find("bml over trnsfr") fP9b = transDescription.find("overage") fP10 = transDescription.find("close out") fP11a = transDescription.find("future") fP11b = transDescription.find("to savings") fP12a = transDescription.find("overdraf") fP12b = transDescription.find("next month vis") fP13 = transDescription.find("tax exp to chkg") fP14 = transDescription.find("double tr") fP15a = transDescription.find("bml") fP15b = transDescription.find("payp") #print("\t","\t","checking in transList transList=",transList) if fP1 >= 0 or fP2 >= 0: transDescription = "retirement funds to mom" transCategory \ = uETL.getDictCategory(transDescription) elif fP3 >= 0 or fP4 >= 0: transDescription = "JS checking up to 500" transCategory \ = uETL.getDictCategory(transDescription) elif fP5 >= 0: transDescription = "JS checking in" transCategory \ = uETL.getDictCategory(transDescription) elif fP6 >= 0: transDescription = "mom checking down to 1000" transCategory \ = uETL.getDictCategory(transDescription) elif fP7 >= 0: transDescription = "hocheim car claim payment" transCategory = \ uETL.getDictCategory(transDescription) elif fP8a >= 0: transDescription = transValue[fP8b:] transCategory = "transfer out funds" elif fP9 >= 0 or fP9b >= 0: transSource = varG.headerList[0] + " " + yAccount transCategory = "over transfer correction" elif fP10 >= 0: transCategory = "account close out transfer" elif fP11a >= 0 or fP11b >= 0: transCategory = "future expense funds" elif fP12a >= 0 or fP12b >= 0: transCategory = "account overdraft prevention" elif fP13 >= 0: transCategory = "tax expense funds" elif fP14 >= 0: transCategory = \ uETL.getDictCategory(transDescription) elif fP15a >= 0 or fP15b >= 0: transCategory = "checking PayPal Payment" varG.studyOutList.append("\t" + "\t" + "3 transDescription=" \ + transDescription + " transCategory=" + transCategory \ + " fP14=" + str(fP14)) #print("\t","\t","checking in transList varG.headerList[3]=", varG.headerList[3]) fP1 = transValue.find("for jm") fP2 = transValue.find("bill") fP3 = transValue.find("reimb") fP4 = debitAttributeList[1].find("prime checking") varG.studyOutList.append("\n" + "\t" + "desc/cat: amt_p1= " + str(amt_p1) + " varG.headerList[0]=" + \ str(varG.headerList[0]) + " fP4=" + str(fP4)) if varG.headerList[0] == "Julia" and amt_p1 != "-": varG.studyOutList.append("fP4=" + str(fP4)) if fP4 >= 0: fP4 = debitAttributeList[1].find("checking") varG.studyOutList.append("\n" + "\t" + "Julia: amt_p1= " + str(amt_p1) + " varG.headerList[0]=" + \ str(varG.headerList[0]) + " fP4=" + str(fP4)) transDescription = debitAttributeList[1][fP4 + 9:] varG.studyOutList.append("\t" + "\t" + "4 transDescription=" + transDescription) transCategory = "reimbursement from anthony" if varG.headerList[0] != "Jeanette" and amt_p1 != "-": if fP1 >= 0: transCategory = "reimbursement from jeanette" elif fP2 >= 0: transCategory = "reimbursement from jeanette" elif fP3 >= 0: transCategory = "reimbursement from jeanette" elif varG.headerList[0] != "Jeanette" and amt_p1 == "-": if fP1 >= 0: transCategory = "reimbursement for jeanette" elif fP2 >= 0: transCategory = "reimbursement for jeanette" elif fP3 >= 0: transCategory = "reimbursement for jeanette" elif varG.headerList[0] == "Jeanette" and amt_p1 == "-": if fP1 >= 0: transCategory = "reimbursement for mom" elif fP2 >= 0: transCategory = "reimbursement for mom" elif fP3 >= 0: transCategory = "reimbursement for mom" elif varG.headerList[0] == "Jeanette" and amt_p1 != "-": if fP1 >= 0: transCategory = "reimbursement from mom" elif fP2 >= 0: transCategory = "reimbursement from mom" elif fP3 >= 0: transCategory = "reimbursement from mom" else: if varG.headerList[3] == "Savings" and "checking" in transList: transCategory = "funds from checking" elif varG.headerList[ 3] == "Checking" and "savings" in transList: transCategory = "funds to savings" if fP8b >= 0: transCategory = "up jm savings" transCategory = uETL.getDictCategory(transCategory) if transAction == "recurring transfer": transDescription = "automated transfer from " + transSource transCategory = "auto transfer funds" varG.studyOutList.append("\t" + "\t" + "transDescription=" + transDescription) transDescription = transDescription.lstrip(" ") transDescription = transDescription.rstrip(" ") return transAction, transSource, transDestination, transDescription, \ transCategory
def First_iValue_Check(iValue, description): sourceSet = "" useValue = "" countUse = 0 changeCase = "y" splitList = [] splitFirst = "" #varG.studyOutList.append("\n" + "\t" + \ # " First_iValue_Check-B: iValue=" + iValue + \ # " description=" + description) fP = iValue.find("'s") if fP != -1: #splitFirst = iValue[:fP] useValue = iValue for key in varG.convertStopDict: fP = iValue.find(key) if fP != -1: useValue = varG.convertStopDict[key] sourceSet = "break" + "Apostrophe-s-find-convertStop" changeCase = "" if sourceSet == "": useValue = iValue[:fP - 1].title() + "'s" sourceSet = "continue" + "-Apostrophe-s" changeCase = "" useValue = uETL.firstPositionSplitKeepRight(useValue) #print("\t","-->2a1") elif iValue in varG.singleNameList: useValue = iValue sourceSet = "break" + varG.singleNameList[-1] elif iValue in varG.rejectList: sourceSet = "continue" + varG.rejectList[-1] elif iValue in varG.convertStopDict: useValue = varG.convertStopDict.get(iValue) sourceSet = "break" + "-convertStop" changeCase = "" if useValue in varG.checkGasList: gP = description.find("gas") if useValue == "wal-mart": useValue.title() if gP >= 0: useValue = useValue + " " + "Gas" sourceSet = sourceSet + "-Gas" elif str.isalpha(iValue): useValue = iValue sourceSet = "continue" + "-alpha" else: for key in varG.convertStopDict: fP = iValue.find(key) if fP != -1: useValue = varG.convertStopDict[key] sourceSet = "break" + "-find-convertStop" changeCase = "" break if sourceSet == "": splitSource = uETL.splitCheck(iValue) #print("\t","splitSource=",splitSource) if splitSource != "": splitList = splitSource.split(" ") splitFirst = splitList[0] if splitFirst in varG.convertStopDict: useValue = varG.convertStopDict.get(splitFirst) sourceSet = "break" + "-split-convertStop" changeCase = "" else: useValue = splitSource sourceSet = "continue" + "-split" else: changeCase = "" if changeCase == "y": if useValue in varG.allCapsList: useValue = useValue.upper() countUse = countUse + 1 else: useValue = useValue.title() countUse = countUse + 1 #print("\n","First: countUse=",countUse,"useValue=",useValue,"\n") return useValue, sourceSet, countUse