flatiron-cleaner 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.
- flatiron_cleaner-0.1.0/LICENSE +21 -0
- flatiron_cleaner-0.1.0/PKG-INFO +126 -0
- flatiron_cleaner-0.1.0/README.md +97 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/__init__.py +27 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/breast.py +3031 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/colorectal.py +2854 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/general.py +2536 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/main.py +108 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/merge_utils.py +51 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/nsclc.py +2968 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/prostate.py +3296 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/test.py +242 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner/urothelial.py +2991 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner.egg-info/PKG-INFO +126 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner.egg-info/SOURCES.txt +18 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner.egg-info/dependency_links.txt +1 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner.egg-info/requires.txt +5 -0
- flatiron_cleaner-0.1.0/flatiron_cleaner.egg-info/top_level.txt +1 -0
- flatiron_cleaner-0.1.0/pyproject.toml +44 -0
- flatiron_cleaner-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Xavier Orcutt
|
|
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,126 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: flatiron_cleaner
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python package for cleaning and harmonizing Flatiron Health cancer data
|
|
5
|
+
Author-email: Xavier Orcutt <xavierorcutt@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/xavier-orcutt/FlatironCleaner
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/xavier-orcutt/FlatironCleaner/issues
|
|
9
|
+
Project-URL: Documentation, https://github.com/xavier-orcutt/FlatironCleaner#readme
|
|
10
|
+
Keywords: cancer,healthcare,data,flatiron
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Intended Audience :: Science/Research
|
|
18
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: numpy>=2.2.0
|
|
25
|
+
Requires-Dist: pandas>=2.2.0
|
|
26
|
+
Requires-Dist: python-dateutil>=2.9.0
|
|
27
|
+
Requires-Dist: pytz>=2024.2
|
|
28
|
+
Requires-Dist: tzdata>=2025.1
|
|
29
|
+
|
|
30
|
+
# FlatironCleaner
|
|
31
|
+
|
|
32
|
+
`FlatironCleaner` is a Python package that cleans Flatiron Health cancer datasets into analysis-ready formats, specifically designed with predictive modeling and survival analysis in mind. By automating complex and tedious data processing workflows, it helps researchers extract meaningful insights and ensure reproducible results while reducing preparation time.
|
|
33
|
+
|
|
34
|
+
Key features of the package include:
|
|
35
|
+
- Providing a modular architecture that allows researchers to select which Flatiron files to process
|
|
36
|
+
- Converting long-format dataframes into wide-format dataframes with unique PatientIDs per row
|
|
37
|
+
- Ensuring appropriate data types for predictive modeling and statistical analysis
|
|
38
|
+
- Standardizing data cleaning around a user-specified index date, such as metastatic diagnosis or treatment initiation
|
|
39
|
+
- Engineering clinically relevant variables for analysis
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
Coming soon.
|
|
44
|
+
|
|
45
|
+
## Available Processors
|
|
46
|
+
|
|
47
|
+
### Cancer-Specific Processors
|
|
48
|
+
|
|
49
|
+
The following cancers have their own dedicated data processor class:
|
|
50
|
+
|
|
51
|
+
| Cancer Type | Processor Name |
|
|
52
|
+
|-------------|-----------------|
|
|
53
|
+
| Advanced Urothelial Cancer | `DataProcessorUrothelial` |
|
|
54
|
+
| Advanced NSCLC | `DataProcessorNSCLC` |
|
|
55
|
+
| Metastatic Colorectal Cancer | `DataProcessorColorectal` |
|
|
56
|
+
| Metastatic Breast Cancer | `DataProcessorBreast` |
|
|
57
|
+
| Metastatic Prostate Cancer | `DataProcessorProstate` |
|
|
58
|
+
|
|
59
|
+
### General Processor
|
|
60
|
+
|
|
61
|
+
For cancer types without a dedicated processor, `DataProcessorGeneral` is available with standard methods.
|
|
62
|
+
|
|
63
|
+
## Processing Methods
|
|
64
|
+
|
|
65
|
+
### Standard Methods
|
|
66
|
+
|
|
67
|
+
The following methods are available across all processor classes, including the general processor:
|
|
68
|
+
|
|
69
|
+
| Method | Description | File Processed |
|
|
70
|
+
|--------|-------------|----------------|
|
|
71
|
+
| `process_demographics()` | Processes patient demographic information | Demographics.csv |
|
|
72
|
+
| `process_mortality()` | Processes mortality data | Enhanced_Mortality_V2.csv |
|
|
73
|
+
| `process_ecog()` | Processes performance status data | ECOG.csv |
|
|
74
|
+
| `process_medications()` | Processes medication administration records | MedicationAdministration.csv |
|
|
75
|
+
| `process_diagnosis()` | Processes ICD coding information | Diagnosis.csv |
|
|
76
|
+
| `process_labs()` | Processes laboratory test results | Lab.csv |
|
|
77
|
+
| `process_vitals()` | Processes vital signs data | Vitals.csv |
|
|
78
|
+
| `process_insurance()` | Processes insurance information | Insurance.csv |
|
|
79
|
+
| `process_practice()` | Processes practice type data | Practice.csv |
|
|
80
|
+
|
|
81
|
+
### Cancer-Specific Methods
|
|
82
|
+
|
|
83
|
+
Cancer-specific classes contain additional methods (e.g., `process_enhanced()` and `process_biomarkers()`). For a complete list of available methods for each cancer type, refer to the source code or use Python's built-in help functionality:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from flatiron_cleaner import DataProcessorUrothelial
|
|
87
|
+
|
|
88
|
+
# View all methods and documentation
|
|
89
|
+
help(DataProcessorUrothelial)
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Usage Example
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from flatiron_cleaner import DataProcessorUrothelial
|
|
97
|
+
from flatiron_cleaner import merge_dataframes
|
|
98
|
+
|
|
99
|
+
# Initialize class
|
|
100
|
+
processor = DataProcessorUrothelial()
|
|
101
|
+
|
|
102
|
+
# Import dataframe with PatientIDs and index date of interest
|
|
103
|
+
df = pd.read_csv('path/to/your/data')
|
|
104
|
+
|
|
105
|
+
# Load and clean data
|
|
106
|
+
cleaned_ecog_df = processor.process_ecog('path/to/your/ECOG.csv',
|
|
107
|
+
index_date_df=df,
|
|
108
|
+
index_date_column='AdvancedDiagnosisDate',
|
|
109
|
+
days_before=30,
|
|
110
|
+
days_after=0)
|
|
111
|
+
|
|
112
|
+
cleaned_medication_df = processor.process_medications('path/to/your/MedicationAdmninistration.csv',
|
|
113
|
+
index_date_df = df,
|
|
114
|
+
index_date_column='AdvancedDiagnosisDate',
|
|
115
|
+
days_before=180,
|
|
116
|
+
days_after=0)
|
|
117
|
+
|
|
118
|
+
# Merge dataframes
|
|
119
|
+
merged_data = merge_dataframes(cleaned_ecog_df, cleaned_medication_df)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
For a more detailed usage demonstration, see the notebook titled "tutorial" in the `example/` directory.
|
|
123
|
+
|
|
124
|
+
## Contact
|
|
125
|
+
|
|
126
|
+
I welcome contributions and feedback. Email me at: xavierorcutt@gmail.com
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# FlatironCleaner
|
|
2
|
+
|
|
3
|
+
`FlatironCleaner` is a Python package that cleans Flatiron Health cancer datasets into analysis-ready formats, specifically designed with predictive modeling and survival analysis in mind. By automating complex and tedious data processing workflows, it helps researchers extract meaningful insights and ensure reproducible results while reducing preparation time.
|
|
4
|
+
|
|
5
|
+
Key features of the package include:
|
|
6
|
+
- Providing a modular architecture that allows researchers to select which Flatiron files to process
|
|
7
|
+
- Converting long-format dataframes into wide-format dataframes with unique PatientIDs per row
|
|
8
|
+
- Ensuring appropriate data types for predictive modeling and statistical analysis
|
|
9
|
+
- Standardizing data cleaning around a user-specified index date, such as metastatic diagnosis or treatment initiation
|
|
10
|
+
- Engineering clinically relevant variables for analysis
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Coming soon.
|
|
15
|
+
|
|
16
|
+
## Available Processors
|
|
17
|
+
|
|
18
|
+
### Cancer-Specific Processors
|
|
19
|
+
|
|
20
|
+
The following cancers have their own dedicated data processor class:
|
|
21
|
+
|
|
22
|
+
| Cancer Type | Processor Name |
|
|
23
|
+
|-------------|-----------------|
|
|
24
|
+
| Advanced Urothelial Cancer | `DataProcessorUrothelial` |
|
|
25
|
+
| Advanced NSCLC | `DataProcessorNSCLC` |
|
|
26
|
+
| Metastatic Colorectal Cancer | `DataProcessorColorectal` |
|
|
27
|
+
| Metastatic Breast Cancer | `DataProcessorBreast` |
|
|
28
|
+
| Metastatic Prostate Cancer | `DataProcessorProstate` |
|
|
29
|
+
|
|
30
|
+
### General Processor
|
|
31
|
+
|
|
32
|
+
For cancer types without a dedicated processor, `DataProcessorGeneral` is available with standard methods.
|
|
33
|
+
|
|
34
|
+
## Processing Methods
|
|
35
|
+
|
|
36
|
+
### Standard Methods
|
|
37
|
+
|
|
38
|
+
The following methods are available across all processor classes, including the general processor:
|
|
39
|
+
|
|
40
|
+
| Method | Description | File Processed |
|
|
41
|
+
|--------|-------------|----------------|
|
|
42
|
+
| `process_demographics()` | Processes patient demographic information | Demographics.csv |
|
|
43
|
+
| `process_mortality()` | Processes mortality data | Enhanced_Mortality_V2.csv |
|
|
44
|
+
| `process_ecog()` | Processes performance status data | ECOG.csv |
|
|
45
|
+
| `process_medications()` | Processes medication administration records | MedicationAdministration.csv |
|
|
46
|
+
| `process_diagnosis()` | Processes ICD coding information | Diagnosis.csv |
|
|
47
|
+
| `process_labs()` | Processes laboratory test results | Lab.csv |
|
|
48
|
+
| `process_vitals()` | Processes vital signs data | Vitals.csv |
|
|
49
|
+
| `process_insurance()` | Processes insurance information | Insurance.csv |
|
|
50
|
+
| `process_practice()` | Processes practice type data | Practice.csv |
|
|
51
|
+
|
|
52
|
+
### Cancer-Specific Methods
|
|
53
|
+
|
|
54
|
+
Cancer-specific classes contain additional methods (e.g., `process_enhanced()` and `process_biomarkers()`). For a complete list of available methods for each cancer type, refer to the source code or use Python's built-in help functionality:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from flatiron_cleaner import DataProcessorUrothelial
|
|
58
|
+
|
|
59
|
+
# View all methods and documentation
|
|
60
|
+
help(DataProcessorUrothelial)
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Usage Example
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from flatiron_cleaner import DataProcessorUrothelial
|
|
68
|
+
from flatiron_cleaner import merge_dataframes
|
|
69
|
+
|
|
70
|
+
# Initialize class
|
|
71
|
+
processor = DataProcessorUrothelial()
|
|
72
|
+
|
|
73
|
+
# Import dataframe with PatientIDs and index date of interest
|
|
74
|
+
df = pd.read_csv('path/to/your/data')
|
|
75
|
+
|
|
76
|
+
# Load and clean data
|
|
77
|
+
cleaned_ecog_df = processor.process_ecog('path/to/your/ECOG.csv',
|
|
78
|
+
index_date_df=df,
|
|
79
|
+
index_date_column='AdvancedDiagnosisDate',
|
|
80
|
+
days_before=30,
|
|
81
|
+
days_after=0)
|
|
82
|
+
|
|
83
|
+
cleaned_medication_df = processor.process_medications('path/to/your/MedicationAdmninistration.csv',
|
|
84
|
+
index_date_df = df,
|
|
85
|
+
index_date_column='AdvancedDiagnosisDate',
|
|
86
|
+
days_before=180,
|
|
87
|
+
days_after=0)
|
|
88
|
+
|
|
89
|
+
# Merge dataframes
|
|
90
|
+
merged_data = merge_dataframes(cleaned_ecog_df, cleaned_medication_df)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
For a more detailed usage demonstration, see the notebook titled "tutorial" in the `example/` directory.
|
|
94
|
+
|
|
95
|
+
## Contact
|
|
96
|
+
|
|
97
|
+
I welcome contributions and feedback. Email me at: xavierorcutt@gmail.com
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
FlatironCleaner
|
|
3
|
+
|
|
4
|
+
A Python package for cleaning and harmonizing Flatiron Health cancer data.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = '0.1.0'
|
|
8
|
+
|
|
9
|
+
# Make key classes available at package level
|
|
10
|
+
from .urothelial import DataProcessorUrothelial
|
|
11
|
+
from .nsclc import DataProcessorNSCLC
|
|
12
|
+
from .colorectal import DataProcessorColorectal
|
|
13
|
+
from .breast import DataProcessorBreast
|
|
14
|
+
from .prostate import DataProcessorProstate
|
|
15
|
+
from .general import DataProcessorGeneral
|
|
16
|
+
from .merge_utils import merge_dataframes
|
|
17
|
+
|
|
18
|
+
# Define what gets imported with `from flatiron_cleaner import *`
|
|
19
|
+
__all__ = [
|
|
20
|
+
'DataProcessorUrothelial',
|
|
21
|
+
'DataProcessorNSCLC',
|
|
22
|
+
'DataProcessorColorectal',
|
|
23
|
+
'DataProcessorBreast',
|
|
24
|
+
'DataProcessorProstate',
|
|
25
|
+
'DataProcessorGeneral',
|
|
26
|
+
'merge_dataframes',
|
|
27
|
+
]
|