care-dataset 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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Human Language Technology (HLT) lab, INESC-ID
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.
@@ -0,0 +1,121 @@
1
+ Metadata-Version: 2.4
2
+ Name: care-dataset
3
+ Version: 0.1.0
4
+ Summary: Official Python package for the CARE multimodal clinical dataset.
5
+ Author: Human Language Technology (HLT) Lab, INESC-ID
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Human Language Technology (HLT) lab, INESC-ID
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://gitlab.inesc-id.pt/hlt/public/datasets/multimodal_care
29
+ Project-URL: Repository, https://gitlab.inesc-id.pt/hlt/public/datasets/multimodal_care
30
+ Project-URL: Dataset, https://huggingface.co/datasets/inesc-id/multimodal_care
31
+ Keywords: care,dataset,multimodal,healthcare,speech,clinical,machine-learning,huggingface
32
+ Classifier: Development Status :: 4 - Beta
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.11
35
+ Classifier: Programming Language :: Python :: 3 :: Only
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Intended Audience :: Science/Research
39
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
40
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
41
+ Requires-Python: >=3.11
42
+ Description-Content-Type: text/markdown
43
+ License-File: LICENSE
44
+ Requires-Dist: datasets>=3.0
45
+ Requires-Dist: numpy
46
+ Requires-Dist: pandas
47
+ Dynamic: license-file
48
+
49
+ # care-dataset
50
+
51
+ `care-dataset` is the official Python package for accessing and managing the CARE multimodal clinical dataset.
52
+
53
+ The package provides a high-level interface for loading CARE from Hugging Face, filtering participants using metadata, selecting modalities, creating profile-level train/test and cross-validation splits, and preventing profile leakage in machine learning experiments.
54
+
55
+ ## Installation
56
+
57
+ The package requires **Python 3.11** or newer.
58
+
59
+ Install the package either directly from PyPI:
60
+
61
+ ```bash
62
+ pip install care-dataset
63
+ ```
64
+
65
+ or by cloning the source repository:
66
+
67
+ ```bash
68
+ git clone https://gitlab.inesc-id.pt/hlt/public/datasets/multimodal_care.git
69
+ cd multimodal_care
70
+ pip install .
71
+ ```
72
+
73
+ ## Quick start
74
+
75
+ ```python
76
+ from care_dataset import CAREDataset
77
+
78
+ care = CAREDataset()
79
+
80
+ care.info()
81
+ ```
82
+
83
+ Filter the dataset
84
+
85
+ ```python
86
+ dataset = care.filter(
87
+ label_id__in=["CONTROL", "PARKINSON"],
88
+ )
89
+ ```
90
+
91
+ Select one or more modalities
92
+
93
+ ```python
94
+ dataset = dataset.select_modalities(
95
+ "egemaps_func",
96
+ )
97
+ ```
98
+
99
+ Create a profile-level cross-validation split
100
+
101
+ ```python
102
+ cv_iters, report = dataset.cross_validation(
103
+ k=5,
104
+ keep_duplicate_profiles=False,
105
+ report=True,
106
+ )
107
+
108
+ report.info()
109
+ ```
110
+
111
+ ## CARE dataset
112
+
113
+ The CARE dataset, documentation, feature archives, and usage examples are available from the official Hugging Face Dataset repository:
114
+
115
+ **https://huggingface.co/datasets/inesc-id/multimodal_care**
116
+
117
+ ## License
118
+
119
+ This package is distributed under the MIT License.
120
+
121
+ The CARE dataset itself is distributed separately under the CARE Data Use Agreement (DUA).
@@ -0,0 +1,73 @@
1
+ # care-dataset
2
+
3
+ `care-dataset` is the official Python package for accessing and managing the CARE multimodal clinical dataset.
4
+
5
+ The package provides a high-level interface for loading CARE from Hugging Face, filtering participants using metadata, selecting modalities, creating profile-level train/test and cross-validation splits, and preventing profile leakage in machine learning experiments.
6
+
7
+ ## Installation
8
+
9
+ The package requires **Python 3.11** or newer.
10
+
11
+ Install the package either directly from PyPI:
12
+
13
+ ```bash
14
+ pip install care-dataset
15
+ ```
16
+
17
+ or by cloning the source repository:
18
+
19
+ ```bash
20
+ git clone https://gitlab.inesc-id.pt/hlt/public/datasets/multimodal_care.git
21
+ cd multimodal_care
22
+ pip install .
23
+ ```
24
+
25
+ ## Quick start
26
+
27
+ ```python
28
+ from care_dataset import CAREDataset
29
+
30
+ care = CAREDataset()
31
+
32
+ care.info()
33
+ ```
34
+
35
+ Filter the dataset
36
+
37
+ ```python
38
+ dataset = care.filter(
39
+ label_id__in=["CONTROL", "PARKINSON"],
40
+ )
41
+ ```
42
+
43
+ Select one or more modalities
44
+
45
+ ```python
46
+ dataset = dataset.select_modalities(
47
+ "egemaps_func",
48
+ )
49
+ ```
50
+
51
+ Create a profile-level cross-validation split
52
+
53
+ ```python
54
+ cv_iters, report = dataset.cross_validation(
55
+ k=5,
56
+ keep_duplicate_profiles=False,
57
+ report=True,
58
+ )
59
+
60
+ report.info()
61
+ ```
62
+
63
+ ## CARE dataset
64
+
65
+ The CARE dataset, documentation, feature archives, and usage examples are available from the official Hugging Face Dataset repository:
66
+
67
+ **https://huggingface.co/datasets/inesc-id/multimodal_care**
68
+
69
+ ## License
70
+
71
+ This package is distributed under the MIT License.
72
+
73
+ The CARE dataset itself is distributed separately under the CARE Data Use Agreement (DUA).
@@ -0,0 +1,5 @@
1
+ from .dataset import CAREDataset
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ __all__ = ["CAREDataset"]
@@ -0,0 +1,174 @@
1
+ from collections import defaultdict
2
+ import pandas as pd
3
+
4
+
5
+ def _extract_profile_ids(dataset):
6
+ """
7
+ Extract profile/profile IDs from a CAREDataset object.
8
+ """
9
+
10
+ profiles = dataset.profiles()
11
+
12
+ metadata = pd.concat(
13
+ [
14
+ profiles["patients"],
15
+ profiles["controls"],
16
+ ],
17
+ ignore_index=True,
18
+ )
19
+
20
+ return set(metadata["profile_id"])
21
+
22
+
23
+
24
+ def check_profile_leakage_holdout(
25
+ train,
26
+ test,
27
+ ):
28
+ """
29
+ Check profile overlap between train and test.
30
+
31
+ Returns
32
+ -------
33
+ dict
34
+ Overlapping profile IDs.
35
+ """
36
+
37
+ train_ids = _extract_profile_ids(train)
38
+ test_ids = _extract_profile_ids(test)
39
+
40
+ overlap = train_ids & test_ids
41
+
42
+ return {
43
+ "leakage": sorted(overlap),
44
+ "valid": len(overlap) == 0,
45
+ }
46
+
47
+
48
+
49
+ def check_profile_leakage_cv(
50
+ folds,
51
+ ):
52
+ """
53
+ Check that profiles appear in only one test fold.
54
+
55
+ Returns
56
+ -------
57
+ dict
58
+ """
59
+
60
+ occurrences = defaultdict(list)
61
+
62
+ for fold_idx, (_, test) in enumerate(folds):
63
+
64
+ test_ids = _extract_profile_ids(test)
65
+
66
+ for pid in test_ids:
67
+ occurrences[pid].append(
68
+ fold_idx
69
+ )
70
+
71
+ leakage = {
72
+ pid: folds
73
+ for pid, folds in occurrences.items()
74
+ if len(folds) > 1
75
+ }
76
+
77
+ return {
78
+ "leakage": leakage,
79
+ "valid": len(leakage) == 0,
80
+ }
81
+
82
+
83
+
84
+ def check_duplicate_leakage_holdout(
85
+ train,
86
+ test,
87
+ duplicate_map,
88
+ ):
89
+ """
90
+ Check duplicate groups are not split
91
+ between train and test.
92
+ """
93
+
94
+ train_ids = _extract_profile_ids(train)
95
+ test_ids = _extract_profile_ids(test)
96
+
97
+ violations = []
98
+
99
+ checked = set()
100
+
101
+ for pid, group in duplicate_map.items():
102
+
103
+ group = frozenset(group)
104
+
105
+ if group in checked:
106
+ continue
107
+
108
+ checked.add(group)
109
+
110
+ in_train = bool(group & train_ids)
111
+ in_test = bool(group & test_ids)
112
+
113
+ if in_train and in_test:
114
+
115
+ violations.append(
116
+ sorted(group)
117
+ )
118
+
119
+ return {
120
+ "leakage": violations,
121
+ "valid": len(violations) == 0,
122
+ }
123
+
124
+
125
+
126
+ def check_duplicate_leakage_cv(
127
+ folds,
128
+ duplicate_map,
129
+ ):
130
+ """
131
+ Check duplicate groups are contained
132
+ within a single CV test fold.
133
+ """
134
+
135
+ fold_ids = []
136
+
137
+ for _, test in folds:
138
+
139
+ fold_ids.append(
140
+ _extract_profile_ids(test)
141
+ )
142
+
143
+ violations = []
144
+
145
+ checked = set()
146
+
147
+ for pid, group in duplicate_map.items():
148
+
149
+ group = frozenset(group)
150
+
151
+ if group in checked:
152
+ continue
153
+
154
+ checked.add(group)
155
+
156
+ locations = [
157
+ i
158
+ for i, ids in enumerate(fold_ids)
159
+ if group & ids
160
+ ]
161
+
162
+ if len(locations) > 1:
163
+
164
+ violations.append(
165
+ {
166
+ "profiles": sorted(group),
167
+ "folds": locations,
168
+ }
169
+ )
170
+
171
+ return {
172
+ "leakage": violations,
173
+ "valid": len(violations) == 0,
174
+ }