use of gov.cms.bfd.model.rif.DMEClaim in project beneficiary-fhir-data by CMSgov.
the class DMEClaimTransformer method transform.
/**
* @param metricRegistry the {@link MetricRegistry} to use
* @param claim the CCW {@link DMEClaim} 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
* DMEClaim}
*/
@Trace
static ExplanationOfBenefit transform(MetricRegistry metricRegistry, Object claim, Optional<Boolean> includeTaxNumbers) {
Timer.Context timer = metricRegistry.timer(MetricRegistry.name(DMEClaimTransformer.class.getSimpleName(), "transform")).time();
if (!(claim instanceof DMEClaim))
throw new BadCodeMonkeyException();
ExplanationOfBenefit eob = transformClaim((DMEClaim) claim, includeTaxNumbers);
timer.stop();
return eob;
}
use of gov.cms.bfd.model.rif.DMEClaim in project beneficiary-fhir-data by CMSgov.
the class DMEClaimTransformerV2Test method generateClaim.
/**
* Generates the Claim object to be used in multiple tests
*
* @return
* @throws FHIRException
*/
public DMEClaim generateClaim() throws FHIRException {
List<Object> parsedRecords = ServerTestUtils.parseData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
DMEClaim claim = parsedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
claim.setLastUpdated(Instant.now());
return claim;
}
use of gov.cms.bfd.model.rif.DMEClaim 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.DMEClaim in project beneficiary-fhir-data by CMSgov.
the class DMEClaimTransformerV2 method transform.
/**
* @param metricRegistry the {@link MetricRegistry} to use
* @param claim the CCW {@link DMEClaim} to transform
* @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
* DMEClaim}
*/
@Trace
static ExplanationOfBenefit transform(MetricRegistry metricRegistry, Object claim, Optional<Boolean> includeTaxNumbers) {
Timer.Context timer = metricRegistry.timer(MetricRegistry.name(DMEClaimTransformerV2.class.getSimpleName(), "transform")).time();
if (!(claim instanceof DMEClaim)) {
throw new BadCodeMonkeyException();
}
ExplanationOfBenefit eob = transformClaim((DMEClaim) claim, includeTaxNumbers);
timer.stop();
return eob;
}
use of gov.cms.bfd.model.rif.DMEClaim in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method readEobForExistingDMEClaim.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.r4.providers.ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.r4.model.IdType)}
* works as expected for a {@link DMEClaim}-derived {@link ExplanationOfBenefit} that does exist
* in the DB.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void readEobForExistingDMEClaim() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
DMEClaim claim = loadedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
ExplanationOfBenefit eob = fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.DME, claim.getClaimId())).execute();
assertNotNull(eob);
// Compare result to transformed EOB
compareEob(ClaimTypeV2.DME, eob, loadedRecords);
}
Aggregations