fix: Support new PkN column format in Stunner parser#1205
Merged
Conversation
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>
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>
tamargrey
approved these changes
May 21, 2026
nathan-stender
added a commit
that referenced
this pull request
May 21, 2026
6 tasks
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Peak N ...) and new (PkN ...) column naming conventions for peak datapeak_listin the output instead of leaking as raw columns incustom_information_documentContext
Customer reported duplicate columns in connector output — e.g. two "Pk1 Intensity Area (%)" columns where one was empty. Root cause: newer Stunner exports use
PkNprefix instead ofPeak N, andPkOI(Peak of Interest) duplicates the primary peak's data.Test plan
Generated with Claude Code