DrugLib Reviews Query Skill
Search patient drug reviews by drug name or medical condition. Auto-detects
entity type and routes to the appropriate field.
| Input Pattern |
Detected As |
Match Logic |
single/two-word term (e.g. lamictal) |
drug name |
substring on urlDrugName |
multi-word or medical keyword (e.g. bipolar disorder) |
condition |
substring on condition |
Condition keywords that trigger condition routing: disease, disorder, syndrome,
infection, pain, cancer, diabetes, hypertension, depression, anxiety, asthma,
arthritis, migraine, allergy, insomnia, nausea, obesity, acne, gerd, copd.
API
| Function |
Input |
Returns |
load_reviews() |
— |
list[dict] (cached) |
search(entity) |
single entity string |
list[dict] |
search_batch(entities) |
list of entity strings |
dict[str, list[dict]] |
summarize(hits, entity) |
list[dict] + label |
compact LLM-readable text |
to_json(hits) |
list[dict] |
list[dict] (JSON-serialisable) |
Usage
See if __name__ == "__main__" block in 16_DRUGLIB_REVIEWS.py for runnable
examples covering: drug name search, condition search, batch search, and JSON
output.
Data
- Source: Drug Review Dataset (Druglib.com), UCI ML Repository #461
- Citation: Kallumadi, S. & Gräßer, F. (2018). Drug Reviews (Druglib.com) [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C55G6J
- License: CC BY 4.0
- Files:
drugLibTrain_raw.tsv, drugLibTest_raw.tsv (TSV, merged at load)
- Path:
DATA_DIR variable in 16_DRUGLIB_REVIEWS.py
- Columns:
| Column |
Type |
Description |
urlDrugName |
str |
Drug name (lowercase, URL-style) |
rating |
int 0–9 |
Overall patient satisfaction |
effectiveness |
str |
Highly / Considerably / Moderately / Marginally Effective, Ineffective |
sideEffects |
str |
No / Mild / Moderate / Severe / Extremely Severe Side Effects |
condition |
str |
Medical condition being treated |
benefitsReview |
str |
Free-text review of benefits |
sideEffectsReview |
str |
Free-text review of side effects |
commentsReview |
str |
Free-text general comments |
1---2name: druglib-reviews3description: Query the DrugLib.com Drug Review Dataset (UCI #461). Use whenever the user asks about patient drug reviews, drug effectiveness ratings, side-effect profiles, or condition-specific treatment experiences from DrugLib.com.4---5
6# DrugLib Reviews Query Skill
7
8Search patient drug reviews by drug name or medical condition. Auto-detects
9entity type and routes to the appropriate field.
10
11| Input Pattern | Detected As | Match Logic |
12|---|---|---|
13| single/two-word term (e.g. `lamictal`) | drug name | substring on `urlDrugName` |
14| multi-word or medical keyword (e.g. `bipolar disorder`) | condition | substring on `condition` |
15
16Condition keywords that trigger condition routing: disease, disorder, syndrome,
17infection, pain, cancer, diabetes, hypertension, depression, anxiety, asthma,
18arthritis, migraine, allergy, insomnia, nausea, obesity, acne, gerd, copd.
19
20## API
21
22| Function | Input | Returns |
23|---|---|---|
24| `load_reviews()` | — | list[dict] (cached) |
25| `search(entity)` | single entity string | list[dict] |
26| `search_batch(entities)` | list of entity strings | dict[str, list[dict]] |
27| `summarize(hits, entity)` | list[dict] + label | compact LLM-readable text |
28| `to_json(hits)` | list[dict] | list[dict] (JSON-serialisable) |
29
30## Usage
31
32See `if __name__ == "__main__"` block in `16_DRUGLIB_REVIEWS.py` for runnable
33examples covering: drug name search, condition search, batch search, and JSON
34output.
35
36## Data
37
38- **Source**: Drug Review Dataset (Druglib.com), UCI ML Repository #461
39- **Citation**: Kallumadi, S. & Gräßer, F. (2018). *Drug Reviews (Druglib.com)* [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C55G6J
40- **License**: CC BY 4.0
41- **Files**: `drugLibTrain_raw.tsv`, `drugLibTest_raw.tsv` (TSV, merged at load)
42- **Path**: `DATA_DIR` variable in `16_DRUGLIB_REVIEWS.py`
43- **Columns**:
44
45| Column | Type | Description |
46|---|---|---|
47| `urlDrugName` | str | Drug name (lowercase, URL-style) |
48| `rating` | int 0–9 | Overall patient satisfaction |
49| `effectiveness` | str | Highly / Considerably / Moderately / Marginally Effective, Ineffective |
50| `sideEffects` | str | No / Mild / Moderate / Severe / Extremely Severe Side Effects |
51| `condition` | str | Medical condition being treated |
52| `benefitsReview` | str | Free-text review of benefits |
53| `sideEffectsReview` | str | Free-text review of side effects |
54| `commentsReview` | str | Free-text general comments |