Spaces:
Running
Running
File size: 3,764 Bytes
016b413 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# Implementation Plans
TDD implementation plans based on the brainstorming documents. Each phase is a self-contained vertical slice with tests, implementation, and demo scripts.
---
## Prerequisites (COMPLETED)
The following foundational changes have been implemented to support all three phases:
| Change | File | Status |
|--------|------|--------|
| Add `"openalex"` to `SourceName` | `src/utils/models.py:9` | β
Done |
| Add `metadata` field to `Evidence` | `src/utils/models.py:39-42` | β
Done |
| Export all tools from `__init__.py` | `src/tools/__init__.py` | β
Done |
All 110 tests pass after these changes.
---
## Priority Order
| Phase | Name | Priority | Effort | Value |
|-------|------|----------|--------|-------|
| **17** | Rate Limiting | P0 CRITICAL | 1 hour | Stability |
| **15** | OpenAlex | HIGH | 2-3 hours | Very High |
| **16** | PubMed Full-Text | MEDIUM | 3 hours | High |
**Recommended implementation order**: 17 β 15 β 16
---
## Phase 15: OpenAlex Integration
**File**: [15_PHASE_OPENALEX.md](./15_PHASE_OPENALEX.md)
Add OpenAlex as 4th data source for:
- Citation networks (who cites whom)
- Concept tagging (semantic discovery)
- 209M+ scholarly works
- Free, no API key required
**Quick Start**:
```bash
# Create the tool
touch src/tools/openalex.py
touch tests/unit/tools/test_openalex.py
# Run tests first (TDD)
uv run pytest tests/unit/tools/test_openalex.py -v
# Demo
uv run python examples/openalex_demo.py
```
---
## Phase 16: PubMed Full-Text
**File**: [16_PHASE_PUBMED_FULLTEXT.md](./16_PHASE_PUBMED_FULLTEXT.md)
Add full-text retrieval via BioC API for:
- Complete paper text (not just abstracts)
- Structured sections (intro, methods, results)
- Better evidence for LLM synthesis
**Quick Start**:
```bash
# Add methods to existing pubmed.py
# Tests in test_pubmed_fulltext.py
# Run tests
uv run pytest tests/unit/tools/test_pubmed_fulltext.py -v
# Demo
uv run python examples/pubmed_fulltext_demo.py
```
---
## Phase 17: Rate Limiting
**File**: [17_PHASE_RATE_LIMITING.md](./17_PHASE_RATE_LIMITING.md)
Replace naive sleep-based rate limiting with `limits` library for:
- Moving window algorithm
- Shared limits across instances
- Configurable per-API rates
- Production-grade stability
**Quick Start**:
```bash
# Add dependency
uv add limits
# Create module
touch src/tools/rate_limiter.py
touch tests/unit/tools/test_rate_limiting.py
# Run tests
uv run pytest tests/unit/tools/test_rate_limiting.py -v
# Demo
uv run python examples/rate_limiting_demo.py
```
---
## TDD Workflow
Each implementation doc follows this pattern:
1. **Write tests first** - Define expected behavior
2. **Run tests** - Verify they fail (red)
3. **Implement** - Write minimal code to pass
4. **Run tests** - Verify they pass (green)
5. **Refactor** - Clean up if needed
6. **Demo** - Verify end-to-end with real APIs
7. **`make check`** - Ensure no regressions
---
## Related Brainstorming Docs
These implementation plans are derived from:
- [00_ROADMAP_SUMMARY.md](../00_ROADMAP_SUMMARY.md) - Priority overview
- [01_PUBMED_IMPROVEMENTS.md](../01_PUBMED_IMPROVEMENTS.md) - PubMed details
- [02_CLINICALTRIALS_IMPROVEMENTS.md](../02_CLINICALTRIALS_IMPROVEMENTS.md) - CT.gov details
- [03_EUROPEPMC_IMPROVEMENTS.md](../03_EUROPEPMC_IMPROVEMENTS.md) - Europe PMC details
- [04_OPENALEX_INTEGRATION.md](../04_OPENALEX_INTEGRATION.md) - OpenAlex integration
---
## Future Phases (Not Yet Documented)
Based on brainstorming, these could be added later:
- **Phase 18**: ClinicalTrials.gov Results Retrieval
- **Phase 19**: Europe PMC Annotations API
- **Phase 20**: Drug Name Normalization (RxNorm)
- **Phase 21**: Citation Network Queries (OpenAlex)
- **Phase 22**: Semantic Search with Embeddings
|