chore: batch commit remaining changes
Includes search engine improvements, Alembic migrations, new services (pubmed_daily_update, query_expansion), frontend updates, and documentation sync.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import gzip, io
|
||||
data = open('pubmed26n1546.xml.gz', 'rb').read()
|
||||
print(f'File size: {len(data)}')
|
||||
try:
|
||||
decomp = gzip.decompress(data)
|
||||
print(f'Valid gzip! Decompressed: {len(decomp)} bytes')
|
||||
from lxml import etree
|
||||
root = etree.parse(io.BytesIO(decomp)).getroot()
|
||||
articles = root.findall('.//PubmedArticle')
|
||||
deletes = root.findall('.//DeleteCitation')
|
||||
print(f'PubmedArticle: {len(articles)}, DeleteCitation: {len(deletes)}')
|
||||
except Exception as e:
|
||||
print(f'Corrupted: {e}')
|
||||
@@ -0,0 +1,32 @@
|
||||
"""Download recent FTP update files for testing"""
|
||||
import ftplib, gzip, io, sys, time
|
||||
|
||||
HOST = "ftp.ncbi.nlm.nih.gov"
|
||||
PATH = "/pubmed/updatefiles/"
|
||||
FILES = ["pubmed26n1544.xml.gz", "pubmed26n1545.xml.gz", "pubmed26n1546.xml.gz"]
|
||||
|
||||
for name in FILES:
|
||||
print(f"Downloading {name}...", end=" ", flush=True)
|
||||
for attempt in range(3):
|
||||
try:
|
||||
ftp = ftplib.FTP(HOST, timeout=120)
|
||||
ftp.login()
|
||||
ftp.cwd(PATH)
|
||||
buf = io.BytesIO()
|
||||
ftp.retrbinary(f"RETR {name}", buf.write)
|
||||
ftp.quit()
|
||||
data = buf.getvalue()
|
||||
# verify
|
||||
gzip.decompress(data)
|
||||
with open(name, "wb") as f:
|
||||
f.write(data)
|
||||
print(f"OK ({len(data)/1024/1024:.1f}MB)")
|
||||
break
|
||||
except Exception as e:
|
||||
print(f"attempt {attempt+1} failed: {e}")
|
||||
time.sleep(3)
|
||||
else:
|
||||
print("FAILED")
|
||||
sys.exit(1)
|
||||
|
||||
print("All files downloaded and verified successfully")
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
MD5(pubmed26n1544.xml.gz)= 8fc6db055d14c130bb25b627d6f7ce93
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
MD5(pubmed26n1545.xml.gz)= eb048ded970621df1cb89236878d0ee2
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
MD5(pubmed26n1546.xml.gz)= d8866f67a94b52c079779d3111f76e05
|
||||
Reference in New Issue
Block a user