$npx -y skills add QSong-github/DrugClaw --skill atcQuery the WHO ATC/DDD Classification System. Use whenever the user asks about ATC codes, drug classification hierarchy, Defined Daily Doses (DDD), or wants to look up drugs by ATC class or find the ATC code for a drug name.
| 1 | # ATC/DDD Query Skill |
| 2 | |
| 3 | Look up ATC classification and DDD data for drugs. Auto-detects entity type: |
| 4 | |
| 5 | | Input Pattern | Detected As | Query Path | |
| 6 | |---|---|---| |
| 7 | | `N02BA` `A10BA02` `C09XX01` | ATC code | local DDD lookup + RxNav member drugs | |
| 8 | | `aspirin` `metformin` | drug name | RxNav ATC classification + local DDD match | |
| 9 | |
| 10 | ATC code regex: `^[A-Z]\d{2}([A-Z]{1,2}\d{0,2})?$` |
| 11 | |
| 12 | ## API |
| 13 | |
| 14 | | Function | Input | Returns | |
| 15 | |---|---|---| |
| 16 | | `load_local(path)` | Excel path | `list[dict]` — cached ATC/DDD records | |
| 17 | | `search(entity)` | single string | `dict` with `entity`, `entity_type`, `local_hits`, `api_hits` | |
| 18 | | `search_batch(entities)` | list of strings | `dict[str, dict]` — keyed by entity | |
| 19 | | `summarize(result)` | search result dict | compact LLM-readable text | |
| 20 | | `to_json(result)` | search result dict | JSON string | |
| 21 | |
| 22 | All functions accept `use_api=True|False` to toggle RxNav queries (default: on). |
| 23 | |
| 24 | ## Usage |
| 25 | |
| 26 | See `if __name__ == "__main__"` block in `27_ATC_DDD.py` for runnable examples: |
| 27 | |
| 28 | ```python |
| 29 | from importlib import import_module |
| 30 | atc = import_module("27_ATC_DDD") |
| 31 | |
| 32 | # Drug name → ATC classes |
| 33 | r = atc.search("aspirin") |
| 34 | print(atc.summarize(r)) |
| 35 | |
| 36 | # ATC code → member drugs + DDD |
| 37 | r = atc.search("N02BA") |
| 38 | print(atc.summarize(r)) |
| 39 | |
| 40 | # Batch |
| 41 | results = atc.search_batch(["metformin", "A10BA02", "C09XX01"]) |
| 42 | |
| 43 | # JSON for pipeline |
| 44 | print(atc.to_json(atc.search("sparsentan"))) |
| 45 | ``` |
| 46 | |
| 47 | ## Data |
| 48 | |
| 49 | - **Local file**: `ATC_DDD_new and alterations 2026_final.xlsx` |
| 50 | - **Columns**: `atc_code`, `atc_level_name`, `new_ddd`, `unit`, `adm_route`, `note` |
| 51 | - **Path**: `DATA_DIR` / `XLSX_PATH` in `27_ATC_DDD.py` |
| 52 | - **Remote API**: RxNav RxClass (`rxnav.nlm.nih.gov/REST/rxclass/`) |
| 53 | - **Citation**: WHOCC — WHO Collaborating Centre for Drug Statistics Methodology, ATC/DDD Index 2026. https://atcddd.fhi.no/atc_ddd_index/ |