mimic-utils 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.
- mimic_utils-1.0.0/.gitignore +63 -0
- mimic_utils-1.0.0/LICENSE +21 -0
- mimic_utils-1.0.0/PKG-INFO +41 -0
- mimic_utils-1.0.0/README_mimic_utils.md +3 -0
- mimic_utils-1.0.0/pyproject.toml +38 -0
- mimic_utils-1.0.0/src/mimic_utils/__init__.py +0 -0
- mimic_utils-1.0.0/src/mimic_utils/__main__.py +31 -0
- mimic_utils-1.0.0/src/mimic_utils/_version.py +16 -0
- mimic_utils-1.0.0/src/mimic_utils/mimic_utils.egg-info/PKG-INFO +37 -0
- mimic_utils-1.0.0/src/mimic_utils/mimic_utils.egg-info/SOURCES.txt +731 -0
- mimic_utils-1.0.0/src/mimic_utils/mimic_utils.egg-info/dependency_links.txt +1 -0
- mimic_utils-1.0.0/src/mimic_utils/mimic_utils.egg-info/entry_points.txt +2 -0
- mimic_utils-1.0.0/src/mimic_utils/mimic_utils.egg-info/requires.txt +3 -0
- mimic_utils-1.0.0/src/mimic_utils/mimic_utils.egg-info/top_level.txt +1 -0
- mimic_utils-1.0.0/src/mimic_utils/sqlglot/__init__.py +0 -0
- mimic_utils-1.0.0/src/mimic_utils/sqlglot/bigquery.py +12 -0
- mimic_utils-1.0.0/src/mimic_utils/sqlglot/duckdb.py +78 -0
- mimic_utils-1.0.0/src/mimic_utils/sqlglot/postgres.py +122 -0
- mimic_utils-1.0.0/src/mimic_utils/transpile.py +102 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
|
|
5
|
+
# C extensions
|
|
6
|
+
*.so
|
|
7
|
+
|
|
8
|
+
# Distribution / packaging
|
|
9
|
+
.Python
|
|
10
|
+
env/
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
*.egg-info/
|
|
23
|
+
.installed.cfg
|
|
24
|
+
*.egg
|
|
25
|
+
|
|
26
|
+
# PyInstaller
|
|
27
|
+
# Usually these files are written by a python script from a template
|
|
28
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
29
|
+
*.manifest
|
|
30
|
+
*.spec
|
|
31
|
+
|
|
32
|
+
# Installer logs
|
|
33
|
+
pip-log.txt
|
|
34
|
+
pip-delete-this-directory.txt
|
|
35
|
+
|
|
36
|
+
# Unit test / coverage reports
|
|
37
|
+
htmlcov/
|
|
38
|
+
.tox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*,cover
|
|
45
|
+
|
|
46
|
+
# Translations
|
|
47
|
+
*.mo
|
|
48
|
+
*.pot
|
|
49
|
+
|
|
50
|
+
# Django stuff:
|
|
51
|
+
*.log
|
|
52
|
+
|
|
53
|
+
# Sphinx documentation
|
|
54
|
+
docs/_build/
|
|
55
|
+
|
|
56
|
+
# PyBuilder
|
|
57
|
+
target/
|
|
58
|
+
|
|
59
|
+
# OSX .DS_Store
|
|
60
|
+
.DS_Store
|
|
61
|
+
|
|
62
|
+
# PyCharm / JetBrains
|
|
63
|
+
.idea
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 MIT Laboratory for Computational Physiology
|
|
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,41 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: mimic_utils
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Utilities to support building and analyzing the MIMIC database(s)
|
|
5
|
+
Project-URL: Homepage, https://github.com/MIT-LCP/mimic-code
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/MIT-LCP/mimic-code/issues
|
|
7
|
+
Author-email: Alistair Johnson <aewj@mit.edu>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2019 MIT Laboratory for Computational Physiology
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
31
|
+
Classifier: Operating System :: OS Independent
|
|
32
|
+
Classifier: Programming Language :: Python :: 3
|
|
33
|
+
Requires-Python: >=3.8
|
|
34
|
+
Requires-Dist: numpy
|
|
35
|
+
Requires-Dist: pandas
|
|
36
|
+
Requires-Dist: sqlglot
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# mimic_utils package
|
|
40
|
+
|
|
41
|
+
This package contains utilities for working with the MIMIC datasets.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mimic_utils"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Alistair Johnson", email="aewj@mit.edu" },
|
|
10
|
+
]
|
|
11
|
+
description = "Utilities to support building and analyzing the MIMIC database(s)"
|
|
12
|
+
readme = "README_mimic_utils.md"
|
|
13
|
+
license = { file="LICENSE" }
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"sqlglot",
|
|
22
|
+
"pandas",
|
|
23
|
+
"numpy",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
mimic_utils = "mimic_utils.__main__:main"
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
"Homepage" = "https://github.com/MIT-LCP/mimic-code"
|
|
31
|
+
"Bug Tracker" = "https://github.com/MIT-LCP/mimic-code/issues"
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.sdist]
|
|
34
|
+
ignore-vcs = true
|
|
35
|
+
only-include = ["src/mimic_utils"]
|
|
36
|
+
|
|
37
|
+
[tool.hatch.build.targets.wheel]
|
|
38
|
+
packages = ["src/mimic_utils"]
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from argparse import ArgumentParser
|
|
2
|
+
|
|
3
|
+
from mimic_utils.transpile import transpile_file, transpile_folder
|
|
4
|
+
|
|
5
|
+
def main():
|
|
6
|
+
parser = ArgumentParser(description="Convert SQL to different dialects.")
|
|
7
|
+
subparsers = parser.add_subparsers()
|
|
8
|
+
|
|
9
|
+
file_parser = subparsers.add_parser('convert_file', help='Transpile a single SQL file.')
|
|
10
|
+
file_parser.add_argument("source_file", help="Source file.")
|
|
11
|
+
file_parser.add_argument("destination_file", help="Destination file.")
|
|
12
|
+
file_parser.add_argument("--source_dialect", choices=["bigquery", "postgres", "duckdb"], default='bigquery', help="SQL dialect to transpile.")
|
|
13
|
+
file_parser.add_argument("--destination_dialect", choices=["postgres", "duckdb"], default='postgres', help="SQL dialect to transpile.")
|
|
14
|
+
file_parser.set_defaults(func=transpile_file)
|
|
15
|
+
|
|
16
|
+
folder_parser = subparsers.add_parser('convert_folder', help='Transpile all SQL files in a folder.')
|
|
17
|
+
folder_parser.add_argument("source_folder", help="Source folder.")
|
|
18
|
+
folder_parser.add_argument("destination_folder", help="Destination folder.")
|
|
19
|
+
folder_parser.add_argument("--source_dialect", choices=["bigquery", "postgres", "duckdb"], default='bigquery', help="SQL dialect to transpile.")
|
|
20
|
+
folder_parser.add_argument("--destination_dialect", choices=["bigquery", "postgres", "duckdb"], default="postgres", help="SQL dialect to transpile.")
|
|
21
|
+
folder_parser.set_defaults(func=transpile_folder)
|
|
22
|
+
|
|
23
|
+
args = parser.parse_args()
|
|
24
|
+
# pop func from args
|
|
25
|
+
args = vars(args)
|
|
26
|
+
func = args.pop("func")
|
|
27
|
+
func(**args)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == '__main__':
|
|
31
|
+
main()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# file generated by setuptools_scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
TYPE_CHECKING = False
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from typing import Tuple, Union
|
|
6
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
|
+
else:
|
|
8
|
+
VERSION_TUPLE = object
|
|
9
|
+
|
|
10
|
+
version: str
|
|
11
|
+
__version__: str
|
|
12
|
+
__version_tuple__: VERSION_TUPLE
|
|
13
|
+
version_tuple: VERSION_TUPLE
|
|
14
|
+
|
|
15
|
+
__version__ = version = '2.4.1.dev119+g9b083be.d20240106'
|
|
16
|
+
__version_tuple__ = version_tuple = (2, 4, 1, 'dev119', 'g9b083be.d20240106')
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: mimic_utils
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Utilities to support building and analyzing the MIMIC database(s)
|
|
5
|
+
Author-email: Alistair Johnson <aewj@mit.edu>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2019 MIT Laboratory for Computational Physiology
|
|
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://github.com/MIT-LCP/mimic-code
|
|
29
|
+
Project-URL: Bug Tracker, https://github.com/MIT-LCP/mimic-code/issues
|
|
30
|
+
Classifier: Programming Language :: Python :: 3
|
|
31
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
32
|
+
Classifier: Operating System :: OS Independent
|
|
33
|
+
Requires-Python: >=3.8
|
|
34
|
+
License-File: LICENSE
|
|
35
|
+
Requires-Dist: sqlglot
|
|
36
|
+
Requires-Dist: pandas
|
|
37
|
+
Requires-Dist: numpy
|