u'CitedBy', 'prior', 'family lenght', 'CitO', 'CitP' ] print "\n> Hi! This is DataTable Families formater", ndf if 'Description' + ndf in os.listdir(ListBiblioPath): with open(ListBiblioPath + '//' + ndf, 'r') as data: dico = LoadBiblioFile(ListBiblioPath, ndf) else: #Retrocompatibility print "please use Comptatibilizer" sys.exit() LstBrevet = dico['brevets'] if dico.has_key('requete'): requete = dico["requete"] print "Using ", ndf, " file. Found ", len( dico["brevets"]), " patents! Formating to HMTL tables" LstExp = [] LstExp2 = [] #just for testing last fnction in gathered should deseapear soon for brev in LstBrevet: #brev = CleanPatent(brev) tempo = dict() # this one for DataTable tempo2 = dict() #the one for pitable countryInv = [] #new field countryApp = []
# data = registered_client.family('publication', , 'biblio') registered_client.accept_type = 'application/json' for ndf in [fic2 for fic2 in os.listdir(ResultBiblioPath) if fic2.count('Description')==0]: if ndf.startswith('Families'): typeSrc = 'Families' else: typeSrc = '' if 'Description'+ndf or 'Description'+ndf.lower() in os.listdir(ResultListPath): # NEW 12/12/15 new gatherer append data to pickle file in order to consume less memory ficBrevet = LoadBiblioFile(ResultListPath, ndf) else: #Retrocompatibility print 'gather your data again. sorry' sys.exit() if ficBrevet.has_key('brevets'): lstBrevet = ficBrevet['brevets'] # if data.has_key('requete'): # DataBrevet['requete'] = data["requete"] print "Found ",typeSrc, ' file and', len(lstBrevet), " patents! Gathering contents" else: print 'gather your data again' sys.exit() registered_client = epo_ops.Client(key, secret) # data = registered_client.family('publication', , 'biblio') registered_client.accept_type = 'application/json' BiblioPatents = [] #making the directory saving patents RepDir = ResultPathContent
try: fic = open(ResultPath + '//' + ndf, 'r') print "loading data file ", ndf + ' from ', ResultPath, " directory." if 'Description' + ndf or "Description" + ndf.title() in os.listdir( ResultPath ): # NEW 12/12/15 new gatherer append data to pickle file in order to consume less memory data = LoadBiblioFile(ResultPath, ndf) else: #Retrocompatibility :-) print "gather your data again" sys.exit() if isinstance(data, collections.Mapping): ListeBrevet = data['brevets'] if data.has_key('number'): print "Found ", data["number"], " patents! and ", len( ListeBrevet), " gathered." else: print 'data corrupted. Do something (destroying data directory is a nice idea)' sys.exit() print len(ListeBrevet), " patents loaded from file." print "Augmenting list with families." ficOk = True except: print "file ", ResultPath + "/" + ndf, " missing. try gather again." ficOk = False ndf2 = "Complete" + ndf ListLab = [pat['label'] for pat in ListeBrevet]
data2 = LoadBiblioFile(ResultBiblioPath, 'Families' + ndf) nbFam = len(data2['brevets']) else: #Retrocompatibility print "please use Comptatibilizer" #if 'Fusion' in data.keys()with open( ResultBiblioPath+'//Families'+ndf, 'r') as ficBib: # data2 = cPickle.load(ficBib) else: nbFam = 0 import datetime today = datetime.datetime.today() date = today.strftime('%d, %b %Y') totalPatents = "" if data.has_key("brevets"): #compatibility, this may be useless totalPatents = len(data["brevets"]) else: totalPatents = "see datatable :-)" # new method to count documents by type totalsPerType = [] totalsPerFamilyType = [] if Gather: def generateTotal(content): path = os.path.join(ResultContentsPath, content) if os.path.isdir(path): lstfic = os.listdir(path) languages = set([str(fi[0:2]) for fi in lstfic]) totalLanguages = {l: 0 for l in languages}
u'CitedBy', # the list of docs (patents) cititng this patent 'CitP', # the patents cited by this patent 'CitO' # the other docs cited by this patent ] #"citations" if 'Description' + ndf in os.listdir( ListBiblioPath ): # NEW 12/12/15 new gatherer append data to pickle file in order to consume less memory dico = LoadBiblioFile(ListBiblioPath, ndf) else: #Retrocompatibility with open(ListBiblioPath + '//' + ndf, 'r') as data: dico = cPickle.load(data) LstBrevet = dico['brevets'] if dico.has_key('requete'): requete = dico["requete"] if dico.has_key('number'): print "Found ", dico["number"], " patents! Formating to HMTL tables" else: print "Found ", len(LstBrevet), " patents! Formating to HMTL tables" LstExp = [] LstExp2 = [] #just for testing las fnction in gathered should deseapear soon ##next may need clarifying update for brev in LstBrevet: #brev = CleanPatent(brev) tempo = dict() # this one for DataTable
for ndf in set(srcFile): if 'Description' + ndf in os.listdir( ListBiblioPath ): # NEW 12/12/15 new gatherer append data to pickle file in order to consume less memory DataBrevet = LoadBiblioFile(ListBiblioPath, ndf) print "\n> Hi! This is FormateExportPivotTable" else: #Retrocompatibility... prévious test is ugly: there is an issue with filename in lowercase (sometimes) print "please use Comptatibilizer" DataBrevet = LoadBiblioFile(ListBiblioPath, ndf) #so I try to laod it.... if isinstance(DataBrevet, collections.Mapping): #data = DataBrevet LstBrevet = DataBrevet['brevets'] if DataBrevet.has_key('number'): print "Found ", DataBrevet[ "number"], " patents! Formating into HMTL Pivot tables" else: print "Found ", len( DataBrevet["brevets"] ), " patents! Trying to format into HMTL Pivot tables" else: print "Please delete you data directory... incompatible old stuff in it" print "or try Comptatibilizer before" LstExp = [] LstExp2 = [] #just for testing las fnction in gathered should deseapear soon if ndf.count('Families') > 0: #clesRef2 = ['label', 'year', 'priority-active-indicator', 'kind', 'applicant', 'country', 'inventor', "CPC", 'IPCR4', 'IPCR7', "Inventor-Country", "Applicant-Country", 'Citations'] #'citations','representative', clesRef2 = [