From 3be66e7dd19ce0e3621b72f4e8581c3d1dfeb29d Mon Sep 17 00:00:00 2001 From: Diogo Ribeiro Date: Fri, 20 Jun 2025 15:30:26 +0100 Subject: [PATCH] docs: document all functions --- README.md | 22 +++++++++++++--------- docs/source/_static/.gitkeep | 0 docs/source/conf.py | 6 +++++- docs/source/index.md | 8 ++++++++ docs/source/modules.md | 24 ++++++++++++++++++++++-- docs/source/usage.md | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 docs/source/_static/.gitkeep create mode 100644 docs/source/usage.md diff --git a/README.md b/README.md index b4f34af..41b5254 100644 --- a/README.md +++ b/README.md @@ -65,15 +65,19 @@ writing Python code: python -m gen_surv dataset aft_ln --n 100 > data.csv ``` -## 🔧 Available Generators - -| Function | Description | -|--------------|--------------------------------------------| -| `gen_cphm()` | Cox Proportional Hazards Model | -| `gen_cmm()` | Continuous-Time Multi-State Markov Model | -| `gen_tdcm()` | Time-Dependent Covariate Model | -| `gen_thmm()` | Time-Homogeneous Markov Model | -| `gen_aft_log_normal()` | Accelerated Failure Time Log-Normal | +## 🔧 API Overview + +| Function | Description | +|----------|-------------| +| `generate()` | Unified interface that calls any generator | +| `gen_cphm()` | Cox Proportional Hazards Model | +| `gen_cmm()` | Continuous-Time Multi-State Markov Model | +| `gen_tdcm()` | Time-Dependent Covariate Model | +| `gen_thmm()` | Time-Homogeneous Markov Model | +| `gen_aft_log_normal()` | Accelerated Failure Time Log-Normal | +| `sample_bivariate_distribution()` | Sample correlated Weibull or exponential times | +| `runifcens()` | Generate uniform censoring times | +| `rexpocens()` | Generate exponential censoring times | ```text diff --git a/docs/source/_static/.gitkeep b/docs/source/_static/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/docs/source/conf.py b/docs/source/conf.py index cd44dab..9c16f15 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -9,7 +9,7 @@ import sys sys.path.insert(0, os.path.abspath('../../gen_surv')) -project = 'gen_suvr' +project = 'gen_surv' copyright = '2025, Diogo Ribeiro' author = 'Diogo Ribeiro' release = '0.6.3' @@ -22,8 +22,11 @@ "sphinx.ext.napoleon", "myst_parser", "sphinx.ext.viewcode", + "sphinx.ext.autosectionlabel", ] +autosectionlabel_prefix_document = True + # Point to index.md or index.rst as the root document master_doc = "index" @@ -36,3 +39,4 @@ html_theme = 'alabaster' html_static_path = ['_static'] + diff --git a/docs/source/index.md b/docs/source/index.md index 83e034d..da7345b 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -10,14 +10,21 @@ It includes generators for: - **Time-Homogeneous Hidden Markov Models (THMM)** - **Accelerated Failure Time (AFT) Log-Normal Models** +Key functions include `generate()`, `gen_cphm()`, `gen_cmm()`, `gen_tdcm()`, +`gen_thmm()`, `gen_aft_log_normal()`, `sample_bivariate_distribution()`, +`runifcens()`, and `rexpocens()`. + --- +See the [Getting Started](usage) guide for installation instructions. + ## 📚 Modules ```{toctree} :maxdepth: 2 :caption: Contents +usage modules theory ``` @@ -62,3 +69,4 @@ python -m gen_surv dataset aft_ln --n 100 > data.csv - [Source Code](https://github.com/DiogoRibeiro7/genSurvPy) - [License](https://github.com/DiogoRibeiro7/genSurvPy/blob/main/LICENSE) - [Code of Conduct](https://github.com/DiogoRibeiro7/genSurvPy/blob/main/CODE_OF_CONDUCT.md) + diff --git a/docs/source/modules.md b/docs/source/modules.md index 7e9256f..114a344 100644 --- a/docs/source/modules.md +++ b/docs/source/modules.md @@ -23,9 +23,29 @@ ::: gen_surv.interface options: members: true - undoc-members: tru + undoc-members: true ::: gen_surv.aft options: members: true - undoc-members: true \ No newline at end of file + undoc-members: true + +::: gen_surv.bivariate + options: + members: true + undoc-members: true + +::: gen_surv.censoring + options: + members: true + undoc-members: true + +::: gen_surv.cli + options: + members: true + undoc-members: true + +::: gen_surv.validate + options: + members: true + undoc-members: true diff --git a/docs/source/usage.md b/docs/source/usage.md new file mode 100644 index 0000000..e3f856e --- /dev/null +++ b/docs/source/usage.md @@ -0,0 +1,33 @@ +# Getting Started + +This page offers a quick introduction to installing and using **gen_surv**. + +## Installation + +The project is managed with [Poetry](https://python-poetry.org). Clone the repository and install dependencies: + +```bash +poetry install +``` + +This will create a virtual environment and install all required packages. + +## Basic Usage + +Generate datasets directly in Python: + +```python +from gen_surv import generate + +# Cox Proportional Hazards example +generate(model="cphm", n=100, model_cens="uniform", cens_par=1.0, beta=0.5, covar=2.0) +``` + +You can also generate data from the command line: + +```bash +python -m gen_surv dataset aft_ln --n 100 > data.csv +``` + +For a full description of available models and parameters, see the API reference. +