From fda8e084868dfc94f3a58379b829204268f8a735 Mon Sep 17 00:00:00 2001 From: NImeson Date: Fri, 12 Dec 2025 10:33:20 +0000 Subject: [PATCH 1/2] amended safe navigation line to improved code - nil values are acceptable in ROA importer --- .../providers/manchester/manchester_handler_colorectal.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/import/colorectal/providers/manchester/manchester_handler_colorectal.rb b/lib/import/colorectal/providers/manchester/manchester_handler_colorectal.rb index 68f48d32..33b07a20 100644 --- a/lib/import/colorectal/providers/manchester/manchester_handler_colorectal.rb +++ b/lib/import/colorectal/providers/manchester/manchester_handler_colorectal.rb @@ -139,7 +139,7 @@ def extract_genes_from_raw_fields exon = raw_record['exon'] 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 /dosage/i.match?(moltesttype) && !/MLPA|P003/i.match?(exon) genes_found << find_genes_genotype(exon, moltesttype, genotype, genotype2) end From 4d5b0477a5954634806dfa7b0d5184b9c3ca32ed Mon Sep 17 00:00:00 2001 From: NImeson Date: Fri, 12 Dec 2025 10:54:26 +0000 Subject: [PATCH 2/2] edited additional lines to reflect same changes --- .../providers/manchester/manchester_handler_colorectal.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/import/colorectal/providers/manchester/manchester_handler_colorectal.rb b/lib/import/colorectal/providers/manchester/manchester_handler_colorectal.rb index 33b07a20..a3b87edd 100644 --- a/lib/import/colorectal/providers/manchester/manchester_handler_colorectal.rb +++ b/lib/import/colorectal/providers/manchester/manchester_handler_colorectal.rb @@ -150,9 +150,9 @@ def find_genes_genotype(exon, moltesttype, genotype, genotype2) exon_genes = exon&.scan(COLORECTAL_GENES_REGEX).to_a genotype_genes = genotype&.scan(COLORECTAL_GENES_REGEX).to_a genotype2_genes = genotype2&.scan(COLORECTAL_GENES_REGEX).to_a - if exon.match?('NGS') + if /NGS/.match?(exon) genotype == 'No pathogenic variant identified' ? exon_genes : genotype_genes - elsif exon.match?(/P003/i) && moltesttype&.match?(/dosage/i) + elsif /P003/i.match?(exon) && /dosage/i.match?(moltesttype) %w[MLH1 MSH2] + [genotype_genes + genotype2_genes] elsif exon == 'MLH1_MSH2_MSH6_NGS-POOL' && genotype == 'No pathogenic variant identified'