fix(resm): audit physical fulltext files
This commit is contained in:
parent
43e8af74a4
commit
b0b26a4ab5
|
|
@ -180,7 +180,8 @@ The paper fetch pipeline in `apps/resm/tasks.py` currently includes:
|
|||
Title quality is tracked on `Paper` with the original value retained only when a correction
|
||||
is applied. `python manage.py audit_paper_titles` performs a dry-run audit by default;
|
||||
`--apply` writes only high-confidence XML corrections unless `--allow-medium` is explicitly
|
||||
provided for reviewed PDF candidates.
|
||||
provided for reviewed PDF candidates. The audit checks physical XML/PDF files even when
|
||||
legacy `has_fulltext_*` flags are stale.
|
||||
|
||||
Download behavior is stateful:
|
||||
|
||||
|
|
|
|||
|
|
@ -33,13 +33,16 @@ def _paper_path(paper, ext):
|
|||
|
||||
def _fulltext_candidate(paper):
|
||||
candidates = []
|
||||
if paper.has_fulltext_xml:
|
||||
candidate = extract_title_from_xml(_paper_path(paper, "xml"), paper.doi)
|
||||
xml_path = _paper_path(paper, "xml")
|
||||
pdf_path = _paper_path(paper, "pdf")
|
||||
# 历史状态位可能与磁盘不一致;审计以实际文件为准,避免“文件存在但 flag=false”漏检。
|
||||
if paper.has_fulltext_xml or os.path.isfile(xml_path):
|
||||
candidate = extract_title_from_xml(xml_path, paper.doi)
|
||||
if candidate:
|
||||
candidates.append(candidate)
|
||||
if paper.has_fulltext_pdf:
|
||||
if paper.has_fulltext_pdf or os.path.isfile(pdf_path):
|
||||
candidate = extract_title_from_pdf(
|
||||
_paper_path(paper, "pdf"), paper.doi, paper.first_author or ""
|
||||
pdf_path, paper.doi, paper.first_author or ""
|
||||
)
|
||||
if candidate:
|
||||
candidates.append(candidate)
|
||||
|
|
|
|||
Loading…
Reference in New Issue