Search in sources :

Example 21 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class TransformerTestUtils method assertInformationPeriodEquals.

/**
 * @param expectedSystem the expected {@link Coding#getSystem()} of the {@link
 *     SupportingInformationComponent#getCategory()} to find and verify
 * @param expectedCode the expected {@link Coding#getCoding()} of the {@link
 *     SupportingInformationComponent#getCategory()} to find and verify
 * @param expectedFromDate the expected {@link
 *     SupportingInformationComponent#getTimingPeriod().getStartElement()}
 * @param expectedThruDate the expected {@link
 *     SupportingInformationComponent#getTimingPeriod().getEndElement()}
 * @param actuals the actual {@link SupportingInformationComponent}s to verify
 */
static void assertInformationPeriodEquals(String expectedSystem, String expectedCode, LocalDate expectedFromDate, LocalDate expectedThruDate, List<SupportingInformationComponent> actuals) {
    Optional<SupportingInformationComponent> supportingInformationComponent = actuals.stream().filter(a -> isCodeInConcept(a.getCategory(), expectedSystem, expectedCode)).findAny();
    assertTrue(supportingInformationComponent.isPresent());
    try {
        assertDateEquals(expectedFromDate, supportingInformationComponent.get().getTimingPeriod().getStartElement());
        assertDateEquals(expectedThruDate, supportingInformationComponent.get().getTimingPeriod().getEndElement());
    } catch (FHIRException e) {
        throw new BadCodeMonkeyException(e);
    }
}
Also used : IBaseHasExtensions(org.hl7.fhir.instance.model.api.IBaseHasExtensions) Arrays(java.util.Arrays) CarrierClaimColumn(gov.cms.bfd.model.rif.CarrierClaimColumn) CcwCodebookInterface(gov.cms.bfd.model.codebook.model.CcwCodebookInterface) Identifier(org.hl7.fhir.dstu3.model.Identifier) Coding(org.hl7.fhir.dstu3.model.Coding) InpatientClaim(gov.cms.bfd.model.rif.InpatientClaim) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) Extension(org.hl7.fhir.dstu3.model.Extension) IBaseExtension(org.hl7.fhir.instance.model.api.IBaseExtension) ClaimCareteamrole(org.hl7.fhir.dstu3.model.codesystems.ClaimCareteamrole) SNFClaimColumn(gov.cms.bfd.model.rif.SNFClaimColumn) BigDecimal(java.math.BigDecimal) FhirContext(ca.uhn.fhir.context.FhirContext) SNFClaim(gov.cms.bfd.model.rif.SNFClaim) SNFClaimLine(gov.cms.bfd.model.rif.SNFClaimLine) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) HHAClaimColumn(gov.cms.bfd.model.rif.HHAClaimColumn) CarrierClaimLine(gov.cms.bfd.model.rif.CarrierClaimLine) Duration(java.time.Duration) BenefitBalanceComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitBalanceComponent) TemporalPrecisionEnum(ca.uhn.fhir.model.api.TemporalPrecisionEnum) Method(java.lang.reflect.Method) Diagnosis(gov.cms.bfd.server.war.commons.Diagnosis) OutpatientClaim(gov.cms.bfd.model.rif.OutpatientClaim) ExplanationOfBenefit(org.hl7.fhir.dstu3.model.ExplanationOfBenefit) MedicareSegment(gov.cms.bfd.server.war.commons.MedicareSegment) Reference(org.hl7.fhir.dstu3.model.Reference) DiagnosisComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.DiagnosisComponent) ItemComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.ItemComponent) InpatientClaimColumn(gov.cms.bfd.model.rif.InpatientClaimColumn) Instant(java.time.Instant) InvocationTargetException(java.lang.reflect.InvocationTargetException) Quantity(org.hl7.fhir.dstu3.model.Quantity) List(java.util.List) CareTeamComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.CareTeamComponent) TransformerConstants(gov.cms.bfd.server.war.commons.TransformerConstants) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CarrierClaim(gov.cms.bfd.model.rif.CarrierClaim) LocalDate(java.time.LocalDate) Optional(java.util.Optional) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) OutpatientClaimColumn(gov.cms.bfd.model.rif.OutpatientClaimColumn) HospiceClaimLine(gov.cms.bfd.model.rif.HospiceClaimLine) HHAClaimLine(gov.cms.bfd.model.rif.HHAClaimLine) HospiceClaimColumn(gov.cms.bfd.model.rif.HospiceClaimColumn) Money(org.hl7.fhir.dstu3.model.Money) InpatientClaimLine(gov.cms.bfd.model.rif.InpatientClaimLine) ReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest) OutpatientClaimLine(gov.cms.bfd.model.rif.OutpatientClaimLine) BenefitComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.BenefitComponent) IAnyResource(org.hl7.fhir.instance.model.api.IAnyResource) CCWUtils(gov.cms.bfd.server.war.commons.CCWUtils) HHAClaim(gov.cms.bfd.model.rif.HHAClaim) CcwCodebookVariable(gov.cms.bfd.model.codebook.data.CcwCodebookVariable) Period(org.hl7.fhir.dstu3.model.Period) DMEClaim(gov.cms.bfd.model.rif.DMEClaim) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DMEClaimLine(gov.cms.bfd.model.rif.DMEClaimLine) AdjudicationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent) BenefitCategory(org.hl7.fhir.dstu3.model.codesystems.BenefitCategory) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) DateTimeType(org.hl7.fhir.dstu3.model.DateTimeType) Resource(org.hl7.fhir.dstu3.model.Resource) HospiceClaim(gov.cms.bfd.model.rif.HospiceClaim) IOException(java.io.IOException) Observation(org.hl7.fhir.dstu3.model.Observation) BaseDateTimeType(org.hl7.fhir.dstu3.model.BaseDateTimeType) SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) DMEClaimColumn(gov.cms.bfd.model.rif.DMEClaimColumn) FHIRException(org.hl7.fhir.exceptions.FHIRException) IdentifierType(gov.cms.bfd.server.war.commons.IdentifierType) SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent) BadCodeMonkeyException(gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException) FHIRException(org.hl7.fhir.exceptions.FHIRException)

Example 22 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class TransformerTestUtils method assertInfoWithCodeEquals.

/**
 * @param categoryVariable the {@link CcwCodebookVariable} matching the {@link
 *     SupportingInformationComponent#getCategory()} to find
 * @param codeSystemVariable the {@link CcwCodebookVariable} that should have been mapped to
 *     {@link SupportingInformationComponent#getCode()}'s {@link Coding#getSystem()}
 * @param codeValue the value that should have been mapped to {@link
 *     SupportingInformationComponent#getCode()}'s {@link Coding#getCode()}
 * @param eob the actual {@link ExplanationOfBenefit} to search
 */
static void assertInfoWithCodeEquals(CcwCodebookVariable categoryVariable, CcwCodebookVariable codeSystemVariable, Optional<?> codeValue, ExplanationOfBenefit eob) {
    SupportingInformationComponent info = assertHasInfo(categoryVariable, eob);
    assertHasCoding(codeSystemVariable, codeValue, info.getCode());
}
Also used : SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent)

Example 23 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class TransformerTestUtils method assertCommonEobInformationInpatientSNF.

/**
 * Tests EOB information fields that are common between the Inpatient and SNF claim types.
 *
 * @param eob the {@link ExplanationOfBenefit} that will be tested by this method
 * @param noncoveredStayFromDate NCH_VRFD_NCVRD_STAY_FROM_DT: an {@link Optional}&lt;{@link
 *     LocalDate}&gt; shared field representing the non-covered stay from date for the claim
 * @param noncoveredStayThroughDate NCH_VRFD_NCVRD_STAY_THRU_DT: an {@link Optional}&lt;{@link
 *     LocalDate}&gt; shared field representing the non-covered stay through date for the claim
 * @param coveredCareThroughDate NCH_ACTV_OR_CVRD_LVL_CARE_THRU: an {@link Optional}&lt;{@link
 *     LocalDate}&gt; shared field representing the covered stay through date for the claim
 * @param medicareBenefitsExhaustedDate NCH_BENE_MDCR_BNFTS_EXHTD_DT_I: an {@link
 *     Optional}&lt;{@link LocalDate}&gt; shared field representing the medicare benefits
 *     exhausted date for the claim
 * @param diagnosisRelatedGroupCd CLM_DRG_CD: an {@link Optional}&lt;{@link String}&gt; shared
 *     field representing the non-covered stay from date for the claim
 */
static void assertCommonEobInformationInpatientSNF(ExplanationOfBenefit eob, Optional<LocalDate> noncoveredStayFromDate, Optional<LocalDate> noncoveredStayThroughDate, Optional<LocalDate> coveredCareThroughDate, Optional<LocalDate> medicareBenefitsExhaustedDate, Optional<String> diagnosisRelatedGroupCd) {
    // noncoveredStayFromDate & noncoveredStayThroughDate
    if (noncoveredStayFromDate.isPresent() || noncoveredStayThroughDate.isPresent()) {
        SupportingInformationComponent nchVrfdNcvrdStayInfo = TransformerTestUtils.assertHasInfo(CcwCodebookVariable.NCH_VRFD_NCVRD_STAY_FROM_DT, eob);
        TransformerTestUtils.assertPeriodEquals(noncoveredStayFromDate, noncoveredStayThroughDate, (Period) nchVrfdNcvrdStayInfo.getTiming());
    }
    // coveredCareThroughDate
    if (coveredCareThroughDate.isPresent()) {
        SupportingInformationComponent nchActvOrCvrdLvlCareThruInfo = TransformerTestUtils.assertHasInfo(CcwCodebookVariable.NCH_ACTV_OR_CVRD_LVL_CARE_THRU, eob);
        TransformerTestUtils.assertDateEquals(coveredCareThroughDate.get(), (DateTimeType) nchActvOrCvrdLvlCareThruInfo.getTiming());
    }
    // medicareBenefitsExhaustedDate
    if (medicareBenefitsExhaustedDate.isPresent()) {
        SupportingInformationComponent nchBeneMdcrBnftsExhtdDtIInfo = TransformerTestUtils.assertHasInfo(CcwCodebookVariable.NCH_BENE_MDCR_BNFTS_EXHTD_DT_I, eob);
        TransformerTestUtils.assertDateEquals(medicareBenefitsExhaustedDate.get(), (BaseDateTimeType) nchBeneMdcrBnftsExhtdDtIInfo.getTiming());
    }
    // diagnosisRelatedGroupCd
    assertHasCoding(CcwCodebookVariable.CLM_DRG_CD, diagnosisRelatedGroupCd, eob.getDiagnosisFirstRep().getPackageCode());
}
Also used : SupportingInformationComponent(org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent)

Example 24 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class SNFClaimTransformerV2Test method shouldHaveNchBeneMdcrBnftsExhtdDtISupInfo.

@Test
public void shouldHaveNchBeneMdcrBnftsExhtdDtISupInfo() {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("https://bluebutton.cms.gov/resources/variables/nch_bene_mdcr_bnfts_exhtd_dt_i", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/claiminformationcategory", "info", "Information"), new Coding("https://bluebutton.cms.gov/resources/codesystem/information", "https://bluebutton.cms.gov/resources/variables/nch_bene_mdcr_bnfts_exhtd_dt_i", "NCH Beneficiary Medicare Benefits Exhausted Date"))).setTiming(new DateType("2002-01-31"));
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) DateType(org.hl7.fhir.r4.model.DateType) Test(org.junit.jupiter.api.Test)

Example 25 with SupportingInformationComponent

use of org.hl7.fhir.r4.model.Claim.SupportingInformationComponent in project beneficiary-fhir-data by CMSgov.

the class SNFClaimTransformerV2Test method shouldHaveAdmissionPeriodSupInfo.

@Test
public void shouldHaveAdmissionPeriodSupInfo() throws Exception {
    SupportingInformationComponent sic = TransformerTestUtilsV2.findSupportingInfoByCode("admissionperiod", eob.getSupportingInfo());
    SupportingInformationComponent compare = TransformerTestUtilsV2.createSupportingInfo(// We don't care what the sequence number is here
    sic.getSequence(), // Category
    Arrays.asList(new Coding("http://hl7.org/fhir/us/carin-bb/CodeSystem/C4BBSupportingInfoType", "admissionperiod", "Admission Period")));
    // timingPeriod
    Period period = new Period();
    period.setStart(new SimpleDateFormat("yyy-MM-dd").parse("2013-11-05"), TemporalPrecisionEnum.DAY);
    period.setEnd(new SimpleDateFormat("yyy-MM-dd").parse("2013-12-18"), TemporalPrecisionEnum.DAY);
    compare.setTiming(period);
    assertTrue(compare.equalsDeep(sic));
}
Also used : SupportingInformationComponent(org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent) Coding(org.hl7.fhir.r4.model.Coding) Period(org.hl7.fhir.r4.model.Period) SimpleDateFormat(java.text.SimpleDateFormat) Test(org.junit.jupiter.api.Test)

Aggregations

SupportingInformationComponent (org.hl7.fhir.r4.model.ExplanationOfBenefit.SupportingInformationComponent)68 Coding (org.hl7.fhir.r4.model.Coding)59 Test (org.junit.jupiter.api.Test)59 SupportingInformationComponent (org.hl7.fhir.dstu3.model.ExplanationOfBenefit.SupportingInformationComponent)11 DateType (org.hl7.fhir.r4.model.DateType)11 Period (org.hl7.fhir.r4.model.Period)6 SNFClaimLine (gov.cms.bfd.model.rif.SNFClaimLine)4 Quantity (org.hl7.fhir.r4.model.Quantity)4 Diagnosis (gov.cms.bfd.server.war.commons.Diagnosis)3 BigDecimal (java.math.BigDecimal)3 SimpleDateFormat (java.text.SimpleDateFormat)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3 SimpleQuantity (org.hl7.fhir.r4.model.SimpleQuantity)3 FhirContext (ca.uhn.fhir.context.FhirContext)2 TemporalPrecisionEnum (ca.uhn.fhir.model.api.TemporalPrecisionEnum)2 CcwCodebookVariable (gov.cms.bfd.model.codebook.data.CcwCodebookVariable)2 CcwCodebookInterface (gov.cms.bfd.model.codebook.model.CcwCodebookInterface)2 CarrierClaim (gov.cms.bfd.model.rif.CarrierClaim)2 CarrierClaimColumn (gov.cms.bfd.model.rif.CarrierClaimColumn)2 CarrierClaimLine (gov.cms.bfd.model.rif.CarrierClaimLine)2