../../_images/badge-colab.svg ../../_images/badge-github-custom.svg

The Patents API: Features Overview

This tutorial provides an overview of the Patents data source available via the Dimensions Analytics API.

The topics covered in this notebook are:

Prerequisites

Please install the latest versions of these libraries to run this notebook.

[1]:
# @markdown Click the 'play' button on the left (or shift+enter) after entering your API credentials

username = "" #@param {type: "string"}
password = "" #@param {type: "string"}
endpoint = "https://app.dimensions.ai" #@param {type: "string"}

!pip install dimcli plotly tqdm -U --quiet

# load common libraries
import pandas as pd
from pandas.io.json import json_normalize

import time
import json
from tqdm.notebook import tqdm as progress

import plotly.express as px
from plotly.offline import plot

import dimcli
from dimcli.shortcuts import *

dimcli.login(username, password, endpoint)
dsl = dimcli.Dsl()
DimCli v0.6.7.2 - Succesfully connected to <https://app.dimensions.ai> (method: dsl.ini file)

1. Sample Patents Queries

For the following queries, we will restrict our search using the keyword nanotubes. You can of course change that, so to explore other topics too.

[2]:
TOPIC = "nanotubes" #@param {type: "string"}

Searching patents by keyword

We can easily discover patents mentioning the keyword nanotubes and sorting them by most recent first.

[3]:
df = dsl.query(f"""
search patents
    in title_abstract_only for "{TOPIC}"
return patents[basics+jurisdiction+legal_status]
    sort by publication_date limit 200
""").as_dataframe()
Returned Patents: 200 (total = 33135)
[4]:
df.head(3)
[4]:
granted_year jurisdiction legal_status year assignee_names inventor_names id filing_status assignees title publication_date
0 2020.0 US Active 2019 [US Air Force, GOVERNMENT OF THE UNITED STATES... [Ahmad Ehteshamul Islam, Benji Maruyama] US-10577246-B1 Grant [{'id': 'grid.453002.0', 'city_name': 'Arlingt... Single walled carbon nanotube triode and metho... 2020-03-03
1 2020.0 US Active 2019 [King Fahd University of Petroleum and Mineral... [Rached Ben Mansour, Naef Qasem] US-10576409-B2 Grant [{'id': 'grid.412135.0', 'city_name': 'Dhahran... CO2 adsorbent 2020-03-03
2 NaN US Pending 2017 [Pirelli Tyre SpA, Politecnico di Milano, PIRE... [Carlo Vittorio MAZZOCCHIA, Matteo Antonio DAG... US-20200062933-A1 Application [{'id': 'grid.425004.7', 'city_name': 'Milan',... TYRE FOR VEHICLE WHEELS 2020-02-27
[5]:
temp = df.copy()
temp['tot'] = 1
px.treemap(
    temp,
    path=['jurisdiction', 'legal_status', 'year'],
    color="legal_status",
    values='tot',
    title=f"Share of different jurisdictions of the 200 most recent patents about '{TOPIC}'"
)