Skip to main content
 
 
 
IN THIS SECTION
5 posts
NoobProgrammer
Last seen: 03/27/2021 - 23:30
Joined: 03/27/2021 - 14:21
Failed to download patent data

I am trying to fetch patent data with the "patentsview" package in R but I am always getting an error and I couldn't find the solution anywhere. Here's my code -

library(patentsview)

query <- with_qfuns(
  and(
    begins(cpc_subgroup_id = 'G06N'),
    gte(patent_year = 2020)
  )
)

# Create a list of fields
# get_fields(endpoint = "patents")

fields <- c(
  "patent_id",
  "patent_title",
  "patent_abstract",
  "patent_date"
)

# Send an HTTP request to the PatentsView API to get the data
pv_res <- search_pv(query = query, fields = fields, all_pages = TRUE)
 

The output is - 

Error in xheader_er_or_status(resp) : Not Found (HTTP 404).

What am I doing wrong here? And what is the solution?

Russ
Last seen: 04/19/2021 - 05:01
Joined: 11/14/2017 - 19:15
a lot going on

Hi NoobProgrammer,

I'm not sure what is going on but it does seem to work if you install the development version.  See https://patentsview.org/forum/7/topic/151#comment-178  It might be that the api is no longer redirecting from https://patentsview.org/api/patents/query to https://api.patentsview.org/patents as it did before.

When I run your code with the dev version I get Error: Bad field(s): patent_id.  It ran when I changed it to patent_number in your fields array.  The patentsview api does work if you call it directly with patent_id.

You could raise an issue in https://github.com/ropensci/patentsview/issues but rumor has it the api will be changing in the near future and the R package will have to be rebuilt.

Russ

noob_patentsviewer
Last seen: 03/31/2021 - 20:19
Joined: 03/29/2021 - 21:03
search_pv() function not found

I am trying to learn how to view any data from the patentsview package in R. Initially, I was receiving this 404 error: Error in xheader_er_or_status(resp) : Not Found (HTTP 404). I resolved that by installing the dev version.

Now, when I run a simple query I get this error: Error in search_pv(query = qry_funs$eq(inventor_last_name = "crew"), all_pages = TRUE) : could not find function "search_pv"

I am not sure what I am doing wrong or if there is another issue. Any help would be greatly appreciated. Here is the code I ran to get that error:

library(patentsview)

search_pv(
  query = qry_funs$eq(inventor_last_name = "crew"),
  all_pages = TRUE
)

 

Thank you!

Russ
Last seen: 04/19/2021 - 05:01
Joined: 11/14/2017 - 19:15
worked for me

That's weird, your code worked for me.  I do get that error if I restart R and enter your code without doing the library(patentsview)

> library(patentsview)
> search_pv(
+   query = qry_funs$eq(inventor_last_name = "crew"),
+   all_pages = TRUE
+ )
$data
#### A list with a single data frame on a patent level:

List of 1
 $ patents:'data.frame':        135 obs. of  3 variables:
  ..$ patent_id    : chr [1:135] "10071164" ...
  ..$ patent_number: chr [1:135] "10071164" ...
  ..$ patent_title : chr [1:135] "Estrogen-related receptor alpha based prota"..

$query_results
#### Distinct entity counts across all downloadable pages of output:

total_patent_count = 135

noob_patentsviewer
Last seen: 03/31/2021 - 20:19
Joined: 03/29/2021 - 21:03
restarted and retried; error gone

Hi,

Thanks for confirming it worked for you. I went back and tried again in a fresh script file, after restarting and it worked for me as well.