|
| 1 | +# Fixing gen_surv Repository Issues |
| 2 | + |
| 3 | +## Priority 1: Critical Fixes |
| 4 | + |
| 5 | +### 1. Fix `__init__.py` Import Issues |
| 6 | + |
| 7 | +Update `gen_surv/__init__.py` to include missing imports: |
| 8 | + |
| 9 | +```python |
| 10 | +# Add these imports |
| 11 | +from .aft import gen_aft_log_logistic |
| 12 | +from .competing_risks import gen_competing_risks, gen_competing_risks_weibull |
| 13 | +from .mixture import gen_mixture_cure, cure_fraction_estimate |
| 14 | +from .piecewise import gen_piecewise_exponential |
| 15 | + |
| 16 | +# Update __all__ to include: |
| 17 | +__all__ = [ |
| 18 | + # ... existing exports ... |
| 19 | + "gen_aft_log_logistic", |
| 20 | + "gen_competing_risks", |
| 21 | + "gen_competing_risks_weibull", |
| 22 | + "gen_mixture_cure", |
| 23 | + "cure_fraction_estimate", |
| 24 | + "gen_piecewise_exponential", |
| 25 | +] |
| 26 | +``` |
| 27 | + |
| 28 | +### 2. Add Missing Validators |
| 29 | + |
| 30 | +Create validation functions in `validate.py`: |
| 31 | + |
| 32 | +```python |
| 33 | +def validate_gen_aft_weibull_inputs(n, beta, shape, scale, model_cens, cens_par): |
| 34 | + # Add validation logic |
| 35 | + |
| 36 | +def validate_gen_aft_log_logistic_inputs(n, beta, shape, scale, model_cens, cens_par): |
| 37 | + # Add validation logic |
| 38 | + |
| 39 | +def validate_competing_risks_inputs(n, n_risks, baseline_hazards, betas, model_cens, cens_par): |
| 40 | + # Add validation logic |
| 41 | +``` |
| 42 | + |
| 43 | +### 3. Update CLI Integration |
| 44 | + |
| 45 | +Modify `cli.py` to handle all available models: |
| 46 | + |
| 47 | +```python |
| 48 | +# Add support for competing_risks, mixture, and piecewise models |
| 49 | +# Update parameter handling for each model type |
| 50 | +``` |
| 51 | + |
| 52 | +## Priority 2: Version Consistency |
| 53 | + |
| 54 | +### Update Version Numbers |
| 55 | + |
| 56 | +1. **CITATION.cff**: Change version from "1.0.3" to "1.0.8" |
| 57 | +2. **docs/source/conf.py**: Change release from '1.0.3' to '1.0.8' |
| 58 | + |
| 59 | +## Priority 3: Testing and Documentation |
| 60 | + |
| 61 | +### Add Missing Tests |
| 62 | + |
| 63 | +Create test files: |
| 64 | +- `tests/test_censoring.py` |
| 65 | +- `tests/test_mixture.py` |
| 66 | +- `tests/test_piecewise.py` |
| 67 | +- `tests/test_summary.py` |
| 68 | +- `tests/test_visualization.py` |
| 69 | + |
| 70 | +### Update Documentation |
| 71 | + |
| 72 | +1. Add competing risks, mixture, and piecewise models to `theory.md` |
| 73 | +2. Update examples in documentation to include new models |
| 74 | + |
| 75 | +## Priority 4: Code Quality Improvements |
| 76 | + |
| 77 | +### Standardize Parameter Naming |
| 78 | + |
| 79 | +- Consistently use `covariate_cols` instead of mixing `covar` and `covariate_cols` |
| 80 | +- Standardize return column names across all models |
| 81 | + |
| 82 | +### Add Type Hints |
| 83 | + |
| 84 | +Complete type hints for all public functions, especially in: |
| 85 | +- `mixture.py` |
| 86 | +- `piecewise.py` |
| 87 | +- `summary.py` |
| 88 | + |
| 89 | +## Verification Steps |
| 90 | + |
| 91 | +After implementing fixes: |
| 92 | + |
| 93 | +1. **Test imports**: `python -c "from gen_surv import gen_aft_log_logistic, gen_competing_risks"` |
| 94 | +2. **Test CLI**: `python -m gen_surv dataset competing_risks --n 10` |
| 95 | +3. **Run full test suite**: `poetry run pytest` |
| 96 | +4. **Check version consistency**: `python scripts/check_version_match.py` |
| 97 | +5. **Build docs**: `poetry run sphinx-build docs/source docs/build` |
| 98 | + |
| 99 | +## Impact Assessment |
| 100 | + |
| 101 | +These fixes will: |
| 102 | +- ✅ Eliminate ImportError exceptions for users |
| 103 | +- ✅ Make all models accessible via public API |
| 104 | +- ✅ Ensure CLI works for all supported models |
| 105 | +- ✅ Improve user experience and API consistency |
| 106 | +- ✅ Maintain backward compatibility |
0 commit comments