Я хочу получить с помощью скрипта Python все отрицательные письменные мнения от всех членов семьи, подавших заявку на патент Израиля, вместе с соответствующим набором претензий. Я проконсультировался с Gemini и Google AI и с их помощью попытался запустить скопированный ниже скрипт Python. Однако строковый код: GlobalDossierApplication.objects.get(...) вызывает исключение. Для членов семьи EP и США исключением является:
В URL-адресе запроса отсутствует протокол «http://» или «https://».
А для членов семьи IL и WO я получаю исключение:
нет совпадения числового формата.
Вывод также скопировано ниже. Буду признателен за любую помощь в исправлении кода. Код:
import os
import re
import pandas as pd
os.environ["PATENT_CLIENT_EPO_API_KEY"]="********"
os.environ["PATENT_CLIENT_EPO_API_SECRET"]="*********"
os.environ.pop("PATENT_CLIENT_ODP_API_KEY",None)
os.environ.pop("PATENT_CLIENT_USPTO_HOST",None)
os.environ["PATENT_CLIENT_EPO_HOST"]="https://ops.epo.org"
from patent_client import Inpadoc, GlobalDossierApplication
DOWNLOAD_DIR="negative_reports"
if not os.path.exists(DOWNLOAD_DIR):
os.makedirs(DOWNLOAD_DIR)
def get_all_deficiencies_with_claims(il_number):
print(f"---1. Finding FAMILY FOR IL{il_number} ---")
try:
primary_app=Inpadoc.objects.get(f"IL{il_number}A")
if not primary_app:
print(f" Could not find IL{il_number} directly in Inpadoc.\nCheck number format.")
return pd.DataFrame()
family=primary_app.family
print(f" Found {len(family)} family members.")
except Exception as e:
print(f" Error finding family: {e}")
return pd.DataFrame()
print(f"\n---2. SCANNING FOR NEGATIVE OPINIONS ----")
rejection_kws=["REJECTION", "OFFICE ACTION", "WRITTEN OPINION", "SEARCH OPINION",
"REASONS FOR REFUSAL", "NOTIFICATION OF REFUSAL", "EXAMINATION REPORT",
"ARTICLE 94", "COMMUNICATION", "DEFICIENCY"]
claim_kws = ["CLAIMS", "AMENDMENT", "REMARKS", "RESPONSE", "MODIFIED"]
investigation_log = []
for member in family:
pub_num = member.publication_number
print(f"\n>>Family member publication number {pub_num}:")
cc,num,kind=parse_patent_id(pub_num)
print(f"Fetching Dossier of Family Member: {cc}{num}{kind}...")
try:
dossier=GlobalDossierApplication.objects.get(num,office=cc,type="publication")
print(f"Got dossier of {pub_num}")
docs=sorted([d for d in dossier.documents if d.date], key=lambda x: x.date)
current_claims_file = "Original Application (As Filed)"
current_claims_date = "N/A"
current_claims_url = "N/A"
for doc in docs:
desc=doc.description.upper()
if any (kw in desc for kw in claim_kws) and not any (rkw in desc for rkw in rejection_kws):
current_claims_file = f"{cc}_{num}_{doc.date}_CLAIMS_{doc.id}.pdf"
current_claims_date = doc.date
current_claims_url = getattr(doc,'download_url','N/A')
download_file(doc,current_claims_file)
if any (kw in desc for kw in rejection_kws):
if "RESPONSE" in desc or "REPLY" in desc:
continue
filename=f"{cc}_{num}_{doc.date}_REJECTION_{doc.id}.pdf"
print(f" [!] Found Deficiency: {doc.date} - {desc}")
local_path=download_file(doc,filename)
#log the event to our master list
investigation_log.append({
"Country": cc,
"App_Number": num,
"Action_Date": doc.date,
"Action_Desc": doc.description,
"Action_File": filename,
"Related_Claims_Date": current_claims_date,
"Related_Claims_File": current_claims_file,
"Related_Claims_URL": current_claims_url
})
except Exception as e:
print(f" [Notice] {cc}{num} not available in Global Dossier/WIPO CASE.")
print(f"Errorrrrrrrrrr: {e}")
return pd.DataFrame(investigation_log)
def download_file(doc_obj,filename):
full_path=os.path.join(DOWNLOAD_DIR,filename.replace(":","").replace("/","-"))
if not os.path.exists(full_path):
try:
print(f" Downloading: {filename}...")
doc_obj.download(full_path)
return full_path
except Exception:
print(f" Download {filename} Failed.")
return "DOWNLOAD_FAILED"
return full_path
def parse_patent_id(patent_str):
match=re.match(r"([A-Z]{2})(\d+)(.*)",patent_str)
if (match):
return match.groups()
return None,None,None
if __name__=="__main__":
report_df=get_all_deficiencies_with_claims('288986')
if not report_df.empty:
report_df.to_csv("Global_Family_Reports.csv",index=False)
print("Global_Family_Reports Generated")
else:
print("No Negative Reports Found or Family Lookup Failed")
Вывод скрипта:
---1. Finding FAMILY FOR IL288986 ---
Found 6 family members.
---2. SCANNING FOR NEGATIVE OPINIONS ----
>>Family member publication number IL288986A:
Fetching Dossier of Family Member: IL288986A...
[Notice] IL288986 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: While country was detected as IL, no number format matched 288986, please check your number
>>Family member publication number EP3983842A1:
Fetching Dossier of Family Member: EP3983842A1...
[Notice] EP3983842 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: Request URL is missing an 'http://' or 'https://' protocol.
>>Family member publication number EP3983842A4:
Fetching Dossier of Family Member: EP3983842A4...
[Notice] EP3983842 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: Request URL is missing an 'http://' or 'https://' protocol.
>>Family member publication number IL267384A:
Fetching Dossier of Family Member: IL267384A...
[Notice] IL267384 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: While country was detected as IL, no number format matched 267384, please check your number
>>Family member publication number US2022308338A1:
Fetching Dossier of Family Member: US2022308338A1...
[Notice] US2022308338 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: Request URL is missing an 'http://' or 'https://' protocol.
>>Family member publication number WO2020255118A1:
Fetching Dossier of Family Member: WO2020255118A1...
[Notice] WO2020255118 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: While country was detected as WO, no number format matched 2020255118, please check your number
Подробнее здесь: https://stackoverflow.com/questions/798 ... rs-of-a-na
Как получить в сценарии Python письменные мнения всех членов семьи национальной патентной заявки? ⇐ Python
Программы на Python
1770232790
Anonymous
Я хочу получить с помощью скрипта Python все отрицательные письменные мнения от всех членов семьи, подавших заявку на патент Израиля, вместе с соответствующим набором претензий. Я проконсультировался с Gemini и Google AI и с их помощью попытался запустить скопированный ниже скрипт Python. Однако строковый код: GlobalDossierApplication.objects.get(...) вызывает исключение. Для членов семьи EP и США исключением является:
В URL-адресе запроса отсутствует протокол «http://» или «https://».
А для членов семьи IL и WO я получаю исключение:
нет совпадения числового формата.
Вывод также скопировано ниже. Буду признателен за любую помощь в исправлении кода. Код:
import os
import re
import pandas as pd
os.environ["PATENT_CLIENT_EPO_API_KEY"]="********"
os.environ["PATENT_CLIENT_EPO_API_SECRET"]="*********"
os.environ.pop("PATENT_CLIENT_ODP_API_KEY",None)
os.environ.pop("PATENT_CLIENT_USPTO_HOST",None)
os.environ["PATENT_CLIENT_EPO_HOST"]="https://ops.epo.org"
from patent_client import Inpadoc, GlobalDossierApplication
DOWNLOAD_DIR="negative_reports"
if not os.path.exists(DOWNLOAD_DIR):
os.makedirs(DOWNLOAD_DIR)
def get_all_deficiencies_with_claims(il_number):
print(f"---1. Finding FAMILY FOR IL{il_number} ---")
try:
primary_app=Inpadoc.objects.get(f"IL{il_number}A")
if not primary_app:
print(f"[i] Could not find IL{il_number} directly in Inpadoc.\nCheck number format.")
return pd.DataFrame()
family=primary_app.family
print(f" Found {len(family)} family members.")
except Exception as e:
print(f" Error finding family: {e}")
return pd.DataFrame()
print(f"\n---2. SCANNING FOR NEGATIVE OPINIONS ----")
rejection_kws=["REJECTION", "OFFICE ACTION", "WRITTEN OPINION", "SEARCH OPINION",
"REASONS FOR REFUSAL", "NOTIFICATION OF REFUSAL", "EXAMINATION REPORT",
"ARTICLE 94", "COMMUNICATION", "DEFICIENCY"]
claim_kws = ["CLAIMS", "AMENDMENT", "REMARKS", "RESPONSE", "MODIFIED"]
investigation_log = []
for member in family:
pub_num = member.publication_number
print(f"\n>>Family member publication number {pub_num}:")
cc,num,kind=parse_patent_id(pub_num)
print(f"Fetching Dossier of Family Member: {cc}{num}{kind}...")
try:
dossier=GlobalDossierApplication.objects.get(num,office=cc,type="publication")
print(f"Got dossier of {pub_num}")
docs=sorted([d for d in dossier.documents if d.date], key=lambda x: x.date)
current_claims_file = "Original Application (As Filed)"
current_claims_date = "N/A"
current_claims_url = "N/A"
for doc in docs:
desc=doc.description.upper()
if any (kw in desc for kw in claim_kws) and not any (rkw in desc for rkw in rejection_kws):
current_claims_file = f"{cc}_{num}_{doc.date}_CLAIMS_{doc.id}.pdf"
current_claims_date = doc.date
current_claims_url = getattr(doc,'download_url','N/A')
download_file(doc,current_claims_file)
if any (kw in desc for kw in rejection_kws):
if "RESPONSE" in desc or "REPLY" in desc:
continue
filename=f"{cc}_{num}_{doc.date}_REJECTION_{doc.id}.pdf"
print(f" [!] Found Deficiency: {doc.date} - {desc}")
local_path=download_file(doc,filename)
#log the event to our master list
investigation_log.append({
"Country": cc,
"App_Number": num,
"Action_Date": doc.date,
"Action_Desc": doc.description,
"Action_File": filename,
"Related_Claims_Date": current_claims_date,
"Related_Claims_File": current_claims_file,
"Related_Claims_URL": current_claims_url
})
except Exception as e:
print(f" [Notice] {cc}{num} not available in Global Dossier/WIPO CASE.")
print(f"Errorrrrrrrrrr: {e}")
return pd.DataFrame(investigation_log)
def download_file(doc_obj,filename):
full_path=os.path.join(DOWNLOAD_DIR,filename.replace(":","").replace("/","-"))
if not os.path.exists(full_path):
try:
print(f" Downloading: {filename}...")
doc_obj.download(full_path)
return full_path
except Exception:
print(f" Download {filename} Failed.")
return "DOWNLOAD_FAILED"
return full_path
def parse_patent_id(patent_str):
match=re.match(r"([A-Z]{2})(\d+)(.*)",patent_str)
if (match):
return match.groups()
return None,None,None
if __name__=="__main__":
report_df=get_all_deficiencies_with_claims('288986')
if not report_df.empty:
report_df.to_csv("Global_Family_Reports.csv",index=False)
print("Global_Family_Reports Generated")
else:
print("No Negative Reports Found or Family Lookup Failed")
Вывод скрипта:
---1. Finding FAMILY FOR IL288986 ---
Found 6 family members.
---2. SCANNING FOR NEGATIVE OPINIONS ----
>>Family member publication number IL288986A:
Fetching Dossier of Family Member: IL288986A...
[Notice] IL288986 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: While country was detected as IL, no number format matched 288986, please check your number
>>Family member publication number EP3983842A1:
Fetching Dossier of Family Member: EP3983842A1...
[Notice] EP3983842 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: Request URL is missing an 'http://' or 'https://' protocol.
>>Family member publication number EP3983842A4:
Fetching Dossier of Family Member: EP3983842A4...
[Notice] EP3983842 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: Request URL is missing an 'http://' or 'https://' protocol.
>>Family member publication number IL267384A:
Fetching Dossier of Family Member: IL267384A...
[Notice] IL267384 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: While country was detected as IL, no number format matched 267384, please check your number
>>Family member publication number US2022308338A1:
Fetching Dossier of Family Member: US2022308338A1...
[Notice] US2022308338 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: Request URL is missing an 'http://' or 'https://' protocol.
>>Family member publication number WO2020255118A1:
Fetching Dossier of Family Member: WO2020255118A1...
[Notice] WO2020255118 not available in Global Dossier/WIPO CASE.
Errorrrrrrrrrr: While country was detected as WO, no number format matched 2020255118, please check your number
Подробнее здесь: [url]https://stackoverflow.com/questions/79883008/how-to-fetch-within-python-script-written-opinions-of-all-family-members-of-a-na[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия