Search in sources :

Example 21 with DiagnosisComponent

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));
}
Also used : Coding(org.hl7.fhir.r4.model.Coding) ArrayList(java.util.ArrayList) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 22 with DiagnosisComponent

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));
}
Also used : DiagnosisComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent) Coding(org.hl7.fhir.r4.model.Coding) Test(org.junit.jupiter.api.Test)

Example 23 with DiagnosisComponent

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));
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) ArrayList(java.util.ArrayList) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 24 with DiagnosisComponent

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));
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) ArrayList(java.util.ArrayList) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 25 with DiagnosisComponent

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));
}
Also used : Coding(org.hl7.fhir.dstu3.model.Coding) ArrayList(java.util.ArrayList) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Aggregations

ArrayList (java.util.ArrayList)15 Coding (org.hl7.fhir.r4.model.Coding)14 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)9 Coding (org.hl7.fhir.dstu3.model.Coding)8 ExplanationOfBenefit (org.hl7.fhir.dstu3.model.ExplanationOfBenefit)8 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)8 ExplanationOfBenefit (org.hl7.fhir.r4.model.ExplanationOfBenefit)8 DiagnosisComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent)8 Test (org.junit.jupiter.api.Test)7 Reference (org.hl7.fhir.dstu3.model.Reference)4 Claim (org.mitre.synthea.world.concepts.Claim)4 DateType (org.hl7.fhir.dstu3.model.DateType)3 Money (org.hl7.fhir.dstu3.model.Money)3 Period (org.hl7.fhir.dstu3.model.Period)3 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)2 CcwCodebookInterface (gov.cms.bfd.model.codebook.model.CcwCodebookInterface)2 Diagnosis (gov.cms.bfd.server.war.commons.Diagnosis)2 DiagnosisLabel (gov.cms.bfd.server.war.commons.Diagnosis.DiagnosisLabel)2 BadCodeMonkeyException (gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException)2 BufferedReader (java.io.BufferedReader)2