Skip to content

fix: Support new PkN column format in Stunner parser#1205

Merged
nathan-stender merged 3 commits into
mainfrom
fix/stunner-pk-column-format
May 21, 2026
Merged

fix: Support new PkN column format in Stunner parser#1205
nathan-stender merged 3 commits into
mainfrom
fix/stunner-pk-column-format

Conversation

@nathan-stender

Copy link
Copy Markdown
Collaborator

Summary

  • Stunner parser now recognizes both old (Peak N ...) and new (PkN ...) column naming conventions for peak data
  • PkOI (Peak of Interest) columns are consumed but not emitted as a separate peak entry, eliminating the duplicate column issue customers reported
  • Peak data (mean diameter, intensity area, mass area, est. MW, rayleigh ratio) is now properly structured under peak_list in the output instead of leaking as raw columns in custom_information_document

Context

Customer reported duplicate columns in connector output — e.g. two "Pk1 Intensity Area (%)" columns where one was empty. Root cause: newer Stunner exports use PkN prefix instead of Peak N, and PkOI (Peak of Interest) duplicates the primary peak's data.

Test plan

  • All 32 existing Stunner/Lunatic tests pass
  • All 10 Lunatic discovery tests pass
  • Verified customer file: 60/85 measurements correctly produce structured peak data
  • Verified no pk*/pkoi columns leak into measurement_custom_info
  • Lint clean

Generated with Claude Code

The Stunner parser only recognized the old "Peak N ..." column naming
convention. Newer exports use "PkN ..." (e.g. "Pk1 Intensity Area (%)"
instead of "Peak 1 Intensity (%)"), causing peak data to leak into
custom_info as raw unread columns with apparent duplicates between
PkOI and Pk1.

Updated _extract_peak_data to detect and handle both formats. PkOI/Peak
of Interest columns are explicitly consumed to prevent custom_info
leakage but not emitted as a separate peak entry since they duplicate
a numbered peak.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nathan-stender
nathan-stender requested review from a team and slopez-b as code owners May 21, 2026 15:14
@nathan-stender
nathan-stender requested a review from tamargrey May 21, 2026 15:14
Adds Unchained_Labs_Stunner_example02.xlsx exercising the newer PkN
column naming convention (Pk1/Pk2/Pk3/PkOI) with multi-peak data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nathan-stender
nathan-stender merged commit 938a1a2 into main May 21, 2026
9 checks passed
@nathan-stender
nathan-stender deleted the fix/stunner-pk-column-format branch May 21, 2026 16:33
nathan-stender added a commit that referenced this pull request May 21, 2026
### Fixed

- Support new PkN column format in Stunner parser (#1205)
- Recognize Evaluation-Kinetics sheet and SCK analyte lookup (#1204)
- Handle QuantStudio Stop Time and non-ASCII delta columns (#1203)
nathan-stender added a commit that referenced this pull request Jun 1, 2026
## Summary
- Stunner parser now recognizes alternate DLS column names used by newer
instrument software (e.g., `Z-Avg Dia. (nm)` vs `Z Ave. Dia (nm)`,
`Rayleigh ratio R (1/km)` vs `(cm^-1)`, `Viscosity at 25°C` vs `20°C`)
- Previously unmapped DLS fields (`Number of Peaks`, `Number of Angles`,
`Angles Measured`, `Intercept`) are now structured as calculated data
documents instead of leaking to custom info
- `number_of_averages` and `Number of acquisitions used` now try both
`(total)` and non-`(total)` column name variants
- `B/S/F/R` (sample role type) added to sample custom info
- Removed 52 N/A placeholder columns from `data system document.custom
information document` that were causing duplicate columns in connector
CSV output

## Context
Follow-up to #1205. Customer (ProFound) reported 17 remaining duplicate
columns after the PkN fix. Root cause was twofold:
1. `CALCULATED_DATA_LOOKUP` did not recognize newer column naming
conventions, so DLS fields fell through `get_unread()` into
`measurement_custom_info`
2. When the parser reads metadata from the first data row (no-header
mode), unread DLS/peak columns leaked into
`data_system_document.custom_information_document` as N/A placeholders —
the CSV conversion lib then produced one column from the placeholder and
one from the actual structured data

## Test plan
- [x] All 34 Stunner/Lunatic tests pass (33 existing + 1 new)
- [x] All 12 Lunatic discovery tests pass
- [x] New anonymized test file (example03) exercises the new PkN column
format with blank, no-peaks, single-peak, and multi-peak measurements
- [x] Verified customer file: 0/85 measurements have
`measurement_custom_info` content
- [x] Verified `data_system_document.custom_information_document` is
empty (was 52 N/A keys)
- [x] Lint clean (black, ruff, mypy)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants