Commit 7c555f6
Fix broken literature_enhanced imports in two writer scripts
scripts/add_evidence_source.py and scripts/intelligent_snippet_fixer.py
both import EnhancedLiteratureFetcher from communitymech.literature_enhanced
— a module that was never committed to git (only a stale .pyc was
shadowing the missing source locally). Both scripts have raised
ModuleNotFoundError on import for as long as anyone has tried to run
them, which was surfaced as a pre-existing-state heads-up by the recent
writer-conversion PR #87.
Swap to LiteratureFetcher from communitymech.literature, which exposes
the same fetch_pubmed_abstract + fetch_paper surface plus a richer
DOI fallback chain (CrossRef → PubMed via DOI lookup → PMC full-text →
OpenAlex → Semantic Scholar → Europe PMC → publisher meta-tag scrape)
that subsumes what fetch_abstract_for_doi did. API differences:
- fetch_paper returns (abstract, pdf_url) not a dict; tuple-unpack at
call sites.
- LiteratureFetcher.fetch_paper has no download_pdf kwarg (the older
version's flag was a no-op in the LiteratureFetcher pipeline; the
pdf URL is just returned alongside the abstract).
- Title field is unavailable separately. In add_evidence_source.py's
guess_evidence_source classifier the title was filter(None, …)-merged
with snippet and abstract anyway; losing it degrades classification
marginally (PubMed abstracts include the title in the abstract text,
so PMID references are unaffected). If richer DOI classification is
needed later, LiteratureFetcher.fetch_doi_metadata() returns CrossRef
metadata with a title field.
After-state: both scripts now import and run their initialization paths
cleanly. pytest tests/ still passes (136 passed, 9 skipped).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a49f889 commit 7c555f6
2 files changed
Lines changed: 35 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| |||
148 | 151 | | |
149 | 152 | | |
150 | 153 | | |
151 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
152 | 159 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 160 | + | |
| 161 | + | |
157 | 162 | | |
158 | 163 | | |
159 | 164 | | |
| |||
221 | 226 | | |
222 | 227 | | |
223 | 228 | | |
224 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
225 | 234 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 235 | + | |
| 236 | + | |
230 | 237 | | |
231 | 238 | | |
232 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
63 | 68 | | |
64 | 69 | | |
65 | 70 | | |
| |||
210 | 215 | | |
211 | 216 | | |
212 | 217 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | 218 | | |
217 | | - | |
218 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
219 | 225 | | |
220 | 226 | | |
221 | 227 | | |
| |||
0 commit comments