How to use this EPO OPS patent crawler
Requerements
- Python 3.9
- python-dotenv 1.0.1
- python-epo-ops-client 4.1.0
Tested with this versions on Windows 10.
Info
A file named "epo_codes.json" will be created.
This file gets managed by the scripts.
Best time to run the script of step 1 and 2 is between 22:00 - 08:00.
Login into EPO API
How to insert your Login data (key and secret)?
You have to use one of this two options!
The code checks Option 1. If the values are not given via this option it tries option 2.
You can't combine the options. Insert both values with option 1 or with option 2!
You have to login in every script you run.
Option 1: Command Line Parameters
Insert the values as Command Line Parameters.
- python <script_name> key=XXX secret=xxx
Option 2: .env
Create a ".env"-file in this directory.
This file should contain two values:
- key: "XXX"
- secret = "XXX"
Nothing more TODO. Just run the scripts.
Usage
How to use
1. 1_get_codes.py
This fetches the patent codes of the wanted patents and writes them into a json-file.
You can enter how many days you want to crawl.
Use the parameter "days":
- python 1_get_codes.py days=XXX
The last XXX days are getting crawled.
If you don't use this parameter the last 7 days will be crawled (default).
You can choose to crawl only "EP" patents (default) or all countries.
If you want to crawl all countries you have to add "all_countries" as a parameter.
- python 1_get_codes.py
Full example:
- python 1_get_codes.py days=15 all_countries
Don't forget to set key and secret (check Login-chapter)!
2. 2_fetch_data.py
This fetches the patents data of the codes and writes them to disc as xml.
It always fetches bibliographic data, description, claims and abstract (if possible).
It also tries to fetch from equivalents.
- python 2_fetch_data.py
Don't forget to set key and secret (check Login-chapter)!
3. 3_xml_to_json.py
Parses the XMLs patent vise into a JSON.
- python 3_xml_to_json.py
4. 4_upload.py
Uploads all the Jsons in Elastic.
You have to give the path to the jsons as a Command Line Parameter.
It's enough to give the path to the "parsed_publications" folder.
But you can also select a single day folder.
- python 4_upload.py path_to_jsons_folder