diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index df2c34a0..ca2d6b95 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -20,4 +20,4 @@ jobs: pip install pylint - name: Analysing the code with pylint run: | - pylint $(git ls-files '*.py') --disable=C0114,C0115,C0116,C0103,E0401,W1203,B101,B311 + pylint $(git ls-files '*.py') --disable=C0114,C0115,C0116,C0103,E0401,W1203,B101,B311,R0913,R0914,R0915,W1202,R0801 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0181854c..678a3635 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -88,4 +88,4 @@ repos: rev: '1.7.7' hooks: - id: bandit - args: ["--skip", "B101,B311"] + args: ["--skip", "B101,B106,B107,B301,B311,B105,B608,B403"] diff --git a/src/cehrbert/utils/spark_utils.py b/src/cehrbert/utils/spark_utils.py index 6af567ff..5b0fbc3a 100644 --- a/src/cehrbert/utils/spark_utils.py +++ b/src/cehrbert/utils/spark_utils.py @@ -360,7 +360,7 @@ def roll_up_procedure(procedure_occurrence, concept, concept_ancestor): def extract_parent_code(concept_code): return concept_code.split(".")[0] - parent_code_udf = F.udf(lambda code: extract_parent_code(code), T.StringType()) + parent_code_udf = F.udf(extract_parent_code, T.StringType()) procedure_code = ( procedure_occurrence.select("procedure_source_concept_id") @@ -983,14 +983,16 @@ def get_descendant_concept_ids(spark, concept_ids): # Join the sanitized IDs into a string for the query concept_ids_str = ",".join(map(str, sanitized_concept_ids)) # Construct and execute the SQL query using the sanitized string - descendant_concept_ids = spark.sql(f""" + descendant_concept_ids = spark.sql( + f""" SELECT DISTINCT c.* FROM global_temp.concept_ancestor AS ca JOIN global_temp.concept AS c ON ca.descendant_concept_id = c.concept_id WHERE ca.ancestor_concept_id IN ({concept_ids_str}) - """) + """ + ) return descendant_concept_ids