Comments (6)
I'm seeing the same issue since last week Friday.
So it seems the script expects the Excel file hosted by EPO to have a filename in the format legal_code_descriptions_YYYYMMDD.xlsx
but the latest file hosted by EPO changed to
https://webserv.epo.org/projects/d5413/rawdatapublic.nsf/0/C12583380039E7DBC12589290063DE7E/$File/legal_code_descriptions_202307.xlsx
which is in the format YYYY, and then what appears to maybe be a week number?
Anyway, the upstream data source changed stuff, so for now you might be better off patching it out manually until @parkerhancock has the time to fix it.
from patent_client.
I added a pull request to fix this issue #95
from patent_client.
Thank you. I tried to fix this issue manually, but it doesn't seem to be working well. Hopefully, @parkerhancock has some better ideas. Thank you again.
from patent_client.
Hey team! This is exactly the error - the EPO went and changed their spreadsheet format. I'm going to review the PR this week. I think I also want to see if there's a way I can make similar failures in the future fail a little more gracefully - rather than erroring out the whole library. Thanks!
from patent_client.
Hi,
thanks for the nice package. I started to play with it yesterday and encounteres the same error @Ianvdl encountered.
Maybe I can contribute a bit (although I am not a very skilled programmer)
it looks as if the proposed fix
"date = datetime.datetime.strptime(date_string, "%Y%W").date()"
returns "date = datetime.date(2023, 1, 1)" - that appears not be the expected week of the year, which should be "07" (or "08" as of today).
For me the following worked:
def has_current_spreadsheet():
con = sqlite3.connect(db_location, timeout=30)
cur = con.cursor()
try:
#fname = cur.execute("SELECT * FROM meta").fetchone()[0]
# fetchone only gets the first entry in META which holds not necessarily the file from the latest week
# at least when I manually edited the meta table to see what happens when file name is an old one
fname = cur.execute("SELECT * FROM meta").fetchall()
# initiate lists of legal_code_descriptions filenames
date_strings = []
#date_string = re.search(r"legal_code_descriptions_(\d+)\.xlsx", fname).group(1)
# step though all rows in meta to collect all dates (years and weeks) in lists
for name in fname:
#print (name[0])
date_string = re.search(r"legal_code_descriptions_(\d+)\.xlsx", name[0]).group(1)
# collect all date_strings
date_strings.append(date_string)
#print (date_strings)
# when tested on 22. Feb 2023 the date/time appended to the EPO excel file has format "YYYYWW"
# e.g. legal_code_descriptions_202307.xlsx, i.e, week 7 in 2023
# therefore testing for "%Y%m%d" caused an error that has to be captured
# note: file was updated by EPO on Wed 23.02.2023 to legal_code_descriptions_202308.xlsx
try:
# keep this code piece in case EPO changes format back
date = datetime.datetime.strptime(date_string, "%Y%m%d").date()
age = datetime.datetime.now().date() - date
logger.debug(f"Legal Code Database is {age} days old")
return age.days <= 30
except:
# initiate date_max that gets the latest date (year and week) from the Excelfile
date_max = 0
# get latest year and week from dates in META
date_max = max(date_strings)
# parse date_max for most recent year and week
year = int(date_max[:4])
week = int(date_max[4:])
# get current year and week
current_year = datetime.datetime.now().isocalendar()[0]
current_week = datetime.datetime.now().isocalendar()[1]
# check if year is the same
if current_year == year :
age = current_week - week
else: # when old file is from week 52 or 53 of previous year then it might be outdated
age = 2
logger.debug(f"Legal Code Database is {age} weeks old")
return age < 1
except (sqlite3.OperationalError, TypeError):
return False
@parkerhancock maybe you can habe a look and see if that helps
Kind regards,
Michael
from patent_client.
Fixed in #102
from patent_client.
Related Issues (20)
- KeyError: 'inventors' HOT 1
- Not getting the inventor details. HOT 1
- 'OpsController' object has no attribute '_key_generator' Error HOT 9
- Problems with PublishedApplicationBiblio.objects.get on Ubuntu HOT 1
- Docker weirdness; GlobalDossierApplication missing 'office_actions' attribute HOT 4
- Failed to authenticate with EPO OPS! Please check your credentials. HOT 5
- BUG: Public Search Returns a Length of 500 without raising an appropriate warning. HOT 4
- Confirmation Number Missing HOT 3
- Option to avoid loading national codes HOT 2
- "Event Loop is closed"/Deadlocks for simultaneous requests HOT 4
- Python 3.9 Is Not Supported HOT 1
- GlobalDossier exception on objects.get HOT 1
- When using docker, Inpadoc client credentials fail to be identified HOT 2
- can't run program when importing library HOT 2
- Public patent search API no longer working - USPTO blocking programmatic access? HOT 3
- lega_codes.sqlite exceeding 3GB HOT 2
- execution_date not being included in available properties HOT 2
- Async yields strangeness.. HOT 1
- Is there lots broken? .claims_text and 'help()' doesn't work, some USPTO searching too HOT 1
- EPO OPS Full document download not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from patent_client.