use of gov.cms.bfd.model.rif.samples.StaticRifResource in project beneficiary-fhir-data by CMSgov.
the class InpatientClaimTransformerTest method transformSampleARecord.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.stu3.providers.InpatientClaimTransformer#transform(Object)} works as
* expected when run against the {@link StaticRifResource#SAMPLE_A_INPATIENT} {@link
* InpatientClaim}.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void transformSampleARecord() throws FHIRException {
List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
InpatientClaim claim = parsedRecords.stream().filter(r -> r instanceof InpatientClaim).map(r -> (InpatientClaim) r).findFirst().get();
claim.setLastUpdated(Instant.now());
ExplanationOfBenefit eob = InpatientClaimTransformer.transform(new MetricRegistry(), claim, Optional.empty());
assertMatches(claim, eob);
}
use of gov.cms.bfd.model.rif.samples.StaticRifResource in project beneficiary-fhir-data by CMSgov.
the class OutpatientClaimTransformerTest method transformSampleARecord.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.stu3.providers.OutpatientClaimTransformer#transform(Object)} works as
* expected when run against the {@link StaticRifResource#SAMPLE_A_OUTPATIENT} {@link
* OutpatientClaim}.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void transformSampleARecord() throws FHIRException {
List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
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);
}
use of gov.cms.bfd.model.rif.samples.StaticRifResource in project beneficiary-fhir-data by CMSgov.
the class CarrierClaimTransformerTest method transformSampleURecord.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.stu3.providers.CarrierClaimTransformer#transform(Object)} works as
* expected when run against the {@link StaticRifResource#SAMPLE_U_CARRIER} {@link CarrierClaim}.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void transformSampleURecord() throws FHIRException {
List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_U.getResources()));
CarrierClaim claim = parsedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
ExplanationOfBenefit eob = CarrierClaimTransformer.transform(new MetricRegistry(), claim, Optional.of(true));
assertMatches(claim, eob, Optional.of(true));
}
use of gov.cms.bfd.model.rif.samples.StaticRifResource in project beneficiary-fhir-data by CMSgov.
the class RifLoaderIT method verifyRecordPrimaryKeysPresent.
/**
* Runs the {@link RifFilesProcessor} to extract RIF records from the specified {@link
* StaticRifResource}s, and then calls {@link #assertAreInDatabase(LoadAppOptions,
* EntityManagerFactory, Stream)} on each record to verify that it's present in the database.
* Basically: this is a decent smoke test to verify that {@link RifLoader} did what it should have
* -- not thorough, but something.
*
* @param sampleResources the {@link StaticRifResource}s to go check for in the DB
*/
private void verifyRecordPrimaryKeysPresent(List<StaticRifResource> sampleResources) {
EntityManagerFactory entityManagerFactory = PipelineTestUtils.get().getPipelineApplicationState().getEntityManagerFactory();
RifFilesProcessor processor = new RifFilesProcessor();
LoadAppOptions options = CcwRifLoadTestUtils.getLoadOptions();
/*
* Run the extraction an extra time and verify that each record can now
* be found in the database.
*/
for (StaticRifResource rifResource : sampleResources) {
/*
* This is too slow to run against larger data sets: for instance,
* it took 45 minutes to run against the synthetic data. So, we skip
* it for some things.
*/
if (rifResource.getRecordCount() > 10000) {
LOGGER.info("Skipping DB records check for: {}", rifResource);
continue;
}
LOGGER.info("Checking DB for records for: {}", rifResource);
RifFilesEvent rifFilesEventSingle = new RifFilesEvent(Instant.now(), rifResource.toRifFile());
RifFileRecords rifFileRecordsCopy = processor.produceRecords(rifFilesEventSingle.getFileEvents().get(0));
assertAreInDatabase(options, entityManagerFactory, rifFileRecordsCopy.getRecords().map(r -> r.getRecord()));
}
LOGGER.info("All records found in DB.");
}
Aggregations