Search in sources :

Example 6 with PROCEDURE

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

the class SamhsaMatcherFromClaimTransformerTest method verifySamhsaMatcherForDiagnosisPackage.

/**
 * Verify SAMHSA matcher for package 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 verifySamhsaMatcherForDiagnosisPackage(String system, String code, boolean shouldMatch, ExplanationOfBenefit explanationOfBenefit) {
    ExplanationOfBenefit modifiedEob = explanationOfBenefit.copy();
    // Set diagnosis DRG
    for (ExplanationOfBenefit.DiagnosisComponent diagnosisComponent : modifiedEob.getDiagnosis()) {
        if (diagnosisComponent.getDiagnosisCodeableConcept() != null) {
            diagnosisComponent.getDiagnosisCodeableConcept().setCoding(new ArrayList<>());
        }
        CodeableConcept codeableConcept = new CodeableConcept();
        Coding coding = new Coding(system, code, null);
        codeableConcept.setCoding(Collections.singletonList(coding));
        diagnosisComponent.setPackageCode(codeableConcept);
    }
    // Set procedure to empty so we dont check it for matches
    for (ExplanationOfBenefit.ProcedureComponent diagnosisComponent : modifiedEob.getProcedure()) {
        CodeableConcept codeableConcept = diagnosisComponent.getProcedureCodeableConcept();
        ArrayList<Coding> codingList = new ArrayList<>();
        codeableConcept.setCoding(codingList);
    }
    // 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 7 with PROCEDURE

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

the class CCWProcedureTest method assertDateNotPresent.

/**
 * Verifies that a procedure date isn't present even though there is a procedure code present
 */
static void assertDateNotPresent(Character version, String system) {
    Optional<String> code = Optional.of("code");
    Optional<LocalDate> procDate = Optional.empty();
    Optional<CCWProcedure> diagnosis = CCWProcedure.from(code, Optional.of(version), procDate);
    assertEquals(Optional.empty(), diagnosis.get().getProcedureDate());
    assertEquals(system, diagnosis.get().getFhirSystem());
    TransformerTestUtils.assertHasCoding(system, code.get(), diagnosis.get().toCodeableConcept().getCoding());
    CodeableConcept codeableConcept = new CodeableConcept();
    Coding coding = codeableConcept.addCoding();
    coding.setSystem(system).setCode(code.get());
    assertTrue(diagnosis.get().isContainedIn(codeableConcept));
}
Also used : CCWProcedure(gov.cms.bfd.server.war.commons.CCWProcedure) Coding(org.hl7.fhir.dstu3.model.Coding) LocalDate(java.time.LocalDate) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 8 with PROCEDURE

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

the class SamhsaMatcherR4FromClaimTransformerV2Test 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()) {
        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).setProductOrService(null);
    // When
    boolean isMatch = samhsaMatcherV2.test(modifiedEob);
    // Then
    assertEquals(expectMatch, isMatch);
}
Also used : ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit)

Example 9 with PROCEDURE

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

the class SNFClaimTransformerV2Test method shouldHaveProcedureMembers.

@Test
public void shouldHaveProcedureMembers() {
    ProcedureComponent proc1 = TransformerTestUtilsV2.findProcedureByCode("0TCCCCC", eob.getProcedure());
    ProcedureComponent cmp1 = TransformerTestUtilsV2.createProcedure(proc1.getSequence(), new Coding("http://hl7.org/fhir/sid/icd-9-cm", "0TCCCCC", null), "2016-01-16T00:00:00-08:00");
    assertTrue(cmp1.equalsDeep(proc1), "Comparing Procedure code 0TCCCCC");
}
Also used : Coding(org.hl7.fhir.r4.model.Coding) ProcedureComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.ProcedureComponent) Test(org.junit.jupiter.api.Test)

Example 10 with PROCEDURE

use of org.hl7.fhir.r4.model.codesystems.ResourceTypes.PROCEDURE in project hl7v2-fhir-converter by LinuxForHealth.

the class Hl7IdentifierFHIRConversionTest method procedureIdentifierTest.

@Test
void procedureIdentifierTest() {
    // with PR1 and PID segments used to create identifiers
    String procedureMsg = "MSH|^~\\&|HL7Soup|Instance1|MCM||200911021022|Security|ADT^A01^ADT_A01|64322|P|2.6|123|456|ER|AL|USA|ASCII|en|2.6|56789^NID^UID|MCM|CDP|^4086::132:2A57:3C28^IPV6|^4086::132:2A57:3C25^IPV6|\n" + "PID|1||000054321^^^MRN|||||||||||||M|CAT|78654^^^ACME||||N\n" + "ROL|5897|UP|AD||20210322133821|20210322133822|10||Hospital|ST||||USA\n" + "PR1|1|ICD10|B45678|Fix break|20210322155008|A|75||V46|80|||32|1|D22|G45|1|G|P98|X|0|0\n";
    Procedure procedure = ResourceUtils.getProcedure(ftv, procedureMsg);
    // Expect 2 identifiers
    assertThat(procedure.hasIdentifier()).isTrue();
    assertThat(procedure.getIdentifier()).hasSize(2);
    List<Identifier> identifiers = procedure.getIdentifier();
    // Match the three id's to position; we can't depend on an order.
    int posExtId = getIdentifierPositionByValue("P98", identifiers);
    assertThat(posExtId).isNotSameAs(-1);
    int posACME = getIdentifierPositionByValue("78654", identifiers);
    assertThat(posACME).isNotSameAs(-1);
    // Identifier 1: PR1.19
    Identifier identifier = procedure.getIdentifier().get(posExtId);
    String value = identifier.getValue();
    String system = identifier.getSystem();
    // PR1.19.1
    assertThat(value).isEqualTo("P98");
    assertThat(system).isEqualTo("urn:id:extID");
    // Identifier 2: Visit number from PID-18
    identifier = procedure.getIdentifier().get(posACME);
    value = identifier.getValue();
    system = identifier.getSystem();
    // PID.18.1
    assertThat(value).isEqualTo("78654");
    // PID.18.4
    assertThat(system).isEqualTo("urn:id:ACME");
    CodeableConcept type = identifier.getType();
    DatatypeUtils.checkCommonCodeableConceptAssertions(type, "VN", "Visit number", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
    // Test: MSH.7 and PV1.19
    String procedureMSH = "MSH|^~\\&||Instance1|MCM||200911021022|Security|ADT^A01^ADT_A01|64322|P|2.6|123|456|ER|AL|USA|ASCII|en|2.6|56789^NID^UID|MCM|CDP|^4086::132:2A57:3C28^IPV6|^4086::132:2A57:3C25^IPV6|\n" + "PID|1||000054321^^^MRN|||||||||||||M|CAT|||||N\n" + "PV1||I|6N^1234^A^GENERAL HOSPITAL2|||||||SUR||||||||S|8846511|A|||||||||||||||||||SF|K||||20170215080000\n" + "ROL|5897|UP|AD||20210322133821|20210322133822|10||Hospital|ST||||USA\n" + "PR1|1|ICD10|B45678|Fix break|20210322155008|A|75||V46|80|||32|1|D22|G45|1|G||X|0|0\n";
    procedure = ResourceUtils.getProcedure(ftv, procedureMSH);
    // Expect 2 identifiers
    assertThat(procedure.hasIdentifier()).isTrue();
    assertThat(procedure.getIdentifier()).hasSize(2);
    identifiers = procedure.getIdentifier();
    // Match the three id's to position; we can't depend on an order.
    posExtId = getIdentifierPositionByValue("200911021022", identifiers);
    assertThat(posExtId).isNotSameAs(-1);
    int posVN = getIdentifierPositionByValue("8846511", identifiers);
    assertThat(posVN).isNotSameAs(-1);
    // Identifier 1: PR1
    identifier = procedure.getIdentifier().get(posExtId);
    value = identifier.getValue();
    system = identifier.getSystem();
    // MSH.7
    assertThat(value).isEqualTo("200911021022");
    assertThat(system).isEqualTo("urn:id:extID");
    // Identifier 2: Visit number from PV1-19
    identifier = procedure.getIdentifier().get(posVN);
    String valueOBR = identifier.getValue();
    system = identifier.getSystem();
    // PV1.19.1
    assertThat(valueOBR).isEqualTo("8846511");
    // No System PV1.19.2 DNE
    assertThat(system).isNull();
    type = identifier.getType();
    DatatypeUtils.checkCommonCodeableConceptAssertions(type, "VN", "Visit number", "http://terminology.hl7.org/CodeSystem/v2-0203", null);
}
Also used : Identifier(org.hl7.fhir.r4.model.Identifier) Procedure(org.hl7.fhir.r4.model.Procedure) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) 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