Search in sources :

Example 61 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE 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 62 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project beneficiary-fhir-data by CMSgov.

the class SamhsaMatcherFromClaimTransformerTest method verifyNoItemCodingsTriggersSamhsaFiltering.

/**
 * Verifies that a claim with no samhsa diagnosis, procedure, or item-level HCPCS codes does
 * trigger filtering because the code array is empty and therefore does not contain known systems.
 *
 * @param expectMatch if the test is expecting a filtering match
 * @param explanationOfBenefit the loaded benefit to use for the test
 */
private void verifyNoItemCodingsTriggersSamhsaFiltering(ExplanationOfBenefit explanationOfBenefit, boolean expectMatch) {
    ExplanationOfBenefit modifiedEob = explanationOfBenefit.copy();
    // Set Top level diagnosis and package code to null and coding to empty
    for (ExplanationOfBenefit.DiagnosisComponent diagnosisComponent : modifiedEob.getDiagnosis()) {
        if (diagnosisComponent != null && diagnosisComponent.getDiagnosisCodeableConcept() != null) {
            diagnosisComponent.getDiagnosisCodeableConcept().setCoding(new ArrayList<>());
            diagnosisComponent.setPackageCode(null);
        }
    }
    // Set procedure to empty
    modifiedEob.setProcedure(new ArrayList<>());
    // Set item level codings to non-SAMHSA
    modifiedEob.getItem().get(0).setService(null);
    // When
    boolean isMatch = samhsaMatcher.test(modifiedEob);
    // Then
    assertEquals(expectMatch, isMatch);
}
Also used : ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit)

Example 63 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project BridgeServer2 by Sage-Bionetworks.

the class CRCControllerTest method procedureMissingIdentifiers.

@Test(expectedExceptions = BadRequestException.class, expectedExceptionsMessageRegExp = "Could not find Bridge user ID.")
public void procedureMissingIdentifiers() throws Exception {
    when(mockRequest.getHeader(AUTHORIZATION)).thenReturn(AUTHORIZATION_HEADER_VALUE);
    when(mockAccountService.authenticate(any(), any())).thenReturn(account);
    when(mockAccountService.getAccount(ACCOUNT_ID)).thenReturn(Optional.of(account));
    ProcedureRequest procedure = new ProcedureRequest();
    String json = FHIR_CONTEXT.newJsonParser().encodeResourceToString(procedure);
    mockRequestBody(mockRequest, json);
    controller.postProcedureRequest();
}
Also used : ProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest) Test(org.testng.annotations.Test)

Example 64 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project fhir-bridge by ehrbase.

the class FindProcedureTransactionIT method findProcedureSearch.

@Test
void findProcedureSearch() throws IOException {
    for (int i = 0; i < 3; i++) {
        create("Procedure/transactions/find-procedure-search.json");
    }
    Bundle bundle = search("Procedure?subject.identifier=" + PATIENT_ID + "&status=entered-in-error");
    Assertions.assertEquals(3, bundle.getTotal());
    bundle.getEntry().forEach(entry -> {
        Procedure procedure = (Procedure) entry.getResource();
        Assertions.assertEquals(PATIENT_ID, procedure.getSubject().getIdentifier().getValue());
        Assertions.assertEquals(Procedure.ProcedureStatus.ENTEREDINERROR, procedure.getStatus());
    });
}
Also used : Bundle(org.hl7.fhir.r4.model.Bundle) Procedure(org.hl7.fhir.r4.model.Procedure) Test(org.junit.jupiter.api.Test)

Example 65 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project fhir-bridge by ehrbase.

the class FindProcedureTransactionIT method findProcedureRead.

@Test
void findProcedureRead() throws IOException {
    MethodOutcome outcome = create("Procedure/transactions/provide-procedure-create.json");
    IIdType id = outcome.getId();
    Procedure procedure = read(id.getIdPart(), Procedure.class);
    Assertions.assertNotNull(procedure);
    Assertions.assertNotNull(procedure.getId(), id.getIdPart());
    Assertions.assertEquals(PATIENT_ID, procedure.getSubject().getIdentifier().getValue());
}
Also used : Procedure(org.hl7.fhir.r4.model.Procedure) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) IIdType(org.hl7.fhir.instance.model.api.IIdType) Test(org.junit.jupiter.api.Test)

Aggregations

Procedure (org.hl7.fhir.r4.model.Procedure)22 Test (org.junit.jupiter.api.Test)19 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)14 Coding (org.hl7.fhir.r4.model.Coding)14 ArrayList (java.util.ArrayList)12 Bundle (org.hl7.fhir.r4.model.Bundle)11 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)11 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)9 Reference (org.hl7.fhir.r4.model.Reference)9 ExplanationOfBenefit (org.hl7.fhir.dstu3.model.ExplanationOfBenefit)8 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)8 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)8 CCWProcedure (gov.cms.bfd.server.war.commons.CCWProcedure)7 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)7 Coding (org.hl7.fhir.dstu3.model.Coding)7 Date (java.util.Date)6 List (java.util.List)6 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)6 Diagnosis (gov.cms.bfd.server.war.commons.Diagnosis)5 Collectors (java.util.stream.Collectors)5