Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update NIH award Format in the award number normalizer #69

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public static String normalizeAwardNumber(String awardNumber) {
}

//if matching the NIH format, then normalize it to the expected format by removing leading zeros
if (awardNumber.toUpperCase().matches("[0-9]*-*\\s*[A-Z]{1,2}[0-9]{1,2}\s*[A-Z]{2}[A-Z0-9]{6}-*[A-Z0-9]*")) {
if (awardNumber
.toUpperCase().matches("[0-9]*-*\\s*[A-Z]{1,2}[0-9]{1,2}[A-Z]?\s*[A-Z]{2}[A-Z0-9]{6}-*[A-Z0-9]*")) {
//remove leading zeros, whitespace and make uppercase
awardNumber = awardNumber
.replaceFirst("^0+-*(?!$)", "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ public void testNullAndEmptyAwardNumber() throws IOException {
public void testNihAwardNumberCorrectFormatWithSpace() throws IOException {
String awardNumber1 = "K99 NS062901";
String awardNumber2 = "P50 AI074285";
String awardNumber3 = "P2C HD042854";
String awardNumber1Expected = "K99NS062901";
String awardNumber2Expected = "P50AI074285";
String awardNumber3Expected = "P2CHD042854";
assertEquals(awardNumber1Expected, ModelUtil.normalizeAwardNumber(awardNumber1));
assertEquals(awardNumber2Expected, ModelUtil.normalizeAwardNumber(awardNumber2));
assertEquals(awardNumber3Expected, ModelUtil.normalizeAwardNumber(awardNumber3));
}

@Test
Expand Down
Loading