toxsim 0.1.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.
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ .pytest_cache/
5
+ .coverage
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+ .DS_Store
toxsim-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.5
2
+ Name: toxsim
3
+ Version: 0.1.0
4
+ Summary: Context-aware synthetic poisoned-patient simulator
5
+ Author: toxsim contributors
6
+ License: MIT
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: numpy>=1.23
9
+ Requires-Dist: pyyaml>=6.0
10
+ Requires-Dist: scipy>=1.9
11
+ Provides-Extra: cli
12
+ Requires-Dist: rich>=13.0; extra == 'cli'
13
+ Requires-Dist: tqdm>=4.64; extra == 'cli'
14
+ Provides-Extra: test
15
+ Requires-Dist: pytest>=7.0; extra == 'test'
16
+ Description-Content-Type: text/markdown
17
+
18
+ # toxsim
19
+
20
+ `toxsim` generates context-aware synthetic poisoned-patient presentations. It
21
+ ports the latent-severity behavior from INTOXICATE: intoxication class affects
22
+ severity, which in turn influences GCS, respiratory failure, dysrhythmia, heart
23
+ rate, and systolic blood pressure.
24
+
25
+ ## Installation
26
+
27
+ ```shell
28
+ python -m pip install toxsim
29
+ # Include optional progress and rich CLI output:
30
+ python -m pip install "toxsim[cli]"
31
+ ```
32
+
33
+ ## Model data
34
+
35
+ The package includes the canonical clinical model configuration as package
36
+ data, including `predictive_variables.yml`, each variable's score file, and
37
+ `model.schema.yml`. `load_model_data()` uses these resources by default and
38
+ never depends on the current working directory.
39
+
40
+ ```text
41
+ toxsim/data/
42
+ model.schema.yml
43
+ model/
44
+ predictive_variables.yml
45
+ <variable-name>_score.yml
46
+ ```
47
+
48
+ Pass a directory to `load_model_data()` or `toxsim-generate
49
+ --model-data-dir` to override the bundled model with a compatible
50
+ configuration. An override directory contains `predictive_variables.yml` and
51
+ one `<variable-name>_score.yml` file for every predictive variable.
52
+
53
+ ## Python API
54
+
55
+ ```python
56
+ from toxsim import create_patient, create_patients
57
+
58
+ patient = create_patient(seed=2026)
59
+ patients = create_patients(count=100, seed=2026)
60
+ ```
61
+
62
+ Both functions lazily load the bundled model data by default. A seed produces
63
+ the same patient data across runs, including the generated patient ID. Each
64
+ presentation entry has `name`, `value`, and `score`; continuous variables also
65
+ include the model range and whether its underlying value was within that range.
66
+ The patient-level `risk` equals the sum of presentation scores.
67
+
68
+ To use a compatible external model directory, pass
69
+ `model_data_dir="/path/to/model-data"`. Advanced callers can use
70
+ `create_patient(predictive_variables=variables, scores=score_tables)` or load
71
+ once with `model = load_model_data(...)` and pass that `ModelData` object as
72
+ the first argument to `create_patient(model)` or `create_patients(model,
73
+ count=100)`.
74
+
75
+ ## CLI
76
+
77
+ ```shell
78
+ toxsim-generate \
79
+ --count 100 \
80
+ --output patients.jsonl \
81
+ --seed 2026
82
+ ```
83
+
84
+ `--output` writes one file and infers the format from its `.json` or `.jsonl`
85
+ suffix. To generate named default files in a directory instead, use
86
+ `--destination ./generated --format both`; `--format` accepts `json`, `jsonl`,
87
+ or `both` (the default). Add `--model-data-dir /path/to/model-data` to use a
88
+ compatible override.
toxsim-0.1.0/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # toxsim
2
+
3
+ `toxsim` generates context-aware synthetic poisoned-patient presentations. It
4
+ ports the latent-severity behavior from INTOXICATE: intoxication class affects
5
+ severity, which in turn influences GCS, respiratory failure, dysrhythmia, heart
6
+ rate, and systolic blood pressure.
7
+
8
+ ## Installation
9
+
10
+ ```shell
11
+ python -m pip install toxsim
12
+ # Include optional progress and rich CLI output:
13
+ python -m pip install "toxsim[cli]"
14
+ ```
15
+
16
+ ## Model data
17
+
18
+ The package includes the canonical clinical model configuration as package
19
+ data, including `predictive_variables.yml`, each variable's score file, and
20
+ `model.schema.yml`. `load_model_data()` uses these resources by default and
21
+ never depends on the current working directory.
22
+
23
+ ```text
24
+ toxsim/data/
25
+ model.schema.yml
26
+ model/
27
+ predictive_variables.yml
28
+ <variable-name>_score.yml
29
+ ```
30
+
31
+ Pass a directory to `load_model_data()` or `toxsim-generate
32
+ --model-data-dir` to override the bundled model with a compatible
33
+ configuration. An override directory contains `predictive_variables.yml` and
34
+ one `<variable-name>_score.yml` file for every predictive variable.
35
+
36
+ ## Python API
37
+
38
+ ```python
39
+ from toxsim import create_patient, create_patients
40
+
41
+ patient = create_patient(seed=2026)
42
+ patients = create_patients(count=100, seed=2026)
43
+ ```
44
+
45
+ Both functions lazily load the bundled model data by default. A seed produces
46
+ the same patient data across runs, including the generated patient ID. Each
47
+ presentation entry has `name`, `value`, and `score`; continuous variables also
48
+ include the model range and whether its underlying value was within that range.
49
+ The patient-level `risk` equals the sum of presentation scores.
50
+
51
+ To use a compatible external model directory, pass
52
+ `model_data_dir="/path/to/model-data"`. Advanced callers can use
53
+ `create_patient(predictive_variables=variables, scores=score_tables)` or load
54
+ once with `model = load_model_data(...)` and pass that `ModelData` object as
55
+ the first argument to `create_patient(model)` or `create_patients(model,
56
+ count=100)`.
57
+
58
+ ## CLI
59
+
60
+ ```shell
61
+ toxsim-generate \
62
+ --count 100 \
63
+ --output patients.jsonl \
64
+ --seed 2026
65
+ ```
66
+
67
+ `--output` writes one file and infers the format from its `.json` or `.jsonl`
68
+ suffix. To generate named default files in a directory instead, use
69
+ `--destination ./generated --format both`; `--format` accepts `json`, `jsonl`,
70
+ or `both` (the default). Add `--model-data-dir /path/to/model-data` to use a
71
+ compatible override.