Search in sources :

Example 1 with CarrierClaim

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;
}
Also used : Timer(com.codahale.metrics.Timer) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) Trace(com.newrelic.api.agent.Trace)

Example 2 with CarrierClaim

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;
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) StaticRifResource(gov.cms.bfd.model.rif.samples.StaticRifResource) ExplanationOfBenefitStatus(org.hl7.fhir.r4.model.ExplanationOfBenefit.ExplanationOfBenefitStatus) Identifier(org.hl7.fhir.r4.model.Identifier) SimpleDateFormat(java.text.SimpleDateFormat) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) BenefitComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent) Use(org.hl7.fhir.r4.model.ExplanationOfBenefit.Use) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) Reference(org.hl7.fhir.r4.model.Reference) Disabled(org.junit.jupiter.api.Disabled) Money(org.hl7.fhir.r4.model.Money) FhirContext(ca.uhn.fhir.context.FhirContext) SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) Quantity(org.hl7.fhir.r4.model.Quantity) CareTeamComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.CareTeamComponent) DecimalType(org.hl7.fhir.r4.model.DecimalType) IParser(ca.uhn.fhir.parser.IParser) MetricRegistry(com.codahale.metrics.MetricRegistry) DateType(org.hl7.fhir.r4.model.DateType) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Instant(java.time.Instant) Test(org.junit.jupiter.api.Test) AdjudicationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Coding(org.hl7.fhir.r4.model.Coding) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) Optional(java.util.Optional) FHIRException(org.hl7.fhir.exceptions.FHIRException) Extension(org.hl7.fhir.r4.model.Extension) DiagnosisComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.DiagnosisComponent) TotalComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim)

Example 3 with CarrierClaim

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())));
}
Also used : InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) LocalDate(java.time.LocalDate) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) ImmutableMap(com.google.common.collect.ImmutableMap) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) Test(org.junit.jupiter.api.Test)

Example 4 with CarrierClaim

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;
}
Also used : Timer(com.codahale.metrics.Timer) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) Trace(com.newrelic.api.agent.Trace)

Example 5 with CarrierClaim

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();
}
Also used : Arrays(java.util.Arrays) Date(java.util.Date) Constants(ca.uhn.fhir.rest.api.Constants) BenefitComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitComponent) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) DateTimeDt(ca.uhn.fhir.model.primitive.DateTimeDt) Stu3EobSamhsaMatcherTest(gov.cms.bfd.server.war.stu3.providers.Stu3EobSamhsaMatcherTest) PartDEvent(gov.cms.bfd.model.rif.PartDEvent) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) DateRangeParam(ca.uhn.fhir.rest.param.DateRangeParam) ItemComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.ItemComponent) BeforeAll(org.junit.jupiter.api.BeforeAll) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) BeneficiaryHistory(gov.cms.bfd.model.rif.BeneficiaryHistory) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) Triple(org.apache.commons.lang3.tuple.Triple) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) IdDt(ca.uhn.fhir.model.primitive.IdDt) InvalidRequestException(ca.uhn.fhir.rest.server.exceptions.InvalidRequestException) BenefitBalanceComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.BenefitBalanceComponent) Resource(org.hl7.fhir.r4.model.Resource) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) ExplanationOfBenefitResourceProvider(gov.cms.bfd.server.war.stu3.providers.ExplanationOfBenefitResourceProvider) Test(org.junit.jupiter.api.Test) Beneficiary(gov.cms.bfd.model.rif.Beneficiary) List(java.util.List) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) EntityManagerFactory(javax.persistence.EntityManagerFactory) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) Optional(java.util.Optional) Extension(org.hl7.fhir.r4.model.Extension) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) RequestHeaders(gov.cms.bfd.server.war.commons.RequestHeaders) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) Money(org.hl7.fhir.r4.model.Money) ArrayList(java.util.ArrayList) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) PipelineTestUtils(gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils) ImmutableList(com.google.common.collect.ImmutableList) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) StaticRifResourceGroup(gov.cms.bfd.model.rif.samples.StaticRifResourceGroup) ServerTestUtils(gov.cms.bfd.server.war.ServerTestUtils) StringClientParam(ca.uhn.fhir.rest.gclient.StringClientParam) CommonHeaders(gov.cms.bfd.server.war.commons.CommonHeaders) ImmutableTriple(org.apache.commons.lang3.tuple.ImmutableTriple) TokenClientParam(ca.uhn.fhir.rest.gclient.TokenClientParam) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) EntityManager(javax.persistence.EntityManager) MedicareBeneficiaryIdHistory(gov.cms.bfd.model.rif.MedicareBeneficiaryIdHistory) AdjudicationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.AdjudicationComponent) AfterEach(org.junit.jupiter.api.AfterEach) ChronoUnit(java.time.temporal.ChronoUnit) ExplanationOfBenefit(org.hl7.fhir.r4.model.ExplanationOfBenefit) FHIRException(org.hl7.fhir.exceptions.FHIRException) Bundle(org.hl7.fhir.r4.model.Bundle) TotalComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.TotalComponent) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim)

Aggregations

CarrierClaim (gov.cms.bfd.model.rif.CarrierClaim)26 Test (org.junit.jupiter.api.Test)19 InpatientClaim (gov.cms.bfd.model.rif.InpatientClaim)18 StaticRifResourceGroup (gov.cms.bfd.model.rif.samples.StaticRifResourceGroup)18 ServerTestUtils (gov.cms.bfd.server.war.ServerTestUtils)18 TransformerConstants (gov.cms.bfd.server.war.commons.TransformerConstants)18 Arrays (java.util.Arrays)18 List (java.util.List)18 Optional (java.util.Optional)18 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)18 DMEClaim (gov.cms.bfd.model.rif.DMEClaim)17 HHAClaim (gov.cms.bfd.model.rif.HHAClaim)17 HospiceClaim (gov.cms.bfd.model.rif.HospiceClaim)17 OutpatientClaim (gov.cms.bfd.model.rif.OutpatientClaim)17 PartDEvent (gov.cms.bfd.model.rif.PartDEvent)17 SNFClaim (gov.cms.bfd.model.rif.SNFClaim)17 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)16 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)15 PipelineTestUtils (gov.cms.bfd.pipeline.sharedutils.PipelineTestUtils)15 CommonHeaders (gov.cms.bfd.server.war.commons.CommonHeaders)15