use of org.hl7.fhir.r5.model in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method eobReadCarrier.
/**
* @return the results of the {@link
* ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
* Carrier claims
*/
public static String eobReadCarrier() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClientAndSetEncoding();
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
CarrierClaim carrClaim = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.CARRIER, carrClaim.getClaimId())).execute();
return jsonInterceptor.getResponse();
}
use of org.hl7.fhir.r5.model in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method eobReadOutpatient.
/**
* @return the results of the {@link
* ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
* Outpatient claims
*/
public static String eobReadOutpatient() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClientAndSetEncoding();
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
OutpatientClaim outClaim = loadedRecords.stream().filter(r -> r instanceof OutpatientClaim).map(r -> (OutpatientClaim) r).findFirst().get();
fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.OUTPATIENT, outClaim.getClaimId())).execute();
return jsonInterceptor.getResponse();
}
use of org.hl7.fhir.r5.model in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method eobReadCarrierWithTaxNumbers.
/**
* @return the results of the {@link
* ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
* Carrier claims, with the {@link
* ExplanationOfBenefitResourceProvider#HEADER_NAME_INCLUDE_TAX_NUMBERS} set to <code>true
* </code>
*/
public static String eobReadCarrierWithTaxNumbers() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClientAndSetEncoding();
RequestHeaders requestHeader = RequestHeaders.getHeaderWrapper(CommonHeaders.HEADER_NAME_INCLUDE_TAX_NUMBERS, "true");
ExtraParamsInterceptor extraParamsInterceptor = new ExtraParamsInterceptor();
extraParamsInterceptor.setHeaders(requestHeader);
fhirClient.registerInterceptor(extraParamsInterceptor);
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
CarrierClaim carrClaim = loadedRecords.stream().filter(r -> r instanceof CarrierClaim).map(r -> (CarrierClaim) r).findFirst().get();
fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtilsV2.buildEobId(ClaimTypeV2.CARRIER, carrClaim.getClaimId())).execute();
return jsonInterceptor.getResponse();
}
use of org.hl7.fhir.r5.model in project beneficiary-fhir-data by CMSgov.
the class CarrierClaimTransformerTest method assertMatches.
/**
* Verifies that the {@link ExplanationOfBenefit} "looks like" it should, if it were produced from
* the specified {@link CarrierClaim}.
*
* @param claim the {@link CarrierClaim} that the {@link ExplanationOfBenefit} was generated from
* @param eob the {@link ExplanationOfBenefit} that was generated from the specified {@link
* CarrierClaim}
* @param includedTaxNumbers whether or not to include tax numbers are expected to be included in
* the result (see {@link
* ExplanationOfBenefitResourceProvider#HEADER_NAME_INCLUDE_TAX_NUMBERS}, defaults to <code>
* false</code>)
* @throws FHIRException (indicates test failure)
*/
static void assertMatches(CarrierClaim claim, ExplanationOfBenefit eob, Optional<Boolean> includedTaxNumbers) throws FHIRException {
// Test to ensure group level fields between all claim types match
TransformerTestUtils.assertEobCommonClaimHeaderData(eob, claim.getClaimId(), claim.getBeneficiaryId(), ClaimType.CARRIER, claim.getClaimGroupId().toPlainString(), MedicareSegment.PART_B, Optional.of(claim.getDateFrom()), Optional.of(claim.getDateThrough()), Optional.of(claim.getPaymentAmount()), claim.getFinalAction());
// Test to ensure common group fields between Carrier and DME match
TransformerTestUtils.assertEobCommonGroupCarrierDMEEquals(eob, claim.getBeneficiaryId(), claim.getCarrierNumber(), claim.getClinicalTrialNumber(), claim.getBeneficiaryPartBDeductAmount(), claim.getPaymentDenialCode(), claim.getReferringPhysicianNpi(), claim.getProviderAssignmentIndicator(), claim.getProviderPaymentAmount(), claim.getBeneficiaryPaymentAmount(), claim.getSubmittedChargeAmount(), claim.getAllowedChargeAmount());
assertEquals(5, eob.getDiagnosis().size());
assertEquals(1, eob.getItem().size());
TransformerTestUtils.assertAdjudicationTotalAmountEquals(CcwCodebookVariable.PRPAYAMT, claim.getPrimaryPayerPaidAmount(), eob);
CarrierClaimLine claimLine1 = claim.getLines().get(0);
ItemComponent eobItem0 = eob.getItem().get(0);
assertEquals(claimLine1.getLineNumber(), new BigDecimal(eobItem0.getSequence()));
TransformerTestUtils.assertCareTeamEquals(claimLine1.getPerformingPhysicianNpi().get(), ClaimCareteamrole.PRIMARY, eob);
CareTeamComponent performingCareTeamEntry = TransformerTestUtils.findCareTeamEntryForProviderNpi(claimLine1.getPerformingPhysicianNpi().get(), eob.getCareTeam());
TransformerTestUtils.assertHasCoding(CcwCodebookVariable.PRVDR_SPCLTY, claimLine1.getProviderSpecialityCode(), performingCareTeamEntry.getQualification());
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.CARR_LINE_PRVDR_TYPE_CD, claimLine1.getProviderTypeCode(), performingCareTeamEntry);
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.PRTCPTNG_IND_CD, claimLine1.getProviderParticipatingIndCode(), performingCareTeamEntry);
TransformerTestUtils.assertExtensionCodingEquals(performingCareTeamEntry, TransformerConstants.CODING_NPI_US, TransformerConstants.CODING_NPI_US, "" + claimLine1.getOrganizationNpi().get());
CareTeamComponent taxNumberCareTeamEntry = TransformerTestUtils.findCareTeamEntryForProviderTaxNumber(claimLine1.getProviderTaxNumber(), eob.getCareTeam());
if (includedTaxNumbers.orElse(false)) {
assertNotNull(taxNumberCareTeamEntry);
} else {
assertNull(taxNumberCareTeamEntry);
}
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.PRVDR_STATE_CD, claimLine1.getProviderStateCode(), eobItem0.getLocation());
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.PRVDR_STATE_CD, claimLine1.getProviderStateCode(), eobItem0.getLocation());
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.CARR_LINE_PRCNG_LCLTY_CD, claimLine1.getLinePricingLocalityCode(), eobItem0.getLocation());
TransformerTestUtils.assertHasCoding(TransformerConstants.CODING_SYSTEM_HCPCS, "" + claim.getHcpcsYearCode().get(), null, claimLine1.getHcpcsCode().get(), eobItem0.getService().getCoding());
assertEquals(1, eobItem0.getModifier().size());
TransformerTestUtils.assertHcpcsCodes(eobItem0, claimLine1.getHcpcsCode(), claimLine1.getHcpcsInitialModifierCode(), claimLine1.getHcpcsSecondModifierCode(), claim.getHcpcsYearCode(), 0);
if (claimLine1.getAnesthesiaUnitCount().compareTo(BigDecimal.ZERO) > 0) {
TransformerTestUtils.assertExtensionQuantityEquals(CcwCodebookVariable.CARR_LINE_ANSTHSA_UNIT_CNT, claimLine1.getAnesthesiaUnitCount(), eobItem0.getService());
}
TransformerTestUtils.assertExtensionCodingEquals(CcwCodebookVariable.CARR_LINE_MTUS_CD, claimLine1.getMtusCode(), eobItem0);
TransformerTestUtils.assertExtensionQuantityEquals(CcwCodebookVariable.CARR_LINE_MTUS_CNT, claimLine1.getMtusCount(), eobItem0);
TransformerTestUtils.assertAdjudicationReasonEquals(CcwCodebookVariable.CARR_LINE_RDCD_PMT_PHYS_ASTN_C, claimLine1.getReducedPaymentPhysicianAsstCode(), eobItem0.getAdjudication());
TransformerTestUtils.assertExtensionIdentifierEquals(CcwCodebookVariable.CARR_LINE_CLIA_LAB_NUM, claimLine1.getCliaLabNumber(), eobItem0.getLocation());
// verify {@link
// TransformerUtils#mapEobType(CodeableConcept,ClaimType,Optional,Optional)}
// method worked as expected for this claim type
TransformerTestUtils.assertMapEobType(eob.getType(), ClaimType.CARRIER, Optional.of(org.hl7.fhir.dstu3.model.codesystems.ClaimType.PROFESSIONAL), Optional.of(claim.getNearLineRecordIdCode()), Optional.of(claim.getClaimTypeCode()));
// Test to ensure common item fields between Carrier and DME match
TransformerTestUtils.assertEobCommonItemCarrierDMEEquals(eobItem0, eob, claimLine1.getServiceCount(), claimLine1.getPlaceOfServiceCode(), claimLine1.getFirstExpenseDate(), claimLine1.getLastExpenseDate(), claimLine1.getBeneficiaryPaymentAmount(), claimLine1.getProviderPaymentAmount(), claimLine1.getBeneficiaryPartBDeductAmount(), claimLine1.getPrimaryPayerCode(), claimLine1.getPrimaryPayerPaidAmount(), claimLine1.getBetosCode(), claimLine1.getPaymentAmount(), claimLine1.getPaymentCode(), claimLine1.getCoinsuranceAmount(), claimLine1.getSubmittedChargeAmount(), claimLine1.getAllowedChargeAmount(), claimLine1.getProcessingIndicatorCode(), claimLine1.getServiceDeductibleCode(), claimLine1.getDiagnosisCode(), claimLine1.getDiagnosisCodeVersion(), claimLine1.getHctHgbTestTypeCode(), claimLine1.getHctHgbTestResult(), claimLine1.getCmsServiceTypeCode(), claimLine1.getNationalDrugCode());
// Test lastUpdated
TransformerTestUtils.assertLastUpdatedEquals(claim.getLastUpdated(), eob);
}
use of org.hl7.fhir.r5.model in project beneficiary-fhir-data by CMSgov.
the class R4PatientResourceProviderIT method assertExistingPatientIncludeIdentifiersExpected.
/**
* Asserts that {@link
* gov.cms.bfd.server.war.r4.providers.R4PatientResourceProvider#read(org.hl7.fhir.r4.model.IdType)}
* contains expected/present identifiers for a {@link Patient}.
*
* @param includeIdentifiersValue header value
* @param expectingMbi true if expecting a MBI
* @param includeAddressValues header value
*/
public void assertExistingPatientIncludeIdentifiersExpected(boolean expectingMbi, RequestHeaders requestHeader) {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
Patient expected = BeneficiaryTransformerV2.transform(PipelineTestUtils.get().getPipelineApplicationState().getMetrics(), beneficiary, requestHeader);
IGenericClient fhirClient = createFhirClient(requestHeader);
Patient patient = fhirClient.read().resource(Patient.class).withId(beneficiary.getBeneficiaryId()).execute();
// Because of how transform doesn't go through R4PatientResourceProvider, `expected` won't have
// the historical MBI data.
// Also, SAMPLE_A does not have mbi history (it used to); however, what used to be denoted as
// historical
// is not provided as the 'current' MBI identifier (no historical).
comparePatient(expected, patient);
/*
* Ensure the unhashed values for MBI are present.
*/
Boolean mbiUnhashedPresent = false;
Iterator<Identifier> identifiers = patient.getIdentifier().iterator();
while (identifiers.hasNext()) {
Identifier identifier = identifiers.next();
if (identifier.getSystem().equals(TransformerConstants.CODING_BBAPI_BENE_ID)) {
mbiUnhashedPresent = true;
}
}
// Unhashed MBI should always be present in V2
assertTrue(mbiUnhashedPresent);
}
Aggregations