use of io.adminshell.aas.v3.model.Identifier in project beneficiary-fhir-data by CMSgov.
the class TransformerTestUtils method assertExtensionIdentifierEqualsString.
/**
* Tests that the specified extension list contains a single Identifier with the expected string
* value
*
* @param extension a {@link List}<{@link Extension}> containing an Identifier
* @param expected a {@link String} containing the expected value of the Identifier
*/
static void assertExtensionIdentifierEqualsString(List<Extension> extension, String expected) {
assertEquals(1, extension.size());
assertTrue(extension.get(0).getValue() instanceof Identifier);
Identifier identifier = (Identifier) extension.get(0).getValue();
assertEquals(expected, identifier.getValue());
}
use of io.adminshell.aas.v3.model.Identifier 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);
}
use of io.adminshell.aas.v3.model.Identifier in project beneficiary-fhir-data by CMSgov.
the class PatientResourceProviderIT method searchForExistingPatientByMbiHashIncludeIdentifiersFalse.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.stu3.providers.PatientResourceProvider#searchByIdentifier(ca.uhn.fhir.rest.param.TokenParam)}
* works as expected for a {@link Patient} that does exist in the DB, including identifiers to
* return the unhashed HICN and MBI.
*/
@Test
public void searchForExistingPatientByMbiHashIncludeIdentifiersFalse() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClient("false", "true");
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
Bundle searchResults = fhirClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndIdentifier(TransformerConstants.CODING_BBAPI_BENE_MBI_HASH, beneficiary.getMbiHash().get())).returnBundle(Bundle.class).execute();
assertNotNull(searchResults);
Patient patientFromSearchResult = (Patient) searchResults.getEntry().get(0).getResource();
/*
* Ensure the unhashed values for HICN and MBI are *not* present.
*/
Boolean hicnUnhashedPresent = false;
Boolean mbiUnhashedPresent = false;
Iterator<Identifier> identifiers = patientFromSearchResult.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;
}
assertFalse(hicnUnhashedPresent);
assertFalse(mbiUnhashedPresent);
}
use of io.adminshell.aas.v3.model.Identifier in project beneficiary-fhir-data by CMSgov.
the class PatientResourceProviderIT method searchForExistingPatientByLogicalIdIncludeIdentifiersTrue.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.stu3.providers.PatientResourceProvider#searchByLogicalId(ca.uhn.fhir.rest.param.TokenParam)}
* works as expected for a {@link Patient} that does exist in the DB, including identifiers to
* return the unhashed HICN and MBI.
*/
@Test
public void searchForExistingPatientByLogicalIdIncludeIdentifiersTrue() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClient("true", "true");
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
Bundle searchResults = fhirClient.search().forResource(Patient.class).where(Patient.RES_ID.exactly().systemAndIdentifier(null, beneficiary.getBeneficiaryId())).returnBundle(Bundle.class).execute();
assertNotNull(searchResults);
Patient patientFromSearchResult = (Patient) searchResults.getEntry().get(0).getResource();
/*
* Ensure the unhashed values for HICN and MBI are present.
*/
Boolean hicnUnhashedPresent = false;
Boolean mbiUnhashedPresent = false;
Iterator<Identifier> identifiers = patientFromSearchResult.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);
}
use of io.adminshell.aas.v3.model.Identifier in project beneficiary-fhir-data by CMSgov.
the class PatientResourceProviderIT method searchForExistingPatientByMbiHashIncludeIdentifiersTrue.
/**
* Verifies that {@link
* gov.cms.bfd.server.war.stu3.providers.PatientResourceProvider#searchByIdentifier(ca.uhn.fhir.rest.param.TokenParam)}
* works as expected for a {@link Patient} that does exist in the DB, including identifiers to
* return the unhashed HICN and MBI.
*/
@Test
public void searchForExistingPatientByMbiHashIncludeIdentifiersTrue() {
List<Object> loadedRecords = ServerTestUtils.get().loadData(Arrays.asList(StaticRifResourceGroup.SAMPLE_A.getResources()));
IGenericClient fhirClient = createFhirClient("true", "true");
Beneficiary beneficiary = loadedRecords.stream().filter(r -> r instanceof Beneficiary).map(r -> (Beneficiary) r).findFirst().get();
Bundle searchResults = fhirClient.search().forResource(Patient.class).where(Patient.IDENTIFIER.exactly().systemAndIdentifier(TransformerConstants.CODING_BBAPI_BENE_MBI_HASH, beneficiary.getMbiHash().get())).returnBundle(Bundle.class).execute();
assertNotNull(searchResults);
Patient patientFromSearchResult = (Patient) searchResults.getEntry().get(0).getResource();
/*
* Ensure the unhashed values for HICN and MBI are present.
*/
Boolean hicnUnhashedPresent = false;
Boolean mbiUnhashedPresent = false;
Iterator<Identifier> identifiers = patientFromSearchResult.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