Examples

Patents endpoint

Which patents have been cited by more than 500 US patents?

library(patentsview)

search_pv(query = qry_funs$gt(patent_num_cited_by_us_patents = 500))
#> $data
#> #### A list with a single data frame on the patent data level:
#> 
#> List of 1
#>  $ patents:'data.frame': 25 obs. of  3 variables:
#>   ..$ patent_id    : chr [1:25] "3946398" ...
#>   ..$ patent_number: chr [1:25] "3946398" ...
#>   ..$ patent_title : chr [1:25] "Method and apparatus for recording with writing fluids and drop projection means therefor" ...
#> 
#> $query_results
#> #### Distinct entity counts across all downloadable pages of output:
#> 
#> total_patent_count = 2,483

How many distinct inventors are represented by these highly-cited patents?

# Setting subent_cnts = TRUE will give us the subentity counts. Since inventors 
# are subentities for the patents endpoint, this means we will get their counts.
search_pv(query = qry_funs$gt(patent_num_cited_by_us_patents = 500),
          fields = c("patent_number", "inventor_id"), subent_cnts = TRUE)
#> $data
#> #### A list with a single data frame (with list column(s) inside) on the patent data level:
#> 
#> List of 1
#>  $ patents:'data.frame': 25 obs. of  2 variables:
#>   ..$ patent_number: chr [1:25] "3946398" ...
#>   ..$ inventors    :List of 25
#> 
#> $query_results
#> #### Distinct entity counts across all downloadable pages of output:
#> 
#> total_patent_count = 2,483, total_inventor_count = 4,318

Where geographically have Microsoft inventors been coming from over the past 20 years?

# Write the query
query <- with_qfuns(
  and(
    gte(patent_date = "2007-07-25"), # Dates are in yyyy-mm-dd format 
    contains(assignee_organization = "microsoft")
  )
)

# Create a field list
inv_fields <- get_fields(endpoint = "patents", groups = "inventors")
fields <- c(inv_fields, "patent_number")

# Pull the data
pv_out <- search_pv(query = query, fields = fields, all_pages = TRUE)

# Unnest the inventor list column
unnest_pv_data(data = pv_out$data, pk = "patent_number")
#> List of 2
#>  $ inventors:'data.frame':   99505 obs. of  20 variables:
#>   ..$ patent_number                 : chr [1:99505] "7249856" ...
#>   ..$ inventor_city                 : chr [1:99505] "Kirkland" ...
#>   ..$ inventor_country              : chr [1:99505] "US" ...
#>   ..$ inventor_first_name           : chr [1:99505] "Michael J." ...
#>   ..$ inventor_first_seen_date      : chr [1:99505] "1981-03-17" ...
#>   ..$ inventor_id                   : chr [1:99505] "4257107-2" ...
#>   ..$ inventor_lastknown_city       : chr [1:99505] "Kirkland" ...
#>   ..$ inventor_lastknown_country    : chr [1:99505] "US" ...
#>   ..$ inventor_lastknown_latitude   : chr [1:99505] "47.6769" ...
#>   ..$ inventor_lastknown_location_id: chr [1:99505] "47.6768927|-122.2059833" ...
#>   ..$ inventor_lastknown_longitude  : chr [1:99505] "-122.206" ...
#>   ..$ inventor_lastknown_state      : chr [1:99505] "WA" ...
#>   ..$ inventor_last_name            : chr [1:99505] "Sinclair" ...
#>   ..$ inventor_last_seen_date       : chr [1:99505] "2016-11-22" ...
#>   ..$ inventor_latitude             : chr [1:99505] "47.6769" ...
#>   ..$ inventor_location_id          : chr [1:99505] "47.6768927|-122.2059833" ...
#>   ..$ inventor_longitude            : chr [1:99505] "-122.206" ...
#>   ..$ inventor_sequence             : chr [1:99505] "0" ...
#>   ..$ inventor_state                : chr [1:99505] "WA" ...
#>   ..$ inventor_total_num_patents    : chr [1:99505] "94" ...
#>  $ patents  :'data.frame':   27635 obs. of  1 variable:
#>   ..$ patent_number: chr [1:27635] "7249856" ...

Inventors endpoint

Return patent numbers and titles with at least one inventor whose location was Chicago, IL.1

search_pv(query = '{"_and":[{"location_city":"Chicago"},{"location_state":"IL"}]}',
          endpoint = "inventors", fields = c("patent_number", "patent_title"))
#> $data
#> #### A list with a single data frame (with list column(s) inside) on the inventor data level:
#> 
#> List of 1
#>  $ inventors:'data.frame':   25 obs. of  1 variable:
#>   ..$ patents:List of 25
#> 
#> $query_results
#> #### Distinct entity counts across all downloadable pages of output:
#> 
#> total_inventor_count = 12,489

Assignees endpoint

Which assignees have an interest in beer?

search_pv(query = qry_funs$text_phrase(patent_title = "beer"), 
          endpoint = "assignees")
#> $data
#> #### A list with a single data frame on the assignee data level:
#> 
#> List of 1
#>  $ assignees:'data.frame':   25 obs. of  4 variables:
#>   ..$ assignee_id          : chr [1:25] "00c135a7c52b5dd3e6e2c342490451f8" ...
#>   ..$ assignee_first_name  : logi [1:25] NA ...
#>   ..$ assignee_last_name   : logi [1:25] NA ...
#>   ..$ assignee_organization: chr [1:25] "PicoBrew, Inc." ...
#> 
#> $query_results
#> #### Distinct entity counts across all downloadable pages of output:
#> 
#> total_assignee_count = 179

1 Example taken from http://www.patentsview.org/api/inventor.htmlback