|
| 1 | +# Python API Reference |
| 2 | + |
| 3 | +This document describes the high-level public API for programmatic journal assessment. |
| 4 | + |
| 5 | +## Single Journal Assessment |
| 6 | + |
| 7 | +**Function**: `query_dispatcher.assess_journal(query_input)` |
| 8 | + |
| 9 | +Assesses a single journal or conference by querying multiple data sources and returning a consolidated classification. |
| 10 | + |
| 11 | +**Usage**: |
| 12 | +```python |
| 13 | +import asyncio |
| 14 | +from aletheia_probe import query_dispatcher |
| 15 | +from aletheia_probe.normalizer import input_normalizer |
| 16 | + |
| 17 | +async def assess(): |
| 18 | + # Normalize the journal name |
| 19 | + query = input_normalizer.normalize("Nature Communications") |
| 20 | + |
| 21 | + # Get assessment |
| 22 | + result = await query_dispatcher.assess_journal(query) |
| 23 | + |
| 24 | + # Use results |
| 25 | + print(f"Classification: {result.assessment}") |
| 26 | + print(f"Confidence: {result.confidence:.0%}") |
| 27 | + |
| 28 | + return result |
| 29 | + |
| 30 | +asyncio.run(assess()) |
| 31 | +``` |
| 32 | + |
| 33 | +**Result object** contains: |
| 34 | +- `assessment`: Classification (predatory, legitimate, suspicious, unknown) |
| 35 | +- `confidence`: Confidence score (0.0 to 1.0) |
| 36 | +- `reasoning`: List of explanation strings |
| 37 | +- `backend_results`: Details from each data source queried |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## BibTeX File Assessment |
| 42 | + |
| 43 | +**Function**: `BibtexBatchAssessor.assess_bibtex_file(file_path, verbose=False)` |
| 44 | + |
| 45 | +Processes an entire BibTeX file and assesses all journals and conferences referenced. |
| 46 | + |
| 47 | +**Usage**: |
| 48 | +```python |
| 49 | +import asyncio |
| 50 | +from pathlib import Path |
| 51 | +from aletheia_probe import BibtexBatchAssessor |
| 52 | + |
| 53 | +async def assess_bibliography(): |
| 54 | + result = await BibtexBatchAssessor.assess_bibtex_file( |
| 55 | + Path("references.bib"), |
| 56 | + verbose=True |
| 57 | + ) |
| 58 | + |
| 59 | + # Get statistics |
| 60 | + print(f"Total venues: {result.entries_with_journals}") |
| 61 | + print(f"Predatory: {result.predatory_count}") |
| 62 | + print(f"Retracted articles: {result.retracted_articles_count}") |
| 63 | + |
| 64 | + # Format summary |
| 65 | + summary = BibtexBatchAssessor.format_summary(result) |
| 66 | + print(summary) |
| 67 | + |
| 68 | + return result |
| 69 | + |
| 70 | +asyncio.run(assess_bibliography()) |
| 71 | +``` |
| 72 | + |
| 73 | +**Result object** contains: |
| 74 | +- `entries_with_journals`: Number of venues assessed |
| 75 | +- `predatory_count`, `legitimate_count`, `suspicious_count`: Classification counts |
| 76 | +- `retracted_articles_count`: Articles found to be retracted |
| 77 | +- `assessment_results`: List of (entry, assessment) tuples for detailed processing |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## Notes |
| 82 | + |
| 83 | +- Both functions are asynchronous and require `await` or `asyncio.run()` |
| 84 | +- Input normalization handles abbreviations, special characters, and acronyms |
| 85 | +- Results include detailed reasoning for transparency |
| 86 | +- BibTeX assessor automatically detects and skips preprints (arXiv, bioRxiv, etc.) |
0 commit comments