use of gov.cms.bfd.model.rif.HHAClaim 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);
}
use of gov.cms.bfd.model.rif.HHAClaim in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorIT method eobReadHha.
/**
* @return the results of the {@link
* ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
* HHA claims
*/
public static String eobReadHha() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClientAndSetEncoding();
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
HHAClaim hhaClaim = loadedRecords.stream().filter(r -> r instanceof HHAClaim).map(r -> (HHAClaim) r).findFirst().get();
fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtils.buildEobId(ClaimType.HHA, hhaClaim.getClaimId())).execute();
return jsonInterceptor.getResponse();
}
use of gov.cms.bfd.model.rif.HHAClaim in project beneficiary-fhir-data by CMSgov.
the class RifFilesProcessorTest method process1HHAClaimRecord.
/**
* Ensures that {@link RifFilesProcessor} can correctly handle {@link
* StaticRifResource#SAMPLE_A_HHA}.
*/
@Test
public void process1HHAClaimRecord() {
RifFilesEvent filesEvent = new RifFilesEvent(Instant.now(), StaticRifResource.SAMPLE_A_HHA.toRifFile());
RifFilesProcessor processor = new RifFilesProcessor();
RifFileRecords rifFileRecords = processor.produceRecords(filesEvent.getFileEvents().get(0));
List<RifRecordEvent<?>> rifEventsList = rifFileRecords.getRecords().collect(Collectors.toList());
assertEquals(StaticRifResource.SAMPLE_A_HHA.getRecordCount(), rifEventsList.size());
RifRecordEvent<?> rifRecordEvent = rifEventsList.get(0);
assertEquals(StaticRifResource.SAMPLE_A_HHA.getRifFileType(), rifRecordEvent.getFileEvent().getFile().getFileType());
assertNotNull(rifRecordEvent.getRecord());
assertTrue(rifRecordEvent.getRecord() instanceof HHAClaim);
// Verify the claim header.
HHAClaim claimGroup = (HHAClaim) rifRecordEvent.getRecord();
assertEquals(RecordAction.INSERT, rifRecordEvent.getRecordAction());
assertEquals(claimGroup.getBeneficiaryId(), rifRecordEvent.getBeneficiaryId());
assertEquals("567834", claimGroup.getBeneficiaryId());
assertEquals("2925555555", claimGroup.getClaimId());
assertEquals(new BigDecimal(900), claimGroup.getClaimGroupId());
assertEquals('W', claimGroup.getNearLineRecordIdCode());
assertEquals("10", claimGroup.getClaimTypeCode());
assertEquals('2', claimGroup.getClaimServiceClassificationTypeCode());
assertEquals(LocalDate.of(2015, 6, 23), claimGroup.getDateFrom());
assertEquals(LocalDate.of(2015, 6, 23), claimGroup.getDateThrough());
assertEquals("45645", claimGroup.getProviderNumber());
assertEquals("P", claimGroup.getClaimNonPaymentReasonCode().get());
assertEquals(new BigDecimal("188.00"), claimGroup.getPaymentAmount());
assertEquals(new BigDecimal("11.00"), claimGroup.getPrimaryPayerPaidAmount());
assertEquals("UT", claimGroup.getProviderStateCode());
assertEquals("1811111111", claimGroup.getOrganizationNpi().get());
assertEquals("2222222222", claimGroup.getAttendingPhysicianNpi().get());
assertEquals("30", claimGroup.getPatientDischargeStatusCode());
assertEquals(new BigDecimal("199.99"), claimGroup.getTotalChargeAmount());
assertEquals("H5555", claimGroup.getDiagnosisPrincipalCode().get());
assertEquals('9', claimGroup.getDiagnosisPrincipalCodeVersion().get().charValue());
assertEquals('L', claimGroup.getClaimLUPACode().get().charValue());
assertEquals('1', claimGroup.getClaimReferralCode().get().charValue());
assertEquals(new BigDecimal(3), claimGroup.getTotalVisitCount());
assertEquals(LocalDate.of(2015, 6, 23), claimGroup.getCareStartDate().get());
// assertEquals("308683096577486", claimGroup.getFiDocumentClaimControlNumber().get());
// assertEquals("10493204767560565", claimGroup.getFiOriginalClaimControlNumber().get());
assertEquals(1, claimGroup.getLines().size());
// Verify one of the claim lines.
HHAClaimLine claimLine = claimGroup.getLines().get(0);
assertEquals(new BigDecimal(1), claimLine.getLineNumber());
assertEquals("0023", claimLine.getRevenueCenterCode());
assertEquals(new BigDecimal("26.00"), claimGroup.getLines().get(0).getPaymentAmount());
assertEquals(new BigDecimal("24.00"), claimGroup.getLines().get(0).getNonCoveredChargeAmount());
assertEquals(new BigDecimal("25.00"), claimGroup.getLines().get(0).getTotalChargeAmount());
assertEquals("345345345", claimLine.getRevenueCenterRenderingPhysicianNPI().get());
}
use of gov.cms.bfd.model.rif.HHAClaim in project beneficiary-fhir-data by CMSgov.
the class RifFilesProcessor method buildHHAClaimEvent.
/**
* @param fileEvent the {@link RifFileEvent} being processed
* @param csvRecords the {@link CSVRecord}s to be mapped, which must be from a {@link
* RifFileType#HHA} {@link RifFile}
* @return a {@link RifRecordEvent} built from the specified {@link CSVRecord}s
*/
private static RifRecordEvent<HHAClaim> buildHHAClaimEvent(RifFileEvent fileEvent, List<CSVRecord> csvRecords) {
if (LOGGER.isTraceEnabled())
LOGGER.trace(csvRecords.toString());
CSVRecord firstCsvRecord = csvRecords.get(0);
RecordAction recordAction = RecordAction.match(firstCsvRecord.get("DML_IND"));
HHAClaim claim = HHAClaimParser.parseRif(csvRecords);
return new RifRecordEvent<HHAClaim>(fileEvent, csvRecords, recordAction, claim.getBeneficiaryId(), claim);
}
use of gov.cms.bfd.model.rif.HHAClaim in project beneficiary-fhir-data by CMSgov.
the class ExplanationOfBenefitResourceProviderIT method searchForEobsWithLargePageSizesOnFewerResults.
/**
* Verifies that {@link ExplanationOfBenefitResourceProvider#findByPatient} works as expected for
* a {@link Patient} that does exist in the DB, with a page size of 50 with fewer (8) results.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void searchForEobsWithLargePageSizesOnFewerResults() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClient();
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
Bundle searchResults = fhirClient.search().forResource(ExplanationOfBenefit.class).where(ExplanationOfBenefit.PATIENT.hasId(TransformerUtils.buildPatientId(beneficiary))).count(50).returnBundle(Bundle.class).execute();
assertNotNull(searchResults);
/*
* Verify the bundle contains a key for total and that the value matches the
* number of entries in the bundle
*/
assertEquals(loadedRecords.stream().filter(r -> !(r instanceof Beneficiary)).filter(r -> !(r instanceof BeneficiaryHistory)).filter(r -> !(r instanceof MedicareBeneficiaryIdHistory)).count(), searchResults.getTotal());
/*
* Verify that only the first and last links exist as there are no previous or
* next pages.
*/
assertNotNull(searchResults.getLink(Constants.LINK_FIRST));
assertNotNull(searchResults.getLink(Constants.LINK_LAST));
assertNull(searchResults.getLink(Constants.LINK_NEXT));
assertNull(searchResults.getLink(Constants.LINK_PREVIOUS));
/*
* Verify that each of the expected claims (one for every claim type) is present
* and looks correct.
*/
CarrierClaim carrierClaim = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
assertEquals(1, filterToClaimType(searchResults, ClaimType.CARRIER).size());
CarrierClaimTransformerTest.assertMatches(carrierClaim, filterToClaimType(searchResults, ClaimType.CARRIER).get(0), Optional.empty());
DMEClaim dmeClaim = loadedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
DMEClaimTransformerTest.assertMatches(dmeClaim, filterToClaimType(searchResults, ClaimType.DME).get(0), Optional.empty());
HHAClaim hhaClaim = loadedRecords.stream().filter(r -> r instanceof HHAClaim).map(r -> (HHAClaim) r).findFirst().get();
HHAClaimTransformerTest.assertMatches(hhaClaim, filterToClaimType(searchResults, ClaimType.HHA).get(0));
HospiceClaim hospiceClaim = loadedRecords.stream().filter(r -> r instanceof HospiceClaim).map(r -> (HospiceClaim) r).findFirst().get();
HospiceClaimTransformerTest.assertMatches(hospiceClaim, filterToClaimType(searchResults, ClaimType.HOSPICE).get(0));
InpatientClaim inpatientClaim = loadedRecords.stream().filter(r -> r instanceof InpatientClaim).map(r -> (InpatientClaim) r).findFirst().get();
InpatientClaimTransformerTest.assertMatches(inpatientClaim, filterToClaimType(searchResults, ClaimType.INPATIENT).get(0));
OutpatientClaim outpatientClaim = loadedRecords.stream().filter(r -> r instanceof OutpatientClaim).map(r -> (OutpatientClaim) r).findFirst().get();
OutpatientClaimTransformerTest.assertMatches(outpatientClaim, filterToClaimType(searchResults, ClaimType.OUTPATIENT).get(0));
PartDEvent partDEvent = loadedRecords.stream().filter(r -> r instanceof PartDEvent).map(r -> (PartDEvent) r).findFirst().get();
PartDEventTransformerTest.assertMatches(partDEvent, filterToClaimType(searchResults, ClaimType.PDE).get(0));
SNFClaim snfClaim = loadedRecords.stream().filter(r -> r instanceof SNFClaim).map(r -> (SNFClaim) r).findFirst().get();
SNFClaimTransformerTest.assertMatches(snfClaim, filterToClaimType(searchResults, ClaimType.SNF).get(0));
}
Aggregations