Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
timothy-ellis-ky committed Sep 19, 2024
2 parents 192db61 + 0e1f7ec commit c30c5ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package gov.cms.bfd.server.war.r4.providers.pac;

import gov.cms.bfd.model.codebook.data.CcwCodebookVariable;
import gov.cms.bfd.model.rda.entities.RdaFissClaim;
import gov.cms.bfd.model.rda.entities.RdaMcsClaim;
import gov.cms.bfd.server.war.adapters.CodeableConcept;
import gov.cms.bfd.server.war.adapters.Coding;
import gov.cms.bfd.server.war.adapters.r4.ClaimAdapter;
import gov.cms.bfd.server.war.commons.AbstractSamhsaMatcher;
import gov.cms.bfd.server.war.commons.CCWUtils;
import gov.cms.bfd.server.war.commons.TransformerConstants;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.hl7.fhir.r4.model.Claim;
import org.springframework.stereotype.Component;

Expand Down Expand Up @@ -74,6 +79,10 @@ public boolean test(Claim claim) {
|| containsSamhsaLineItem(adapter.getItem());
}

/** Additional valid coding system URL for backwards-compatibility. */
private static final Set<String> BACKWARDS_COMPATIBLE_HCPCS_SYSTEM =
Set.of(CCWUtils.calculateVariableReferenceUrl(CcwCodebookVariable.HCPCS_CD));

/**
* Checks if the given {@link CodeableConcept} contains only known coding systems.
*
Expand All @@ -83,8 +92,17 @@ public boolean test(Claim claim) {
*/
@Override
protected boolean containsOnlyKnownSystems(CodeableConcept procedureConcept) {
return procedureConcept.getCoding().stream()
.allMatch(c -> c.getSystem().equals(TransformerConstants.CODING_SYSTEM_CARIN_HCPCS));
Set<String> codingSystems =
procedureConcept.getCoding().stream().map(Coding::getSystem).collect(Collectors.toSet());

for (String system : codingSystems) {
if (!(BACKWARDS_COMPATIBLE_HCPCS_SYSTEM.contains(system)
|| TransformerConstants.CODING_SYSTEM_CARIN_HCPCS.equals(system))) {
return false;
}
;
}
return true;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void shouldGetClaimResponseResourcesByMbiHashWithExcludeSamhsaTrue() {
.spec(requestAuth)
.expect()
.statusCode(200)
.body("entry.size()", equalTo(1))
.body("entry.size()", equalTo(2))
.when()
.get(requestString);
}
Expand Down

0 comments on commit c30c5ff

Please sign in to comment.