$npx -y skills add QSong-github/DrugClaw --skill psytarQuery the PsyTAR psychiatric adverse-reaction corpus. Use when the user asks about patient-reported ADRs, withdrawal symptoms, drug indications, or effectiveness for Zoloft, Lexapro, Cymbalta, or Effexor XR. Accepts drug names (brand or generic), symptom terms, or UMLS CUIs.
| 1 | # PsyTAR Query Skill |
| 2 | |
| 3 | 891 patient reviews → 6 009 annotated sentences → extracted ADR / WD / SSI / |
| 4 | DI entities → mapped to 918 UMLS + 755 SNOMED CT concepts. |
| 5 | |
| 6 | ## Entity Detection & Routing |
| 7 | |
| 8 | | Input Pattern | Detected As | Targets | |
| 9 | |---|---|---| |
| 10 | | `C0917801` | UMLS CUI | `*_Mapped` sheets only (UMLS1/UMLS2 cols) | |
| 11 | | `Zoloft` / `sertraline` | Drug name | `drug_id` or `drug` columns (alias-aware) | |
| 12 | | `nausea`, `insomnia` … | Free text | substring across all cell values | |
| 13 | |
| 14 | Generic ↔ brand aliases: sertraline↔Zoloft, escitalopram↔Lexapro, |
| 15 | duloxetine↔Cymbalta, venlafaxine↔Effexor. |
| 16 | |
| 17 | ## API |
| 18 | |
| 19 | | Function | Input | Returns | |
| 20 | |---|---|---| |
| 21 | | `search(entity, sheet?, label?)` | single string | `{sheet: [row_dict]}` | |
| 22 | | `search_batch(entities, sheet?, label?)` | list of strings | `{entity: {sheet: [row_dict]}}` | |
| 23 | | `summarize(results, entity)` | result dict + label | compact text | |
| 24 | | `to_json(results)` | result dict | `list[dict]` (flat, adds `_sheet`) | |
| 25 | | `describe()` | — | dataset overview text | |
| 26 | |
| 27 | ### Parameters |
| 28 | |
| 29 | - **`sheet`** — restrict to one sheet (fuzzy-matched: `"ADR"` → `ADR_Identified`). |
| 30 | - **`label`** — when on `Sentence_Labeling`, keep only rows where the named |
| 31 | label column (ADR / WD / EF / INF / SSI / DI) equals 1. |
| 32 | |
| 33 | ## Sheet Schema |
| 34 | |
| 35 | | Sheet | Description | Key Columns | |
| 36 | |---|---|---| |
| 37 | | `Sample` | Original posts | drug_id, rating, indication, side-effect, comment, gender, age, duration | |
| 38 | | `Sentence_Labeling` | 6 009 sentences, binary labels | drug_id, sentence_index, sentences, ADR, WD, EF, INF, SSI, DI, Findings, others, rating, category | |
| 39 | | `ADR_Identified` | Extracted ADR mentions | drug_id, sentence_index, sentences, ADR1 … ADRn | |
| 40 | | `WD_Identified` | Extracted WD mentions | drug_id, sentence_index, sentences, WD1 … WDn | |
| 41 | | `SSI_Identified` | Extracted SSI mentions | drug_id, sentence_index, sentences, SSI1 … SSIn | |
| 42 | | `DI_Identified` | Extracted DI mentions | drug_id, sentence_index, sentences, DI1 … DIn | |
| 43 | | `ADR_Mapped` | ADR → UMLS/SNOMED | drug_id, sentence_index, ADR/ADRs, UMLS1, UMLS2, SNOMED-CT, mild, moderate, severe, persistent, not-persistent, body-site, rating, drug, class, type, entity_type | |
| 44 | | `WD_Mapped` | WD → UMLS/SNOMED | (same structure as ADR_Mapped) | |
| 45 | | `SSI_Mapped` | SSI → UMLS/SNOMED | (same structure) | |
| 46 | | `DI_Mapped` | DI → UMLS/SNOMED | (same structure) | |
| 47 | |
| 48 | ### Mapped-sheet qualifier columns |
| 49 | |
| 50 | `mild`, `moderate`, `severe` — severity descriptors; |
| 51 | `persistent`, `not-persistent` — duration; `body-site` — anatomical site; |
| 52 | `entity_type` — Cognitive / Physiological / Psychological / Functional. |
| 53 | |
| 54 | ## Usage |
| 55 | |
| 56 | ```python |
| 57 | from importlib.machinery import SourceFileLoader |
| 58 | m = SourceFileLoader("psytar", "36_PSYTAR.py").load_module() |
| 59 | |
| 60 | # overview |
| 61 | print(m.describe()) |
| 62 | |
| 63 | # drug → ADR mappings |
| 64 | res = m.search("Zoloft", sheet="ADR_Mapped") |
| 65 | print(m.summarize(res, "Zoloft")) |
| 66 | |
| 67 | # generic name works too |
| 68 | res = m.search("sertraline", sheet="ADR_Mapped") |
| 69 | |
| 70 | # symptom in one Identified sheet |
| 71 | res = m.search("nausea", sheet="ADR_Identified") |
| 72 | |
| 73 | # symptom across all sheets |
| 74 | res = m.search("insomnia") |
| 75 | |
| 76 | # UMLS CUI (auto-scoped to Mapped sheets) |
| 77 | res = m.search("C0917801") |
| 78 | |
| 79 | # withdrawal sentences for Effexor |
| 80 | res = m.search("Effexor", sheet="Sentence_Labeling", label="WD") |
| 81 | |
| 82 | # batch |
| 83 | batch = m.search_batch(["Lexapro", "insomnia", "C0917801"]) |
| 84 | |
| 85 | # JSON for pipeline |
| 86 | flat = m.to_json(m.search("Cymbalta")) |
| 87 | ``` |
| 88 | |
| 89 | ## Data Source |
| 90 | |
| 91 | - **Corpus**: PsyTAR v1.0 — CC BY 4.0 |
| 92 | - **File**: `PsyTAR_dataset.xlsx` — set via `DATA_PATH` or env `PSYTAR_XLSX` |
| 93 | - **Paper**: Zolnoori et al., *Data in Brief* 24, 103838 (2019). |
| 94 | https://doi.org/10.1016/j.dib.2019.103838 |
| 95 | - **Stats**: 891 reviews, 6 009 sentences, 4 813 ADR + 590 WD + 1 219 SSI |
| 96 | + 792 DI mentions, 918 UMLS / 755 SNOMED concepts |