Showing 93 of 93 total issues
File fhir_server.py
has 862 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import re
from typing import Iterable, List, Union
import fhir.resources
File dataset.py
has 457 lines of code (exceeds 250 allowed). Consider refactoring. Open
import random
from typing import Dict, List, Optional, Type, Union
from uuid import uuid4
import matplotlib.pyplot as plt
FhirServer
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class FhirServer:
def __init__(
self,
api_address: str,
username: Union[str, None] = None,
File base.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
from inspect import signature
from typing import Any, Callable, List, TypeVar, Union
import fhir.resources
import httpx
Function _resolve_xml_pagination
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def _resolve_xml_pagination(self, server_response: httpx.Response) -> str:
# parse the xml response and extract the initial entries
initial_response = xmltodict.parse(server_response.text)
entries = initial_response["Bundle"].get("entry")
- 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
File bench.py
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import time
from datetime import datetime
from typing import Any, List, Tuple, Union
Function __repr__
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def __repr__(self):
resource = self.resource.resource_type
if self.query_parameters.include_parameters:
includes = []
rev_includes = []
- 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
File query_parameters.py
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
from abc import ABC
from enum import Enum
from typing import List, Optional, Tuple, Union
from pydantic import BaseModel, root_validator, validator
Function _resolve_json_pagination
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _resolve_json_pagination(
self,
initial_response: httpx.Response,
page_callback: Union[
Callable[[List[FHIRAbstractModel]], Any], Callable[[], Any], 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 _setup
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _setup(
self,
queries: Union[List[Tuple[str, Union[str, FhirQueryParameters]]], None] = None,
steps: List[Union[str, BenchmarkOperations]] = 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 __init__
has 19 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _get_required_reference
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _get_required_reference(
resource: Union[FHIRResourceModel, Type[FHIRAbstractModel]]
) -> str:
fields = get_resource_fields(resource)
required_fields = []
- 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 extract_references
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def extract_references(resource: Resource) -> List[Tuple[str, str, str, bool]]:
"""
Extracts the references from a resource and returns them as a list of dicts.
Args:
resource: fhir resource object to extract references from.
- 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 flatten_dict
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def flatten_dict(
d, parent_key: str = "", sep: str = "_", keys: List[str] = None
) -> dict:
"""
Flatten a nested dictionary into a single level dictionary.
- 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
DatasetGenerator
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class DatasetGenerator:
"""
Generates a dataset of FHIR resources.
"""
Function make_transaction_entry
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def make_transaction_entry(
method: Union[TransactionMethod, str],
url: str = None,
resource: Union[Resource, dict] = None,
) -> BundleEntry:
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def generate(
self,
references: bool = False,
generate_ids: bool = False,
as_dict: 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 include
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def include(
self: T,
resource: str = None,
reference_param: str = None,
target: 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 _validate_depends
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _validate_depends(
self,
depends_on: Union[str, List[str]],
):
graph = self.graph()
- 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_refs_for_generator
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _get_refs_for_generator(
self, generator: DataSetResourceGenerator, result: dict
) -> dict:
"""Get the references resources for a generator from the results and insert a reference to them into
the reference field of the generator
- 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"