use of org.hl7.fhir.r4.model.Resource 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.r4.model.Resource in project beneficiary-fhir-data by CMSgov.
the class ExplanationOfBenefitResourceProviderIT method readEobForExistingOutpatientClaim.
/**
* Verifies that {link ExplanationOfBenefitResourceProvider#read(IdType, RequestDetails)} works as
* expected for an {@link OutpatientClaim}-derived {@link ExplanationOfBenefit} that does exist in
* the DB.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void readEobForExistingOutpatientClaim() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClient();
OutpatientClaim claim = loadedRecords.stream().filter(r -> r instanceof OutpatientClaim).map(r -> (OutpatientClaim) r).findFirst().get();
ExplanationOfBenefit eob = fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtils.buildEobId(ClaimType.OUTPATIENT, claim.getClaimId())).execute();
assertNotNull(eob);
OutpatientClaimTransformerTest.assertMatches(claim, eob);
}
use of org.hl7.fhir.r4.model.Resource in project beneficiary-fhir-data by CMSgov.
the class ExplanationOfBenefitResourceProviderIT method readEobForExistingDMEClaim.
/**
* Verifies that {@link ExplanationOfBenefitResourceProvider#read(IdType, RequestDetails)} works
* as expected for a {@link DMEClaim}-derived {@link ExplanationOfBenefit} that does exist in the
* DB.
*
* @throws FHIRException (indicates test failure)
*/
@Test
public void readEobForExistingDMEClaim() throws FHIRException {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = ServerTestUtils.get().createFhirClient();
DMEClaim claim = loadedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
ExplanationOfBenefit eob = fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtils.buildEobId(ClaimType.DME, claim.getClaimId())).execute();
assertNotNull(eob);
DMEClaimTransformerTest.assertMatches(claim, eob, Optional.empty());
}
use of org.hl7.fhir.r4.model.Resource 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);
}
use of org.hl7.fhir.r4.model.Resource in project beneficiary-fhir-data by CMSgov.
the class R4ClaimResponseResourceProviderIT method shouldGetCorrectFissClaimResponseResourceById.
@Test
void shouldGetCorrectFissClaimResponseResourceById() {
IGenericClient fhirClient = ServerTestUtils.get().createFhirClientV2();
ClaimResponse claimResult = fhirClient.read().resource(ClaimResponse.class).withId("f-123456").execute();
String expected = testUtils.expectedResponseFor("claimResponseFissRead");
String actual = FhirContext.forR4().newJsonParser().encodeResourceToString(claimResult);
AssertUtils.assertJsonEquals(expected, actual, IGNORE_PATTERNS);
}
Aggregations