def add(self, npiid, npiName, newAddrM, newAddrP, msg): highScoreAndAddr = (0, None, '-') #print (npiName) #print (newAddr) for origAddr in self.origAddrList: adM = Distance(newAddrM, origAddr).ad adP = Distance(newAddrP, origAddr).ad if newAddrM == newAddrP: if adM > highScoreAndAddr[0]: highScoreAndAddr = (adM, newAddrM, 'Both') else: if adM > highScoreAndAddr[0]: highScoreAndAddr = (adM, newAddrM, 'Mail') if adP > highScoreAndAddr[0]: highScoreAndAddr = (adP, newAddrP, 'Prct') knd, detail = strDistance(npiName, self.origName) if knd <= lowestScore: return self.nameDistanceMap[npiid] = (knd, highScoreAndAddr[0], npiName, highScoreAndAddr[1], highScoreAndAddr[2], detail, msg)
def testReturnFirmName(self): print('testReturnFirmName') addr = Address('DEPT 52519 PO BOX 950123', '', 'LOUISVILLE', 'KY', '402950000') print(addr) aa, msg, alt = verify_by_google.reqGoogle(addr) for ga in alt: print(ga) print(Distance(addr, ga))
def testFirmNameAndCity(self): print('testFirmNameAndCity') addr = Address('DIAGNOSTIC IMAGING SO NV', '', 'LAS VEGAS', 'NV', '89121') print(addr) aa, msg, alt = verify_by_google.reqGoogle(addr) for ga in alt: print(ga) print(Distance(addr, ga))
def testName(self): for a in addresses: print() ws = a.split(',') addr = Address(ws[0], ws[1], ws[2], ws[3], ws[4]) print(addr) aa, msg, alt = verify_by_google.reqGoogle(addr) for ga in alt: print(ga) print(Distance(addr, ga)) pass
def testFirmName2(self): print('testFirmName2') addr = Address('6644 BAYWOOD AVE', '', 'MESA', 'AZ', '85206') print(addr) aa, msg, alt = verify_by_google.reqGoogle(addr) for ga in alt: print(ga) print(Distance(addr, ga).detail()) print('placeid :', ga.placeid) verify_by_google.reqPlaceDetail(ga.placeid) verify_by_google.reqSearch(ga.lat, ga.lng, 'BANNER BAYWOOD MEDICAL')
def testDistance(self): print('testDistance') a1 = Address('a', 'b', 'c', 's', 'z', 'n') a2 = Address('a', 'b', 'c', 's', 'z', 'n') dist = Distance(a1, a2) self.assertTrue(dist.isMatched()) a1 = Address('7500 SMOKE RANCH RD STE 200', '', 'LASVEGAS', 'NV', '891280000') a2 = Address('500 SMOKE RANCH RD', 'STE 200', 'LAS VEGAS', 'NV', '89128,0373') dist = Distance(a1, a2) print(dist.detail()) self.assertTrue(dist.isMatched())
def testPOBOXDistance(self): print('testPOBOXDistance') a1 = Address('PO BOX 12345', '', 'c', 's', 'z', 'n') self.assertTrue(a1.isPOBox()) a2 = Address('PO BOX 67890', '', 'c', 's', 'z', 'n') self.assertTrue(a1.isPOBox()) dist = Distance(a1, a2) print(dist.detail()) a1 = Address('PO BOX 12345', '', 'c', 's', 'z', 'n') self.assertTrue(a1.isPOBox()) a2 = Address('PO BOX 92345', '', 'c', 's', 'z', 'n') self.assertTrue(a1.isPOBox()) dist = Distance(a1, a2) print(dist.detail())
def testAddrDistance(self): print('testAddrDistance') a1 = Address('488 SAINT LUKES DR', '', 'MONTGOMERY', 'AL', '361170000') a2 = Address('488 SAINT LUKES DR', '', 'MONTGOMERY', 'AL', '361177104') print(Distance(a1, a2).detail())
allReturnName = [] for r in resp['results']: allReturnName.append(r['name']) return (allReturnName, 'OK') if __name__ == '__main__': statReport = Reporter() conn = npidb.getConnection() r = npidb.fetchBlank(conn, '', 10) for row in r: va, oa = npidb.createAddrFromRow(row) print() print(row[22], row[24]) print(oa) if oa.isPOBox(): print('is a Post Mail Box') statReport.report('Post Mail Box') continue a2, msg, alt = reqGoogle(oa) statReport.report(len(alt)) for ga in alt: print(ga) print(Distance(oa, ga)) statReport.showStat()
def testAddrDistance(self): a1 = Address('90 MEMORIAL DR', '', 'PINEHURST', 'NC', '28374') a2 = Address('205 PAGE RD', '', 'PINEHURST', 'NC', '28374') print(Distance(a1, a2).detail())
uspsAddr, msg = verify_by_usps.reqUSPS(newAddr) if uspsAddr == None : continue; return uspsAddr, newAddr, rewriteMothedName[index] else : return None, newAddr, msg; if __name__ == '__main__': statReport = Reporter() r = npidb.fetchBlank('1467455782', 300); for row in r: va, oa = npidb.createAddrFromRow(row) print(); print(row[22], row[24]); print (oa) a2, la, msg = verify(oa); if a2 != None: statReport.report(msg) print (la) print (a2); print(Distance(oa, a2)) else: print (la); statReport.report(':'.join(msg)) statReport.showStat() pass