from imlsdatafile import IMLSDataFile rtype = "puout" # just playing with some sample years for i in range(2008, 2009): d1 = IMLSDataFile(rtype, i) d2 = IMLSDataFile(rtype, i + 1) s1 = d1.select_all_s("FSCSKEY") s2 = d2.select_all_s("FSCSKEY") diff = s1.difference(s2) # print(diff) print("missing from record {0}".format(i)) for i in diff: name = d1.id_lookup(i, "LIBNAME") city = d1.id_lookup(i, "CITY") state = d1.id_lookup(i, "STABR") print("{0} - {1},{2}".format(name.strip(), city.strip(), state)) # print("missing {0}-{1}: {2}".format(i,i+1,len(diff)))
if __name__ == "__main__": print("sanity check for IMLSRecord") fpuout = open("./data/puout/puout2009.txt",'r') testObj = IMLSRecord(fpuout.readline(),"puout",2009) print("puout data") print("Print Name and address for test library") print(testObj.lookup("libname")) print(testObj.lookup("address")) print(testObj.lookup("city")) print(testObj.lookup("zip")) fpuout.close() print("pupld data") df = IMLSDataFile('pupld',2009) df.to_csv() print("2009 csv complete") df2 = IMLSDataFile('pupld',2008) df2.to_csv() print("2008 csv complete") df3 = IMLSDataFile('pupld',2007) df3.to_csv() print("2007 csv complete") df4 = IMLSDataFile('pupld',2006) df4.to_csv() print("2006 csv complete") print("pusum data")