Showing 168 of 557 total issues
File exporters.py
has 1597 lines of code (exceeds 250 allowed). Consider refactoring. Open
import re
from radar.exporter import queries
from radar.exporter.utils import (
format_date,
File nurture_validator.py
has 786 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Script to do simple validations on nurture export.
"""
from collections import defaultdict, OrderedDict
Function get_rows
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
def get_rows(self):
'''
Gets all the primary diagnosis data for a specific cohort
:yield: yields CSV row for writting to file
- 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
Patient
has 75 functions (exceeds 20 allowed). Consider refactoring. Open
class Patient(db.Model, MetaModelMixin):
__tablename__ = "patients"
id = Column(Integer, Sequence("patients_seq"), primary_key=True)
comments = Column(String)
File patients.py
has 482 lines of code (exceeds 250 allowed). Consider refactoring. Open
from datetime import datetime
from enum import Enum
from sqlalchemy import (
Boolean,
File results.py
has 422 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import OrderedDict
from datetime import date
from enum import Enum
from itertools import chain
import math
Function export_medications
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def export_medications(sda_container, patient, group):
q = Medication.query
q = q.filter(Medication.patient == patient)
q = q.filter(Medication.source_group == group)
q = q.filter(Medication.source_type == SOURCE_TYPE_MANUAL)
- 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 demographics_column_factory
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def demographics_column_factory(config):
"""Returns a column based on the config."""
if config["anonymised"]:
- 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 revisit
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def revisit():
nurtureins = Group.query.filter_by(code='NURTUREINS').first()
nurtureckd = Group.query.filter_by(code='NURTURECKD').first()
- 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 __init__.py
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
from asyncio import protocols
import calendar
from datetime import datetime
import itertools
import logging
File generics.py
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
from functools import wraps
import uuid
from cornflake import fields, serializers
from cornflake.exceptions import ValidationError
Function get_rows
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def get_rows(self):
self._columns.extend(
column(item.lower()) for item in SUPPORTIVE_MEDICATIONS.keys()
)
- 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 patient_search.py
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
from curses.ascii import NUL
from sqlalchemy import and_, case, desc, extract, func, null, or_
from sqlalchemy.orm import aliased, subqueryload
from radar.database import db
File patient_addresses.py
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
#! -*- coding: utf-8 -*-
from collections import OrderedDict
from sqlalchemy import Column, Date, ForeignKey, Index, String
from sqlalchemy import Integer
Function validate
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, data):
data = super(UserSerializer, self).validate(data)
current_user = self.context['user']
instance = self.instance
- 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 list_patients
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def list_patients():
args = parse_args(PatientListRequestSerializer)
builder = PatientQueryBuilder(current_user)
- 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_rows
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def get_rows(self):
headers = [col[0] for col in self._columns]
yield headers
for result in self._query:
- 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 create_groups
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create_groups():
for groups in batches:
for x in groups:
group = Group()
group.type = x['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 export
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def export(self, sheet, errorfmt=None, warningfmt=None):
medications = self.patient.medications
if medications:
for instance in medications:
data = [getattr(instance, field) for field in self.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 create_demographics_f
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create_demographics_f():
def create_demographics(patient, source_group, source_type, gender):
old_d = PatientDemographics.query.filter(PatientDemographics.patient == patient).first()
new_d = PatientDemographics()
new_d.patient = patient
- 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"