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_pregrants(config): feature_map = collections.defaultdict(list) cnx = pvdb.incremental_pregranted_table(config) if cnx is None: return feature_map cursor = cnx.cursor() query = "SELECT id, document_number, name_first, name_last FROM rawinventor;" cursor.execute(query) idx = 0 for uuid, document_number, name_first, name_last in cursor: im = InventorMention(uuid, None, '', name_first if name_first else '', name_last if name_last else '', '', '', '', document_number=document_number) feature_map[im.record_id].append(last_name(im)) idx += 1 logging.log_every_n(logging.INFO, 'Processed %s pregrant records - %s features', 10000, idx, len(feature_map)) logging.log(logging.INFO, 'Processed %s pregrant records - %s features', idx, len(feature_map)) return feature_map
def build_pregrants(config): feature_map = dict() cnx = pvdb.incremental_pregranted_table(config) if cnx is None: return feature_map cursor = cnx.cursor() query = "select document_number,invention_title from application;" cursor.execute(query) idx = 0 for rec in cursor: record_id = 'pg-%s' % rec[0] feature_map[record_id] = rec[1] idx += 1 logging.log_every_n(logging.INFO, 'Processed %s pregrant records - %s features', 10000, idx, len(feature_map)) logging.log(logging.INFO, 'Processed %s pregrant records - %s features', idx, len(feature_map)) return feature_map
def build_pregrants(config): canopy2uuids = collections.defaultdict(list) cnx = pvdb.incremental_pregranted_table(config) # cnx is none if we haven't specified a pregranted table if cnx is None: return canopy2uuids cursor = cnx.cursor() query = "SELECT id, 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 pregrant records - %s canopies', 10000, idx, len(canopy2uuids)) logging.log(logging.INFO, 'Processed %s pregrant records - %s canopies', idx, len(canopy2uuids)) return canopy2uuids
def build_pregrants(config): # | id | document_number | sequence | name_first | name_last | organization | type | rawlocation_id | city | state | country | filename | created_date | updated_date | feature_map = collections.defaultdict(list) cnx = pvdb.incremental_pregranted_table(config) # if there was no table specified if cnx is None: return feature_map cursor = cnx.cursor() query = "SELECT id, document_number, sequence-1 as sequence, name_first, name_last, organization, type, rawlocation_id, city, state, country FROM rawassignee" cursor.execute(query) idx = 0 for rec in cursor: am = AssigneeMention.from_application_sql_record(rec) feature_map[am.record_id].append(am.assignee_name()) idx += 1 logging.log_every_n(logging.INFO, 'Processed %s pregrant records - %s features', 10000, idx, len(feature_map)) logging.log(logging.INFO, 'Processed %s pregrant records - %s features', idx, len(feature_map)) return feature_map