-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply pre-commit code formatters (#47)
* added python-app to run the tests when the main branch is pushed or a PR is approved * Removed unused dependencies from the project and updated README.md * Try to fix the tensorflow reshaping error * Renamed python-app.yml to tests.yml * reformatted source code using black * added .pre-commit-config.yaml * added black to the dev environment in pyproject.toml * manually ran the pre-commit hooks to fix the file formats * apply black line-length rule * deleted unused script from the branch * changed the private methods (convert_token_to_id, convert_id_to_token) to public for CehrBertTokenizer * restored the function create_folder_if_not_exist * created a property oov_token_index for CehrBertTokenizer * fixed the hf_cehrbert_pretrain_runner integration test * removed the github pylint action for now because it's too restrictive * restored LICENSE.md * applied code git hooks to re-format the source * fixed the unittest due to the changing private members to public ones
- Loading branch information
Showing
113 changed files
with
8,301 additions
and
8,196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# For documentation on pre-commit usage, see https://pre-commit.com/ | ||
# This file should be updated quarterly by a developer running `pre-commit autoupdate` | ||
# with changes added and committed. | ||
# This will run all defined formatters prior to adding a commit. | ||
default_language_version: | ||
python: python3 # or python3.10 to set a specific default version | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
|
||
- repo: https://github.com/DanielNoord/pydocstringformatter | ||
rev: 'v0.7.3' | ||
hooks: | ||
- id: pydocstringformatter | ||
|
||
- repo: https://github.com/PyCQA/autoflake | ||
rev: v2.2.0 | ||
hooks: | ||
- id: autoflake | ||
|
||
- repo: https://github.com/psf/black | ||
rev: '24.1.1' | ||
hooks: | ||
- id: black | ||
# It is recommended to specify the latest version of Python | ||
# supported by your project here, or alternatively use | ||
# pre-commit's default_language_version, see | ||
# https://pre-commit.com/#top_level-default_language_version | ||
# Pre-commit hook info from: https://black.readthedocs.io/en/stable/integrations/source_version_control.html | ||
# Editor integration here: https://black.readthedocs.io/en/stable/integrations/editors.html | ||
|
||
- repo: https://github.com/adamchainz/blacken-docs | ||
rev: "v1.12.1" # replace with latest tag on GitHub | ||
hooks: | ||
- id: blacken-docs | ||
additional_dependencies: | ||
- black>=22.12.0 | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: 'v4.5.0' | ||
hooks: | ||
- id: trailing-whitespace | ||
exclude: .git/COMMIT_EDITMSG | ||
- id: end-of-file-fixer | ||
exclude: .git/COMMIT_EDITMSG | ||
- id: detect-private-key | ||
- id: debug-statements | ||
- id: check-json | ||
- id: pretty-format-json | ||
- id: check-yaml | ||
- id: name-tests-test | ||
- id: requirements-txt-fixer | ||
|
||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: 'v1.10.0' | ||
hooks: | ||
- id: python-no-eval | ||
- id: python-no-log-warn | ||
- id: python-use-type-annotations | ||
|
||
- repo: https://github.com/Lucas-C/pre-commit-hooks | ||
rev: v1.5.4 | ||
hooks: | ||
- id: remove-crlf | ||
- id: remove-tabs # defaults to: 4 | ||
exclude: .git/COMMIT_EDITMSG | ||
|
||
- repo: https://github.com/PyCQA/isort.git | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
args: [ "--profile", "black" ] | ||
|
||
- repo: https://github.com/PyCQA/bandit | ||
rev: '1.7.7' | ||
hooks: | ||
- id: bandit | ||
args: ["--skip", "B101,B106,B107,B301,B311,B105,B608,B403"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Department of Biomedical Informatics | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ | |
"train_batch_size": "auto", | ||
"train_micro_batch_size_per_gpu": "auto", | ||
"wall_clock_breakdown": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ | |
"train_batch_size": "auto", | ||
"train_micro_batch_size_per_gpu": "auto", | ||
"wall_clock_breakdown": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,4 @@ | |
"train_batch_size": "auto", | ||
"train_micro_batch_size_per_gpu": "auto", | ||
"wall_clock_breakdown": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ val_4 = 1.2e-4 | |
val_1 = True | ||
|
||
[LSTM_UNIT] | ||
val_1 = 128 | ||
val_1 = 128 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ val_1 = 1.0e-4 | |
val_1 = True | ||
|
||
[LSTM_UNIT] | ||
val_1 = 128 | ||
val_1 = 128 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
from typing import NamedTuple, List | ||
from typing import List, NamedTuple | ||
|
||
LEARNING_RATE = 'LEARNING_RATE' | ||
LSTM_DIRECTION = 'LSTM_DIRECTION' | ||
LSTM_UNIT = 'LSTM_UNIT' | ||
LEARNING_RATE = "LEARNING_RATE" | ||
LSTM_DIRECTION = "LSTM_DIRECTION" | ||
LSTM_UNIT = "LSTM_UNIT" | ||
|
||
|
||
class GridSearchConfig(NamedTuple): | ||
""" | ||
A data class for storing the row from the pandas data frame and the indexes for slicing the | ||
""" | ||
"""A data class for storing the row from the pandas data frame and the indexes for slicing the.""" | ||
|
||
learning_rates: List[float] = [1.0e-4] | ||
lstm_directions: List[bool] = [True] | ||
lstm_units: List[int] = [128] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
PARQUET_DATA_PATH = 'patient_sequence' | ||
QUALIFIED_CONCEPT_LIST_PATH = 'qualified_concept_list' | ||
TIME_ATTENTION_MODEL_PATH = 'time_aware_model.h5' | ||
BERT_MODEL_VALIDATION_PATH = 'bert_model.h5' | ||
MORTALITY_DATA_PATH = 'mortality' | ||
HEART_FAILURE_DATA_PATH = 'heart_failure' | ||
HOSPITALIZATION_DATA_PATH = 'hospitalization' | ||
INFORMATION_CONTENT_DATA_PATH = 'information_content' | ||
CONCEPT_SIMILARITY_PATH = 'concept_similarity' | ||
PARQUET_DATA_PATH = "patient_sequence" | ||
QUALIFIED_CONCEPT_LIST_PATH = "qualified_concept_list" | ||
TIME_ATTENTION_MODEL_PATH = "time_aware_model.h5" | ||
BERT_MODEL_VALIDATION_PATH = "bert_model.h5" | ||
MORTALITY_DATA_PATH = "mortality" | ||
HEART_FAILURE_DATA_PATH = "heart_failure" | ||
HOSPITALIZATION_DATA_PATH = "hospitalization" | ||
INFORMATION_CONTENT_DATA_PATH = "information_content" | ||
CONCEPT_SIMILARITY_PATH = "concept_similarity" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
PERSON = 'person' | ||
VISIT_OCCURRENCE = 'visit_occurrence' | ||
CONDITION_OCCURRENCE = 'condition_occurrence' | ||
PROCEDURE_OCCURRENCE = 'procedure_occurrence' | ||
DRUG_EXPOSURE = 'drug_exposure' | ||
DEVICE_EXPOSURE = 'device_exposure' | ||
OBSERVATION = 'observation' | ||
MEASUREMENT = 'measurement' | ||
CATEGORICAL_MEASUREMENT = 'categorical_measurement' | ||
OBSERVATION_PERIOD = 'observation_period' | ||
DEATH = 'death' | ||
CDM_TABLES = [PERSON, VISIT_OCCURRENCE, CONDITION_OCCURRENCE, PROCEDURE_OCCURRENCE, DRUG_EXPOSURE, | ||
DEVICE_EXPOSURE, OBSERVATION, MEASUREMENT, CATEGORICAL_MEASUREMENT, | ||
OBSERVATION_PERIOD, DEATH] | ||
REQUIRED_MEASUREMENT = 'required_measurement' | ||
UNKNOWN_CONCEPT = '[UNKNOWN]' | ||
CONCEPT = 'concept' | ||
CONCEPT_ANCESTOR = 'concept_ancestor' | ||
PERSON = "person" | ||
VISIT_OCCURRENCE = "visit_occurrence" | ||
CONDITION_OCCURRENCE = "condition_occurrence" | ||
PROCEDURE_OCCURRENCE = "procedure_occurrence" | ||
DRUG_EXPOSURE = "drug_exposure" | ||
DEVICE_EXPOSURE = "device_exposure" | ||
OBSERVATION = "observation" | ||
MEASUREMENT = "measurement" | ||
CATEGORICAL_MEASUREMENT = "categorical_measurement" | ||
OBSERVATION_PERIOD = "observation_period" | ||
DEATH = "death" | ||
CDM_TABLES = [ | ||
PERSON, | ||
VISIT_OCCURRENCE, | ||
CONDITION_OCCURRENCE, | ||
PROCEDURE_OCCURRENCE, | ||
DRUG_EXPOSURE, | ||
DEVICE_EXPOSURE, | ||
OBSERVATION, | ||
MEASUREMENT, | ||
CATEGORICAL_MEASUREMENT, | ||
OBSERVATION_PERIOD, | ||
DEATH, | ||
] | ||
REQUIRED_MEASUREMENT = "required_measurement" | ||
UNKNOWN_CONCEPT = "[UNKNOWN]" | ||
CONCEPT = "concept" | ||
CONCEPT_ANCESTOR = "concept_ancestor" |
Oops, something went wrong.