def __init__(self, pregranted_canopies, granted_canopies, config): self.pregranted_canopies = pregranted_canopies self.granted_canopies = granted_canopies self.cnx_g = pvdb.granted_table(config) self.cnx_pg = pvdb.pregranted_table(config) self.cnx_g_inc = pvdb.incremental_granted_table(config) self.cnx_pg_inc = pvdb.incremental_pregranted_table(config)
def build_granted(config): feature_map = collections.defaultdict(list) cnx = pvdb.incremental_granted_table(config) if cnx is None: return feature_map cursor = cnx.cursor() query = "SELECT uuid, patent_id, name_first, name_last FROM rawinventor;" cursor.execute(query) idx = 0 for uuid, patent_id, name_first, name_last in cursor: im = InventorMention(uuid, patent_id, '', name_first if name_first else '', name_last if name_last else '', '', '', '') feature_map[im.record_id].append(last_name(im)) idx += 1 logging.log_every_n(logging.INFO, 'Processed %s granted records - %s features', 10000, idx, len(feature_map)) logging.log(logging.INFO, 'Processed %s granted records - %s features', idx, len(feature_map)) return feature_map
def build_granted(config): feature_map = dict() cnx = pvdb.incremental_granted_table(config) if cnx is None: return feature_map cursor = cnx.cursor() query = "SELECT id,title FROM patent;" cursor.execute(query) idx = 0 for rec in cursor: record_id = '%s' % rec[0] feature_map[record_id] = rec[1] idx += 1 logging.log_every_n(logging.INFO, 'Processed %s grant records - %s features', 10000, idx, len(feature_map)) logging.log(logging.INFO, 'Processed %s grant records - %s features', idx, len(feature_map)) return feature_map
def build_granted(config): # | uuid | patent_id | assignee_id | rawlocation_id | type | name_first | name_last | organization | sequence | feature_map = collections.defaultdict(list) cnx = pvdb.incremental_granted_table(config) # if there was no table specified if cnx is None: return feature_map cursor = cnx.cursor() query = "SELECT uuid, patent_id, assignee_id, rawlocation_id, type, name_first, name_last, organization, sequence FROM rawassignee" cursor.execute(query) idx = 0 for rec in cursor: am = AssigneeMention.from_granted_sql_record(rec) feature_map[am.record_id].append(am.assignee_name()) idx += 1 logging.log_every_n(logging.INFO, 'Processed %s granted records - %s features', 10000, idx, len(feature_map)) logging.log(logging.INFO, 'Processed %s granted records - %s features', idx, len(feature_map)) return feature_map
def build_granted(config): canopy2uuids = collections.defaultdict(list) cnx = pvdb.incremental_granted_table(config) # cnx is none if we haven't specified a granted table if cnx is None: return canopy2uuids cursor = cnx.cursor() query = "SELECT uuid, name_first, name_last FROM rawinventor;" cursor.execute(query) idx = 0 for uuid, name_first, name_last in cursor: im = InventorMention(uuid, '0', '', name_first if name_first else '', name_last if name_last else '', '', '', '') canopy2uuids[first_letter_last_name(im)].append(uuid) idx += 1 logging.log_every_n(logging.INFO, 'Processed %s granted records - %s canopies', 10000, idx, len(canopy2uuids)) logging.log(logging.INFO, 'Processed %s granted records - %s canopies', idx, len(canopy2uuids)) return canopy2uuids