use of org.hl7.fhir.utilities.graphql.Value 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 org.hl7.fhir.utilities.graphql.Value in project beneficiary-fhir-data by CMSgov.
the class TransformerTestUtils method assertInformationPeriodEquals.
/**
* @param expectedCategorySystem the expected value for {@link
* SupportingInformationComponent#getCategory()}'s {@link Coding#getSystem()}
* @param expectedCategoryCodeVariable the expected {@link CcwCodebookVariable} for {@link
* SupportingInformationComponent#getCategory()}'s {@link Coding#getCode()}
* @param expectedFromDate the expected {@link
* SupportingInformationComponent#getTimingPeriod().getStartElement()}
* @param expectedThruDate the expected {@link
* SupportingInformationComponent#getTimingPeriod().getEndElement()}
* @param actuals the actual {@link SupportingInformationComponent}s to verify
*/
static void assertInformationPeriodEquals(String expectedCategorySystem, CcwCodebookVariable expectedCategoryCodeVariable, LocalDate expectedFromDate, LocalDate expectedThruDate, List<SupportingInformationComponent> actuals) {
String expectedCategoryCode = CCWUtils.calculateVariableReferenceUrl(expectedCategoryCodeVariable);
Optional<SupportingInformationComponent> supportingInformationComponent = actuals.stream().filter(a -> isCodeInConcept(a.getCategory(), expectedCategorySystem, expectedCategoryCode)).findAny();
assertTrue(supportingInformationComponent.isPresent());
try {
assertDateEquals(expectedFromDate, supportingInformationComponent.get().getTimingPeriod().getStartElement());
assertDateEquals(expectedThruDate, supportingInformationComponent.get().getTimingPeriod().getEndElement());
} catch (FHIRException e) {
throw new BadCodeMonkeyException(e);
}
}
use of org.hl7.fhir.utilities.graphql.Value in project beneficiary-fhir-data by CMSgov.
the class TransformerTestUtils method assertInfoWithCodeEquals.
/**
* @param categoryVariable the {@link CcwCodebookVariable} matching the {@link
* SupportingInformationComponent#getCategory()} to find
* @param codeSystemVariable the {@link CcwCodebookVariable} that should have been mapped to
* {@link SupportingInformationComponent#getCode()}'s {@link Coding#getSystem()}
* @param codeValue the value that should have been mapped to {@link
* SupportingInformationComponent#getCode()}'s {@link Coding#getCode()}
* @param eob the actual {@link ExplanationOfBenefit} to search
*/
static void assertInfoWithCodeEquals(CcwCodebookVariable categoryVariable, CcwCodebookVariable codeSystemVariable, Optional<?> codeValue, ExplanationOfBenefit eob) {
SupportingInformationComponent info = assertHasInfo(categoryVariable, eob);
assertHasCoding(codeSystemVariable, codeValue, info.getCode());
}
use of org.hl7.fhir.utilities.graphql.Value in project beneficiary-fhir-data by CMSgov.
the class TransformerTestUtils method assertBenefitBalanceUsedIntEquals.
/**
* @param expectedBenefitCategory the {@link BenefitCategory} for the expected {@link
* BenefitBalanceComponent#getCategory()}
* @param expectedFinancialType the {@link CcwCodebookVariable} for the expected {@link
* BenefitComponent#getType()}
* @param expectedUsedInt the expected {@link BenefitComponent#getUsedUnsignedIntType()} value
* @param eob the {@link ExplanationOfBenefit} to verify the actual {@link BenefitComponent}
* within
*/
static void assertBenefitBalanceUsedIntEquals(BenefitCategory expectedBenefitCategory, CcwCodebookVariable expectedFinancialType, Integer expectedUsedInt, ExplanationOfBenefit eob) {
Optional<BenefitBalanceComponent> benefitBalanceComponent = eob.getBenefitBalance().stream().filter(bb -> isCodeInConcept(bb.getCategory(), expectedBenefitCategory.getSystem(), expectedBenefitCategory.toCode())).findAny();
assertTrue(benefitBalanceComponent.isPresent());
Optional<BenefitComponent> benefitBalanceFinancialEntry = benefitBalanceComponent.get().getFinancial().stream().filter(f -> isCodeInConcept(f.getType(), TransformerConstants.CODING_BBAPI_BENEFIT_BALANCE_TYPE, CCWUtils.calculateVariableReferenceUrl(expectedFinancialType))).findAny();
assertTrue(benefitBalanceFinancialEntry.isPresent());
try {
assertEquals(expectedUsedInt, benefitBalanceFinancialEntry.get().getUsedUnsignedIntType().getValue());
} catch (FHIRException e) {
throw new BadCodeMonkeyException(e);
}
}
use of org.hl7.fhir.utilities.graphql.Value 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());
}
Aggregations