heavystats 0.3.1__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.
- heavystats-0.3.1/PKG-INFO +219 -0
- heavystats-0.3.1/README.md +185 -0
- heavystats-0.3.1/pyproject.toml +67 -0
- heavystats-0.3.1/pyproject.toml.orig +64 -0
- heavystats-0.3.1/src/heavystats/__init__.py +114 -0
- heavystats-0.3.1/src/heavystats/bivariate/__init__.py +68 -0
- heavystats-0.3.1/src/heavystats/bivariate/constants.py +183 -0
- heavystats-0.3.1/src/heavystats/bivariate/plots.py +1446 -0
- heavystats-0.3.1/src/heavystats/bivariate/tables.py +2037 -0
- heavystats-0.3.1/src/heavystats/bivariate/tests.py +667 -0
- heavystats-0.3.1/src/heavystats/cleaning.py +559 -0
- heavystats-0.3.1/src/heavystats/comparation.py +520 -0
- heavystats-0.3.1/src/heavystats/data/data_example.csv +49 -0
- heavystats-0.3.1/src/heavystats/html_utils.py +516 -0
- heavystats-0.3.1/src/heavystats/py.typed +0 -0
- heavystats-0.3.1/src/heavystats/univariate/__init__.py +21 -0
- heavystats-0.3.1/src/heavystats/univariate/constants.py +151 -0
- heavystats-0.3.1/src/heavystats/univariate/html_table.py +24 -0
- heavystats-0.3.1/src/heavystats/univariate/plots.py +1079 -0
- heavystats-0.3.1/src/heavystats/univariate/table_style_example.html +123 -0
- heavystats-0.3.1/src/heavystats/univariate/tables.py +1008 -0
- heavystats-0.3.1/src/heavystats/validation.py +302 -0
- heavystats-0.3.1/src/heavystats/version_checker.py +224 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: heavystats
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Paquete estadístico para análisis y biomonitoreo de metales pesados en salud infantil
|
|
5
|
+
Keywords: heavy-metals,statistics,epidemiology,pediatrics,toxicology,biomonitoring,data-analysis,lead,mercury,cadmium,arsenic
|
|
6
|
+
Author: estralvarez
|
|
7
|
+
Author-email: estralvarez <estralvarez@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Dist: numpy>=1.26.0
|
|
23
|
+
Requires-Dist: pandas>=2.2.0
|
|
24
|
+
Requires-Dist: scipy>=1.12.0
|
|
25
|
+
Requires-Dist: seaborn>=0.13.0
|
|
26
|
+
Requires-Dist: matplotlib>=3.8.0
|
|
27
|
+
Requires-Dist: openpyxl>=3.1.0
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Project-URL: Homepage, https://github.com/estralvarez/HeavyStats
|
|
30
|
+
Project-URL: Repository, https://github.com/estralvarez/HeavyStats
|
|
31
|
+
Project-URL: Issues, https://github.com/estralvarez/HeavyStats/issues
|
|
32
|
+
Project-URL: Documentation, https://github.com/estralvarez/HeavyStats#readme
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
<div align="center">
|
|
36
|
+
|
|
37
|
+
<img src="assets/logo.png" alt="HeavyStats Logo" width="180" />
|
|
38
|
+
|
|
39
|
+
# HeavyStats
|
|
40
|
+
|
|
41
|
+
**Statistical framework for heavy metals biomonitoring, toxicological epidemiology, and pediatric health analytics.**
|
|
42
|
+
|
|
43
|
+
[](https://pypi.org/project/heavystats/)
|
|
44
|
+
[](https://pypi.org/project/heavystats/)
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
[](https://peps.python.org/pep-0008/)
|
|
47
|
+
[](https://peps.python.org/pep-0561/)
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
*Paquete estadístico integral en Python para el análisis, control de calidad, bioestadística univariante/bivariante y estratificación de riesgo toxicológico por metales pesados (Plomo, Mercurio, Cadmio, Arsénico, etc.) en salud infantil y poblaciones vulnerables.*
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 🌟 Características Principales
|
|
58
|
+
|
|
59
|
+
- **🔬 Control de Calidad Automatizado**: Validación metodológica de datos biológicos (límites de detección LOD, rangos plausibles, consistencia antropométrica según CDC/OMS).
|
|
60
|
+
- **🧹 Preprocesamiento Epidemiológico**: Limpieza de encuestas, desagregación de respuestas múltiples, estandarización de frecuencias dietéticas e indicadores compuestos de vulnerabilidad.
|
|
61
|
+
- **📊 Análisis Univariante con Calidad de Publicación**: Generación de tablas formateadas (estilo APA/médico) con visualización interactiva HTML forzada en modo claro, exportables a Excel, CSV y LaTeX.
|
|
62
|
+
- **📈 Bioestadística Bivariante No Paramétrica**:
|
|
63
|
+
- Pruebas de hipótesis: Mann-Whitney U, Kruskal-Wallis, Dunn *post-hoc*, Jonckheere-Terpstra (tendencia ordenada).
|
|
64
|
+
- Correlación y colinealidad: Matrices de Spearman, correlaciones pareadas, Chi-cuadrado y Fisher.
|
|
65
|
+
- Métodos robustos: Estimador de Hodges-Lehmann, intervalos de confianza Bootstrap para diferencias de medianas.
|
|
66
|
+
- Control de tasa de falsos descubrimientos (FDR / Benjamini-Hochberg, Bonferroni, Holm).
|
|
67
|
+
- **🛡️ Comparación Poblacional y Algoritmo de Riesgo**: Comparación de sectores expuestos vs. control con categorización de riesgo toxicológico pediátrico.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 📦 Instalación
|
|
72
|
+
|
|
73
|
+
Instala la versión estable directamente desde PyPI con `pip`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install heavystats
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
O si utilizas `uv`:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
uv add heavystats
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 🚀 Guía de Inicio Rápido (Quickstart)
|
|
88
|
+
|
|
89
|
+
### 1. Carga y Control de Calidad de Datos
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
import heavystats as hs
|
|
93
|
+
|
|
94
|
+
# Carga de datos (utiliza el dataset de muestra integrado si no se especifica ruta)
|
|
95
|
+
df = hs.load_data()
|
|
96
|
+
|
|
97
|
+
# Ejecución del control de calidad metodológico
|
|
98
|
+
reporte_val = hs.validate_data(df)
|
|
99
|
+
|
|
100
|
+
# Visualización del reporte en Jupyter / VSCode / Positron
|
|
101
|
+
reporte_val.show()
|
|
102
|
+
|
|
103
|
+
# Exportación a Excel y texto
|
|
104
|
+
reporte_val.to_excel("reporte_calidad.xlsx")
|
|
105
|
+
reporte_val.to_text("reporte_calidad.txt")
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### 2. Análisis Univariante
|
|
111
|
+
|
|
112
|
+
Generación de tablas y gráficos descriptivos para biomarcadores y variables sociodemográficas:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from heavystats.univariate import UnivariateTables, UnivariatePlots
|
|
116
|
+
|
|
117
|
+
# Tablas descriptivas de metales pesados con percentiles y límites CDC/OMS
|
|
118
|
+
tables = UnivariateTables(df)
|
|
119
|
+
tabla_metales = tables.metals_table()
|
|
120
|
+
tabla_metales.show()
|
|
121
|
+
|
|
122
|
+
# Exportar tabla formateada
|
|
123
|
+
tabla_metales.to_excel("tabla_univariante_metales.xlsx")
|
|
124
|
+
|
|
125
|
+
# Gráficos descriptivos (Histogramas, KDE, Boxplots)
|
|
126
|
+
plots = UnivariatePlots(df)
|
|
127
|
+
fig = plots.plot_distribution("Plomo_Sangre")
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### 3. Análisis Bivariante y Pruebas No Paramétricas
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from heavystats.bivariate import (
|
|
136
|
+
BivariateTables,
|
|
137
|
+
BivariatePlots,
|
|
138
|
+
mann_whitney_test,
|
|
139
|
+
kruskal_wallis_test,
|
|
140
|
+
spearman_matrix,
|
|
141
|
+
rank_bivariate_associations,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
# Comparación entre dos grupos independientes (ej. Sector A vs Sector B)
|
|
145
|
+
mw_result = mann_whitney_test(
|
|
146
|
+
df=df,
|
|
147
|
+
group_col="Sector",
|
|
148
|
+
val_col="Plomo_Sangre",
|
|
149
|
+
group_a="Sector_1",
|
|
150
|
+
group_b="Sector_2"
|
|
151
|
+
)
|
|
152
|
+
print(mw_result)
|
|
153
|
+
|
|
154
|
+
# Matriz de correlación de Spearman entre metales pesados
|
|
155
|
+
matriz_corr = spearman_matrix(df, metal_cols=["Plomo_Sangre", "Mercurio_Sangre", "Cadmio_Sangre"])
|
|
156
|
+
matriz_corr.show()
|
|
157
|
+
|
|
158
|
+
# Ranking de factores de riesgo asociados a niveles elevados de plomo
|
|
159
|
+
ranking = rank_bivariate_associations(df, outcome_col="Plomo_Sangre")
|
|
160
|
+
ranking.show()
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### 4. Comparación de Grupos y Estratificación de Riesgo
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from heavystats import compare_groups
|
|
169
|
+
|
|
170
|
+
# Comparación integral de sectores frente a límites toxicológicos
|
|
171
|
+
comp_report = compare_groups(df, group_col="Sector", metal_col="Plomo_Sangre")
|
|
172
|
+
comp_report.show()
|
|
173
|
+
comp_report.to_excel("comparacion_sectores.xlsx")
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 📋 Módulos de la Librería
|
|
179
|
+
|
|
180
|
+
| Módulo | Descripción |
|
|
181
|
+
| :--- | :--- |
|
|
182
|
+
| `heavystats.validation` | Reglas de validación biológica, rangos plausibles y generación de reportes de calidad. |
|
|
183
|
+
| `heavystats.cleaning` | Limpieza, decodificación, tipificación de variables e ingeniería de indicadores compuestos. |
|
|
184
|
+
| `heavystats.univariate` | Estadísticos descriptivos robustos, percentiles de referencia, tablas APA y gráficos de distribución. |
|
|
185
|
+
| `heavystats.bivariate` | Tests no paramétricos (Mann-Whitney, Kruskal-Wallis, Dunn), correlaciones de Spearman y análisis de colinealidad. |
|
|
186
|
+
| `heavystats.comparation` | Comparación poblacional de riesgo y análisis de exposición por sectores. |
|
|
187
|
+
| `heavystats.html_utils` | Motor de renderizado HTML con soporte forzado para visualización clara en temas oscuros y claros. |
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## 🧪 Pruebas Automatizadas
|
|
192
|
+
|
|
193
|
+
Para ejecutar la suite de pruebas unitarias con `pytest`:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
uv run pytest tests/ -v
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 📖 Cita y Referencias
|
|
202
|
+
|
|
203
|
+
Si utilizas `heavystats` en tus investigaciones científicas, tesis o reportes de salud pública, por favor cita la librería:
|
|
204
|
+
|
|
205
|
+
```bibtex
|
|
206
|
+
@software{heavystats2026,
|
|
207
|
+
author = {Alvarez, Estrada},
|
|
208
|
+
title = {HeavyStats: Statistical framework for heavy metals biomonitoring and pediatric epidemiology},
|
|
209
|
+
year = {2026},
|
|
210
|
+
version = {0.3.0},
|
|
211
|
+
url = {https://github.com/estralvarez/HeavyStats}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 📄 Licencia
|
|
218
|
+
|
|
219
|
+
Este proyecto está bajo la Licencia **MIT**. Consulta el archivo [LICENSE](LICENSE) para más detalles.
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="assets/logo.png" alt="HeavyStats Logo" width="180" />
|
|
4
|
+
|
|
5
|
+
# HeavyStats
|
|
6
|
+
|
|
7
|
+
**Statistical framework for heavy metals biomonitoring, toxicological epidemiology, and pediatric health analytics.**
|
|
8
|
+
|
|
9
|
+
[](https://pypi.org/project/heavystats/)
|
|
10
|
+
[](https://pypi.org/project/heavystats/)
|
|
11
|
+
[](https://opensource.org/licenses/MIT)
|
|
12
|
+
[](https://peps.python.org/pep-0008/)
|
|
13
|
+
[](https://peps.python.org/pep-0561/)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
*Paquete estadístico integral en Python para el análisis, control de calidad, bioestadística univariante/bivariante y estratificación de riesgo toxicológico por metales pesados (Plomo, Mercurio, Cadmio, Arsénico, etc.) en salud infantil y poblaciones vulnerables.*
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🌟 Características Principales
|
|
24
|
+
|
|
25
|
+
- **🔬 Control de Calidad Automatizado**: Validación metodológica de datos biológicos (límites de detección LOD, rangos plausibles, consistencia antropométrica según CDC/OMS).
|
|
26
|
+
- **🧹 Preprocesamiento Epidemiológico**: Limpieza de encuestas, desagregación de respuestas múltiples, estandarización de frecuencias dietéticas e indicadores compuestos de vulnerabilidad.
|
|
27
|
+
- **📊 Análisis Univariante con Calidad de Publicación**: Generación de tablas formateadas (estilo APA/médico) con visualización interactiva HTML forzada en modo claro, exportables a Excel, CSV y LaTeX.
|
|
28
|
+
- **📈 Bioestadística Bivariante No Paramétrica**:
|
|
29
|
+
- Pruebas de hipótesis: Mann-Whitney U, Kruskal-Wallis, Dunn *post-hoc*, Jonckheere-Terpstra (tendencia ordenada).
|
|
30
|
+
- Correlación y colinealidad: Matrices de Spearman, correlaciones pareadas, Chi-cuadrado y Fisher.
|
|
31
|
+
- Métodos robustos: Estimador de Hodges-Lehmann, intervalos de confianza Bootstrap para diferencias de medianas.
|
|
32
|
+
- Control de tasa de falsos descubrimientos (FDR / Benjamini-Hochberg, Bonferroni, Holm).
|
|
33
|
+
- **🛡️ Comparación Poblacional y Algoritmo de Riesgo**: Comparación de sectores expuestos vs. control con categorización de riesgo toxicológico pediátrico.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 📦 Instalación
|
|
38
|
+
|
|
39
|
+
Instala la versión estable directamente desde PyPI con `pip`:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install heavystats
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
O si utilizas `uv`:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uv add heavystats
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 🚀 Guía de Inicio Rápido (Quickstart)
|
|
54
|
+
|
|
55
|
+
### 1. Carga y Control de Calidad de Datos
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import heavystats as hs
|
|
59
|
+
|
|
60
|
+
# Carga de datos (utiliza el dataset de muestra integrado si no se especifica ruta)
|
|
61
|
+
df = hs.load_data()
|
|
62
|
+
|
|
63
|
+
# Ejecución del control de calidad metodológico
|
|
64
|
+
reporte_val = hs.validate_data(df)
|
|
65
|
+
|
|
66
|
+
# Visualización del reporte en Jupyter / VSCode / Positron
|
|
67
|
+
reporte_val.show()
|
|
68
|
+
|
|
69
|
+
# Exportación a Excel y texto
|
|
70
|
+
reporte_val.to_excel("reporte_calidad.xlsx")
|
|
71
|
+
reporte_val.to_text("reporte_calidad.txt")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### 2. Análisis Univariante
|
|
77
|
+
|
|
78
|
+
Generación de tablas y gráficos descriptivos para biomarcadores y variables sociodemográficas:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from heavystats.univariate import UnivariateTables, UnivariatePlots
|
|
82
|
+
|
|
83
|
+
# Tablas descriptivas de metales pesados con percentiles y límites CDC/OMS
|
|
84
|
+
tables = UnivariateTables(df)
|
|
85
|
+
tabla_metales = tables.metals_table()
|
|
86
|
+
tabla_metales.show()
|
|
87
|
+
|
|
88
|
+
# Exportar tabla formateada
|
|
89
|
+
tabla_metales.to_excel("tabla_univariante_metales.xlsx")
|
|
90
|
+
|
|
91
|
+
# Gráficos descriptivos (Histogramas, KDE, Boxplots)
|
|
92
|
+
plots = UnivariatePlots(df)
|
|
93
|
+
fig = plots.plot_distribution("Plomo_Sangre")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### 3. Análisis Bivariante y Pruebas No Paramétricas
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
from heavystats.bivariate import (
|
|
102
|
+
BivariateTables,
|
|
103
|
+
BivariatePlots,
|
|
104
|
+
mann_whitney_test,
|
|
105
|
+
kruskal_wallis_test,
|
|
106
|
+
spearman_matrix,
|
|
107
|
+
rank_bivariate_associations,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
# Comparación entre dos grupos independientes (ej. Sector A vs Sector B)
|
|
111
|
+
mw_result = mann_whitney_test(
|
|
112
|
+
df=df,
|
|
113
|
+
group_col="Sector",
|
|
114
|
+
val_col="Plomo_Sangre",
|
|
115
|
+
group_a="Sector_1",
|
|
116
|
+
group_b="Sector_2"
|
|
117
|
+
)
|
|
118
|
+
print(mw_result)
|
|
119
|
+
|
|
120
|
+
# Matriz de correlación de Spearman entre metales pesados
|
|
121
|
+
matriz_corr = spearman_matrix(df, metal_cols=["Plomo_Sangre", "Mercurio_Sangre", "Cadmio_Sangre"])
|
|
122
|
+
matriz_corr.show()
|
|
123
|
+
|
|
124
|
+
# Ranking de factores de riesgo asociados a niveles elevados de plomo
|
|
125
|
+
ranking = rank_bivariate_associations(df, outcome_col="Plomo_Sangre")
|
|
126
|
+
ranking.show()
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### 4. Comparación de Grupos y Estratificación de Riesgo
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from heavystats import compare_groups
|
|
135
|
+
|
|
136
|
+
# Comparación integral de sectores frente a límites toxicológicos
|
|
137
|
+
comp_report = compare_groups(df, group_col="Sector", metal_col="Plomo_Sangre")
|
|
138
|
+
comp_report.show()
|
|
139
|
+
comp_report.to_excel("comparacion_sectores.xlsx")
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 📋 Módulos de la Librería
|
|
145
|
+
|
|
146
|
+
| Módulo | Descripción |
|
|
147
|
+
| :--- | :--- |
|
|
148
|
+
| `heavystats.validation` | Reglas de validación biológica, rangos plausibles y generación de reportes de calidad. |
|
|
149
|
+
| `heavystats.cleaning` | Limpieza, decodificación, tipificación de variables e ingeniería de indicadores compuestos. |
|
|
150
|
+
| `heavystats.univariate` | Estadísticos descriptivos robustos, percentiles de referencia, tablas APA y gráficos de distribución. |
|
|
151
|
+
| `heavystats.bivariate` | Tests no paramétricos (Mann-Whitney, Kruskal-Wallis, Dunn), correlaciones de Spearman y análisis de colinealidad. |
|
|
152
|
+
| `heavystats.comparation` | Comparación poblacional de riesgo y análisis de exposición por sectores. |
|
|
153
|
+
| `heavystats.html_utils` | Motor de renderizado HTML con soporte forzado para visualización clara en temas oscuros y claros. |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 🧪 Pruebas Automatizadas
|
|
158
|
+
|
|
159
|
+
Para ejecutar la suite de pruebas unitarias con `pytest`:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
uv run pytest tests/ -v
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 📖 Cita y Referencias
|
|
168
|
+
|
|
169
|
+
Si utilizas `heavystats` en tus investigaciones científicas, tesis o reportes de salud pública, por favor cita la librería:
|
|
170
|
+
|
|
171
|
+
```bibtex
|
|
172
|
+
@software{heavystats2026,
|
|
173
|
+
author = {Alvarez, Estrada},
|
|
174
|
+
title = {HeavyStats: Statistical framework for heavy metals biomonitoring and pediatric epidemiology},
|
|
175
|
+
year = {2026},
|
|
176
|
+
version = {0.3.0},
|
|
177
|
+
url = {https://github.com/estralvarez/HeavyStats}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 📄 Licencia
|
|
184
|
+
|
|
185
|
+
Este proyecto está bajo la Licencia **MIT**. Consulta el archivo [LICENSE](LICENSE) para más detalles.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "heavystats"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
description = "Paquete estadístico para análisis y biomonitoreo de metales pesados en salud infantil"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
keywords = [
|
|
9
|
+
"heavy-metals",
|
|
10
|
+
"statistics",
|
|
11
|
+
"epidemiology",
|
|
12
|
+
"pediatrics",
|
|
13
|
+
"toxicology",
|
|
14
|
+
"biomonitoring",
|
|
15
|
+
"data-analysis",
|
|
16
|
+
"lead",
|
|
17
|
+
"mercury",
|
|
18
|
+
"cadmium",
|
|
19
|
+
"arsenic",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Development Status :: 4 - Beta",
|
|
23
|
+
"Intended Audience :: Science/Research",
|
|
24
|
+
"Intended Audience :: Healthcare Industry",
|
|
25
|
+
"Operating System :: OS Independent",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Programming Language :: Python :: 3.13",
|
|
30
|
+
"Programming Language :: Python :: 3.14",
|
|
31
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
34
|
+
"Typing :: Typed",
|
|
35
|
+
]
|
|
36
|
+
dependencies = [
|
|
37
|
+
"numpy>=1.26.0",
|
|
38
|
+
"pandas>=2.2.0",
|
|
39
|
+
"scipy>=1.12.0",
|
|
40
|
+
"seaborn>=0.13.0",
|
|
41
|
+
"matplotlib>=3.8.0",
|
|
42
|
+
"openpyxl>=3.1.0",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[[project.authors]]
|
|
46
|
+
name = "estralvarez"
|
|
47
|
+
email = "estralvarez@gmail.com"
|
|
48
|
+
|
|
49
|
+
[project.urls]
|
|
50
|
+
Homepage = "https://github.com/estralvarez/HeavyStats"
|
|
51
|
+
Repository = "https://github.com/estralvarez/HeavyStats"
|
|
52
|
+
Issues = "https://github.com/estralvarez/HeavyStats/issues"
|
|
53
|
+
Documentation = "https://github.com/estralvarez/HeavyStats#readme"
|
|
54
|
+
|
|
55
|
+
[dependency-groups]
|
|
56
|
+
dev = [
|
|
57
|
+
"pytest>=8.0.0",
|
|
58
|
+
"pytest-cov>=4.1.0",
|
|
59
|
+
"build>=1.2.0",
|
|
60
|
+
"twine>=5.0.0",
|
|
61
|
+
"ipykernel>=6.29.3",
|
|
62
|
+
"spyder-kernels>=3.1.0",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[build-system]
|
|
66
|
+
requires = ["uv_build>=0.12.0,<0.13.0"]
|
|
67
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "heavystats"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
description = "Paquete estadístico para análisis y biomonitoreo de metales pesados en salud infantil"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
authors = [{ name = "estralvarez", email = "estralvarez@gmail.com" }]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
keywords = [
|
|
10
|
+
"heavy-metals",
|
|
11
|
+
"statistics",
|
|
12
|
+
"epidemiology",
|
|
13
|
+
"pediatrics",
|
|
14
|
+
"toxicology",
|
|
15
|
+
"biomonitoring",
|
|
16
|
+
"data-analysis",
|
|
17
|
+
"lead",
|
|
18
|
+
"mercury",
|
|
19
|
+
"cadmium",
|
|
20
|
+
"arsenic",
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 4 - Beta",
|
|
24
|
+
"Intended Audience :: Science/Research",
|
|
25
|
+
"Intended Audience :: Healthcare Industry",
|
|
26
|
+
"Operating System :: OS Independent",
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Programming Language :: Python :: 3.14",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
33
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
34
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
35
|
+
"Typing :: Typed",
|
|
36
|
+
]
|
|
37
|
+
dependencies = [
|
|
38
|
+
"numpy>=1.26.0",
|
|
39
|
+
"pandas>=2.2.0",
|
|
40
|
+
"scipy>=1.12.0",
|
|
41
|
+
"seaborn>=0.13.0",
|
|
42
|
+
"matplotlib>=3.8.0",
|
|
43
|
+
"openpyxl>=3.1.0",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Homepage = "https://github.com/estralvarez/HeavyStats"
|
|
48
|
+
Repository = "https://github.com/estralvarez/HeavyStats"
|
|
49
|
+
Issues = "https://github.com/estralvarez/HeavyStats/issues"
|
|
50
|
+
Documentation = "https://github.com/estralvarez/HeavyStats#readme"
|
|
51
|
+
|
|
52
|
+
[dependency-groups]
|
|
53
|
+
dev = [
|
|
54
|
+
"pytest>=8.0.0",
|
|
55
|
+
"pytest-cov>=4.1.0",
|
|
56
|
+
"build>=1.2.0",
|
|
57
|
+
"twine>=5.0.0",
|
|
58
|
+
"ipykernel>=6.29.3",
|
|
59
|
+
"spyder-kernels>=3.1.0",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[build-system]
|
|
63
|
+
requires = ["uv_build>=0.12.0,<0.13.0"]
|
|
64
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
__version__ = "0.3.1"
|
|
2
|
+
|
|
3
|
+
from heavystats.validation import ValidationReport, validate_data
|
|
4
|
+
from heavystats.comparation import (
|
|
5
|
+
ComparationReport,
|
|
6
|
+
compare_groups,
|
|
7
|
+
)
|
|
8
|
+
from heavystats.cleaning import (
|
|
9
|
+
VariableTypeReport,
|
|
10
|
+
VariablesTableReport,
|
|
11
|
+
columns_type,
|
|
12
|
+
categorical_columns,
|
|
13
|
+
numerical_columns,
|
|
14
|
+
variables_table,
|
|
15
|
+
get_analytical_sample,
|
|
16
|
+
select_metal,
|
|
17
|
+
load_data,
|
|
18
|
+
standardize_boolean_columns,
|
|
19
|
+
desaggregate_multiple_responses,
|
|
20
|
+
encode_dietary_frequencies,
|
|
21
|
+
create_composite_indicators,
|
|
22
|
+
)
|
|
23
|
+
from heavystats.univariate import (
|
|
24
|
+
UnivariateTables,
|
|
25
|
+
UnivariatePlots,
|
|
26
|
+
DEFAULT_LABELS_MAP,
|
|
27
|
+
DEFAULT_CUSTOM_PARAMS,
|
|
28
|
+
DEFAULT_PERMISSIBLE_LIMITS,
|
|
29
|
+
CDC_BMI_REFERENCE,
|
|
30
|
+
get_label,
|
|
31
|
+
)
|
|
32
|
+
from heavystats.bivariate import (
|
|
33
|
+
BivariateTables,
|
|
34
|
+
BivariateTableReport,
|
|
35
|
+
BivariatePlots,
|
|
36
|
+
mann_whitney_test,
|
|
37
|
+
kruskal_wallis_test,
|
|
38
|
+
dunn_posthoc_test,
|
|
39
|
+
jonckheere_terpstra_test,
|
|
40
|
+
spearman_correlation,
|
|
41
|
+
spearman_matrix,
|
|
42
|
+
fisher_chi2_test,
|
|
43
|
+
adjust_pvalues,
|
|
44
|
+
hodges_lehmann_2sample,
|
|
45
|
+
bootstrap_ci_diff_medians,
|
|
46
|
+
rank_bivariate_associations,
|
|
47
|
+
collinearity_matrix,
|
|
48
|
+
DEFAULT_METAL_LIMITS,
|
|
49
|
+
DEFAULT_METAL_LODS,
|
|
50
|
+
DEFAULT_METAL_CUTOFFS,
|
|
51
|
+
DEFAULT_METAL_PAIRS,
|
|
52
|
+
)
|
|
53
|
+
from heavystats.version_checker import check_for_updates
|
|
54
|
+
|
|
55
|
+
__all__ = [
|
|
56
|
+
"__version__",
|
|
57
|
+
"ValidationReport",
|
|
58
|
+
"validate_data",
|
|
59
|
+
"ComparationReport",
|
|
60
|
+
"compare_groups",
|
|
61
|
+
"VariableTypeReport",
|
|
62
|
+
"VariablesTableReport",
|
|
63
|
+
"columns_type",
|
|
64
|
+
"categorical_columns",
|
|
65
|
+
"numerical_columns",
|
|
66
|
+
"variables_table",
|
|
67
|
+
"get_analytical_sample",
|
|
68
|
+
"select_metal",
|
|
69
|
+
"load_data",
|
|
70
|
+
"standardize_boolean_columns",
|
|
71
|
+
"desaggregate_multiple_responses",
|
|
72
|
+
"encode_dietary_frequencies",
|
|
73
|
+
"create_composite_indicators",
|
|
74
|
+
"UnivariateTables",
|
|
75
|
+
"UnivariatePlots",
|
|
76
|
+
"BivariateTables",
|
|
77
|
+
"BivariateTableReport",
|
|
78
|
+
"BivariatePlots",
|
|
79
|
+
"mann_whitney_test",
|
|
80
|
+
"kruskal_wallis_test",
|
|
81
|
+
"dunn_posthoc_test",
|
|
82
|
+
"jonckheere_terpstra_test",
|
|
83
|
+
"spearman_correlation",
|
|
84
|
+
"spearman_matrix",
|
|
85
|
+
"fisher_chi2_test",
|
|
86
|
+
"adjust_pvalues",
|
|
87
|
+
"hodges_lehmann_2sample",
|
|
88
|
+
"bootstrap_ci_diff_medians",
|
|
89
|
+
"rank_bivariate_associations",
|
|
90
|
+
"collinearity_matrix",
|
|
91
|
+
"DEFAULT_LABELS_MAP",
|
|
92
|
+
"DEFAULT_CUSTOM_PARAMS",
|
|
93
|
+
"DEFAULT_PERMISSIBLE_LIMITS",
|
|
94
|
+
"DEFAULT_METAL_LIMITS",
|
|
95
|
+
"DEFAULT_METAL_LODS",
|
|
96
|
+
"DEFAULT_METAL_CUTOFFS",
|
|
97
|
+
"DEFAULT_METAL_PAIRS",
|
|
98
|
+
"CDC_BMI_REFERENCE",
|
|
99
|
+
"get_label",
|
|
100
|
+
"check_for_updates",
|
|
101
|
+
]
|
|
102
|
+
|
|
103
|
+
# Verificación de versiones no bloqueante en segundo plano al importar
|
|
104
|
+
try:
|
|
105
|
+
check_for_updates(__version__, async_check=True)
|
|
106
|
+
except Exception:
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def __getattr__(name: str):
|
|
111
|
+
if name == "df":
|
|
112
|
+
from heavystats.cleaning import df
|
|
113
|
+
return df
|
|
114
|
+
raise AttributeError(f"module {__name__} has no attribute {name}")
|