# Impakt — Brainstorm

Ideas, feature proposals, and design thoughts collected during development.
Grouped by theme. Checkboxes indicate implementation status.

---

## Data Import & Channel Intelligence

- [ ] **Lazy channel loading** — For tests with 500+ channels, don't load `.dat` files until a channel is first accessed. Load headers eagerly, data lazily. This keeps `Session.open()` fast even for large datasets.
- [ ] **Channel aliasing** — Allow users to define human-friendly aliases for channel codes. e.g., `"head_ax" -> "11HEAD0000ACXA"`. Aliases can live in templates or user config.
- [ ] **Auto-detect signal type from channel code** — Use the measurement code (AC, FO, MO, DC...) to automatically suggest appropriate CFC class, plot axis labels, and unit handling.
- [ ] **Batch loader** — Load an entire directory of tests at once. `Session.open_batch("/tests/series_2024/")` returns a `Series` object with cross-test operations.
- [ ] **Channel search by physical meaning** — "Show me all head accelerations" should work across different test objects (driver, passenger, child dummies).
- [ ] **Delta channel** — Compute the difference between the same channel across two tests. Useful for design iteration comparisons.
- [ ] **NHTSA open data integration** — NHTSA publishes crash test data but in their own proprietary format (UDS), not ISO 13499 MME. No publicly available MME datasets exist (the format is industry-internal; Euro NCAP data is confidential). Build a UDS-to-MME converter or direct UDS reader plugin. NHTSA's NCAP database is at `nhtsa.gov/file-downloads?p=nhtsa/downloads/NCAP/` — the Access DB (`NCAP 6-14-10.mdb`) contains summary results, not time-history data. Contact NHTSA (SCI@dot.gov, 888-327-4236) for time-history channel data access.
- [ ] **Channel metadata editor** — Sometimes `.chn` files have wrong units or missing metadata. Provide a non-destructive override mechanism stored in the session.
- [ ] **Synthetic data generator** — Built into the test suite (`tests/fixtures/generate_mme.py`) for development. Consider exposing this as `impakt.synth` for users who want to prototype templates or test analysis scripts without real test data.

## Visualization

- [ ] **Synchronized zoom/pan** — When plotting multiple subplots (e.g., head accel + chest deflection), zoom/pan actions should sync across all subplots.
- [ ] **Waterfall / 3D surface plots** — For tests with many similar channels (e.g., barrier face loads at multiple locations), a 3D surface or waterfall view shows spatial distribution.
- [ ] **Animation mode** — Playback the crash event in time, with a vertical cursor sweeping across all plots simultaneously. Sync with video if available.
- [ ] **Channel comparison sparklines** — In the channel tree sidebar, show tiny inline sparklines next to each channel name so engineers can visually identify signals before selecting them.
- [ ] **Peak annotation** — Auto-annotate the peak value and time on plots. Toggle-able. Shows a marker + text label at the peak.
- [ ] **Statistical overlays** — When viewing multiple tests, show mean +/- 1 sigma envelope, min/max envelope. Useful for repeatability studies.
- [ ] **Color-by-test vs color-by-channel** — When overlaying multiple tests, let the user choose: each test gets a color (channels within a test share the color), or each channel gets a color (tests use line dash variants).
- [ ] **Dark mode** — Engineers often work in labs with varying lighting. A dark theme would be appreciated.
- [ ] **Custom plot layouts** — Allow 2x2, 3x1, 1x3, etc. subplot grids within a single view, each with independent channel selection.
- [ ] **Persistent cursor positions** — When moving between plot views or applying transforms, cursor positions should persist in the session state.

## Signal Processing

- [ ] **Frequency spectrum viewer** — FFT / power spectral density of a channel. Helps diagnose noise, identify resonant frequencies, and verify CFC filter behavior.
- [ ] **Integration / differentiation** — Integrate acceleration to get velocity/displacement. Differentiate displacement to get velocity. Track cumulative units.
- [ ] **Cross-correlation** — Find time lag between two channels. Useful for understanding signal propagation through the vehicle structure.
- [ ] **Envelope detection** — Compute the signal envelope (Hilbert transform). Useful for identifying amplitude trends.
- [ ] **Window functions** — Apply Hanning, Hamming, etc. for spectral analysis pre-processing.
- [ ] **Savitzky-Golay filter** — Alternative to CFC for smoothing that better preserves peaks.
- [ ] **Event detection** — Automatically detect impact events from acceleration signals (threshold crossing, change-point detection). Useful for multi-event tests.
- [ ] **Signal quality metrics** — Detect clipping, saturation, dropout, or excessive noise. Flag channels with potential data quality issues.

## Injury Criteria & Protocols

- [ ] **BrIC (Brain Injury Criterion)** — Rotational brain injury metric using angular velocity. Increasingly used in newer protocols.
- [ ] **DAMAGE (Diffuse Axonal Multi-Axis General Evaluation)** — Related to BrIC, uses angular acceleration.
- [ ] **SIMon / GHBMC coupling** — Interface with finite element head models for advanced brain injury assessment.
- [ ] **Thorax Trauma Index (TTI)** — Side impact chest criterion.
- [ ] **Abdominal Peak Force (APF)** — Abdomen criterion for side impact.
- [ ] **Acetabular force** — Pelvis criterion for side impact (SID-IIs, WorldSID).
- [ ] **Pedestrian criteria** — Head Impact Criterion for headform impactors, lower leg bending, upper leg force.
- [ ] **Protocol version management UI** — Visual diff between protocol versions. Show what thresholds changed between e.g. Euro NCAP 2023 vs 2025.
- [ ] **Custom protocol builder** — Let users define their own pass/fail criteria with custom thresholds. Useful for internal OEM targets that are stricter than regulation.
- [ ] **Sensitivity analysis** — "What if" tool: how would the score change if HIC was 50 points lower? Slider-based interactive exploration.
- [ ] **Regulatory compliance check** — Given a test, automatically check all applicable FMVSS / ECE regulation limits and flag any exceedances.

## Templates & Workflow

- [ ] **Template marketplace / sharing** — Allow teams to share templates. Git-based version control for template libraries. Team templates synced via a shared directory or Git repo.
- [ ] **Template inheritance** — A template can extend another template. e.g., "My NCAP template" extends "Euro NCAP 2024" but adds custom corridors and extra plots.
- [ ] **Channel auto-mapping** — When applying a template to a new test, auto-map channel patterns to actual available channels. Handle naming variations across test facilities.
- [ ] **Template validation** — When a template references channel patterns, validate that the current test data has matching channels. Show warnings for missing channels.
- [ ] **Quick comparison mode** — Two tests side-by-side with synchronized cursors. One-click "compare" from the template panel.
- [ ] **Corridor management UI** — Visual editor for creating and editing tolerance corridors. Draw the envelope on a plot, export to CSV.
- [ ] **Session history / undo** — Track a history of actions (transforms applied, cursors moved, channels added) with undo/redo.

## Reports

- [ ] **Multi-page reports** — Combine multiple plots + injury summary + protocol rating into a single PDF with automatic table of contents.
- [ ] **Configurable report branding** — Company logo, header/footer text, color scheme. Stored in user config.
- [ ] **Excel export** — Export criteria results and cursor values to Excel, not just PDF. Engineers love spreadsheets.
- [ ] **PowerPoint export** — Generate slides with one plot per slide. Common request in OEM environments.
- [ ] **Automated report narration** — Generate natural-language summary paragraphs: "The head acceleration exceeded the Euro NCAP green threshold at t=0.032s, resulting in a yellow rating for the head region."
- [ ] **Report templates gallery** — Pre-built templates for common submission formats (NHTSA compliance report, Euro NCAP submission, IIHS test report).
- [ ] **Comparison reports** — Automatically generate a report comparing two or more tests, highlighting differences in criteria and ratings.

## Integration & Automation

- [ ] **Jupyter notebook integration** — Impakt objects should display rich output in Jupyter (interactive Plotly plots, HTML tables). Consider `_repr_html_` on key objects.
- [ ] **Watch mode** — Monitor a directory for new test data. When a new test appears (e.g., DAQ export completes), automatically apply a template and generate a report.
- [ ] **CI/CD integration** — `impakt evaluate --protocol euro_ncap --exit-code` returns non-zero if any criterion fails. Useful for automated test validation pipelines.
- [ ] **REST API mode** — Run Impakt as a server with a REST API for integration with other tools (CAE workflows, PLM systems).
- [ ] **Pre/post-processing hooks** — User-defined Python functions that run before/after template application, criteria computation, or report generation. Part of the plugin system.
- [ ] **CAE data import** — Read simulation results (LS-DYNA d3plot binodes, Abaqus ODB) so that test vs. simulation overlay is trivial.
- [ ] **Video sync** — Link high-speed camera footage with channel data. Scrubbing the video moves the time cursor on plots, and vice versa.

## Performance & Scale

- [ ] **Memory-mapped data** — For very large datasets, use `numpy.memmap` to avoid loading everything into RAM.
- [ ] **Channel cache** — Cache frequently-accessed transformed channels to avoid recomputing CFC filters every time.
- [ ] **Parallel criteria computation** — Compute all injury criteria in parallel using `concurrent.futures`. The individual computations are independent.
- [ ] **Web UI performance** — For 500-channel tests, the channel tree and dropdown become unwieldy. Implement virtualized scrolling and tree expansion.
- [ ] **Progressive rendering** — Show plots immediately with low-resolution data, then refine with full-resolution data once loaded.

## Data Quality & Validation

- [ ] **Channel polarity check** — Verify SAE sign convention compliance. Detect if a channel appears to have inverted polarity (e.g., positive compression forces that should be negative).
- [ ] **Sensor sanity checks** — Flag physically impossible values (e.g., head acceleration > 500g, negative femur tension during frontal impact).
- [ ] **Inter-channel consistency** — Check that related channels are consistent (e.g., resultant acceleration is actually sqrt of sum of squares of components).
- [ ] **Time sync verification** — Check that all channels have consistent timing (same sample rate, same trigger point, no time drift).
- [ ] **Missing channel detection** — For a given protocol, check which required channels are missing from the test data and warn the user.

## User Experience

- [ ] **Keyboard shortcuts** — `Ctrl+1` through `Ctrl+9` for quick channel groups. `Space` to toggle play/pause on animation. `R` to reset zoom.
- [ ] **Right-click context menus** — Right-click on a channel in the tree to apply common transforms, compute criteria, or export data.
- [ ] **Drag-and-drop** — Drag channels from the tree onto the plot area. Drag a test directory onto the app to open it.
- [ ] **Recent files** — Remember recently opened tests for quick access.
- [ ] **Bookmarks** — Save specific views (channel selection + zoom range + cursors) as named bookmarks within a session.
- [ ] **Multi-window** — Open multiple test sessions in separate browser tabs, synchronized or independent.
- [ ] **Guided analysis wizards** — Step-by-step guided workflows: "Run frontal NCAP analysis" walks the user through channel selection, filtering, criteria computation, and report generation.
- [ ] **Tooltip glossary** — Hover over terms like "HIC15", "CFC 180", "Nij" to see a brief explanation. Aids learning for junior engineers.

## Plugin Ideas

- [ ] **impakt-dicom** — Import DICOM medical imaging data for correlation with dummy injury metrics.
- [ ] **impakt-catia** — Link to CATIA vehicle models for 3D visualization of sensor locations.
- [ ] **impakt-abaqus** — Import Abaqus simulation results.
- [ ] **impakt-lsdyna** — Import LS-DYNA simulation results (binout, d3plot).
- [ ] **impakt-madymo** — Import MADYMO occupant simulation results.
- [ ] **impakt-jncap** — Japanese NCAP scoring protocol.
- [ ] **impakt-cncap** — Chinese NCAP scoring protocol.
- [ ] **impakt-kncap** — Korean NCAP scoring protocol.
- [ ] **impakt-ancap** — Australian NCAP scoring protocol.
- [ ] **impakt-latinncap** — Latin NCAP scoring protocol.

---

## Architecture Notes

### Transform Pipeline Composition

Currently transforms are a flat chain. Consider a DAG-based pipeline for more complex workflows where a channel needs to be both filtered and unfiltered, with the resultant computed from filtered components but cursor values shown on unfiltered data.

### Real-time Collaboration

Multiple engineers often need to look at the same test data simultaneously during post-test review sessions. Consider WebSocket-based real-time sync of cursor positions, channel selections, and annotations. A "presenter mode" where one engineer drives and others follow.

### Offline Mode

The web UI requires a running Python server. For situations where engineers need to share results with non-technical stakeholders, consider an "export to static HTML" mode that bundles all data and Plotly.js into a single self-contained HTML file that can be opened in any browser.

### Standardization of Corridor Files

Corridors currently use a simple CSV format. Consider adopting or defining a more structured format that includes metadata (source protocol, year, applicable dummy type, confidence level). Corridors from official protocol documents could be bundled with the tool.
