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

QPPSE-2783: Added fix for the null TIN root id issue #1467

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -28,17 +28,21 @@ public SpecPiiValidator(PcfValidationInfoMap file) {

@Override
public void validateApmTinNpiCombination(Node node, NodeValidator validator) {
validateInvalidApmCombinations(node, validator);
validateMissingApmCombinations(node, validator);
List<String> npiList = Arrays.asList(
node.getValue(NATIONAL_PROVIDER_IDENTIFIER).split(","));
List<String> tinList = Arrays.asList(
node.getValue(TAX_PAYER_IDENTIFICATION_NUMBER).split(","));
if (npiList.size() != tinList.size()) {
validator.addError(Detail.forProblemAndNode(ProblemCode.INCORRECT_API_NPI_COMBINATION, node));
} else {
validateInvalidApmCombinations(node, validator, npiList, tinList);
validateMissingApmCombinations(node, validator, npiList, tinList);
}
}

private void validateInvalidApmCombinations(Node node, NodeValidator validator) {
private void validateInvalidApmCombinations(Node node, NodeValidator validator, List<String> npiList, List<String> tinList) {
String program = node.getValue(PROGRAM_NAME);
String apm = getApmEntityId(node, program);
List<String> npiList = Arrays.asList(
node.getValue(NATIONAL_PROVIDER_IDENTIFIER).split(","));
List<String> tinList = Arrays.asList(
node.getValue(TAX_PAYER_IDENTIFICATION_NUMBER).split(","));

Map<String, Map<String, List<String>>> apmToTinNpiMap = file.getApmTinNpiCombinationMap();
if (apmToTinNpiMap == null || StringUtils.isEmpty(apm)) {
Expand All @@ -59,13 +63,9 @@ private void validateInvalidApmCombinations(Node node, NodeValidator validator)
}
}

private void validateMissingApmCombinations(Node node, NodeValidator validator) {
private void validateMissingApmCombinations(Node node, NodeValidator validator, List<String> npiList, List<String> tinList) {
String program = node.getValue(PROGRAM_NAME);
String apm = getApmEntityId(node, program);
List<String> npiList = Arrays.asList(
node.getValue(NATIONAL_PROVIDER_IDENTIFIER).split(","));
List<String> tinList = Arrays.asList(
node.getValue(TAX_PAYER_IDENTIFICATION_NUMBER).split(","));

List<TinNpiCombination> tinNpiCombinations = createTinNpiMap(tinList, npiList);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ protected void performValidation(Node node) {
Truth.assertThat(nodeValidator.viewWarnings().get(0).getErrorCode()).isEqualTo(108);
}

@Test
void testNpiTinSizeMismatch() throws Exception {
SpecPiiValidator validator = validator("DogCow_APM", "DogCow_NPI");
Node node = node("Invalid_Apm", "DogCow_NPI,DogCow_NPI2", "DogCow", PCF_PROGRAM_NAME);
Comment on lines +115 to +116
Copy link
Contributor

Choose a reason for hiding this comment

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

🐶 🐮

System.out.println(node);
NodeValidator nodeValidator = new NodeValidator() {
@Override
protected void performValidation(Node node) {
}
};
validator.validateApmTinNpiCombination(node, nodeValidator);
Truth.assertThat(nodeValidator.viewWarnings().get(0).getErrorCode()).isEqualTo(80);
}

private SpecPiiValidator validator(String apm, String npi) throws Exception {
return new SpecPiiValidator(createSpecFile(apm, npi));
}
Expand Down
Loading