Skip to main content

Python-first toolkit for dissolution, NCA, PK/PD simulation, and pharmacometric reporting.

Project description

OpenPKFlow

A transparent, reproducible, open-source Python workflow for dissolution, NCA, PK/PD simulation, and pharmacometric reporting.

CI PyPI version Python License: MIT


What it does

OpenPKFlow gives formulation scientists, PK/PD researchers, and CRO/CDMO teams a clean Python workflow for:

  • Dissolution similarity: f1, f2, bootstrap f2, model fitting (Weibull, Higuchi, first-order, zero-order, Korsmeyer-Peppas)
  • NCA: AUClast, AUCinf, Cmax, Tmax, lambda_z, half-life, CL/F, Vz/F — three AUC methods, explicit BLQ handling
  • Report generation: Markdown, HTML, PDF (ReportLab), Word (python-docx)
  • PK simulation: 1- and 2-compartment models, oral/IV/infusion — planned v0.5.0

It does not replace expert regulatory judgement or validated commercial platforms. It makes routine analysis faster, cleaner, and more reproducible.


Install

pip install openpkflow

For PDF and Word reports:

pip install openpkflow[reports]

Quick start: dissolution similarity

from openpkflow.dissolution import f1, f2

reference = [20.0, 40.0, 60.0, 80.0, 90.0]
test      = [21.0, 39.0, 61.0, 79.0, 88.0]

print(f"f1 = {f1(reference, test):.2f}")
print(f"f2 = {f2(reference, test):.2f}")

From a CSV file

from openpkflow.dissolution import DissolutionStudy

study = DissolutionStudy.from_csv("dissolution.csv")

result = study.compare(reference="reference", test="test")
result.summary()
result.report("dissolution_report.html")
result.report("dissolution_report.pdf", format="pdf")   # requires [reports]

CSV format: formulation,batch,time,percent_released

CLI

openpkflow version
openpkflow similarity --reference "20,40,60,80" --test "21,39,61,79"

Quick start: NCA

from openpkflow.nca import NCAStudy

study = NCAStudy.from_csv(
    "pk_data.csv",
    auc_method="linear_up_log_down",   # required: "linear", "log", or "linear_up_log_down"
    blq_method="none",                  # required: "none", "drop", "zero", "half_lloq", "lloq"
)
summary = study.analyze()
print(summary.summary())               # tabular ASCII output

# Per-subject results
result = summary.results[0]
print(f"Subject: {result.subject}")
print(f"AUClast: {result.AUClast:.2f} h*mg/L")
print(f"Cmax:    {result.Cmax:.2f} mg/L")
print(f"Tmax:    {result.Tmax:.2f} h")
print(f"t1/2:    {result.half_life:.2f} h")
print(f"CL/F:    {result.CL_F:.2f} L/h")

# Reports
result.report("nca_subject1.html")
summary.report("nca_summary.html")

NCA CSV format

subject,time,conc,dose,route
1,0.0,0.0,320.0,oral
1,0.5,4.2,320.0,oral
1,1.0,8.1,320.0,oral
1,2.0,6.8,320.0,oral
1,4.0,3.5,320.0,oral
1,8.0,1.7,320.0,oral
1,12.0,0.9,320.0,oral
1,24.0,0.2,320.0,oral

Required columns: subject, time, conc, dose, route. Dose in the same mass unit as concentration * time (e.g. mg when conc is mg/L and time is h). Route values: "oral", "iv_bolus", "iv_infusion".

Oral route produces apparent parameters (CL_F, Vz_F). IV routes produce absolute parameters (CL, Vz).


Current status

Module Status
Dissolution f1 / f2 Stable
Bootstrap f2 Stable
Dissolution CSV loader Stable
Dissolution model fitting (5 models, AICc) Stable
HTML, Markdown, PDF, Word reports Stable
NCA (AUC, lambda_z, CL/F, reports) Stable — v0.4.0
PK simulation (1/2-comp, oral/IV) Planned v0.5.0
Population PK diagnostics Planned v0.6.0
Bayesian PK (PyMC, CmdStanPy) Planned v0.8.0
ML / neural ODE Planned v0.9.0

Validation

All formula implementations are validated against published FDA/EMA guidance examples. Each test case cites its source: paper DOI, FDA guidance ID, or R-package vignette. NCA results are validated against the R nlme Theoph reference dataset. See tests/ for details.


Disclaimer

This software is for research and decision-support workflows. Final regulatory interpretation should be reviewed by qualified formulation, pharmacokinetic, and regulatory experts.


Contributing

Issues and PRs welcome at https://github.com/priyamthakar/openpkflow/issues


Citation

If you use OpenPKFlow in research, please cite:

Thakar, P. (2026). OpenPKFlow: Python-first pharmacometrics and dissolution toolkit.
https://github.com/priyamthakar/openpkflow

License

MIT · see LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openpkflow-0.4.0.tar.gz (134.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openpkflow-0.4.0-py3-none-any.whl (65.6 kB view details)

Uploaded Python 3

File details

Details for the file openpkflow-0.4.0.tar.gz.

File metadata

  • Download URL: openpkflow-0.4.0.tar.gz
  • Upload date:
  • Size: 134.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openpkflow-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9d87d15aa30603fe42ef4c9e8f7f47f8feb8f99de422ffcfc22d9a4bb5d56602
MD5 49f15ccd137a2a5c9c8aa8ce91c39763
BLAKE2b-256 8bf5c8d5ee50a099e55d7fe43bee4cc078c42ad9afa911ef8a6c210570a7b068

See more details on using hashes here.

Provenance

The following attestation bundles were made for openpkflow-0.4.0.tar.gz:

Publisher: publish.yml on priyamthakar/openpkflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openpkflow-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: openpkflow-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 65.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openpkflow-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73f9fee8ddfa5db4c37462fcd436200b98c3bc4a23bc56261f189b8a73b35a6a
MD5 62242391c581a3e652ddee6b2c222661
BLAKE2b-256 749dab60a4f77c3f40cf89095632fcf1dda0c1174728a111e67c37c0580e02c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for openpkflow-0.4.0-py3-none-any.whl:

Publisher: publish.yml on priyamthakar/openpkflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page