Skip to content

Commit

Permalink
Merge pull request #68 from n1zea144/sample-class-fix
Browse files Browse the repository at this point in the history
Bug fix when sampleClass is not a known class
  • Loading branch information
n1zea144 authored Sep 24, 2023
2 parents 5b7081d + d0c56fa commit a1cdc11
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,21 @@ public String resolveSampleTypeAbbreviation(String specimenTypeValue, String sam
}

// if abbreviation is still not resolved then try to resolve from sample class
CmoSampleClass sampleClass = CmoSampleClass.fromValue(cmoSampleClassValue);
String sampleTypeAbbreviation = SAMPLE_CLASS_ABBREV_MAP.get(sampleClass);
if (sampleTypeAbbreviation == null) {
String sampleTypeAbbreviation = "F";
try {
CmoSampleClass sampleClass = CmoSampleClass.fromValue(cmoSampleClassValue);
if (SAMPLE_CLASS_ABBREV_MAP.containsKey(sampleClass)) {
sampleTypeAbbreviation = SAMPLE_CLASS_ABBREV_MAP.get(sampleClass);
}
} catch (Exception e) {
// happens if cmoSampleClassValue is not found in CmoSampleClass
// nothing to do here since since sampleTypeAbbreviation
// is initialized to default 'F'
}

if (sampleTypeAbbreviation == "F") {
LOG.warn("Could not resolve sample type abbreviation from specimen type,"
+ " sample origin, or sample class - using default 'F' ");
return "F";
+ " sample origin, or sample class - using default 'F' ");
}
return sampleTypeAbbreviation;
}
Expand Down

0 comments on commit a1cdc11

Please sign in to comment.