Conversation
PMIDSource.fetch no longer retrieves PMC full text - that moved to the provider chain in linkml#48 - but the PMC helper methods were left behind in etl/sources/pmid.py with no live caller. The design plan deferred the cleanup explicitly: docs/superpowers/plans/2026-06-12-modular-pdf-fulltext-fetching.md "Leave _fetch_pmc_fulltext, _get_pmcid, _fetch_pmc_xml, and _fetch_pmc_html in place for now ... A later cleanup may remove them once the provider fully supersedes them." PMCFullTextProvider now owns all four behaviours, so this removes: - _fetch_pmc_fulltext, _get_pmcid, _fetch_pmc_xml and _fetch_pmc_html (pmid.py lines 339-472) - the now-unused `import requests`; its only use was inside the deleted _fetch_pmc_html Coverage of PMC-ID resolution is moved rather than dropped. test_get_pmcid_handles_entrez_error covered the deleted _get_pmcid, so it is replaced by test_resolve_pmcid_handles_entrez_error, which exercises the same Entrez elink failure path on the live PMCFullTextProvider._resolve_pmcid. Also drops the stale references to the removed methods in plugins/REVIEW.md. Closes linkml#52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #52.
What
Removes four dead methods from
PMIDSource(src/linkml_reference_validator/etl/sources/pmid.py):_fetch_pmc_fulltext_get_pmcid_fetch_pmc_xml_fetch_pmc_htmlPlus the now-unused
import requests— its only use in the module was inside the deleted_fetch_pmc_html.Why they are dead
PMIDSource.fetchstopped retrieving PMC full text when that moved to the provider chain in #48. The methods were left behind, and the design plan deferred exactly this cleanup:Evidence they are unreachable
The four methods call only each other — nothing outside the block calls them, and
fetch()does not:The only
self._*calls reachable fromfetch()are_parse_authors,_fetch_pubmed_xml,_parse_abstract,_parse_mesh_termsand_parse_publication_types. Every behaviour in the deleted block now lives inPMCFullTextProvider(etl/fulltext/pmc.py):_resolve_pmcid≡_get_pmcid,_fetch_pmc_xml_bytes≡_fetch_pmc_xml,_fetch_pmc_html≡_fetch_pmc_html.Test coverage is moved, not dropped
test_get_pmcid_handles_entrez_errorwas the only test covering the deleted_get_pmcid, so I did not simply remove it. The same error path is now asserted against the live implementation:tests/test_sources.py::TestPMIDSource::test_get_pmcid_handles_entrez_error(covered the dead_get_pmcid)tests/test_fulltext_providers.py::TestPMCProvider::test_resolve_pmcid_handles_entrez_error— patchesEntrez.elinkto raise and assertsPMCFullTextProvider._resolve_pmcidreturnsNoneI intentionally did not port the old test's
handle.close.assert_called_once():PMCFullTextProvider._resolve_pmcidwrapselinkandreadin a singletry, sohandle.close()is not reached onreadfailure. The new test asserts the actual contract (None) rather than the old implementation detail.Stale references
src/linkml_reference_validator/plugins/REVIEW.mdstill pointed at the removed methods. Dropped:(e.g., _fetch_pmc_fulltext)in "Insufficient Doctests for Complex Functions"_fetch_pmc_fulltext/_fetch_pmc_xml/_fetch_pmc_htmlImpact: PMC full-text retrieval completely untestedline, which is no longer true (PMC retrieval is covered bytests/test_fulltext_providers.py::TestPMCProvider) and no longer matches the remaining bullet listHappy to trim that last one back if you would rather keep the review doc as an unedited historical record.
Verification
Run on
refactor/remove-dead-pmc-code, Python 3.11,uv 0.12.7:Not done
PMIDSource.fetchorPMCFullTextProvider— deletion only.docs/superpowers/plans/2026-06-12-modular-pdf-fulltext-fetching.mdandREVIEW2.mdstill mention these names in their historical narrative; I left both alone as records of the plan rather than live documentation.test_locate_returns_text_from_xmlpatches_resolve_pmcidwithreturn_value="999"while passingpmcid="999", so the patch is not actually exercised there. That is pre-existing and out of scope for this PR, but flagging it in case it is worth a follow-up.