DashKaplanMeier Dash Component
Dash component built with React to render Kaplan–Meier survival curves with enhanced interactivity and styling options. This component is ideal for visualizing survival analysis data directly within Dash applications.
Features
- Plot Kaplan–Meier survival curves from preprocessed data.
- Support for multiple curves with different group labels.
- Interactive tooltips and hover effects.
- Customizable colors and dimensions.
- Fully integrated with Dash callback system.
Installation
pip install dash-kaplan-meier
Install requirements
pip install dash
pip install lifelines
Usage
Here’s how to use the DashKaplanMeier component in your Dash app:
import dash
from dash import html, Dash
import dash_kaplan_meier as dkm
from dash_kaplan_meier.survival_stats import compute_survival_stats
# Example data
time = [your time values list here]
event = [your event values list here]
group = [you rgroup values list here]
# Compute statistics
stats = compute_survival_stats(time ,event, group)
# Dash app
app = Dash()
# Dash app layout with DashKaplanMeier component
app.layout = html.Div([
dkm.DashKaplanMeier(
id = 'km-example',
time = time,
event = event,
group = group,
showCIs = True,
colors = ['blue', 'green', 'red'],
showStatistics = True,
logrankP = stats["logrank_p"],
coxP = stats["cox_p"],
hazardRatio = stats["hazard_ratio"],
layout ={ 'title': 'Kaplan-Meier Survival Curve Example',
"xaxis": {"title": {"text": "Time (months)"}},
"yaxis": {"title": {"text": "Survival Probability"}}},
title = "Kaplan-Meier curves",
config = {'responsive': True}
)
])
if __name__ == '__main__':
app.run(debug=True)
Plot Example
Contributing
See CONTRIBUTING.md
License
MIT License. See LICENSE file for details.
Metadata
Release files for dash-kaplan-meier 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dash_kaplan_meier-0.1.3.tar.gz | 1.4 MB | Without provenance | Details for dash_kaplan_meier-0.1.3.tar.gz |
Release files / dash_kaplan_meier-0.1.3.tar.gz
| Download URL | dash_kaplan_meier-0.1.3.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d80a9ee3f6cdbbe4d1ea9b52b73179c36265f01b944a86d58d8a25e4f2a3632
|
|
BLAKE2b-256 checksum How to use checksums |
b61a0d11087748014490121e16f0ec275d83f512854d4aea4c2fb3be5eedbad9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Security for dash-kaplan-meier 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.