Generate publication-quality Kaplan-Meier survival curves with aligned "Number at risk" tables meeting NEJM, Lancet, and JCO journal standards.
86
83%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Automatically add "Number at risk" tables to Kaplan-Meier survival curves. Aligns time points precisely with the curve X-axis and generates publication-quality combined figures for clinical oncology journals.
python -m py_compile scripts/main.py
python scripts/main.py --help
python scripts/main.py --input survival_data.csv --time-col time --event-col event --group-col treatment --output risk_table.pngscripts/main.py with the appropriate style and time-point flags.Group count check: If more than 6 groups are provided, emit a warning, split into pages of 6 groups each, and name paginated output files as risk_table_page1.png, risk_table_page2.png, etc.
If scripts/main.py fails or required fields are missing, respond with:
FALLBACK REPORT
───────────────────────────────────────
Objective : <risk table generation goal>
Inputs Available : <file, columns, style provided>
Missing Inputs : <list exactly what is missing>
Partial Result : <any steps completed safely>
Blocked Steps : <what could not be completed and why>
Note: If lifelines is not installed, survival analysis features are limited.
Install with: pip install lifelines
Next Steps : <minimum info needed to complete>
───────────────────────────────────────For complex multi-constraint requests, always include these sections explicitly:
lifelines optional but required for full survival analysis# Basic risk table
python scripts/main.py \
--input survival_data.csv \
--time-col time --event-col event --group-col treatment \
--output risk_table.png
# Journal style
python scripts/main.py \
--input survival_data.csv \
--time-col time --event-col status --group-col arm \
--style NEJM --time-points 0,6,12,18,24,30,36 \
--output figure_1a.pdf
# Combined figure (KM curve + risk table)
python scripts/main.py \
--input survival_data.csv \
--time-col months --event-col death --group-col group \
--km-plot km_curve.png --combine \
--output combined_figure.png| Column | Description | Type |
|---|---|---|
| time | Follow-up time (months) | Numeric |
| event | Event flag | 0=Censored, 1=Event |
| group | Treatment group (optional) | Text/Categorical |
Supported file formats: CSV, Excel (.xlsx/.xls), SAS (.sas7bdat), RData (.rda/.rds), pickle (.pkl)
| Parameter | Description | Default |
|---|---|---|
--input | Input data file | required |
--time-col | Time column name | required |
--event-col | Event column name | required |
--group-col | Group column name | None (single-arm: labeled "All patients") |
--style | Journal style: NEJM/Lancet/JCO | NEJM |
--time-points | Comma-separated time points | auto |
--format | Output format: png/pdf/svg | png |
--dpi | Image resolution | 300 |
--combine | Combine with KM curve | False |
→ Full parameter and journal style reference: references/parameters.md
This skill accepts: CSV or tabular survival data files with time-to-event and event indicator columns, for generating Kaplan-Meier risk tables.
If the request does not involve KM survival curve risk table generation — for example, asking to perform Cox regression, compute hazard ratios, or analyze non-survival time-series data — do not proceed. Instead respond:
"
survival-curve-risk-tableis designed to generate 'Number at risk' tables for Kaplan-Meier survival curves. Your request appears to be outside this scope. Please provide a survival data CSV with time and event columns, or use a more appropriate tool."
lifelines is not installed, report the warning and provide the install command: pip install lifelines.scripts/main.py fails, use the Fallback Template above.Every final response must include:
numpy >= 1.20.0
pandas >= 1.3.0
matplotlib >= 3.4.0
seaborn >= 0.11.0
lifelines >= 0.27.0 # optional but recommended
Pillow >= 8.0.0ca9aaa4
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.