use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorV2IT method patientRead.
/**
* @return the results of the {@link
* R4PatientResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation
*/
public static String patientRead() {
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();
IGenericClient fhirClient = createFhirClientAndSetEncoding();
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
fhirClient.read().resource(Patient.class).withId(beneficiary.getBeneficiaryId()).execute();
return sortPatientIdentifiers(jsonInterceptor.getResponse());
}
use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorIT method eobReadDmeWithTaxNumbers.
/**
* @return the results of the {@link
* ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
* DME claims, with the {@link
* ExplanationOfBenefitResourceProvider#HEADER_NAME_INCLUDE_TAX_NUMBERS} set to <code>true
* </code>
*/
public static String eobReadDmeWithTaxNumbers() {
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);
DMEClaim dmeClaim = loadedRecords.stream().filter(r -> r instanceof DMEClaim).map(r -> (DMEClaim) r).findFirst().get();
fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtils.buildEobId(ClaimType.DME, dmeClaim.getClaimId())).execute();
return jsonInterceptor.getResponse();
}
use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class EndpointJsonResponseComparatorIT method eobReadHospice.
/**
* @return the results of the {@link
* ExplanationOfBenefitResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)} operation for
* Hospice claims
*/
public static String eobReadHospice() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClientAndSetEncoding();
JsonInterceptor jsonInterceptor = createAndRegisterJsonInterceptor(fhirClient);
HospiceClaim hosClaim = loadedRecords.stream().filter(r -> r instanceof HospiceClaim).map(r -> (HospiceClaim) r).findFirst().get();
fhirClient.read().resource(ExplanationOfBenefit.class).withId(TransformerUtils.buildEobId(ClaimType.HOSPICE, hosClaim.getClaimId())).execute();
return jsonInterceptor.getResponse();
}
use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsTest method createCodeableConcept_display.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.stu3.providers.TransformerUtils#createCodeableConcept(org.hl7.fhir.instance.model.api.IAnyResource,
* CcwCodebookVariable, String)} sets {@link Coding#getDisplay()} correctly.
*/
@Test
public void createCodeableConcept_display() {
Patient patientA = new Patient();
patientA.setId("12345");
CodeableConcept raceConcept_4 = TransformerUtils.createCodeableConcept(patientA, CcwCodebookVariable.RACE, "4");
assertEquals("Asian", raceConcept_4.getCodingFirstRep().getDisplay());
// This code isn't valid and shouldn't end up with a matching display.
CodeableConcept raceConcept_12 = TransformerUtils.createCodeableConcept(patientA, CcwCodebookVariable.RACE, "12");
assertNull(raceConcept_12.getCodingFirstRep().getDisplay());
/*
* The REV_CNTR_PMT_MTHD_IND_CD Variable has value collisions. Verify that those
* are handled correctly.
*/
CodeableConcept paymentMethodConcept_1 = TransformerUtils.createCodeableConcept(patientA, CcwCodebookVariable.REV_CNTR_PMT_MTHD_IND_CD, "1");
assertNull(paymentMethodConcept_1.getCodingFirstRep().getDisplay());
}
use of org.hl7.fhir.r5.utils.validation in project beneficiary-fhir-data by CMSgov.
the class PatientResourceProviderIT method readExistingPatientWithNoHistoryIncludeIdentifiersTrue.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.stu3.providers.PatientResourceProvider#read(org.hl7.fhir.dstu3.model.IdType)}
* works as expected for a {@link Patient} that does exist in the DB but has no {@link
* BeneficiaryHistory} or {@link MedicareBeneficiaryIdHistory} records when include identifiers
* value = ["true"].
*/
@Test
public void readExistingPatientWithNoHistoryIncludeIdentifiersTrue() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResource.SAMPLE_A_BENES));
RequestHeaders requestHeader = RequestHeaders.getHeaderWrapper(PatientResourceProvider.HEADER_NAME_INCLUDE_IDENTIFIERS, "true", PatientResourceProvider.HEADER_NAME_INCLUDE_ADDRESS_FIELDS, "true");
IGenericClient fhirClient = createFhirClient(requestHeader);
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
Patient patient = fhirClient.read().resource(Patient.class).withId(beneficiary.getBeneficiaryId()).execute();
assertNotNull(patient);
BeneficiaryTransformerTest.assertMatches(beneficiary, patient, requestHeader);
/*
* Ensure the unhashed values for HICN and MBI are present.
*/
Boolean hicnUnhashedPresent = false;
Boolean mbiUnhashedPresent = false;
Iterator<Identifier> identifiers = patient.getIdentifier().iterator();
while (identifiers.hasNext()) {
Identifier identifier = identifiers.next();
if (identifier.getSystem().equals(TransformerConstants.CODING_BBAPI_BENE_HICN_UNHASHED))
hicnUnhashedPresent = true;
if (identifier.getSystem().equals(TransformerConstants.CODING_BBAPI_MEDICARE_BENEFICIARY_ID_UNHASHED))
mbiUnhashedPresent = true;
}
assertTrue(hicnUnhashedPresent);
assertTrue(mbiUnhashedPresent);
}
Aggregations