$npx -y skills add QSong-github/DrugClaw --skill pheeQuery the PHEE pharmacovigilance event extraction dataset. Use whenever the user asks about annotated adverse drug events, pharmacovigilance case reports, drug–effect associations from medical literature, or wants to find PHEE examples mentioning a drug name, adverse effect, or c
| 1 | # PHEE Query Skill |
| 2 | |
| 3 | Search PHEE annotated pharmacovigilance events by drug name, adverse effect, |
| 4 | or free text. Substring matching is case-insensitive across all event fields. |
| 5 | |
| 6 | | Input Pattern | Match Logic | |
| 7 | |---|---| |
| 8 | | drug name (e.g. `phenytoin`) | substring on `drug`, `treatment`, `combination_drug`, and `text` | |
| 9 | | adverse effect (e.g. `hepatotoxicity`) | substring on `effect`, `treatment_disorder`, and `text` | |
| 10 | | any other text | substring on all event fields and full sentence | |
| 11 | |
| 12 | ## API |
| 13 | |
| 14 | | Function | Input | Returns | |
| 15 | |---|---|---| |
| 16 | | `load_phee(data_dir)` | directory path | list[dict] (cached) | |
| 17 | | `search(records, entity)` | single entity string | list[dict] | |
| 18 | | `search_batch(records, entities)` | list of entity strings | dict[str, list[dict]] | |
| 19 | | `summarize(hits, entity)` | hit list + label | compact text (sentence count, ADE/PTE counts, top drugs & effects) | |
| 20 | | `to_json(hits)` | hit list | list[dict] | |
| 21 | |
| 22 | ## Record Schema |
| 23 | |
| 24 | Each record returned by `search`: |
| 25 | |
| 26 | ``` |
| 27 | { |
| 28 | "id": "8908396_3", |
| 29 | "text": "A 52-year-old Black woman on phenytoin therapy ...", |
| 30 | "split": "train", |
| 31 | "events": [ |
| 32 | { |
| 33 | "event_type": "Adverse_event | Potential_therapeutic_event", |
| 34 | "trigger": ["developed"], |
| 35 | "subject": ["A 52-year-old Black woman ..."], |
| 36 | "subject_age": ["52-year-old"], |
| 37 | "subject_gender": ["woman"], |
| 38 | "subject_race": ["Black"], |
| 39 | "subject_population": [], |
| 40 | "subject_disorder": ["post-traumatic epilepsy"], |
| 41 | "treatment": ["phenytoin therapy ..."], |
| 42 | "drug": ["phenytoin"], |
| 43 | "dosage": [], |
| 44 | "freq": [], |
| 45 | "route": [], |
| 46 | "duration": [], |
| 47 | "treatment_disorder": ["post-traumatic epilepsy"], |
| 48 | "combination_drug": [], |
| 49 | "effect": ["transient hemiparesis"] |
| 50 | } |
| 51 | ] |
| 52 | } |
| 53 | ``` |
| 54 | |
| 55 | ## Usage |
| 56 | |
| 57 | See `if __name__ == "__main__"` block in `38_PHEE.py` for runnable examples |
| 58 | covering: single drug search, single effect search, batch search, and JSON |
| 59 | output. |
| 60 | |
| 61 | ## Data |
| 62 | |
| 63 | - **Source**: PHEE dataset (Zenodo record 7689970), EMNLP 2022 |
| 64 | - **Files**: `train.json` (~2,900 sentences), `dev.json` (~960), `test.json` (~960) |
| 65 | - **Path**: `DATA_DIR` variable in `38_PHEE.py` |
| 66 | (`resources_metadata/drug_nlp/PHEE/data/json`) |
| 67 | - **Event types**: `Adverse_event`, `Potential_therapeutic_event` |
| 68 | - **Main arguments**: Subject, Treatment, Effect |
| 69 | - **Sub-arguments**: Subject (age, gender, race, population, disorder); Treatment (drug, dosage, freq, route, duration, disorder, combination.drug) |