Skip to content

Commit 3a38e0d

Browse files
committed
Fix version mismatch and refine CLI docs
1 parent a1484f9 commit 3a38e0d

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ message: "If you use this software, please cite it using the metadata below."
55
preferred-citation:
66
type: software
77
title: "gen_surv"
8-
version: "1.0.1"
8+
version: "1.0.0"
99
url: "https://github.com/DiogoRibeiro7/genSurvPy"
1010
authors:
1111
- family-names: Ribeiro

gen_surv/cli.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,24 @@
77

88
@app.command()
99
def dataset(
10-
model: str = typer.Argument(..., help="Model to simulate [cphm, cmm, tdcm, thmm, aft_ln]"),
10+
model: str = typer.Argument(
11+
..., help="Model to simulate [cphm, cmm, tdcm, thmm, aft_ln]"
12+
),
1113
n: int = typer.Option(100, help="Number of samples"),
12-
output: Optional[str] = typer.Option(None, "-o", help="Output CSV file. Prints to stdout if omitted."),
13-
):
14-
"""Generate survival data and optionally save to CSV."""
14+
output: Optional[str] = typer.Option(
15+
None, "-o", help="Output CSV file. Prints to stdout if omitted."
16+
),
17+
) -> None:
18+
"""Generate survival data and optionally save to CSV.
19+
20+
Args:
21+
model: Identifier of the generator to use.
22+
n: Number of samples to create.
23+
output: Optional path to save the CSV file.
24+
25+
Returns:
26+
None
27+
"""
1528
df = generate(model=model, n=n)
1629
if output:
1730
df.to_csv(output, index=False)

gen_surv/interface.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
>>> df = generate(model="cphm", n=100, model_cens="uniform", cens_par=1.0, beta=0.5, covar=2.0)
77
"""
88

9+
from typing import Any
10+
import pandas as pd
11+
912
from gen_surv.cphm import gen_cphm
1013
from gen_surv.cmm import gen_cmm
1114
from gen_surv.tdcm import gen_tdcm
@@ -22,13 +25,13 @@
2225
}
2326

2427

25-
def generate(model: str, **kwargs):
26-
"""
27-
Generic interface to generate survival data from various models.
28+
def generate(model: str, **kwargs: Any) -> pd.DataFrame:
29+
"""Generate survival data from a specific model.
2830
29-
Parameters:
30-
model (str): One of ["cphm", "cmm", "tdcm", "thmm"]
31-
**kwargs: Arguments forwarded to the selected model generator.
31+
Args:
32+
model: Name of the generator to run. Must be one of ``cphm``, ``cmm``,
33+
``tdcm``, ``thmm`` or ``aft_ln``.
34+
**kwargs: Arguments forwarded to the chosen generator.
3235
3336
Returns:
3437
pd.DataFrame: Simulated survival data.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "gen_surv"
3-
version = "1.0.1"
3+
version = "1.0.0"
44
description = "A Python package for simulating survival data, inspired by the R package genSurv"
55
authors = ["Diogo Ribeiro <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)