use of org.hl7.fhir.r4.model.Claim.DiagnosisComponent in project beneficiary-fhir-data by CMSgov.
the class SamhsaMatcherR4FromClaimTransformerV2Test method verifySamhsaMatcherForItemWithSingleCoding.
/**
* Verify SAMHSA matcher for item with the given system, code and if the expectation is that there
* should be a match for this combination.
*
* @param system the system value
* @param code the code
* @param shouldMatch if the matcher should match on this combination
* @param explanationOfBenefit the explanation of benefit
*/
private void verifySamhsaMatcherForItemWithSingleCoding(String system, String code, boolean shouldMatch, ExplanationOfBenefit explanationOfBenefit) {
ExplanationOfBenefit modifiedEob = explanationOfBenefit.copy();
// Set Top level diagnosis and package code to null so we can test item logic
for (ExplanationOfBenefit.DiagnosisComponent diagnosisComponent : modifiedEob.getDiagnosis()) {
CodeableConcept codeableConcept = diagnosisComponent.getDiagnosisCodeableConcept();
codeableConcept.setCoding(new ArrayList<>());
diagnosisComponent.setPackageCode(null);
}
List<Coding> codings = new ArrayList<>();
Coding coding = new Coding();
coding.setSystem(system);
coding.setCode(code);
codings.add(coding);
modifiedEob.getItem().get(0).getProductOrService().setCoding(codings);
assertEquals(shouldMatch, samhsaMatcherV2.test(modifiedEob));
}
use of org.hl7.fhir.r4.model.Claim.DiagnosisComponent in project beneficiary-fhir-data by CMSgov.
the class OutpatientClaimTransformerV2Test method shouldHaveDiagnosesMembers.
@Test
public void shouldHaveDiagnosesMembers() {
DiagnosisComponent diag1 = TransformerTestUtilsV2.findDiagnosisByCode("R5555", eob.getDiagnosis());
DiagnosisComponent cmp1 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag1.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R5555", null), new Coding("http://terminology.hl7.org/CodeSystem/ex-diagnosistype", "principal", "Principal Diagnosis"), null, null);
assertTrue(cmp1.equalsDeep(diag1));
DiagnosisComponent diag2 = TransformerTestUtilsV2.findDiagnosisByCode("I9999", eob.getDiagnosis());
DiagnosisComponent cmp2 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag2.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "I9999", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "other", "Other"), null, null);
assertTrue(cmp2.equalsDeep(diag2));
DiagnosisComponent diag3 = TransformerTestUtilsV2.findDiagnosisByCode("R2222", eob.getDiagnosis());
DiagnosisComponent cmp3 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag3.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R2222", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "externalcauseofinjury", "External Cause of Injury"), null, null);
assertTrue(cmp3.equalsDeep(diag3));
DiagnosisComponent diag4 = TransformerTestUtilsV2.findDiagnosisByCode("R3333", eob.getDiagnosis());
DiagnosisComponent cmp4 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag4.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R3333", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "externalcauseofinjury", "External Cause of Injury"), null, null);
assertTrue(cmp4.equalsDeep(diag4));
DiagnosisComponent diag5 = TransformerTestUtilsV2.findDiagnosisByCode("R1122", eob.getDiagnosis());
DiagnosisComponent cmp5 = TransformerTestUtilsV2.createDiagnosis(// Order doesn't matter
diag5.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-10", "R1122", null), new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBClaimDiagnosisType", "patientreasonforvisit", "Patient Reason for Visit"), null, null);
assertTrue(cmp5.equalsDeep(diag5));
}
use of org.hl7.fhir.r4.model.Claim.DiagnosisComponent in project beneficiary-fhir-data by CMSgov.
the class SamhsaMatcherFromClaimTransformerTest method verifySamhsaMatcherForDiagnosisIcd.
/**
* Verify SAMHSA matcher for ICD item with the given system, code and if the expectation is that
* there should be a match for this combination.
*
* @param system the system value
* @param code the code
* @param shouldMatch if the matcher should match on this combination
*/
private void verifySamhsaMatcherForDiagnosisIcd(String system, String code, boolean shouldMatch, ExplanationOfBenefit explanationOfBenefit) {
ExplanationOfBenefit modifiedEob = explanationOfBenefit.copy();
// Set diagnosis
for (ExplanationOfBenefit.DiagnosisComponent diagnosisComponent : modifiedEob.getDiagnosis()) {
CodeableConcept codeableConcept = diagnosisComponent.getDiagnosisCodeableConcept();
if (codeableConcept != null) {
ArrayList<Coding> codingList = new ArrayList<>();
codingList.add(new Coding().setSystem(system).setCode(code));
codeableConcept.setCoding(codingList);
diagnosisComponent.setPackageCode(null);
}
}
// Set procedure to empty so we dont check it for matches
modifiedEob.getProcedure().forEach(c -> c.getProcedureCodeableConcept().setCoding(new ArrayList<>()));
// Set item coding to non-SAMHSA so we dont check it for matches
List<Coding> codings = new ArrayList<>();
Coding coding = new Coding();
coding.setSystem(TransformerConstants.CODING_SYSTEM_HCPCS);
coding.setCode(NON_SAMHSA_HCPCS_CODE);
codings.add(coding);
modifiedEob.getItem().get(0).getService().setCoding(codings);
assertEquals(shouldMatch, samhsaMatcher.test(modifiedEob));
}
use of org.hl7.fhir.r4.model.Claim.DiagnosisComponent in project beneficiary-fhir-data by CMSgov.
the class SamhsaMatcherFromClaimTransformerTest method verifySamhsaMatcherForItemWithMultiCoding.
/**
* Verify SAMHSA matcher for item with the given system, code and if the expectation is that there
* should be a match for this combination.
*
* @param system the system value of the first coding
* @param code the code of the first coding
* @param system2 the system value of the second coding
* @param code2 the code of the second coding
* @param shouldMatch if the matcher should match on this combination
* @param explanationOfBenefit the explanation of benefit
*/
private void verifySamhsaMatcherForItemWithMultiCoding(String system, String code, String system2, String code2, boolean shouldMatch, ExplanationOfBenefit explanationOfBenefit) {
ExplanationOfBenefit modifiedEob = explanationOfBenefit.copy();
// Set Top level diagnosis and package code to null so we can test item logic
for (ExplanationOfBenefit.DiagnosisComponent diagnosisComponent : modifiedEob.getDiagnosis()) {
CodeableConcept codeableConcept = diagnosisComponent.getDiagnosisCodeableConcept();
codeableConcept.setCoding(new ArrayList<>());
diagnosisComponent.setPackageCode(null);
}
List<Coding> codings = new ArrayList<>();
Coding coding = new Coding();
coding.setSystem(system);
coding.setCode(code);
Coding coding2 = new Coding();
coding2.setSystem(system2);
coding2.setCode(code2);
codings.add(coding);
codings.add(coding2);
modifiedEob.getItem().get(0).getService().setCoding(codings);
assertEquals(shouldMatch, samhsaMatcher.test(modifiedEob));
}
use of org.hl7.fhir.r4.model.Claim.DiagnosisComponent in project beneficiary-fhir-data by CMSgov.
the class SamhsaMatcherFromClaimTransformerTest method verifySamhsaMatcherForItemWithSingleCoding.
/**
* Verify SAMHSA matcher for item with the given system, code and if the expectation is that there
* should be a match for this combination.
*
* @param system the system value
* @param code the code
* @param shouldMatch if the matcher should match on this combination
* @param explanationOfBenefit the explanation of benefit
*/
private void verifySamhsaMatcherForItemWithSingleCoding(String system, String code, boolean shouldMatch, ExplanationOfBenefit explanationOfBenefit) {
ExplanationOfBenefit modifiedEob = explanationOfBenefit.copy();
// Set Top level diagnosis and package code to null so we can test item logic
for (ExplanationOfBenefit.DiagnosisComponent diagnosisComponent : modifiedEob.getDiagnosis()) {
CodeableConcept codeableConcept = diagnosisComponent.getDiagnosisCodeableConcept();
if (codeableConcept != null) {
codeableConcept.setCoding(new ArrayList<>());
diagnosisComponent.setPackageCode(null);
}
}
List<Coding> codings = new ArrayList<>();
Coding coding = new Coding();
coding.setSystem(system);
coding.setCode(code);
codings.add(coding);
modifiedEob.getItem().get(0).getService().setCoding(codings);
assertEquals(shouldMatch, samhsaMatcher.test(modifiedEob));
}
Aggregations