renalreg/radar

View on GitHub
radar/exporter/exporters.py

Summary

Maintainability
F
2 wks
Test Coverage

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,
Severity: Major
Found in radar/exporter/exporters.py - About 4 days to fix

    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
    Severity: Minor
    Found in radar/exporter/exporters.py - About 1 day to fix

    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"]:
    
    
    Severity: Minor
    Found in radar/exporter/exporters.py - About 4 hrs to fix

    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 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_rows(self):
            self._columns.extend(
                column(item.lower()) for item in SUPPORTIVE_MEDICATIONS.keys()
            )
    
    
    Severity: Minor
    Found in radar/exporter/exporters.py - About 3 hrs to fix

    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:
    Severity: Minor
    Found in radar/exporter/exporters.py - About 2 hrs to fix

    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 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_rows(self):
            observations = queries.get_observations()
            for observation in observations:
                self._columns.append(column(observation.short_name))
    
    
    Severity: Minor
    Found in radar/exporter/exporters.py - About 1 hr to fix

    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 make_row has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_row(self, record, diagnosis):
            '''
            Returns a list that represents the content of a single row
            in a CSV file that provides data about a patients diagnoses.
    
    
    Severity: Minor
    Found in radar/exporter/exporters.py - About 1 hr to fix

    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 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_rows(self):
            headers = [col[0] for col in self._columns]
            yield headers
    
            q = queries.get_results(self.config)
    Severity: Minor
    Found in radar/exporter/exporters.py - About 1 hr to fix

    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

    Avoid deeply nested control flow statements.
    Open

                            if self.ins_data['ins_dia_name'] != '':
                                row = [''] * len(headers)
                                row[1] = self.ins_data['pat_id']
                                self.ins_data['pat_id'] = ''
                                self.insert_ins_data(row)
    Severity: Major
    Found in radar/exporter/exporters.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if not self.ins_data['ins_dia_date'] or self.ins_data['ins_dia_date'] < record.from_date:
                                  ins_data = self.get_ins_data(record, diagnosis)
      
                          # Search for primary diagnosis and INS data
                          else:
      Severity: Major
      Found in radar/exporter/exporters.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if diagnosis in self._primary:
                                    row = self.make_row(record, diagnosis)
                                else:
                                    row = []
        
        
        Severity: Major
        Found in radar/exporter/exporters.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if diagnosis in self._primary:
                                      row = self.make_row(record, diagnosis)
                                  else:
                                      row = []
          
          
          Severity: Major
          Found in radar/exporter/exporters.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if not self.ins_data['ins_dia_date'] or self.ins_data['ins_dia_date'] < record.from_date:
                                        ins_data = self.get_ins_data(record, diagnosis)
                    
                    # Not Nurture-ins export
                    else:            
            Severity: Major
            Found in radar/exporter/exporters.py - About 45 mins to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              @register("eq-5d-5l")
              class Eq5d5lExporter(Exporter):
                  def setup(self):
                      self._columns = [
                          column("id"),
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 1 day to fix
              radar/exporter/exporters.py on lines 1193..1211

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 125.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              @register("eq-5d-y")
              class Eq5dyExporter(Exporter):
                  def setup(self):
                      self._columns = [
                          column("id"),
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 1 day to fix
              radar/exporter/exporters.py on lines 1172..1190

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 125.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      if diagnosis.codes:
                          for code in diagnosis.codes:
                              if code.system == "ERA-EDTA PRD":
                                  row[5] = code.code                        
                              if code.system == "ICD-10":
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 4 hrs to fix
              radar/exporter/exporters.py on lines 616..623

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 83.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                          if diagnosis and diagnosis.codes:
                              for code in diagnosis.codes:
                                  if code.system == "ERA-EDTA PRD":
                                      row[5] = code.code
                                  if code.system == "ICD-10":
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 4 hrs to fix
              radar/exporter/exporters.py on lines 551..558

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 83.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              @register("transplant_rejections")
              class TransplantRejectionExporter(Exporter):
                  def setup(self):
                      self._columns = [
                          column("id"),
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 4 hrs to fix
              radar/exporter/exporters.py on lines 811..822

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 77.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              @register("transplant_biopsies")
              class TransplantBiopsyExporter(Exporter):
                  def setup(self):
                      self._columns = [
                          column("id"),
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 4 hrs to fix
              radar/exporter/exporters.py on lines 825..836

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 77.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                          if value:
                              row = [col[1](result) for col in self._columns]
                              row[6] = "RADAR Calculated eGFR without ethnicity"
                              row[7] = row[9] = value
                              yield row
              Severity: Major
              Found in radar/exporter/exporters.py and 4 other locations - About 3 hrs to fix
              radar/exporter/exporters.py on lines 979..983
              radar/exporter/exporters.py on lines 985..989
              radar/exporter/exporters.py on lines 991..995
              radar/exporter/exporters.py on lines 997..1001

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 63.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                          if value:
                              row = [col[1](result) for col in self._columns]
                              row[6] = "RADAR Calculated eGFR"
                              row[7] = row[9] = value
                              yield row
              Severity: Major
              Found in radar/exporter/exporters.py and 4 other locations - About 3 hrs to fix
              radar/exporter/exporters.py on lines 979..983
              radar/exporter/exporters.py on lines 985..989
              radar/exporter/exporters.py on lines 997..1001
              radar/exporter/exporters.py on lines 1003..1007

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 63.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                          if value:
                              row = [col[1](result) for col in self._columns]
                              row[6] = "RADAR Z Score Weight"
                              row[7] = row[9] = value
                              yield row
              Severity: Major
              Found in radar/exporter/exporters.py and 4 other locations - About 3 hrs to fix
              radar/exporter/exporters.py on lines 979..983
              radar/exporter/exporters.py on lines 991..995
              radar/exporter/exporters.py on lines 997..1001
              radar/exporter/exporters.py on lines 1003..1007

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 63.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                          if value:
                              row = [col[1](result) for col in self._columns]
                              row[6] = "RADAR Calculated eGFR with ethnicity"
                              row[7] = row[9] = value
                              yield row
              Severity: Major
              Found in radar/exporter/exporters.py and 4 other locations - About 3 hrs to fix
              radar/exporter/exporters.py on lines 979..983
              radar/exporter/exporters.py on lines 985..989
              radar/exporter/exporters.py on lines 991..995
              radar/exporter/exporters.py on lines 1003..1007

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 63.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                          if value:
                              row = [col[1](result) for col in self._columns]
                              row[6] = "RADAR Z Score Height"
                              row[7] = row[9] = value
                              yield row
              Severity: Major
              Found in radar/exporter/exporters.py and 4 other locations - About 3 hrs to fix
              radar/exporter/exporters.py on lines 985..989
              radar/exporter/exporters.py on lines 991..995
              radar/exporter/exporters.py on lines 997..1001
              radar/exporter/exporters.py on lines 1003..1007

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 63.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                                  if row:
                                      if not self.ins_data['ins_dia_date'] or self.ins_data['ins_dia_date'] < record.from_date:
                                          ins_data = self.get_ins_data(record, diagnosis)
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 1 hr to fix
              radar/exporter/exporters.py on lines 520..521

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 49.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                                      if not self.ins_data['ins_dia_date'] or self.ins_data['ins_dia_date'] < record.from_date:
                                          ins_data = self.get_ins_data(record, diagnosis)
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 1 hr to fix
              radar/exporter/exporters.py on lines 509..511

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 49.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      def column(name, getter=None, anonymised_getter=None, patient_getter=None):
                          if getter is None:
                              getter = path_getter(name)
                          elif isinstance(getter, str):
                              getter = path_getter(getter)
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 1 hr to fix
              radar/exporter/exporters.py on lines 59..65

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

              def column(name, getter=None):
                  if getter is None:
                      getter = path_getter(name)
                  elif isinstance(getter, str):
                      getter = path_getter(getter)
              Severity: Major
              Found in radar/exporter/exporters.py and 1 other location - About 1 hr to fix
              radar/exporter/exporters.py on lines 113..119

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                          if anonymised_getter is None:
                              anonymised_getter = none_getter
                          elif isinstance(anonymised_getter, str):
                              anonymised_getter = path_getter(anonymised_getter)
              Severity: Minor
              Found in radar/exporter/exporters.py and 1 other location - About 40 mins to fix
              radar/exporter/exporters.py on lines 74..77

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 34.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                          if anonymised_getter is None:
                              anonymised_getter = none_getter
                          elif isinstance(anonymised_getter, str):
                              anonymised_getter = path_getter(anonymised_getter)
              Severity: Minor
              Found in radar/exporter/exporters.py and 1 other location - About 40 mins to fix
              radar/exporter/exporters.py on lines 89..92

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 34.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status