Giter Site home page Giter Site logo

jyprojs / patentpy Goto Github PK

View Code? Open in Web Editor NEW
14.0 2.0 5.0 3.05 MB

Python package to access USPTO bulk data in rectangular format

License: MIT License

Python 73.88% C++ 26.12%
pypi-package uspto python-package python-programming patents python3 patent-data

patentpy's Introduction

patentpy: Access USPTO data in Rectangular Format

CI status
Docker CircleCI Build Status
Code coverage codecov

License: MIT Downloads

Overview

The patentpy package allows easy access to USPTO (United States Patent and Trademark Office) bulk patent data in rectangular format. By downloading, converting, and storing patent data directly from the USPTO website, patentpy minimizes the work needed to acquire usable data, allowing users to focus on analyzing the data. The R version of this can be found at https://github.com/JYProjs/patentr.

Installation

# install from PyPI
pip install patentpy

# To install development version
# clone repository then run follow code from its parent directory
pip install ./patentpy

Note: This package utilizes pybind11 to wrap a custom txt parser written in C++ code, lxml to parse xml files, and pandas for the option of presenting uspto bulk data as a dataframe.

Sample code

Bulk patent data in TXT or XML format (1976+) can be downloaded using the year and week (within each year) as follows:

# import get_bulk_patent_data functionality
from patentpy.acquire import get_bulk_patent_data


# download patents from the first week of 1976 and get data frame
patent_data = get_bulk_patent_data(year = 1976, week = 1)

# download patents from the last 5 weeks of 1980
# and store in a CSV file named "patent-data.csv"
# Note: uspto patent data is reported on Tuesdays and 1980
# has 53 Tuesdays, hence, 53 weeks worth of data
get_bulk_patent_data(year = [1980] * 5, week = [i for i in range(49,54)], output_file = "patent-data.csv")

Functionality

Data collected for each patent

  • unique identifier (patent number - WKU)
  • application date
  • patent issue date
  • patent title
  • inventor name(s)
  • assignee name(s)
  • ICL classification (IPC or Locarno)
  • referenced patent numbers
  • claims

API Documentation

https://jyprojs.github.io/patentpy/index.html

Contribute

To contribute to patentpy, you can create issues for any bugs/suggestions on the issues page. You can also fork the patentpy repository and create pull requests to add features you think will be useful for users.

Citation

Yu J, Wadhwa RR, Beltz H, Desai MY, Scott JG, Érdi P. patentpy: Access USPTO Bulk Data in Rectangular Format. 2021; Python package version 0.1.0. URL https://github.com/JYProjs/patentpy.

patentpy's People

Contributors

jyprojs avatar rrrlw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

patentpy's Issues

Add automated tests

Add automated testing using travis-CI / pip builds /conda.recipe / other continuous integration tools

Error on Week Out of Bounds

I'm running patentpy's latest version on Windows 10 with Python 3.8. It is noted in the documentation that weeks that are out of bounds for a given year (e.g., no week 53, year/week in the future) that it would not return an error. However, I'm receiving errors for weeks that are out of bounds.

ValueError: week 53's Tuesday exceeded the date range of year 2020.

This particular error seems strange since 2020 is complete. Regardless, the package stated that it would not return an error when the period is out of bounds. Is this the correct behavior? Should the documentation be updated or the code fixed?

ICL_class to CPC class

Hi,

I downloaded USPTO bulkdata using patentpy package. There is an ICL_class (International classification) field here. I need help to map this to CPC_class and CPC_subclass.

Kindly advise how can this be done? Thanks.

Wrap C++ code

Use pybind11 or Cython to wrap convert functions written in C++ to be accessed on python jupyter notebooks

Future Development? - Patent Client

Hey! This is the only way I can see to contact you, so here I go!

I'm the author and maintainer of patent_client, a library with a similar scope and feature set as your own. patent_client is under active development, and growing, so if you'd like, I'd love to have you contribute, or add a note on your readme pointing to it!

Patent Client Logo

PyPI | GitHub | Docs

Thanks!

Parker

UnicodeEncodeError: 'charmap' codec can't encode character '\u0144' in position 75: character maps to

Hi,

My issue is similar to a closed issue - #10

I checked the convert_xml2.py file and its contents are same as what was recommended as a solution for using python 3.7 and above on Windows in the closed issue. I also tried python -X utf8 on command prompt but still get an error which I am sharing below. Kindly help in resolving this. Thanks!

from patentpy.acquire import get_bulk_patent_data

get_bulk_patent_data(year = 2017, week =1,output_file="filepath\\df2017w1a.csv")

error - "File "C:\ProgramData\Anaconda3\lib\site-packages\patentpy\convert_xml2.py", line 229, in convert_xml2_to_df xml2_to_df(curr_file, output_file if output_file is not None else temp_output_file, append, header) UnicodeEncodeError: 'charmap' codec can't encode character '\u0144' in position 75: character maps to "

UnicodeEncodeError: 'charmap' codec can't encode character '\u03a9' in position 3361: character maps to <undefined>

Here is a code:

import get_bulk_patent_data functionality

from patentpy.acquire import get_bulk_patent_data

download patents from the first week of 1976 and get data frame

patent_data = get_bulk_patent_data(year = 2021, week = 1, output_file = "patent-data-1.csv")

Which results:

Traceback (most recent call last):
File "C:\Users\XXXXXXXXXX\patentpy\patentpy\convert_xml2.py", line 229, in convert_xml2_to_df
xml2_to_df(curr_file, output_file if output_file is not None else temp_output_file, append, header)
UnicodeEncodeError: 'charmap' codec can't encode character '\u03a9' in position 3361: character maps to

Package

  • Build packages
  • ensure build successful using test PyPI
  • submit to PyPI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.