Skip to content

Conversation

@nils-herrmann
Copy link
Contributor

@nils-herrmann nils-herrmann commented Jun 4, 2025

This PR follows the fix for #166 proposed in #167 with two minor changes:

  1. Delete assertion
  2. Iterate only through the children with the tag "PMID"

iacopy and others added 2 commits June 4, 2025 12:04
This commit fixes a regression introduced in v0.4.0 where the
parsing of <DeleteCitation> elements was inadvertently removed during
the refactor to an iterator-based model for `parse_medline_xml`.
The original functionality present in v0.3.1 for identifying deleted
articles is now restored, adapted for the memory-efficient iterator design.

Changes include:
- Added logic to process <DeleteCitation> elements within the iterparse loop.
  For each deleted citation, a dictionary `{'pmid': <pmid_value>, 'delete': True}`
  is yielded, consistent with the updated function docstring.
- Ensured `element.clear()` is called for both <DeleteCitation> and
  <PubmedArticle> elements to prevent memory leaks, upholding the
  memory-saving goals of the iterator pattern.

This change brings the parser's behavior in line with its documentation
regarding deleted articles and rectifies the omission from the previous
refactor.

Fixes titipata#166 (addresses the core bug of not handling deleted articles)
Related to titipata#165 (clarifies behavior for the 'delete' flag)
Addresses regression from v0.4.0 (restores DeleteCitation parsing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants