Skip to content

Conversation

@NImeson
Copy link
Collaborator

@NImeson NImeson commented Dec 11, 2025

Added in safe navigation operator to handle where molecular testing type is genuinly nil in the data.

All local tests passing successfully

@NImeson NImeson merged commit edb8ba4 into develop Dec 11, 2025
10 of 15 checks passed
@NImeson NImeson deleted the casref_refresh_errors_manchester_roa branch December 11, 2025 21:09
genotype2 = raw_record['genotype2']
next if MSH6_DOSAGE_MTYPE.include?(moltesttype) && !exon.scan(/MLPA/i).size.positive?
next if moltesttype.match?(/dosage/i) && !exon.match?(/MLPA|P003/i)
next if moltesttype&.match?(/dosage/i) && !exon.match?(/MLPA|P003/i)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, if nil values are allowed, you can write these comparisons as:

 next if /dosage/i.match?(moltesttype) && !/MLPA|P003/i.match?(exon)

without needing to think about safe navigation.

However, in this case, I can see that having nil inputs for comparison might be a logical error, so maybe it's better to do what's happened here, fail with an exception, and then explicitly flag the exceptions with safe navigation.

irb> /el/.match?('hello')
=> true
irb> /el/.match?('world')
=> false
irb> /el/.match?(nil)
=> false

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Brian, yes nil values are acceptable in this case, i've amended the code to you suggested first option in a new PR #171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants