Skip to content

Fix Pmetrics CSV import and export - #313

Open
Siel wants to merge 10 commits into
mainfrom
feature/pmetrics-csv-v1
Open

Fix Pmetrics CSV import and export#313
Siel wants to merge 10 commits into
mainfrom
feature/pmetrics-csv-v1

Conversation

@Siel

@Siel Siel commented Jul 31, 2026

Copy link
Copy Markdown
Member

Summary

  • Fixes the existing Pmetrics reader and writer to preserve complete Data values that Pmetrics CSV can represent.
  • Adds Data::as_bytes and Data::from_bytes; write_pmetrics and read_pmetrics use those same paths.
  • Writes real observations and doses only: the first occasion has no reset row, and a later occasion marks its initial dose with EVID=4.
  • Writes covariates on real event rows at matching times and returns an error for standalone covariate times.
  • Writes missing observations as OUT=-99 and rejects an actual observed value of -99.
  • Preserves the existing lowercase-header reader behavior and keeps older Pmetrics files and bincode data readable.
  • Retains exact covariate source values without changing the serialized covariate layout.

Validation

  • cargo fmt --check
  • cargo check --all-targets --all-features
  • focused Pmetrics tests: 24 passed
  • cargo test -p pharmsol --lib: 395 passed
  • git diff --check

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpharmsol
Branchfeature/pmetrics-csv-v1
Testbedmhovd-pgx

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

🐰 View full continuous benchmarking report in Bencher

@Siel
Siel requested a review from mhovd July 31, 2026 01:19
@Siel Siel changed the title Add exact Pmetrics CSV import and export Fix Pmetrics CSV import and export Jul 31, 2026
@mhovd

mhovd commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Writes missing observations as OUT=-99 and rejects an actual observed value of -99.
I think I prefer that missing observations are written back to the CSV as actual missing values. What do you think?

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