p3 improvements

This commit is contained in:
2026-04-11 08:21:41 -04:00
parent 1125105152
commit 9e9bde33b8
8 changed files with 397 additions and 43 deletions

View File

@@ -1,10 +1,11 @@
# Impakt -- Project Status
**Date:** 2026-04-10
**Date:** 2026-04-11
**Version:** 0.1.0
**Tests:** 181 passing
**Source:** ~11,000 lines (py+js+css+html) | ~2,150 lines tests
**Tooling:** uv (Python 3.12.12), hatchling build backend
**Tests:** 240 passing (69.7% coverage)
**Source:** ~10,300 lines (py) | ~2,700 lines tests
**Quality:** 78.3/100 (Grade B) -- see `docs/QA-*.md`
**Tooling:** uv (Python 3.12.12), hatchling build backend, ruff, mypy strict
---
@@ -13,7 +14,7 @@
```bash
cd /Users/noise/Code/impakt
uv sync --dev # install all dependencies
uv run pytest tests/ # run all 181 tests
uv run pytest tests/ # run all 240 tests (with coverage)
uv run impakt info tests/mme_data/3239 # show test metadata
uv run impakt serve tests/mme_data/3239 # launch web UI on :8050
```
@@ -211,13 +212,59 @@ Every selected channel has a stable color index (position in selection order). T
---
## Next Steps (Priority 3)
## Roadmap
1. **Annotations** -- text on plots, measurement lines, highlight regions
2. **Comparison mode** -- side-by-side tests, delta plots, synced cursors
3. **Report builder** -- drag-and-drop report composer, PDF preview
4. **Keyboard shortcuts** -- Ctrl+O, Ctrl+S, 1-9 pane switch, F fullscreen, R reset zoom
5. **Consider Python/WASM frontend** -- NiceGUI or Solara for pure-Python UI (no JS)
Informed by competitive landscape survey (`research/landscape.md`). No open-source web-based tool covers this domain end-to-end. See `BRAINSTORM.md` for full feature ideas with priority tiers.
### Priority 3 — Performance & Rendering
Goal: handle large datasets (500+ channels, 100kHz sample rates) without lag.
1. **plotly-resampler integration** -- Drop-in `FigureResampler` wrapper for Plotly figures. Handles 110M+ points via LTTB downsampling. Works natively with Dash. Repo cloned at `research/repos/plotly-resampler/`. This is the single highest-impact performance improvement.
2. **Synchronized zoom/pan** -- When plotting multiple subplots, zoom/pan syncs across all panes sharing an X axis. Most-requested feature in crash test visualization. Implement via shared `xaxis` config or callback-based range sync.
3. **Lazy channel loading** -- Load `.dat` files on first access, not at `Session.open()`. Load headers eagerly, data lazily. Keeps startup fast for tests with 500+ channels.
4. **Channel sparklines** -- Tiny inline sparklines in the channel grid sidebar. Engineers visually scan 100+ channels before selecting. A 60px-wide sparkline column is transformative for signal browsing.
### Priority 4 — Data Format Expansion
Goal: read the world's crash test data, not just ISO MME.
5. **UDS reader plugin** -- NHTSA's proprietary binary format. Required to access the largest public crash test database. The NHTSA-Tools Fortran source (`research/repos/NHTSA-Tools/`) documents the UDS spec.
6. **ASAM MDF reader plugin** -- Standard for ECU/CAN bus measurement data. Many labs record vehicle bus data alongside crash instrumentation. asammdf (`research/repos/asammdf/`) is a mature library — add as optional dependency.
7. **Flexible CSV reader** -- Column mapping, delimiter detection, header conventions. Engineers frequently receive data as CSV exports from other tools.
### Priority 5 — Comparison & Reporting
Goal: make multi-test comparison and deliverable generation effortless.
8. **Quick comparison mode** -- Two tests side-by-side with synchronized cursors. One-click "compare" button. Color-by-test with channel differentiation via line dash.
9. **Multi-page PDF reports** -- Combine plots + injury summary + protocol rating into a single PDF with table of contents. Currently each report type is standalone.
10. **Excel export** -- Criteria results and cursor values to .xlsx. Engineers live in spreadsheets.
11. **Static HTML export** -- Bundle data + Plotly.js into a self-contained HTML file. Opens in any browser without a Python server. Learned from FalCon's CustomerView distribution model.
### Priority 6 — Video & Advanced Analysis
Goal: close the biggest remaining gap vs. commercial tools.
12. **Video synchronization** -- Link high-speed camera footage with channel data. Scrubbing video moves the time cursor; moving the cursor seeks the video. Every major commercial competitor (measX, DIAdem, Kistler, FalCon) has this. Foxglove and Rerun demonstrate web-native approaches.
13. **Frequency spectrum viewer** -- FFT / PSD alongside time-domain plots. Diagnose noise, verify CFC filter behavior.
14. **Integration / differentiation transforms** -- Acceleration -> velocity -> displacement with cumulative unit tracking.
15. **Data quality dashboard** -- Automated polarity check, sensor sanity, missing channel detection, completeness scoring. No commercial competitor is strong here — opportunity to differentiate.
### Priority 7 — Simulation Correlation & Ecosystem
Goal: bridge the gap between physical test and CAE simulation.
16. **LS-DYNA data import** via lasso-python (`research/repos/lasso-python/`). Enables test-vs-simulation overlay — a premium feature in Altair HyperGraph and Siemens Simcenter.
17. **ISO/TS 18571 CORA correlation** -- Quantitative rating of test-vs-simulation agreement. Standard metric for model validation.
18. **Additional injury criteria** -- BrIC, DAMAGE, TTI, pedestrian criteria, OLC. Required for broader Euro NCAP coverage.
19. **Additional NCAP programs** -- J-NCAP, C-NCAP, K-NCAP, ANCAP, Latin NCAP as protocol plugins.
20. **Jupyter integration** -- `_repr_html_` on Session, Channel, ProtocolResult for rich notebook output.
### Validation (ongoing)
- **Cross-validate CFC filter** against PyAvia's J211_2pole (`research/repos/pyavia/`) and NHTSA-Tools' BwFilt. PyAvia's author notes that scipy's generic `sosfiltfilt` may differ from the SAE J211 Appendix C digital Butterworth algorithm for CFC 60 and 180.
- **Cross-validate injury criteria** against NHTSA-Tools Fortran reference implementations, pyisomme, and EPFL crash-tests-service-robots. Four independent codebases available in `research/repos/`.
---
@@ -238,7 +285,8 @@ Every selected channel has a stable color index (position in selection order). T
Core: numpy, scipy, plotly, dash, dash-bootstrap-components, pandas, pyyaml, jinja2, weasyprint, pydantic
Dev: pytest, pytest-cov, ruff, mypy
Optional: nptdms (for future TDMS reader plugin)
Optional: nptdms (TDMS reader plugin)
Planned: plotly-resampler (P3), asammdf (P4), openpyxl (P5), lasso-python (P7)
---
@@ -249,4 +297,29 @@ Optional: nptdms (for future TDMS reader plugin)
3. **DataTable deprecation warning** -- Dash recommends migrating to dash-ag-grid.
4. **Cursor poll interval (80ms)** -- slight latency in cursor grid updates.
5. **Chest deflection auto-detect** skips DS channels with peak > 150mm to avoid steering column displacement.
6. **Dead files** -- `cursors.py` and `inspector.py` were replaced by `channel_values.py` and deleted; `inspector_callbacks.py` deleted. If old `.pyc` files cause issues, run `find src -name __pycache__ -type d | xargs rm -rf`.
6. **CFC filter implementation** uses scipy `sosfiltfilt` which may diverge from SAE J211 Appendix C for CFC 60/180. Needs cross-validation against PyAvia and NHTSA-Tools reference implementations.
---
## Quality Assurance
Automated QA scoring is configured:
- **Scoring agent:** `.claude/agents/quality-scorer.md` -- collects metrics, applies rubrics, writes report
- **Improvement agent:** `.claude/agents/qa-improver.md` -- reads QA report, auto-fixes mechanical issues
- **Methodology:** `docs/QA-INSTRUCTIONS.md` -- reproducible 8-dimension rubric
- **Reports:** `docs/QA-*.md` -- timestamped scorecards with deltas
- **Scripts:** `scripts/qa-score.sh` (score only), `scripts/qa-improve.sh` (score -> fix -> re-score)
---
## Competitive Landscape
Full survey at `research/landscape.md` with 11 cloned open-source repos in `research/repos/`.
**Key finding:** No existing tool combines open-source + web-based + ISO-MME + CFC + injury criteria + protocol scoring + templates + reports. Commercial tools (measX X-Crash, NI DIAdem, Kistler) do this but are expensive and Windows-only. Impakt occupies a genuinely unserved niche.
**Most actionable libraries:**
- plotly-resampler (performance) -- `research/repos/plotly-resampler/`
- asammdf (MDF format) -- `research/repos/asammdf/`
- lasso-python (LS-DYNA) -- `research/repos/lasso-python/`
- PyAvia, NHTSA-Tools (validation) -- `research/repos/pyavia/`, `research/repos/NHTSA-Tools/`