Showing 318 of 318 total issues
Method test_population_criteria
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_population_criteria
all_population_criteria = @doc.all_population_criteria
assert_equal 4, all_population_criteria.length
codes = all_population_criteria.collect {|p| p.code}
Method apply_temporal
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.apply_temporal(data_criteria, precondition, restriction, data_criteria_converter)
data_criteria.temporal_references ||= []
value = restriction.operator.value
type = restriction.operator.type
temporal_reference = nil
Method data_criteria_matches
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def data_criteria_matches(expected, actual)
matches = true
matches &&= actual[:description] == expected[:description]
matches &&= expected[:code_list_id] == actual[:code_list_id]
Method initialize
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(id, hqmf_id, hqmf_set_id, hqmf_version_number, cms_id, title, description, population_criteria, data_criteria, source_data_criteria, attributes, measure_period, populations=nil)
Method parse_precondition
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_precondition(precondition,data_criteria_converter)
# grab child preconditions, and parse recursively
preconditions = parse_and_merge_preconditions(precondition[:preconditions],data_criteria_converter) if precondition[:preconditions] || []
- 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
Method entry_matches_criteria
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def entry_matches_criteria(entry, data_criteria_info_list)
data_criteria_info_list.each do |data_criteria_info|
data_criteria = data_criteria_info['data_criteria']
data_criteria_oid = HQMFTemplateHelper.template_id_by_definition_and_status(data_criteria.definition,
data_criteria.status || '',
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
class LabOrderImporterTest < Minitest::Test
def test_lab_order_importing
doc = Nokogiri::XML(File.new('test/fixtures/cat1_fragments/lab_order_fragment.xml'))
doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
nrh = HealthDataStandards::Import::CDA::NarrativeReferenceHandler.new
- Read upRead up
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 65.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
class DiagnosticStudyOrderImporterTest < Minitest::Test
def test_encounter_order_importing
doc = Nokogiri::XML(File.new('test/fixtures/cat1_fragments/diagnostic_study_order_fragment.xml'))
doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
nrh = HealthDataStandards::Import::CDA::NarrativeReferenceHandler.new
- Read upRead up
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 65.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method parse_precondition
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse_precondition(precondition,data_criteria_converter)
# grab child preconditions, and parse recursively
preconditions = parse_and_merge_preconditions(precondition[:preconditions],data_criteria_converter) if precondition[:preconditions] || []
Similar blocks of code found in 2 locations. Consider refactoring. Open
def test_transfer_from_act_importing
doc = Nokogiri::XML(File.new('test/fixtures/cat1_fragments/transfer_from_act_fragment.xml'))
doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
nrh = HealthDataStandards::Import::CDA::NarrativeReferenceHandler.new
nrh.build_id_map(doc)
- Read upRead up
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 62.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def test_transfer_to_act_importing
doc = Nokogiri::XML(File.new('test/fixtures/cat1_fragments/transfer_to_act_fragment.xml'))
doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
nrh = HealthDataStandards::Import::CDA::NarrativeReferenceHandler.new
nrh.build_id_map(doc)
- Read upRead up
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 62.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method diff_hash
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def diff_hash(other, ignore_id=false, clean_reference=true)
(self.keys | other.keys).inject({}) do |diff, k|
left = self[k]
right = other[k]
right = right.gsub(/_precondition_\d+/, '') if (right && k==:reference && clean_reference)
Method convert
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.convert(key, criteria)
# @param [String] id
# @param [String] title
# @param [String] standard_category
Method unique_data_criteria
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def unique_data_criteria(measures, r2_compatibility)
all_data_criteria = measures.map {|measure| measure.all_data_criteria}.flatten
mapped_data_criteria = {}
all_data_criteria.each do |data_criteria|
Method test_value_fields
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def test_value_fields
fields = HQMF::DataCriteria::FIELDS
values = HQMF::DataCriteria::VALUE_FIELDS
mismatches = []
- 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
Method handle_data_criteria
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def handle_data_criteria(criteria, collapsed_source_data_criteria)
# Sometimes there are multiple criteria with the same ID, even though they're different; in the HQMF
# criteria refer to parent criteria via outboundRelationship, using an extension (aka ID) and a root;
# we use just the extension to follow the reference, and build the lookup hash using that; since they
# can repeat, we wind up overwriting some content. This becomes important when we want, for example,
- 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
Method find_or_create_provider
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def find_or_create_provider(provider_hash, patient=nil)
provider = Provider.by_npi(provider_hash[:npi]).first if provider_hash[:npi] && !provider_hash[:npi].empty?
unless provider
if provider_hash[:npi]
provider = Provider.create(provider_hash)
- 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
Method import
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.import(xml_data, provider_map = {})
doc = xml_data.kind_of?(Nokogiri::XML::Document) ? xml_data : Nokogiri::XML(xml_data)
providers = []
root_element_name = doc.root.name
- 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
Method add_entry
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_entry(cache_entry)
entry_populations = []
cache_entry.population_ids.each do |population_type, population_id|
population = populations.find{|pop| pop.id == population_id}
if population.nil? && population_type != 'stratification' && population_type != 'STRAT'
- 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
Method import_archive
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.import_archive(file, failed_dir=nil)
begin
failed_dir ||=File.join(File.dirname(file))
patient_id_list = nil