Search in sources :

Example 1 with StaticRifResource

use of gov.cms.bfd.model.rif.samples.StaticRifResource 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 2 with StaticRifResource

use of gov.cms.bfd.model.rif.samples.StaticRifResource 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 3 with StaticRifResource

use of gov.cms.bfd.model.rif.samples.StaticRifResource in project beneficiary-fhir-data by CMSgov.

the class CarrierClaimTransformerTest method transformSampleARecord.

/**
 * Verifies that {@link
 * gov.cms.bfd.server.war.stu3.providers.CarrierClaimTransformer#transform(Object)} works as
 * expected when run against the {@link StaticRifResource#SAMPLE_A_CARRIER} {@link CarrierClaim}.
 *
 * @throws FHIRException (indicates test failure)
 */
@Test
public void transformSampleARecord() throws FHIRException {
    List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
    CarrierClaim claim = parsedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
    claim.setLastUpdated(Instant.now());
    ExplanationOfBenefit eobWithLastUpdated = CarrierClaimTransformer.transform(new MetricRegistry(), claim, Optional.of(true));
    assertMatches(claim, eobWithLastUpdated, Optional.of(true));
    claim.setLastUpdated(Optional.empty());
    ExplanationOfBenefit eobWithoutLastUpdated = CarrierClaimTransformer.transform(new MetricRegistry(), claim, Optional.of(true));
    assertMatches(claim, eobWithoutLastUpdated, Optional.of(true));
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) 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) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) Instant(java.time.Instant) ClaimCareteamrole(org.hl7.fhir.dstu3.model.codesystems.ClaimCareteamrole) Test(org.junit.jupiter.api.Test) BigDecimal(java.math.BigDecimal) List(java.util.List) CareTeamComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.CareTeamComponent) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) CarrierClaimLine(gov.cms.bfd.model.rif.CarrierClaimLine) 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) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test)

Example 4 with StaticRifResource

use of gov.cms.bfd.model.rif.samples.StaticRifResource in project beneficiary-fhir-data by CMSgov.

the class LoadedFilterManagerIT method loadData.

/**
 * @param sampleResources the sample RIF resources to load
 */
private static void loadData(DataSource dataSource, List<StaticRifResource> sampleResources) {
    LoadAppOptions loadOptions = CcwRifLoadTestUtils.getLoadOptions();
    RifFilesEvent rifFilesEvent = new RifFilesEvent(Instant.now(), sampleResources.stream().map(StaticRifResource::toRifFile).collect(Collectors.toList()));
    // Create the processors that will handle each stage of the pipeline.
    RifFilesProcessor processor = new RifFilesProcessor();
    RifLoader loader = new RifLoader(loadOptions, PipelineTestUtils.get().getPipelineApplicationState());
    // Link up the pipeline and run it.
    for (RifFileEvent rifFileEvent : rifFilesEvent.getFileEvents()) {
        RifFileRecords rifFileRecords = processor.produceRecords(rifFileEvent);
        loader.process(rifFileRecords, error -> {
        }, result -> {
        });
    }
}
Also used : LoadAppOptions(gov.cms.bfd.pipeline.ccw.rif.load.LoadAppOptions) StaticRifResource(gov.cms.bfd.model.rif.samples.StaticRifResource) RifFileEvent(gov.cms.bfd.model.rif.RifFileEvent) RifFileRecords(gov.cms.bfd.model.rif.RifFileRecords) RifFilesEvent(gov.cms.bfd.model.rif.RifFilesEvent) RifFilesProcessor(gov.cms.bfd.pipeline.ccw.rif.extract.RifFilesProcessor) RifLoader(gov.cms.bfd.pipeline.ccw.rif.load.RifLoader)

Example 5 with StaticRifResource

use of gov.cms.bfd.model.rif.samples.StaticRifResource in project beneficiary-fhir-data by CMSgov.

the class OutpatientClaimTransformerTest method transformSyntheticRecord.

/**
 * Verifies that {@link
 * gov.cms.bfd.server.war.stu3.providers.OutpatientClaimTransformer#transform(Object)} works as
 * expected when run against the {@link StaticRifResource#SYNTHETIC_OUTPATIENT_1999_1999} {@link
 * OutpatientClaim}.
 *
 * <p>Note: This test is normally disabled like other synthetic data tests
 *
 * @throws FHIRException (indicates test failure)
 */
@Disabled
@Test
public void transformSyntheticRecord() throws FHIRException {
    List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResource.SYNTHETIC_OUTPATIENT_1999_1999));
    OutpatientClaim claim = parsedRecords.stream().filter(r -> r instanceof OutpatientClaim).map(r -> (OutpatientClaim) r).findFirst().get();
    ExplanationOfBenefit eob = OutpatientClaimTransformer.transform(new MetricRegistry(), claim, Optional.empty());
    assertMatches(claim, eob);
}
Also used : IntStream(java.util.stream.IntStream) Arrays(java.util.Arrays) RifFileType(gov.cms.bfd.model.rif.RifFileType) StaticRifResource(gov.cms.bfd.model.rif.samples.StaticRifResource) LoggerFactory(org.slf4j.LoggerFactory) Disabled(org.junit.jupiter.api.Disabled) OutpatientClaimLine(gov.cms.bfd.model.rif.OutpatientClaimLine) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) CCWProcedure(gov.cms.bfd.server.war.commons.CCWProcedure) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) Collectors(java.util.stream.Collectors) ZoneId(java.time.ZoneId) Test(org.junit.jupiter.api.Test) List(java.util.List) Stream(java.util.stream.Stream) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Optional(java.util.Optional) FHIRException(org.hl7.fhir.exceptions.FHIRException) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) MetricRegistry(com.codahale.metrics.MetricRegistry) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

StaticRifResource (gov.cms.bfd.model.rif.samples.StaticRifResource)14 List (java.util.List)13 Optional (java.util.Optional)13 StaticRifResourceGroup (gov.cms.bfd.model.rif.samples.StaticRifResourceGroup)12 Arrays (java.util.Arrays)12 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)12 Test (org.junit.jupiter.api.Test)12 MetricRegistry (com.codahale.metrics.MetricRegistry)11 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)11 ServerTestUtils (gov.cms.bfd.server.war.ServerTestUtils)11 MedicareSegment (gov.cms.bfd.server.war.commons.MedicareSegment)11 FHIRException (org.hl7.fhir.exceptions.FHIRException)11 ExplanationOfBenefit (org.hl7.fhir.dstu3.model.ExplanationOfBenefit)10 ItemComponent (org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent)10 BigDecimal (java.math.BigDecimal)7 Instant (java.time.Instant)6 CCWProcedure (gov.cms.bfd.server.war.commons.CCWProcedure)5 Collectors (java.util.stream.Collectors)5 LoggerFactory (org.slf4j.LoggerFactory)5 RifFileType (gov.cms.bfd.model.rif.RifFileType)4