Summary
The current EUCAST breakpoint import pipeline does not handle Excel rich text cells correctly. EUCAST uses superscript footnote references appended to breakpoint values (e.g. 0.5 with superscript 1 appears as 0.51 when read naively by readxl or openxlsx2). This causes silent data corruption in clinical_breakpoints.
Proposed solution
An R-based import script using tidyxl::xlsx_cells(), which exposes run-level formatting via the character_formatted column. The script:
- Parses rich text cells by separating base values from superscript footnote references using the
vertAlign attribute
- Auto-detects sheet structure generically across all organism sheets:
- Header rows (via "MIC breakpoint" pattern in col B)
- Single-organism vs multi-organism sheets (col A at header = class name vs "Antimicrobial agent")
- Organism names discovered above each header row for multi-organism sheets
- Data ranges between sub-headers
- Resolves EUCAST footnotes per row by matching superscript references to parsed note blocks in col I, including correct handling of combined keys (e.g.
1/A)
- Outputs the
clinical_breakpoints structure with added columns: version, is_screening, note
Tested on
- EUCAST v13.1 Breakpoint Tables (all 29 data sheets)
- 921 rows extracted, cross-validated against manually curated anaerobe corrections
- Correctly handles: screening breakpoints in parentheses, IE/IP/Note exclusions, combined note keys, disk dose formatting
New columns
| Column |
Description |
version |
Raw EUCAST version string (e.g. "13.1") |
is_screening |
TRUE for parenthesised breakpoint values |
note |
Resolved per-row footnote text with key references |
Remaining work
Context
Developed interactively in a Claude chat session with @msberends. A working prototype (parse_eucast_generic.R) exists and has been tested end-to-end.
Summary
The current EUCAST breakpoint import pipeline does not handle Excel rich text cells correctly. EUCAST uses superscript footnote references appended to breakpoint values (e.g.
0.5with superscript1appears as0.51when read naively byreadxloropenxlsx2). This causes silent data corruption inclinical_breakpoints.Proposed solution
An R-based import script using
tidyxl::xlsx_cells(), which exposes run-level formatting via thecharacter_formattedcolumn. The script:vertAlignattribute1/A)clinical_breakpointsstructure with added columns:version,is_screening,noteTested on
New columns
versionis_screeningTRUEfor parenthesised breakpoint valuesnoteRemaining work
moandabconversion viaas.mo()/as.ab()rank_indexassignment based on taxonomic levelsiteparsing from antimicrobial name qualifiers (meningitis, UTI, etc.)utiflag derivation from siteContext
Developed interactively in a Claude chat session with @msberends. A working prototype (
parse_eucast_generic.R) exists and has been tested end-to-end.