$npx -y skills add QSong-github/DrugClaw --skill tac2017Query TAC 2017 ADR annotated drug labels for adverse drug reactions. Use whenever the user asks about ADRs extracted from FDA drug labels, MedDRA-normalized adverse reactions, or wants to look up a drug name, ADR string, or MedDRA code in the TAC 2017 ADR corpus.
| 1 | # TAC 2017 ADR Query Skill |
| 2 | |
| 3 | Search 200 FDA drug labels annotated with adverse reactions, severity, |
| 4 | and MedDRA normalization from the TAC 2017 shared task. |
| 5 | |
| 6 | ## Entity Auto-detection |
| 7 | |
| 8 | | Input Pattern | Detected As | Match Logic | |
| 9 | |---|---|---| |
| 10 | | `10019211` (8 digits) | MedDRA ID | exact on `meddra_pt_id` or `meddra_llt_id` | |
| 11 | | `ACTEMRA` (known drug) | Drug name | exact (case-insensitive) on drug label name | |
| 12 | | `headache` (known ADR) | ADR string | exact on ADR reaction string | |
| 13 | | anything else | Free text | substring on drug names, ADR strings, MedDRA PT/LLT names | |
| 14 | |
| 15 | ## API |
| 16 | |
| 17 | | Function | Input | Returns | |
| 18 | |---|---|---| |
| 19 | | `search(entity)` | single entity string | `list[dict]` — matching label hit(s) | |
| 20 | | `search_batch(entities)` | list of entity strings | `dict[str, list[dict]]` | |
| 21 | | `summarize(hits, entity)` | hit list + query label | compact LLM-readable text | |
| 22 | | `to_json(hits)` | hit list | `list[dict]` (JSON-serializable) | |
| 23 | | `list_drugs()` | — | sorted list of all drug names | |
| 24 | | `stats()` | — | dataset-level statistics dict | |
| 25 | |
| 26 | ## Hit Dict Structure |
| 27 | |
| 28 | Each hit returned by `search()` contains: |
| 29 | |
| 30 | | Field | Type | Description | |
| 31 | |---|---|---| |
| 32 | | `drug` | str | Drug label name | |
| 33 | | `source_file` | str | XML filename | |
| 34 | | `sections` | list[str] | Annotated section names (e.g. "adverse reactions") | |
| 35 | | `mention_counts` | dict | Count per mention type (AdverseReaction, Severity, …) | |
| 36 | | `num_reactions` | int | Total unique reactions in this label | |
| 37 | | `positive_adrs` | list[str] | Positive (non-negated, non-hypothetical) ADR strings | |
| 38 | | `reactions` | list[dict] | Each with `adr`, `meddra_pt`, `meddra_pt_id`, optional `meddra_llt`, `meddra_llt_id`, `flag` | |
| 39 | |
| 40 | ## Usage |
| 41 | |
| 42 | See `if __name__ == "__main__"` block in `37_TAC_2017_ADR.py` for runnable |
| 43 | examples covering: drug name lookup, ADR string search, MedDRA ID search, |
| 44 | batch search, and JSON output. |
| 45 | |
| 46 | ```python |
| 47 | from importlib.machinery import SourceFileLoader |
| 48 | tac = SourceFileLoader("tac2017", "/path/to/37_TAC_2017_ADR.py").load_module() |
| 49 | |
| 50 | # Single drug |
| 51 | hits = tac.search("ACTEMRA") |
| 52 | print(tac.summarize(hits, "ACTEMRA")) |
| 53 | |
| 54 | # ADR across all labels |
| 55 | hits = tac.search("headache") |
| 56 | print(tac.summarize(hits, "headache")) |
| 57 | |
| 58 | # MedDRA PT ID |
| 59 | hits = tac.search("10019211") |
| 60 | |
| 61 | # Batch |
| 62 | results = tac.search_batch(["ENBREL", "nausea", "10002198"]) |
| 63 | ``` |
| 64 | |
| 65 | ## Data |
| 66 | |
| 67 | - **Source**: TAC 2017 ADR shared task (NLM / FDA) |
| 68 | - **Files**: `gold_xml/` (99 test labels) + `train_xml/` (101 training labels), each annotated XML |
| 69 | - **Annotations**: Mentions (AdverseReaction, Severity, Factor, DrugClass, Negation, Animal), Relations (Negated, Hypothetical, Effect), Reactions (unique ADRs with MedDRA PT/LLT normalization) |
| 70 | - **MedDRA version**: 18.1 |
| 71 | - **Path**: `DATA_DIR` variable in `37_TAC_2017_ADR.py` |
| 72 | - **Reference**: https://bionlp.nlm.nih.gov/tac2017adversereactions/ |