Search in sources :

Example 81 with Claim

use of org.hl7.fhir.r4.model.Claim in project beneficiary-fhir-data by CMSgov.

the class HHAClaimTransformerTest method transformSampleARecord.

/**
 * Verifies that {@link
 * gov.cms.bfd.server.war.stu3.providers.HHAClaimTransformer#transform(Object)} works as expected
 * when run against the {@link StaticRifResource#SAMPLE_A_HHA} {@link HHAClaim}.
 *
 * @throws FHIRException (indicates test failure)
 */
@Test
public void transformSampleARecord() throws FHIRException {
    List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    HHAClaim claim = parsedRecords.stream().filter(r -> r instanceof HHAClaim).map(r -> (HHAClaim) r).findFirst().get();
    ExplanationOfBenefit eob = HHAClaimTransformer.transform(new MetricRegistry(), claim, Optional.empty());
    assertMatches(claim, eob);
}
Also used : Arrays(java.util.Arrays) MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) BenefitCategory(org.hl7.fhir.dstu3.model.codesystems.BenefitCategory) StaticRifResource(gov.cms.bfd.model.rif.samples.StaticRifResource) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) HHAClaimLine(gov.cms.bfd.model.rif.HHAClaimLine) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) Test(org.junit.jupiter.api.Test) BigDecimal(java.math.BigDecimal) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) List(java.util.List) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Optional(java.util.Optional) FHIRException(org.hl7.fhir.exceptions.FHIRException) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) MetricRegistry(com.codahale.metrics.MetricRegistry) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test)

Example 82 with Claim

use of org.hl7.fhir.r4.model.Claim in project beneficiary-fhir-data by CMSgov.

the class TransformerTestUtils method assertCommonEobInformationInpatientSNF.

/**
 * Tests EOB information fields that are common between the Inpatient and SNF claim types.
 *
 * @param eob the {@link ExplanationOfBenefit} that will be tested by this method
 * @param noncoveredStayFromDate NCH_VRFD_NCVRD_STAY_FROM_DT: an {@link Optional}&lt;{@link
 *     LocalDate}&gt; shared field representing the non-covered stay from date for the claim
 * @param noncoveredStayThroughDate NCH_VRFD_NCVRD_STAY_THRU_DT: an {@link Optional}&lt;{@link
 *     LocalDate}&gt; shared field representing the non-covered stay through date for the claim
 * @param coveredCareThroughDate NCH_ACTV_OR_CVRD_LVL_CARE_THRU: an {@link Optional}&lt;{@link
 *     LocalDate}&gt; shared field representing the covered stay through date for the claim
 * @param medicareBenefitsExhaustedDate NCH_BENE_MDCR_BNFTS_EXHTD_DT_I: an {@link
 *     Optional}&lt;{@link LocalDate}&gt; shared field representing the medicare benefits
 *     exhausted date for the claim
 * @param diagnosisRelatedGroupCd CLM_DRG_CD: an {@link Optional}&lt;{@link String}&gt; shared
 *     field representing the non-covered stay from date for the claim
 */
static void assertCommonEobInformationInpatientSNF(ExplanationOfBenefit eob, Optional<LocalDate> noncoveredStayFromDate, Optional<LocalDate> noncoveredStayThroughDate, Optional<LocalDate> coveredCareThroughDate, Optional<LocalDate> medicareBenefitsExhaustedDate, Optional<String> diagnosisRelatedGroupCd) {
    // noncoveredStayFromDate & noncoveredStayThroughDate
    if (noncoveredStayFromDate.isPresent() || noncoveredStayThroughDate.isPresent()) {
        SupportingInformationComponent nchVrfdNcvrdStayInfo = TransformerTestUtils.assertHasInfo(CcwCodebookVariable.NCH_VRFD_NCVRD_STAY_FROM_DT, eob);
        TransformerTestUtils.assertPeriodEquals(noncoveredStayFromDate, noncoveredStayThroughDate, (Period) nchVrfdNcvrdStayInfo.getTiming());
    }
    // coveredCareThroughDate
    if (coveredCareThroughDate.isPresent()) {
        SupportingInformationComponent nchActvOrCvrdLvlCareThruInfo = TransformerTestUtils.assertHasInfo(CcwCodebookVariable.NCH_ACTV_OR_CVRD_LVL_CARE_THRU, eob);
        TransformerTestUtils.assertDateEquals(coveredCareThroughDate.get(), (DateTimeType) nchActvOrCvrdLvlCareThruInfo.getTiming());
    }
    // medicareBenefitsExhaustedDate
    if (medicareBenefitsExhaustedDate.isPresent()) {
        SupportingInformationComponent nchBeneMdcrBnftsExhtdDtIInfo = TransformerTestUtils.assertHasInfo(CcwCodebookVariable.NCH_BENE_MDCR_BNFTS_EXHTD_DT_I, eob);
        TransformerTestUtils.assertDateEquals(medicareBenefitsExhaustedDate.get(), (BaseDateTimeType) nchBeneMdcrBnftsExhtdDtIInfo.getTiming());
    }
    // diagnosisRelatedGroupCd
    assertHasCoding(CcwCodebookVariable.CLM_DRG_CD, diagnosisRelatedGroupCd, eob.getDiagnosisFirstRep().getPackageCode());
}
Also used : SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent)

Example 83 with Claim

use of org.hl7.fhir.r4.model.Claim in project beneficiary-fhir-data by CMSgov.

the class SNFClaimTransformerTest method transformSampleARecord.

/**
 * Verifies that {@link
 * gov.cms.bfd.server.war.stu3.providers.SNFClaimTransformer#transform(Object)} works as expected
 * when run against the {@link StaticRifResource#SAMPLE_A_SNF} {@link SNFClaim}.
 *
 * @throws FHIRException (indicates test failure)
 */
@Test
public void transformSampleARecord() throws FHIRException {
    List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    SNFClaim claim = parsedRecords.stream().filter(r -> r instanceof SNFClaim).map(r -> (SNFClaim) r).findFirst().get();
    ExplanationOfBenefit eob = SNFClaimTransformer.transform(new MetricRegistry(), claim, Optional.empty());
    assertMatches(claim, eob);
}
Also used : Arrays(java.util.Arrays) MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) StaticRifResource(gov.cms.bfd.model.rif.samples.StaticRifResource) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) Test(org.junit.jupiter.api.Test) BigDecimal(java.math.BigDecimal) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) SNFClaimLine(gov.cms.bfd.model.rif.SNFClaimLine) List(java.util.List) SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Period(org.hl7.fhir.dstu3.model.Period) Optional(java.util.Optional) CCWProcedure(gov.cms.bfd.server.war.commons.CCWProcedure) FHIRException(org.hl7.fhir.exceptions.FHIRException) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) MetricRegistry(com.codahale.metrics.MetricRegistry) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test)

Example 84 with Claim

use of org.hl7.fhir.r4.model.Claim in project beneficiary-fhir-data by CMSgov.

the class SamhsaMatcherFromClaimTransformerTest method data.

/**
 * Data collection.
 *
 * @return the collection
 */
public static Stream<Arguments> data() {
    // Load and transform the various claim types for testing
    ExplanationOfBenefit inpatientEob = InpatientClaimTransformer.transform(new MetricRegistry(), getClaim(InpatientClaim.class), Optional.empty());
    String inpatientClaimType = TransformerUtils.getClaimType(inpatientEob).toString();
    ExplanationOfBenefit outpatientEob = OutpatientClaimTransformer.transform(new MetricRegistry(), getClaim(OutpatientClaim.class), Optional.empty());
    String outpatientClaimType = TransformerUtils.getClaimType(outpatientEob).toString();
    ExplanationOfBenefit dmeEob = DMEClaimTransformer.transform(new MetricRegistry(), getClaim(DMEClaim.class), Optional.empty());
    String dmeClaimType = TransformerUtils.getClaimType(dmeEob).toString();
    ExplanationOfBenefit hhaEob = HHAClaimTransformer.transform(new MetricRegistry(), getClaim(HHAClaim.class), Optional.empty());
    String hhaClaimType = TransformerUtils.getClaimType(hhaEob).toString();
    ExplanationOfBenefit hospiceEob = HospiceClaimTransformer.transform(new MetricRegistry(), getClaim(HospiceClaim.class), Optional.empty());
    String hospiceClaimType = TransformerUtils.getClaimType(hospiceEob).toString();
    ExplanationOfBenefit snfEob = SNFClaimTransformer.transform(new MetricRegistry(), getClaim(SNFClaim.class), Optional.empty());
    String snfClaimType = TransformerUtils.getClaimType(snfEob).toString();
    ExplanationOfBenefit carrierEob = CarrierClaimTransformer.transform(new MetricRegistry(), getClaim(CarrierClaim.class), Optional.empty());
    String carrierClaimType = TransformerUtils.getClaimType(carrierEob).toString();
    ExplanationOfBenefit pdeEob = PartDEventTransformer.transform(new MetricRegistry(), getClaim(PartDEvent.class), Optional.empty());
    String pdeClaimType = TransformerUtils.getClaimType(pdeEob).toString();
    // Load the claim types into the test data that will be run against each test
    return Stream.of(arguments(inpatientClaimType, inpatientEob), arguments(outpatientClaimType, outpatientEob), arguments(dmeClaimType, dmeEob), arguments(hhaClaimType, hhaEob), arguments(hospiceClaimType, hospiceEob), arguments(snfClaimType, snfEob), arguments(carrierClaimType, carrierEob), arguments(pdeClaimType, pdeEob));
}
Also used : DMEClaim(gov.cms.bfd.model.rif.DMEClaim) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) MetricRegistry(com.codahale.metrics.MetricRegistry) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) PartDEvent(gov.cms.bfd.model.rif.PartDEvent)

Example 85 with Claim

use of org.hl7.fhir.r4.model.Claim in project beneficiary-fhir-data by CMSgov.

the class ExplanationOfBenefitResourceProviderIT method adjustCarrierClaimForSamhsaDiagnosis.

/**
 * Adjusts the carrier claim to support samhsa.
 *
 * @param loadedRecords the loaded records
 * @param entityManager the entity manager
 */
private void adjustCarrierClaimForSamhsaDiagnosis(List<Object> loadedRecords, EntityManager entityManager) {
    CarrierClaim carrierRifRecord = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
    entityManager.getTransaction().begin();
    carrierRifRecord = entityManager.find(CarrierClaim.class, carrierRifRecord.getClaimId());
    carrierRifRecord.setDiagnosis2Code(Optional.of(Stu3EobSamhsaMatcherTest.SAMPLE_SAMHSA_ICD_9_DIAGNOSIS_CODE));
    carrierRifRecord.setDiagnosis2CodeVersion(Optional.of('9'));
    entityManager.merge(carrierRifRecord);
    entityManager.getTransaction().commit();
}
Also used : Arrays(java.util.Arrays) Bundle(org.hl7.fhir.dstu3.model.Bundle) Date(java.util.Date) Constants(ca.uhn.fhir.rest.api.Constants) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) DateTimeDt(ca.uhn.fhir.model.primitive.DateTimeDt) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) DateRangeParam(ca.uhn.fhir.rest.param.DateRangeParam) BeforeAll(org.junit.jupiter.api.BeforeAll) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) BeneficiaryHistory(gov.cms.bfd.model.rif.BeneficiaryHistory) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Triple(org.apache.commons.lang3.tuple.Triple) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) IdDt(ca.uhn.fhir.model.primitive.IdDt) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) Test(org.junit.jupiter.api.Test) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) EntityManagerFactory(javax.persistence.EntityManagerFactory) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) Optional(java.util.Optional) TokenAndListParam(ca.uhn.fhir.rest.param.TokenAndListParam) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) ArrayList(java.util.ArrayList) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) PipelineTestUtils(gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) ImmutableList(com.google.common.collect.ImmutableList) ReferenceParam(ca.uhn.fhir.rest.param.ReferenceParam) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) StringClientParam(ca.uhn.fhir.rest.gclient.StringClientParam) CommonHeaders(gov.cms.bfd.server.war.commons.CommonHeaders) ImmutableTriple(org.apache.commons.lang3.tuple.ImmutableTriple) TokenClientParam(ca.uhn.fhir.rest.gclient.TokenClientParam) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) EntityManager(javax.persistence.EntityManager) MedicareBeneficiaryIdHistory(gov.cms.bfd.model.rif.MedicareBeneficiaryIdHistory) AfterEach(org.junit.jupiter.api.AfterEach) ChronoUnit(java.time.temporal.ChronoUnit) Patient(org.hl7.fhir.dstu3.model.Patient) FHIRException(org.hl7.fhir.exceptions.FHIRException) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim)

Aggregations

Test (org.junit.jupiter.api.Test)149 Coding (org.hl7.fhir.r4.model.Coding)92 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)62 Money (org.hl7.fhir.r4.model.Money)61 BenefitComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent)56 Optional (java.util.Optional)50 Arrays (java.util.Arrays)49 List (java.util.List)49 ExplanationOfBenefit (org.hl7.fhir.r4.model.ExplanationOfBenefit)49 FHIRException (org.hl7.fhir.exceptions.FHIRException)48 SupportingInformationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent)48 ExplanationOfBenefit (org.hl7.fhir.dstu3.model.ExplanationOfBenefit)47 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)47 StaticRifResourceGroup (gov.cms.bfd.model.rif.samples.StaticRifResourceGroup)45 ServerTestUtils (gov.cms.bfd.server.war.ServerTestUtils)45 TransformerConstants (gov.cms.bfd.server.war.commons.TransformerConstants)41 Instant (java.time.Instant)40 ArrayList (java.util.ArrayList)39 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)37 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)37