@@ -14,12 +14,10 @@ knitr::opts_chunk$set(
14
14
)
15
15
```
16
16
17
- ## Recent API Change
18
-
19
17
With the recent [API changes](api-changes.html), the patents endpoint is the main way to retrieve data. The other
20
18
endpoints supply additional information. Also note that an API key is required.
21
19
22
- ## Patents endpoint
20
+ ## Patent endpoint
23
21
24
22
Which patents have been cited by more than 500 US patents?
25
23
@@ -49,10 +47,6 @@ pv_out$data$assignees$assignee_organization
49
47
50
48
Where geographically have Microsoft inventors been coming from over the past few years?
51
49
52
- Note that the api currently returns no results for "Microsoft Corporation" but will return
53
- "Microsoft Corporation",
54
- "Microsoft Corporation—One Microsoft Way"
55
-
56
50
```{r}
57
51
# Write the query
58
52
query <- with_qfuns(
@@ -71,21 +65,44 @@ pv_out <- search_pv(query, fields = inv_fields, all_pages = TRUE, per_page = 100
71
65
unnest_pv_data(pv_out$data, "patent_id")
72
66
```
73
67
74
- Which inventors have Chicago, IL listed as their location on at least one patent.[^1]
68
+ ## Inventor Endpoint
69
+
70
+ Which inventor's most recent patent has Chicago, IL listed as their location.
75
71
76
72
```{r}
77
73
pv_out <- search_pv(
78
- query = '{"_and":[{"_text_phrase": {"inventors.inventor_city":"Chicago"}},{"_text_phrase": {"inventors.inventor_state":"IL"}}]}',
79
- endpoint = "patent"
74
+ query = '{"_and":[{"_text_phrase": {"inventor_lastknown_city":"Chicago"}},
75
+ {"_text_phrase": {"inventor_lastknown_state":"IL"}}]}',
76
+ endpoint = "inventor"
80
77
)
81
78
82
79
pv_out
83
80
84
- if (pv_out$query_results$total_hits == 0) {
85
- print("something seems to be wrong with the API")
86
- }
81
+ ```
82
+ In the new version of the API, the behavior of this endpoint has changed. See the similar example
83
+ on the [legacy inventors endpoint](https://patentsview.org/apis/api-endpoints/inventors) page
84
+ for its original behavior.
85
+
86
+ We could also call the new version of the patent endpoint to find inventors who listed
87
+ Chicago, IL as their location when applying for a patent.
88
+
89
+ ```{r}
90
+ fields <- c("patent_id", get_fields('patent', groups="inventors"))
91
+ fields
92
+
93
+ query <- '{"_and":[{"_text_phrase": {"inventors.inventor_city":"Chicago"}},
94
+ {"_text_phrase": {"inventors.inventor_state":"IL"}}]}'
95
+
96
+ search_pv(query, fields=fields, endpoint="patent")
97
+
87
98
```
88
99
100
+ Note that here all the inventors on a particular patent will be returned, not just the ones whose
101
+ location was Chicago, IL. Also see the [Writing Queries Vignette](writing-queries.html) for more readable ways
102
+ to write queries.
103
+
104
+ ## Assignee Endpoint
105
+
89
106
Which assignees have an interest in beer?
90
107
91
108
```{r}
@@ -94,5 +111,3 @@ search_pv(
94
111
endpoint = "patent"
95
112
)
96
113
```
97
-
98
- [^1]: Example taken from https://patentsview.org/apis/api-endpoints/inventors.
0 commit comments