adamstat 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- adamstat-1.0.0/LICENSE +21 -0
- adamstat-1.0.0/MANIFEST.in +7 -0
- adamstat-1.0.0/PKG-INFO +197 -0
- adamstat-1.0.0/README.md +159 -0
- adamstat-1.0.0/notebooks/Clinical_lab_1.ipynb +325 -0
- adamstat-1.0.0/notebooks/Clinical_lab_3.ipynb +1681 -0
- adamstat-1.0.0/notebooks/Clinical_lab_4.ipynb +1223 -0
- adamstat-1.0.0/notebooks/Clinical_lab_5.ipynb +1046 -0
- adamstat-1.0.0/notebooks/Clinical_lab_6.ipynb +1106 -0
- adamstat-1.0.0/notebooks/Clinical_lab_7.ipynb +253 -0
- adamstat-1.0.0/notebooks/Clinical_lab_8.ipynb +256 -0
- adamstat-1.0.0/pyproject.toml +70 -0
- adamstat-1.0.0/records/clinical_statistics_Lab_Raj_1.docx +0 -0
- adamstat-1.0.0/records/clinical_statistics_Lab_Raj_2.docx +0 -0
- adamstat-1.0.0/records/clinical_statistics_Lab_Raj_2.pdf +0 -0
- adamstat-1.0.0/records/clinical_statistics_Lab_Raj_3.docx +0 -0
- adamstat-1.0.0/records/clinical_statistics_Lab_Raj_4.docx +0 -0
- adamstat-1.0.0/records/clinical_statistics_Lab_Raj_5.docx +0 -0
- adamstat-1.0.0/records/clinical_statistics_Lab_Raj_6.docx +0 -0
- adamstat-1.0.0/records/clinical_statistics_Lab_Raj_7.docx +0 -0
- adamstat-1.0.0/records/clinical_statistics_Lab_Raj_8.docx +0 -0
- adamstat-1.0.0/setup.cfg +4 -0
- adamstat-1.0.0/setup.py +10 -0
- adamstat-1.0.0/src/adamstat/__init__.py +162 -0
- adamstat-1.0.0/src/adamstat/adam.py +280 -0
- adamstat-1.0.0/src/adamstat/cleaning.py +302 -0
- adamstat-1.0.0/src/adamstat/cli.py +122 -0
- adamstat-1.0.0/src/adamstat/data/clinical_demographics.csv +181 -0
- adamstat-1.0.0/src/adamstat/data/clinical_trial_data.csv +181 -0
- adamstat-1.0.0/src/adamstat/data/clinical_vitals_labs.csv +181 -0
- adamstat-1.0.0/src/adamstat/derivation.py +158 -0
- adamstat-1.0.0/src/adamstat/eda.py +146 -0
- adamstat-1.0.0/src/adamstat/experiments.py +479 -0
- adamstat-1.0.0/src/adamstat/pipeline.py +113 -0
- adamstat-1.0.0/src/adamstat/reporting.py +314 -0
- adamstat-1.0.0/src/adamstat/sample_data.py +131 -0
- adamstat-1.0.0/src/adamstat/sdtm.py +270 -0
- adamstat-1.0.0/src/adamstat/stats.py +211 -0
- adamstat-1.0.0/src/adamstat/visualization.py +170 -0
- adamstat-1.0.0/src/adamstat.egg-info/PKG-INFO +197 -0
- adamstat-1.0.0/src/adamstat.egg-info/SOURCES.txt +52 -0
- adamstat-1.0.0/src/adamstat.egg-info/dependency_links.txt +1 -0
- adamstat-1.0.0/src/adamstat.egg-info/entry_points.txt +2 -0
- adamstat-1.0.0/src/adamstat.egg-info/requires.txt +13 -0
- adamstat-1.0.0/src/adamstat.egg-info/top_level.txt +1 -0
- adamstat-1.0.0/tests/__init__.py +1 -0
- adamstat-1.0.0/tests/test_adam.py +71 -0
- adamstat-1.0.0/tests/test_cleaning.py +83 -0
- adamstat-1.0.0/tests/test_derivation.py +76 -0
- adamstat-1.0.0/tests/test_eda.py +50 -0
- adamstat-1.0.0/tests/test_pipeline.py +24 -0
- adamstat-1.0.0/tests/test_reporting.py +72 -0
- adamstat-1.0.0/tests/test_sdtm.py +98 -0
- adamstat-1.0.0/tests/test_stats.py +73 -0
adamstat-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VSRAJHAVEL
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
adamstat-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: adamstat
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: CDISC ADaM, SDTM, Biostatistics, and Clinical Study Reporting (CSR) Toolkit
|
|
5
|
+
Author-email: VSRAJHAVEL <218490778+VSRAJHAVEL@users.noreply.github.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/VSRAJHAVEL/adamstat
|
|
8
|
+
Project-URL: Repository, https://github.com/VSRAJHAVEL/adamstat.git
|
|
9
|
+
Project-URL: Issues, https://github.com/VSRAJHAVEL/adamstat/issues
|
|
10
|
+
Keywords: clinical-trials,biostatistics,cdisc,sdtm,adam,adsl,csr,ich-e3,data-science,pharmaceuticals
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: numpy>=1.22.0
|
|
26
|
+
Requires-Dist: pandas>=1.4.0
|
|
27
|
+
Requires-Dist: scipy>=1.8.0
|
|
28
|
+
Requires-Dist: statsmodels>=0.13.0
|
|
29
|
+
Requires-Dist: matplotlib>=3.5.0
|
|
30
|
+
Requires-Dist: seaborn>=0.12.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# ๐ adamstat
|
|
40
|
+
|
|
41
|
+
[](https://www.python.org/)
|
|
42
|
+
[](https://www.cdisc.org/)
|
|
43
|
+
[](https://www.ich.org/)
|
|
44
|
+
[](https://opensource.org/licenses/MIT)
|
|
45
|
+
[]()
|
|
46
|
+
|
|
47
|
+
> **Production-grade CDISC SDTM, ADaM, Biostatistics, and Clinical Study Reporting (CSR) Toolkit in Python.**
|
|
48
|
+
|
|
49
|
+
`adamstat` is a complete clinical trial data analytics package that bridges raw electronic data capture (EDC) or clinical trial CSV records to regulatory-compliant CDISC SDTM domains, ADaM analysis datasets (ADSL, BDS, OCCDS), inferential biostatistical testing, and ICH E3 compliant Tables, Figures, and Listings (TFLs).
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## ๐ Key Capabilities
|
|
54
|
+
|
|
55
|
+
- **Clinical EDA & Descriptive Profiling**: Multi-column descriptive statistics (mean, SD, median, IQR, quantiles), missingness matrix audits, and categorical demographic breakdown.
|
|
56
|
+
- **Data Cleaning & Harmonization**: Standardizing case and whitespace anomalies in `SEX` and `ARM`, biometric outlier isolation (`AGE`, `BMI`), date parsing to ISO 8601 (`YYYY-MM-DD`), deduplication, and baseline feature median array imputations.
|
|
57
|
+
- **Clinical Derivations**: ACC/AHA blood pressure categorization, WHO BMI classification, protocol age group stratification, days on study follow-up calculation, and multisystem high-risk flags.
|
|
58
|
+
- **CDISC SDTM Standardization**: Built-in mapping and validation engines for **DM** (Demographics), **VS** (Vital Signs), **LB** (Laboratory), **AE** (Adverse Events), and **EX** (Exposure) domains with sequence numbering and ISO date formats.
|
|
59
|
+
- **CDISC ADaM Model Generation**:
|
|
60
|
+
- **ADSL** (Subject-Level Analysis Dataset) with trial population flags (`SAFFL`, `ITTFL`, `EFFFL`), baseline vital signs, and exposure metrics.
|
|
61
|
+
- **ADVS & ADLB** (Basic Data Structure - BDS) with `AVAL`, `BASE`, `CHG` (change from baseline), `PCHG` (% change), and protocol responder criteria.
|
|
62
|
+
- **ADAE** (Occurrence Data Structure - OCCDS) with mapped numeric severity (`AESEVN`) and causality (`AERELN`).
|
|
63
|
+
- **Biostatistics & Inferential Testing**: Independent and paired two-sample t-tests, Cohen's d effect sizes, One-way ANOVA, post-hoc Tukey HSD pairwise comparisons, Shapiro-Wilk normality testing, Levene's test for equality of variance, and Pearson Chi-Square tests for adverse event incidence.
|
|
64
|
+
- **ICH E3 Clinical Study Reporting (CSR)**:
|
|
65
|
+
- **Table 14.1.1**: Demographic and Baseline Characteristics.
|
|
66
|
+
- **Table 14.2.1**: Primary and Secondary Efficacy Endpoints with 95% Confidence Intervals and treatment differences vs Placebo.
|
|
67
|
+
- **Table 14.3.1**: Adverse Events Summary by Severity and Preferred Term.
|
|
68
|
+
- **Figure 14.2.1**: Boxplot of Change from Baseline by Treatment Arm.
|
|
69
|
+
- **Figure 14.2.2**: Forest Plot of Treatment Differences with 95% Confidence Intervals.
|
|
70
|
+
- **Narratives**: Automated regulatory result summaries for CSR Section 11/12.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## ๐ฆ Installation
|
|
75
|
+
|
|
76
|
+
Install `adamstat` locally in editable/development mode:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
git clone https://github.com/VSRAJHAVEL/adamstat.git
|
|
80
|
+
cd adamstat
|
|
81
|
+
pip install -e .
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Or install with test dependencies:
|
|
85
|
+
```bash
|
|
86
|
+
pip install -e ".[dev]"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## ๐ Quickstart Example
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import adamstat as ads
|
|
95
|
+
|
|
96
|
+
# 1. Load sample clinical trial data
|
|
97
|
+
trial_data = ads.load_sample_clinical_trial()
|
|
98
|
+
|
|
99
|
+
# 2. Clean and standardize the dataset
|
|
100
|
+
cleaner = ads.ClinicalDataCleaner()
|
|
101
|
+
clean_data = cleaner.fit_transform(trial_data)
|
|
102
|
+
|
|
103
|
+
# 3. Derive clinical categories (BP, BMI, Age groups, Risk flags)
|
|
104
|
+
derived_data = ads.derive_clinical_features(clean_data)
|
|
105
|
+
|
|
106
|
+
# 4. Generate CDISC SDTM Demographics (DM)
|
|
107
|
+
dm = ads.create_dm(derived_data, study_id="CT01")
|
|
108
|
+
|
|
109
|
+
# 5. Generate CDISC ADaM Subject-Level Analysis Dataset (ADSL)
|
|
110
|
+
adsl = ads.create_adsl(dm)
|
|
111
|
+
|
|
112
|
+
# 6. Generate ICH E3 Table 14.1.1 (Demographics)
|
|
113
|
+
table_14_1_1 = ads.generate_table_14_1_1_demographics(adsl)
|
|
114
|
+
print(table_14_1_1.to_string(index=False))
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## ๐ฌ End-to-End Pipeline
|
|
120
|
+
|
|
121
|
+
Execute the full ingestion to CSR reporting workflow in a single call:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from adamstat import ClinicalStudyPipeline, generate_synthetic_clinical_trial
|
|
125
|
+
|
|
126
|
+
# Generate or load clinical trial dataset
|
|
127
|
+
study_data = generate_synthetic_clinical_trial(n_subjects=180)
|
|
128
|
+
|
|
129
|
+
# Initialize pipeline
|
|
130
|
+
pipeline = ClinicalStudyPipeline(study_id="CT01", placebo_arm="Placebo")
|
|
131
|
+
|
|
132
|
+
# Run pipeline
|
|
133
|
+
results = pipeline.run(
|
|
134
|
+
trial_df=study_data["clinical_trial"],
|
|
135
|
+
vs_long=study_data["vs_long"],
|
|
136
|
+
ae_df=study_data["adverse_events"]
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
# Inspect generated ADaM datasets and CSR tables
|
|
140
|
+
print("ADSL shape:", results["adam_datasets"]["ADSL"].shape)
|
|
141
|
+
print("ADVS shape:", results["adam_datasets"]["ADVS"].shape)
|
|
142
|
+
print("CSR Demographics Table:\n", results["tables"]["Table_14_1_1"])
|
|
143
|
+
print("CSR Narrative:\n", results["narrative"])
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## ๐ป Command Line Interface (CLI)
|
|
149
|
+
|
|
150
|
+
`adamstat` includes a full CLI for executing clinical data workflows directly from the terminal:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# 1. Generate descriptive profiling & completeness audit
|
|
154
|
+
adamstat eda clinical_raw.csv -o eda_summary.csv
|
|
155
|
+
|
|
156
|
+
# 2. Clean, deduplicate, and impute raw clinical data
|
|
157
|
+
adamstat clean clinical_raw.csv -o clinical_clean.csv
|
|
158
|
+
|
|
159
|
+
# 3. Derive clinical parameters
|
|
160
|
+
adamstat derive clinical_clean.csv -o clinical_derived.csv
|
|
161
|
+
|
|
162
|
+
# 4. Run inferential biostatistical tests (t-tests, ANOVA)
|
|
163
|
+
adamstat stats clinical_analysis.csv --endpoints SBP_CHG DBP_CHG GLU_CHG --arm-col ARM --placebo Placebo
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## ๐งช Running Unit Tests
|
|
169
|
+
|
|
170
|
+
Run the test suite with `pytest`:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
python -m pytest tests -v
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## ๐ Laboratory Experiments & Code Mapping
|
|
179
|
+
|
|
180
|
+
This repository consolidates the laboratory experiments:
|
|
181
|
+
|
|
182
|
+
| Lab / Module | Topic / Focus | Core Implementation |
|
|
183
|
+
| :---: | :--- | :--- |
|
|
184
|
+
| **Lab 01** | Clinical Data Exploration & Descriptive Profiling | `adamstat.eda` (`clinical_summary`, `completeness_audit`, `categorical_profiles`) |
|
|
185
|
+
| **Lab 02** | Clinical Data Cleaning, Imputation & Deduplication | `adamstat.cleaning` (`ClinicalDataCleaner`, `standardize_demographics`, `impute_clinical_data`) |
|
|
186
|
+
| **Lab 03** | Clinical Feature Derivations & Risk Stratification | `adamstat.derivation` (`derive_age_group`, `derive_bp_category`, `derive_high_risk_flag`) |
|
|
187
|
+
| **Lab 04** | Clinical Biomarker Visualizations | `adamstat.visualization` (`plot_demographics`, `plot_vitals_scatter`, `plot_treatment_boxplots`) |
|
|
188
|
+
| **Lab 05** | CDISC SDTM Domain Generation (DM, VS, LB, AE, EX) | `adamstat.sdtm` (`create_dm`, `create_vs`, `create_lb`, `create_ae`, `create_ex`, `validate_sdtm_domain`) |
|
|
189
|
+
| **Lab 06** | CDISC ADaM Datasets (ADSL, BDS, OCCDS) | `adamstat.adam` (`create_adsl`, `create_advs`, `create_adlb`, `create_adae`, `validate_adam`) |
|
|
190
|
+
| **Lab 07** | Biostatistics & Hypothesis Testing | `adamstat.stats` (`two_sample_ttest`, `oneway_anova`, `posthoc_tukey`, `ae_contingency_test`) |
|
|
191
|
+
| **Lab 08** | ICH E3 Clinical Study Report (CSR) Tables & Figures | `adamstat.reporting` (`generate_table_14_1_1`, `generate_table_14_2_1`, `plot_figure_14_2_2_forest`) |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## ๐ License
|
|
196
|
+
|
|
197
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
adamstat-1.0.0/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# ๐ adamstat
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/)
|
|
4
|
+
[](https://www.cdisc.org/)
|
|
5
|
+
[](https://www.ich.org/)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[]()
|
|
8
|
+
|
|
9
|
+
> **Production-grade CDISC SDTM, ADaM, Biostatistics, and Clinical Study Reporting (CSR) Toolkit in Python.**
|
|
10
|
+
|
|
11
|
+
`adamstat` is a complete clinical trial data analytics package that bridges raw electronic data capture (EDC) or clinical trial CSV records to regulatory-compliant CDISC SDTM domains, ADaM analysis datasets (ADSL, BDS, OCCDS), inferential biostatistical testing, and ICH E3 compliant Tables, Figures, and Listings (TFLs).
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ๐ Key Capabilities
|
|
16
|
+
|
|
17
|
+
- **Clinical EDA & Descriptive Profiling**: Multi-column descriptive statistics (mean, SD, median, IQR, quantiles), missingness matrix audits, and categorical demographic breakdown.
|
|
18
|
+
- **Data Cleaning & Harmonization**: Standardizing case and whitespace anomalies in `SEX` and `ARM`, biometric outlier isolation (`AGE`, `BMI`), date parsing to ISO 8601 (`YYYY-MM-DD`), deduplication, and baseline feature median array imputations.
|
|
19
|
+
- **Clinical Derivations**: ACC/AHA blood pressure categorization, WHO BMI classification, protocol age group stratification, days on study follow-up calculation, and multisystem high-risk flags.
|
|
20
|
+
- **CDISC SDTM Standardization**: Built-in mapping and validation engines for **DM** (Demographics), **VS** (Vital Signs), **LB** (Laboratory), **AE** (Adverse Events), and **EX** (Exposure) domains with sequence numbering and ISO date formats.
|
|
21
|
+
- **CDISC ADaM Model Generation**:
|
|
22
|
+
- **ADSL** (Subject-Level Analysis Dataset) with trial population flags (`SAFFL`, `ITTFL`, `EFFFL`), baseline vital signs, and exposure metrics.
|
|
23
|
+
- **ADVS & ADLB** (Basic Data Structure - BDS) with `AVAL`, `BASE`, `CHG` (change from baseline), `PCHG` (% change), and protocol responder criteria.
|
|
24
|
+
- **ADAE** (Occurrence Data Structure - OCCDS) with mapped numeric severity (`AESEVN`) and causality (`AERELN`).
|
|
25
|
+
- **Biostatistics & Inferential Testing**: Independent and paired two-sample t-tests, Cohen's d effect sizes, One-way ANOVA, post-hoc Tukey HSD pairwise comparisons, Shapiro-Wilk normality testing, Levene's test for equality of variance, and Pearson Chi-Square tests for adverse event incidence.
|
|
26
|
+
- **ICH E3 Clinical Study Reporting (CSR)**:
|
|
27
|
+
- **Table 14.1.1**: Demographic and Baseline Characteristics.
|
|
28
|
+
- **Table 14.2.1**: Primary and Secondary Efficacy Endpoints with 95% Confidence Intervals and treatment differences vs Placebo.
|
|
29
|
+
- **Table 14.3.1**: Adverse Events Summary by Severity and Preferred Term.
|
|
30
|
+
- **Figure 14.2.1**: Boxplot of Change from Baseline by Treatment Arm.
|
|
31
|
+
- **Figure 14.2.2**: Forest Plot of Treatment Differences with 95% Confidence Intervals.
|
|
32
|
+
- **Narratives**: Automated regulatory result summaries for CSR Section 11/12.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## ๐ฆ Installation
|
|
37
|
+
|
|
38
|
+
Install `adamstat` locally in editable/development mode:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://github.com/VSRAJHAVEL/adamstat.git
|
|
42
|
+
cd adamstat
|
|
43
|
+
pip install -e .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or install with test dependencies:
|
|
47
|
+
```bash
|
|
48
|
+
pip install -e ".[dev]"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## ๐ Quickstart Example
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import adamstat as ads
|
|
57
|
+
|
|
58
|
+
# 1. Load sample clinical trial data
|
|
59
|
+
trial_data = ads.load_sample_clinical_trial()
|
|
60
|
+
|
|
61
|
+
# 2. Clean and standardize the dataset
|
|
62
|
+
cleaner = ads.ClinicalDataCleaner()
|
|
63
|
+
clean_data = cleaner.fit_transform(trial_data)
|
|
64
|
+
|
|
65
|
+
# 3. Derive clinical categories (BP, BMI, Age groups, Risk flags)
|
|
66
|
+
derived_data = ads.derive_clinical_features(clean_data)
|
|
67
|
+
|
|
68
|
+
# 4. Generate CDISC SDTM Demographics (DM)
|
|
69
|
+
dm = ads.create_dm(derived_data, study_id="CT01")
|
|
70
|
+
|
|
71
|
+
# 5. Generate CDISC ADaM Subject-Level Analysis Dataset (ADSL)
|
|
72
|
+
adsl = ads.create_adsl(dm)
|
|
73
|
+
|
|
74
|
+
# 6. Generate ICH E3 Table 14.1.1 (Demographics)
|
|
75
|
+
table_14_1_1 = ads.generate_table_14_1_1_demographics(adsl)
|
|
76
|
+
print(table_14_1_1.to_string(index=False))
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## ๐ฌ End-to-End Pipeline
|
|
82
|
+
|
|
83
|
+
Execute the full ingestion to CSR reporting workflow in a single call:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from adamstat import ClinicalStudyPipeline, generate_synthetic_clinical_trial
|
|
87
|
+
|
|
88
|
+
# Generate or load clinical trial dataset
|
|
89
|
+
study_data = generate_synthetic_clinical_trial(n_subjects=180)
|
|
90
|
+
|
|
91
|
+
# Initialize pipeline
|
|
92
|
+
pipeline = ClinicalStudyPipeline(study_id="CT01", placebo_arm="Placebo")
|
|
93
|
+
|
|
94
|
+
# Run pipeline
|
|
95
|
+
results = pipeline.run(
|
|
96
|
+
trial_df=study_data["clinical_trial"],
|
|
97
|
+
vs_long=study_data["vs_long"],
|
|
98
|
+
ae_df=study_data["adverse_events"]
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# Inspect generated ADaM datasets and CSR tables
|
|
102
|
+
print("ADSL shape:", results["adam_datasets"]["ADSL"].shape)
|
|
103
|
+
print("ADVS shape:", results["adam_datasets"]["ADVS"].shape)
|
|
104
|
+
print("CSR Demographics Table:\n", results["tables"]["Table_14_1_1"])
|
|
105
|
+
print("CSR Narrative:\n", results["narrative"])
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## ๐ป Command Line Interface (CLI)
|
|
111
|
+
|
|
112
|
+
`adamstat` includes a full CLI for executing clinical data workflows directly from the terminal:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# 1. Generate descriptive profiling & completeness audit
|
|
116
|
+
adamstat eda clinical_raw.csv -o eda_summary.csv
|
|
117
|
+
|
|
118
|
+
# 2. Clean, deduplicate, and impute raw clinical data
|
|
119
|
+
adamstat clean clinical_raw.csv -o clinical_clean.csv
|
|
120
|
+
|
|
121
|
+
# 3. Derive clinical parameters
|
|
122
|
+
adamstat derive clinical_clean.csv -o clinical_derived.csv
|
|
123
|
+
|
|
124
|
+
# 4. Run inferential biostatistical tests (t-tests, ANOVA)
|
|
125
|
+
adamstat stats clinical_analysis.csv --endpoints SBP_CHG DBP_CHG GLU_CHG --arm-col ARM --placebo Placebo
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## ๐งช Running Unit Tests
|
|
131
|
+
|
|
132
|
+
Run the test suite with `pytest`:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
python -m pytest tests -v
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## ๐ Laboratory Experiments & Code Mapping
|
|
141
|
+
|
|
142
|
+
This repository consolidates the laboratory experiments:
|
|
143
|
+
|
|
144
|
+
| Lab / Module | Topic / Focus | Core Implementation |
|
|
145
|
+
| :---: | :--- | :--- |
|
|
146
|
+
| **Lab 01** | Clinical Data Exploration & Descriptive Profiling | `adamstat.eda` (`clinical_summary`, `completeness_audit`, `categorical_profiles`) |
|
|
147
|
+
| **Lab 02** | Clinical Data Cleaning, Imputation & Deduplication | `adamstat.cleaning` (`ClinicalDataCleaner`, `standardize_demographics`, `impute_clinical_data`) |
|
|
148
|
+
| **Lab 03** | Clinical Feature Derivations & Risk Stratification | `adamstat.derivation` (`derive_age_group`, `derive_bp_category`, `derive_high_risk_flag`) |
|
|
149
|
+
| **Lab 04** | Clinical Biomarker Visualizations | `adamstat.visualization` (`plot_demographics`, `plot_vitals_scatter`, `plot_treatment_boxplots`) |
|
|
150
|
+
| **Lab 05** | CDISC SDTM Domain Generation (DM, VS, LB, AE, EX) | `adamstat.sdtm` (`create_dm`, `create_vs`, `create_lb`, `create_ae`, `create_ex`, `validate_sdtm_domain`) |
|
|
151
|
+
| **Lab 06** | CDISC ADaM Datasets (ADSL, BDS, OCCDS) | `adamstat.adam` (`create_adsl`, `create_advs`, `create_adlb`, `create_adae`, `validate_adam`) |
|
|
152
|
+
| **Lab 07** | Biostatistics & Hypothesis Testing | `adamstat.stats` (`two_sample_ttest`, `oneway_anova`, `posthoc_tukey`, `ae_contingency_test`) |
|
|
153
|
+
| **Lab 08** | ICH E3 Clinical Study Report (CSR) Tables & Figures | `adamstat.reporting` (`generate_table_14_1_1`, `generate_table_14_2_1`, `plot_figure_14_2_2_forest`) |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## ๐ License
|
|
158
|
+
|
|
159
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|