use of gov.cms.bfd.model.rif.CarrierClaim in project beneficiary-fhir-data by CMSgov.
the class CarrierClaimTransformer method transform.
/**
* @param metricRegistry the {@link MetricRegistry} to use
* @param claim the CCW {@link CarrierClaim} 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
* CarrierClaim}
*/
@Trace
static ExplanationOfBenefit transform(MetricRegistry metricRegistry, Object claim, Optional<Boolean> includeTaxNumbers) {
Timer.Context timer = metricRegistry.timer(MetricRegistry.name(CarrierClaimTransformer.class.getSimpleName(), "transform")).time();
if (!(claim instanceof CarrierClaim))
throw new BadCodeMonkeyException();
ExplanationOfBenefit eob = transformClaim((CarrierClaim) claim, includeTaxNumbers);
timer.stop();
return eob;
}
use of gov.cms.bfd.model.rif.CarrierClaim in project beneficiary-fhir-data by CMSgov.
the class CarrierClaimTransformerV2Test method generateClaim.
/**
* Generates the Claim object to be used in multiple tests
*
* @return claim object
* @throws FHIRException
*/
public CarrierClaim generateClaim() 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());
return claim;
}
use of gov.cms.bfd.model.rif.CarrierClaim 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.CarrierClaim in project beneficiary-fhir-data by CMSgov.
the class CarrierClaimTransformerV2 method transform.
/**
* @param metricRegistry the {@link MetricRegistry} to use
* @param claim the CCW {@link CarrierClaim} to transform
* @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
* CarrierClaim}
*/
@Trace
static ExplanationOfBenefit transform(MetricRegistry metricRegistry, Object claim, Optional<Boolean> includeTaxNumbers) {
Timer.Context timer = metricRegistry.timer(MetricRegistry.name(CarrierClaimTransformerV2.class.getSimpleName(), "transform")).time();
if (!(claim instanceof CarrierClaim)) {
throw new BadCodeMonkeyException();
}
ExplanationOfBenefit eob = transformClaim((CarrierClaim) claim, includeTaxNumbers);
timer.stop();
return eob;
}
use of gov.cms.bfd.model.rif.CarrierClaim in project beneficiary-fhir-data by CMSgov.
the class R4ExplanationOfBenefitResourceProviderIT method adjustCarrierClaimForSamhsaDiagnosis.
/**
* Adjusts the carrier claim to support samhsa.
*
* @param loadedRecords the loaded records
* @param entityManager the entity manager
*/
private void adjustCarrierClaimForSamhsaDiagnosis(List<Object> loadedRecords, EntityManager entityManager) {
CarrierClaim carrierRifRecord = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
entityManager.getTransaction().begin();
carrierRifRecord = entityManager.find(CarrierClaim.class, carrierRifRecord.getClaimId());
carrierRifRecord.setDiagnosis2Code(Optional.of(Stu3EobSamhsaMatcherTest.SAMPLE_SAMHSA_ICD_9_DIAGNOSIS_CODE));
carrierRifRecord.setDiagnosis2CodeVersion(Optional.of('9'));
entityManager.merge(carrierRifRecord);
entityManager.getTransaction().commit();
}
Aggregations