Repository navigation
Conversation
The expand grid started at 0 and keyed times as u64 microseconds, so negative times produced no grid and collided at 0. Use signed microseconds and start at the first event when it is before 0, then continue on multiples of idelta from 0. Also fix two clippy lints flagged by a newer toolchain. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
In my usecases, I will often have time = 0 at the current day, so if I had observations in the past then I would not get predictions for it. This fixes that, which should also make BestDose more flexible. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #384 +/- ##
==========================================
+ Coverage 84.75% 84.80% +0.05%
==========================================
Files 78 78
Lines 35818 35950 +132
==========================================
+ Hits 30356 30487 +131
- Misses 5462 5463 +1
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Rounding the initial negative timestamp can move predictions across a dose boundary or change simulation initialization time.
1 open finding
What changed in this PR
Updates Data::expand to cover negative-time dosing histories while keeping later grid points aligned to zero.
Changes:
- Uses signed microseconds and starts negative-time grids at the earliest event.
- Adds regression tests for negative-time expansion.
- Cleans up two lint patterns.
| File | Description |
|---|---|
| src/optimize/parameters.rs | Removes a blank line after documentation. |
| src/data/structs.rs | Updates grid generation, documentation, and tests. |
| src/data/parser/pmetrics/tests.rs | Uses next_back() for final-header checks. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The seed point at a negative first event used the rounded microsecond key, which could move it across the first dose or before the simulation start. Use the exact time and start the aligned grid strictly after it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
| Project | pharmsol |
| Branch | fix/expand-negative-times |
| Testbed | mhovd-pgx |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.

Bug:
Data::expandstarted its grid at t = 0 and keyed times asu64microseconds. Negative times got no grid points, and they saturated to 0, which also suppressed the grid point at t = 0.Rationale: Dosing histories before t = 0 are a normal TDM setup. Predictions should start at the first event, so initial conditions are applied there, and stay on a shared grid of multiples of
ideltafrom 0.Fix: Use signed microseconds. If an occasion's first event is before 0, start the grid there and continue on multiples of
ideltafrom 0. Data with no negative times is unchanged. Also fixes two clippy lints from a newer toolchain.🤖 Generated with Claude Code