From 50243d55935633ed30742d3e7c66d6d27b72bb31 Mon Sep 17 00:00:00 2001 From: NImeson Date: Thu, 11 Dec 2025 16:08:09 +0000 Subject: [PATCH] added safe navigation for when moleculartesttype is nil in data --- .../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 b6778a79..68f48d32 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 moltesttype&.match?(/dosage/i) && !exon.match?(/MLPA|P003/i) genes_found << find_genes_genotype(exon, moltesttype, genotype, genotype2) end @@ -152,7 +152,7 @@ def find_genes_genotype(exon, moltesttype, genotype, genotype2) genotype2_genes = genotype2&.scan(COLORECTAL_GENES_REGEX).to_a if exon.match?('NGS') genotype == 'No pathogenic variant identified' ? exon_genes : genotype_genes - elsif exon.match?(/P003/i) && moltesttype.match?(/dosage/i) + elsif exon.match?(/P003/i) && moltesttype&.match?(/dosage/i) %w[MLH1 MSH2] + [genotype_genes + genotype2_genes] elsif exon == 'MLH1_MSH2_MSH6_NGS-POOL' && genotype == 'No pathogenic variant identified'