use of gov.cms.bfd.model.rif.HospiceClaim in project beneficiary-fhir-data by CMSgov.
the class HospiceClaimTransformer method transform.
/**
* @param metricRegistry the {@link MetricRegistry} to use
* @param claim the CCW {@link HospiceClaim} to transform
* @param includeTaxNumbers whether or not to include tax numbers in the result (see {@link
* ExplanationOfBenefitResourceProvider#HEADER_NAME_INCLUDE_TAX_NUMBERS}, defaults to <code>
* false</code>)
* @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
* HospiceClaim}
*/
@Trace
static ExplanationOfBenefit transform(MetricRegistry metricRegistry, Object claim, Optional<Boolean> includeTaxNumbers) {
Timer.Context timer = metricRegistry.timer(MetricRegistry.name(HospiceClaimTransformer.class.getSimpleName(), "transform")).time();
if (!(claim instanceof HospiceClaim))
throw new BadCodeMonkeyException();
ExplanationOfBenefit eob = transformClaim((HospiceClaim) claim);
timer.stop();
return eob;
}
use of gov.cms.bfd.model.rif.HospiceClaim in project beneficiary-fhir-data by CMSgov.
the class ClaimTypeV2Test method verifyServiceEndAttributeFunc.
/**
* Verifies that our service end date function is working as expected. Since we are type casting
* our claim object, we need to verify that every ClaimType is tested.
*/
@Test
public void verifyServiceEndAttributeFunc() {
LocalDate start = LocalDate.now();
LocalDate end = start.plusDays(10);
CarrierClaim carrierClaim = new CarrierClaim();
carrierClaim.setDateFrom(start);
carrierClaim.setDateThrough(end);
DMEClaim dmeClaim = new DMEClaim();
dmeClaim.setDateFrom(start);
dmeClaim.setDateThrough(end);
HospiceClaim hospiceClaim = new HospiceClaim();
hospiceClaim.setDateFrom(start);
hospiceClaim.setDateThrough(end);
PartDEvent partDEvent = new PartDEvent();
partDEvent.setPrescriptionFillDate(end);
InpatientClaim inpatientClaim = new InpatientClaim();
inpatientClaim.setDateFrom(start);
inpatientClaim.setDateThrough(end);
OutpatientClaim outpatientClaim = new OutpatientClaim();
outpatientClaim.setDateFrom(start);
outpatientClaim.setDateThrough(end);
SNFClaim snfClaim = new SNFClaim();
snfClaim.setDateFrom(start);
snfClaim.setDateThrough(end);
HHAClaim hhaClaim = new HHAClaim();
hhaClaim.setDateFrom(start);
hhaClaim.setDateThrough(end);
ImmutableMap.Builder<ClaimTypeV2, Object> builder = ImmutableMap.builder();
builder.put(ClaimTypeV2.CARRIER, carrierClaim);
builder.put(ClaimTypeV2.DME, dmeClaim);
builder.put(ClaimTypeV2.PDE, partDEvent);
builder.put(ClaimTypeV2.INPATIENT, inpatientClaim);
builder.put(ClaimTypeV2.OUTPATIENT, outpatientClaim);
builder.put(ClaimTypeV2.HOSPICE, hospiceClaim);
builder.put(ClaimTypeV2.SNF, snfClaim);
builder.put(ClaimTypeV2.HHA, hhaClaim);
Map<ClaimTypeV2, Object> claimTypeToClaim = builder.build();
// Verify that we're testing all of the ClaimTypes that are defined
EnumSet.allOf(ClaimTypeV2.class).stream().forEach(claimType -> assertTrue(claimTypeToClaim.containsKey(claimType), String.format("ClaimType %s not tested", claimType.name())));
claimTypeToClaim.entrySet().forEach(entry -> assertEquals(end, entry.getKey().getServiceEndAttributeFunction().apply(entry.getValue()), String.format("Claim type %s does not match expectations", entry.getKey().name())));
}
use of gov.cms.bfd.model.rif.HospiceClaim in project beneficiary-fhir-data by CMSgov.
the class RifFilesProcessor method buildHospiceClaimEvent.
/**
* @param fileEvent the {@link RifFileEvent} being processed
* @param csvRecords the {@link CSVRecord}s to be mapped, which must be from a {@link
* RifFileType#HOSPICE} {@link RifFile}
* @return a {@link RifRecordEvent} built from the specified {@link CSVRecord}s
*/
private static RifRecordEvent<HospiceClaim> buildHospiceClaimEvent(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"));
HospiceClaim claim = HospiceClaimParser.parseRif(csvRecords);
return new RifRecordEvent<HospiceClaim>(fileEvent, csvRecords, recordAction, claim.getBeneficiaryId(), claim);
}
use of gov.cms.bfd.model.rif.HospiceClaim in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method readEobForExistingHospiceClaim.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.r4.providers.ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.r4.model.IdType)}
* works as expected for a {@link HospiceClaim}-derived {@link ExplanationOfBenefit} that does
* exist in the DB.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void readEobForExistingHospiceClaim() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
HospiceClaim claim = loadedRecords.stream().filter(r -> r instanceof HospiceClaim).map(r -> (HospiceClaim) r).findFirst().get();
ExplanationOfBenefit eob = fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.HOSPICE, claim.getClaimId())).execute();
assertNotNull(eob);
// Compare result to transformed EOB
compareEob(ClaimTypeV2.HOSPICE, eob, loadedRecords);
}
use of gov.cms.bfd.model.rif.HospiceClaim in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method adjustHospiceRecordForSamhsaDiagnosis.
/**
* Adjusts the first Hospice record to support samhsa.
*
* @param loadedRecords the loaded records
* @param entityManager the entity manager
*/
private void adjustHospiceRecordForSamhsaDiagnosis(List<Object> loadedRecords, EntityManager entityManager) {
HospiceClaim hospiceRifRecord = loadedRecords.stream().filter(r -> r instanceof HospiceClaim).map(r -> (HospiceClaim) r).findFirst().get();
entityManager.getTransaction().begin();
hospiceRifRecord = entityManager.find(HospiceClaim.class, hospiceRifRecord.getClaimId());
hospiceRifRecord.setDiagnosis2Code(Optional.of(Stu3EobSamhsaMatcherTest.SAMPLE_SAMHSA_ICD_9_DIAGNOSIS_CODE));
hospiceRifRecord.setDiagnosis2CodeVersion(Optional.of('9'));
entityManager.merge(hospiceRifRecord);
entityManager.getTransaction().commit();
}
Aggregations