Files
backend/tmp_check_citation_status.py
T
34047007@qq.com a6cd99a4ca
CI / backend (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
feat: initial commit - oncology literature search platform
OncoLit: a multi-tenant oncology literature search, feed, and
collaboration platform. Built with FastAPI + Vue 3 + PostgreSQL.
Includes PubMed pipeline, drug approvals, AI summaries, and
systematic review tools.
2026-07-27 07:59:18 +08:00

30 lines
1.5 KiB
Python

"""Check citation refresh status after background run"""
import asyncio, sys
from sqlalchemy import text
from sqlalchemy.ext.asyncio import create_async_engine
DB = 'postgresql+asyncpg://scilit:scilit_prod_2026@postgres:5432/scilit'
async def main():
engine = create_async_engine(DB)
async with engine.connect() as c:
r = await c.execute(text("SELECT COUNT(*) FROM global_literature WHERE cited_by_count > 0"))
print(f'Articles with citations > 0: {r.scalar()}')
r = await c.execute(text("SELECT COUNT(*) FROM global_literature WHERE cited_by_count IS NOT NULL"))
checked = r.scalar()
total = (await c.execute(text("SELECT COUNT(*) FROM global_literature"))).scalar()
print(f'Total checked: {checked}')
print(f'Total records: {total}')
print(f'Progress: {checked}/{total} ({(checked/total*100) if total else 0:.1f}%)')
r = await c.execute(text("SELECT cited_by_count, COUNT(*) FROM global_literature WHERE cited_by_count > 0 GROUP BY cited_by_count ORDER BY cited_by_count DESC LIMIT 5"))
print('Top 5 citation counts:')
for row in r:
print(f' cited_by_count={row[0]}: {row[1]}')
r = await c.execute(text("SELECT pmid, cited_by_count FROM global_literature WHERE cited_by_count > 0 ORDER BY cited_by_count DESC LIMIT 10"))
print('Most cited articles:')
for row in r:
print(f' PMID={row.pmid}: {row.cited_by_count}')
await engine.dispose()
asyncio.run(main())