Showing 93 of 93 total issues
Function generate_auth
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def generate_auth(
username: str = None,
password: str = None,
token: str = None,
load_env: bool = False,
- 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 _resource_from_graph_node
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _resource_from_graph_node(graph: nx.DiGraph, node: str) -> FHIRAbstractModel:
"""
Get a resource from a graph node.
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 generate_benchmark_data
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_benchmark_data(n_patients: int = N_BASE_RESOURCES) -> DatasetGenerator:
dataset_generator = DatasetGenerator("Patient", n=n_patients)
# covid
covid_params = GeneratorParameters(
Function _add_generator_to_graph
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _add_generator_to_graph(self, generator: DataSetResourceGenerator):
self._graph.add_node(generator.name, generator=generator)
if generator.depends_on:
if isinstance(generator.depends_on, str):
self._graph.add_edge(
- 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 _update_successors
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _update_successors(graph: nx.DiGraph, node: str, reference: str):
"""
Update the successors of a node in a graph with the updated reference from the new server.
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 _generate_time_series
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _generate_time_series(self):
resources = self.generator.generate(generate_ids=True, as_dict=True)
if self.references:
# insert the references
for r in resources:
- 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 auth_info_from_env
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def auth_info_from_env() -> Union[str, Tuple[str, str], Tuple[str, str, str]]:
# First try to load basic auth information
username = os.getenv("FHIR_USER")
# Static token auth
token = os.getenv("FHIR_TOKEN")
- 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 _get_transaction_url_for_method
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _get_transaction_url_for_method(
method: TransactionMethod, url: str = None, resource: Resource = None
) -> str:
"""
Get the url for a transaction entry based on the method, url, and resource.
- 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
Consider simplifying this complex logical expression. Open
if include_dict and include_param:
raise ValueError("Cannot use both include_dict and include_param")
elif include_dict and (resource or reference_param or target):
raise ValueError("Cannot use both include_dict and kv parameters")
elif include_param and (resource or reference_param or target):
Function anonymize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def anonymize(df: pd.DataFrame, k: int = 3, id_cols: List[str] = None) -> pd.DataFrame:
"""
Attempts to generalize the given dataframe to make it k-anonymized
:param df: dataframe to check
- 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 check_value
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def check_value(cls, v, values):
if isinstance(v, list):
if values["operator"] not in [QueryOperators.in_, QueryOperators.not_in]:
raise ValueError(
"List values can only be used with the 'in' and 'not_in' operator."
- 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 where
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def where(
self: T,
field: str = None,
operator: Union[QueryOperators, str] = None,
value: Union[int, float, bool, str, list] = None,
- 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 _benchmark_server
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _benchmark_server(self, server: FhirServer, progress: bool, name: str = None):
"""Run the benchmark suite for a single server
Args:
server: The server to run the benchmark against
- 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 _get_missing_references
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _get_missing_references(references: dict, resource_ids: dict) -> List[str]:
missing_references = []
for ref_resource, reference_set in references.items():
# get set of resource ids for this resource type
id_set = resource_ids.get(ref_resource)
- 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 has
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def has(
self: T,
resource: str = None,
reference_param: str = None,
search_param: str = None,
- 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 resolve_reference_graph
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def resolve_reference_graph(
graph: nx.DiGraph,
target: "FhirServer",
record_linkage: bool,
display: bool,
- 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 _validate_depends_and_reference
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _validate_depends_and_reference(
self,
depends_on: Union[str, List[str]],
reference_field: Union[str, List[str], None],
):
- 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 included_resources
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def included_resources(self) -> List[IncludedResources]:
"""
Returns the list of resources included in the search.
Returns:
List of IncludeResources objects containing the resource type and the list of resources of this type
- 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 generate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def generate(self, display: bool = False) -> DataSet:
"""
Generate a dataset of FHIR resources according to the given conditions
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 _validate_transaction_input
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _validate_transaction_input(
method: Union[TransactionMethod, str],
references: Union[List[Reference], List[str]],
resources: Union[List[Resource], List[dict]],
):
- 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"