use of org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.
the class OutpatientClaimTransformerV2Test method shouldHaveLineItemAdjudicationRevCntrTotChrgAmt.
@Test
public void shouldHaveLineItemAdjudicationRevCntrTotChrgAmt() {
AdjudicationComponent adjudication = TransformerTestUtilsV2.findAdjudicationByCategory("https://bluebutton.cms.gov/resources/variables/rev_cntr_tot_chrg_amt", eob.getItemFirstRep().getAdjudication());
AdjudicationComponent compare = new AdjudicationComponent().setCategory(new CodeableConcept().setCoding(Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/adjudication", "submitted", "Submitted Amount"), new Coding("https://bluebutton.cms.gov/resources/codesystem/adjudication", "https://bluebutton.cms.gov/resources/variables/rev_cntr_tot_chrg_amt", "Revenue Center Total Charge Amount")))).setAmount(new Money().setValue(999.85).setCurrency(TransformerConstants.CODED_MONEY_USD));
assertTrue(compare.equalsDeep(adjudication));
}
use of org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.
the class OutpatientClaimTransformerV2Test method shouldHaveLineItemAdjudicationRevCntrRateAmt.
@Test
public void shouldHaveLineItemAdjudicationRevCntrRateAmt() {
AdjudicationComponent adjudication = TransformerTestUtilsV2.findAdjudicationByCategory("https://bluebutton.cms.gov/resources/variables/rev_cntr_rate_amt", eob.getItemFirstRep().getAdjudication());
AdjudicationComponent compare = new AdjudicationComponent().setCategory(new CodeableConcept().setCoding(Arrays.asList(new Coding("http://terminology.hl7.org/CodeSystem/adjudication", "submitted", "Submitted Amount"), new Coding("https://bluebutton.cms.gov/resources/codesystem/adjudication", "https://bluebutton.cms.gov/resources/variables/rev_cntr_rate_amt", "Revenue Center Rate Amount")))).setAmount(new Money().setValue(5).setCurrency(TransformerConstants.CODED_MONEY_USD));
assertTrue(compare.equalsDeep(adjudication));
}
use of org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.
the class TransformerTestUtils method assertAdjudicationReasonEquals.
/**
* @param expectedCategoryCode the {@link CcwCodebookVariable} for the {@link
* AdjudicationComponent#getCategory()} to find and verify
* @param expectedReasonCode the expected {@link Coding#getCode()} of the {@link
* AdjudicationComponent#getReason()} to find and verify
* @param actuals the actual {@link AdjudicationComponent}s to verify
*/
static void assertAdjudicationReasonEquals(CcwCodebookInterface ccwVariable, Optional<?> expectedReasonCode, List<AdjudicationComponent> actuals) {
CodeableConcept expectedCategory = TransformerUtils.createAdjudicationCategory(ccwVariable);
Optional<AdjudicationComponent> adjudication = actuals.stream().filter(a -> isCodeInConcept(a.getCategory(), expectedCategory.getCodingFirstRep().getSystem(), expectedCategory.getCodingFirstRep().getCode())).findAny();
assertEquals(expectedReasonCode.isPresent(), adjudication.isPresent());
if (expectedReasonCode.isPresent())
assertHasCoding(ccwVariable, expectedReasonCode, adjudication.get().getReason());
}
use of org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.
the class TransformerTestUtils method assertEobCommonItemCarrierDMEEquals.
/**
* Test the transformation of the item level data elements between the {@link CarrierClaimLine}
* and {@link DMEClaimLine} claim types to FHIR. The method parameter fields from {@link
* CarrierClaimLine} and {@link DMEClaimLine} are listed below and their corresponding RIF CCW
* fields (denoted in all CAPS below from {@link CarrierClaimColumn} and {@link DMEClaimColumn}).
*
* @param item the {@ ItemComponent} to test
* @param eob the {@ ExplanationOfBenefit} to test
* @param serviceCount LINE_SRVC_CNT,
* @param placeOfServiceCode LINE_PLACE_OF_SRVC_CD,
* @param firstExpenseDate LINE_1ST_EXPNS_DT,
* @param lastExpenseDate LINE_LAST_EXPNS_DT,
* @param beneficiaryPaymentAmount LINE_BENE_PMT_AMT,
* @param providerPaymentAmount LINE_PRVDR_PMT_AMT,
* @param beneficiaryPartBDeductAmount LINE_BENE_PTB_DDCTBL_AMT,
* @param primaryPayerCode LINE_BENE_PRMRY_PYR_CD,
* @param primaryPayerPaidAmount LINE_BENE_PRMRY_PYR_PD_AMT,
* @param betosCode BETOS_CD,
* @param paymentAmount LINE_NCH_PMT_AMT,
* @param paymentCode LINE_PMT_80_100_CD,
* @param coinsuranceAmount LINE_COINSRNC_AMT,
* @param submittedChargeAmount LINE_SBMTD_CHRG_AMT,
* @param allowedChargeAmount LINE_ALOWD_CHRG_AMT,
* @param processingIndicatorCode LINE_PRCSG_IND_CD,
* @param serviceDeductibleCode LINE_SERVICE_DEDUCTIBLE,
* @param diagnosisCode LINE_ICD_DGNS_CD,
* @param diagnosisCodeVersion LINE_ICD_DGNS_VRSN_CD,
* @param hctHgbTestTypeCode LINE_HCT_HGB_TYPE_CD
* @param hctHgbTestResult LINE_HCT_HGB_RSLT_NUM,
* @param cmsServiceTypeCode LINE_CMS_TYPE_SRVC_CD,
* @param nationalDrugCode LINE_NDC_CD
* @throws FHIRException
*/
static void assertEobCommonItemCarrierDMEEquals(ItemComponent item, ExplanationOfBenefit eob, BigDecimal serviceCount, String placeOfServiceCode, Optional<LocalDate> firstExpenseDate, Optional<LocalDate> lastExpenseDate, BigDecimal beneficiaryPaymentAmount, BigDecimal providerPaymentAmount, BigDecimal beneficiaryPartBDeductAmount, Optional<Character> primaryPayerCode, BigDecimal primaryPayerPaidAmount, Optional<String> betosCode, BigDecimal paymentAmount, Optional<Character> paymentCode, BigDecimal coinsuranceAmount, BigDecimal submittedChargeAmount, BigDecimal allowedChargeAmount, Optional<String> processingIndicatorCode, Optional<Character> serviceDeductibleCode, Optional<String> diagnosisCode, Optional<Character> diagnosisCodeVersion, Optional<String> hctHgbTestTypeCode, BigDecimal hctHgbTestResult, char cmsServiceTypeCode, Optional<String> nationalDrugCode) throws FHIRException {
assertEquals(serviceCount, item.getQuantity().getValue());
assertHasCoding(CcwCodebookVariable.LINE_CMS_TYPE_SRVC_CD, cmsServiceTypeCode, item.getCategory());
assertHasCoding(CcwCodebookVariable.LINE_PLACE_OF_SRVC_CD, placeOfServiceCode, item.getLocationCodeableConcept());
assertExtensionCodingEquals(CcwCodebookVariable.BETOS_CD, betosCode, item);
assertDateEquals(firstExpenseDate.get(), item.getServicedPeriod().getStartElement());
assertDateEquals(lastExpenseDate.get(), item.getServicedPeriod().getEndElement());
AdjudicationComponent adjudicationForPayment = assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_NCH_PMT_AMT, paymentAmount, item.getAdjudication());
assertExtensionCodingEquals(CcwCodebookVariable.LINE_PMT_80_100_CD, paymentCode, adjudicationForPayment);
assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_BENE_PMT_AMT, beneficiaryPaymentAmount, item.getAdjudication());
assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_PRVDR_PMT_AMT, providerPaymentAmount, item.getAdjudication());
assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_BENE_PTB_DDCTBL_AMT, beneficiaryPartBDeductAmount, item.getAdjudication());
assertExtensionCodingEquals(CcwCodebookVariable.LINE_BENE_PRMRY_PYR_CD, primaryPayerCode, item);
assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_BENE_PRMRY_PYR_PD_AMT, primaryPayerPaidAmount, item.getAdjudication());
assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_COINSRNC_AMT, coinsuranceAmount, item.getAdjudication());
assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_SBMTD_CHRG_AMT, submittedChargeAmount, item.getAdjudication());
assertAdjudicationAmountEquals(CcwCodebookVariable.LINE_ALOWD_CHRG_AMT, allowedChargeAmount, item.getAdjudication());
assertAdjudicationReasonEquals(CcwCodebookVariable.LINE_PRCSG_IND_CD, processingIndicatorCode, item.getAdjudication());
assertExtensionCodingEquals(CcwCodebookVariable.LINE_SERVICE_DEDUCTIBLE, serviceDeductibleCode, item);
assertDiagnosisLinkPresent(Diagnosis.from(diagnosisCode, diagnosisCodeVersion), eob, item);
List<Extension> hctHgbObservationExtension = item.getExtensionsByUrl(CCWUtils.calculateVariableReferenceUrl(CcwCodebookVariable.LINE_HCT_HGB_RSLT_NUM));
assertEquals(1, hctHgbObservationExtension.size());
assertTrue(hctHgbObservationExtension.get(0).getValue() instanceof Reference);
Reference hctHgbReference = (Reference) hctHgbObservationExtension.get(0).getValue();
assertTrue(hctHgbReference.getResource() instanceof Observation);
Observation hctHgbObservation = (Observation) hctHgbReference.getResource();
assertHasCoding(CcwCodebookVariable.LINE_HCT_HGB_TYPE_CD, hctHgbTestTypeCode, hctHgbObservation.getCode());
assertEquals(hctHgbTestResult, hctHgbObservation.getValueQuantity().getValue());
assertExtensionCodingEquals(item, TransformerConstants.CODING_NDC, TransformerConstants.CODING_NDC, nationalDrugCode.get());
}
use of org.hl7.fhir.dstu3.model.ExplanationOfBenefit.AdjudicationComponent in project beneficiary-fhir-data by CMSgov.
the class TransformerTestUtils method assertAdjudicationAmountEquals.
/**
* @param ccwVariable the {@link CcwCodebookVariable} for the {@link
* AdjudicationComponent#getCategory()} to find and verify
* @param expectedAmount the expected {@link AdjudicationComponent#getAmount()}
* @param actuals the actual {@link AdjudicationComponent}s to verify
* @return the {@link AdjudicationComponent} that was found and verified
*/
static AdjudicationComponent assertAdjudicationAmountEquals(CcwCodebookInterface ccwVariable, BigDecimal expectedAmount, List<AdjudicationComponent> actuals) {
CodeableConcept expectedCategory = TransformerUtils.createAdjudicationCategory(ccwVariable);
Optional<AdjudicationComponent> adjudication = actuals.stream().filter(a -> isCodeInConcept(a.getCategory(), expectedCategory.getCodingFirstRep().getSystem(), expectedCategory.getCodingFirstRep().getCode())).findAny();
assertTrue(adjudication.isPresent());
assertEquivalent(expectedAmount, adjudication.get().getAmount().getValue());
return adjudication.get();
}
Aggregations