Showing 14 of 34 total issues
File n3c_mapping_conversion.py
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import needed libraries
File analytic_utils.py
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Analytic Utility Functions.
Function process_mapping_evidence
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process_mapping_evidence(evidence_list):
evidence_dict = {'all': [], 'dbxref': [], 'synonym': [], 'label': [], 'similarity': []}
for x in evidence_list:
for i in x.split(' | '):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function main
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def main():
### Step 0: set/update hard-coded variables
# update hard-coded attributes
version = 'v2.0.0'
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function splits_concept_levels
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def splits_concept_levels(data: pd.DataFrame, type_col: Optional[str], concept_strings: List) -> List:
"""Takes a Pandas DataFrame and a string containing a keyword and with the keyword, splits the input DataFrame
into concept and ancestor-level data. The keyword is used to obtain relevant columns where the data differs for
concepts and ancestors.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function process_error_analysis_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_error_analysis_data(error_analysis, purposefully_unmapped, missing_concepts, cp_data, chco_data):
Function ontology_loader
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ontology_loader(self) -> None:
"""Function takes a list of file paths to pickled data, loads the data, and then saves each file as a dictionary
entry.
Returns:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function downloads_data_from_url
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def downloads_data_from_url(self, owltools_location: str = './omop2obo/libs/owltools') -> None:
"""Takes a string representing a file path/name to a text file as an argument. The function assumes
that each item in the input file list is an URL to an OWL/OBO ontology.
For each URL, the referenced ontology is downloaded, and used as input to an OWLTools command line argument (
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function normalizes_source_codes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def normalizes_source_codes(data: pd.DataFrame, source_code_dict: Dict) -> pd.Series:
"""Takes a Pandas DataFrame column containing source code values that need normalization and normalizes them
using values from a pre-built dictionary (resources/mappings/source_code_vocab_map.csv). The function is designed
to normalize identifier prefixes according to the specifications in the source_code_dict. It provides some light
regex support for the following scenarios:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function filters_mapping_content
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def filters_mapping_content(exact_results: List, similarity_results: List, threshold: float) -> Tuple:
"""Parses compiled mapping results, when results exist, to determine a final aggregated mapping result.
Args:
exact_results: A nested list containing 3 sub-lists where sub-list[0] contains exact match uris, sub-list[1]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function creates_concept_set_container
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def creates_concept_set_container(map_dict: Dict, output_loc: str, enclave_params: Dict) -> None:
"""Takes input information on the OMOP2OBO mappings and outputs a csv file with the columns required for creating
the concept set container data.
Args:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function parses_resource_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parses_resource_file(self) -> None:
"""Parses data from a file and outputs a list where each item is a line from the input text file.
Returns:
source_list: A dictionary, where the key is the type of data and the value is the file path or url. See
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function creates_concept_set_version
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def creates_concept_set_version(map_dict: Dict, id_dict: Dict, output_loc: str, enclave_params: Dict) -> None:
"""Takes input information on the OMOP2OBO mappings and outputs a csv file with the columns required for creating
the concept set version data.
Args:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function creates_concept_set_expression_items
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def creates_concept_set_expression_items(map_dict: Dict, id_dict: Dict, output_loc: str, enclave_params: Dict) -> None:
"""Takes input information on the OMOP2OBO mappings and outputs a csv file with the columns required for creating
the concept set expression items data.
Args:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"