use of org.hl7.fhir.r4b.model.CodeableConcept in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method createCodeableConcept.
/**
* @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link
* CodeableConcept} will be contained in
* @param ccwVariable the {@link CcwCodebookInterface} being coded
* @param code the value to use for {@link Coding#getCode()} for the resulting (single) {@link
* Coding}, wrapped within the resulting {@link CodeableConcept}
* @return the output {@link CodeableConcept} for the specified input values
*/
static CodeableConcept createCodeableConcept(IAnyResource rootResource, CcwCodebookInterface ccwVariable, Optional<?> code) {
if (!code.isPresent()) {
throw new IllegalArgumentException();
}
Coding coding = createCoding(rootResource, ccwVariable, code.get());
CodeableConcept concept = new CodeableConcept();
concept.addCoding(coding);
return concept;
}
use of org.hl7.fhir.r4b.model.CodeableConcept in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method createCodeableConceptForFieldId.
/**
* Unlike {@link #createCodeableConcept(IAnyResource, CcwCodebookInterface, Optional)}, this
* method creates a {@link CodeableConcept} that's intended for use as a field ID/discriminator:
* the {@link Variable#getId()} will be used for the {@link Coding#getCode()}, rather than the
* {@link Coding#getSystem()}.
*
* @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link
* CodeableConcept} will be contained in
* @param codingSystem the {@link Coding#getSystem()} to use
* @param ccwVariable the {@link CcwCodebookInterface} being coded
* @return the output {@link CodeableConcept} for the specified input values
*/
private static CodeableConcept createCodeableConceptForFieldId(IAnyResource rootResource, String codingSystem, CcwCodebookInterface ccwVariable) {
String code = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
Coding carinCoding = new Coding().setCode("info").setSystem(TransformerConstants.CARIN_SUPPORTING_INFO_TYPE).setDisplay("Information");
Coding cmsBBcoding = new Coding(codingSystem, code, ccwVariable.getVariable().getLabel());
CodeableConcept categoryCodeableConcept = new CodeableConcept();
categoryCodeableConcept.addCoding(carinCoding);
categoryCodeableConcept.addCoding(cmsBBcoding);
return categoryCodeableConcept;
}
use of org.hl7.fhir.r4b.model.CodeableConcept in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method addInformationWithCode.
/**
* Returns a new {@link SupportingInformationComponent} that has been added to the specified
* {@link ExplanationOfBenefit}. Unlike {@link #addInformation(ExplanationOfBenefit,
* CcwCodebookInterface)}, this also sets the {@link SupportingInformationComponent#getCode()}
* based on the values provided.
*
* @param eob the {@link ExplanationOfBenefit} to modify
* @param categoryVariable {@link CcwCodebookInterface} to map to {@link
* SupportingInformationComponent#getCategory()}
* @param codeSystemVariable the {@link CcwCodebookInterface} to map to the {@link
* Coding#getSystem()} used in the {@link SupportingInformationComponent#getCode()}
* @param codeValue the value to map to the {@link Coding#getCode()} used in the {@link
* SupportingInformationComponent#getCode()}
* @return the newly-added {@link SupportingInformationComponent} entry
*/
static SupportingInformationComponent addInformationWithCode(ExplanationOfBenefit eob, CcwCodebookInterface categoryVariable, CcwCodebookInterface codeSystemVariable, Optional<?> codeValue) {
SupportingInformationComponent infoComponent = addInformation(eob, categoryVariable);
CodeableConcept infoCode = new CodeableConcept().addCoding(createCoding(eob, codeSystemVariable, codeValue));
infoComponent.setCode(infoCode);
return infoComponent;
}
use of org.hl7.fhir.r4b.model.CodeableConcept in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method findOrAddBenefitBalance.
/**
* @param eob the {@link ExplanationOfBenefit} that the {@link BenefitComponent} should be part of
* @param benefitCategory the {@link BenefitCategory} to map to {@link
* BenefitBalanceComponent#getCategory()}
* @return the already-existing {@link BenefitBalanceComponent} that matches the specified
* parameters, or a new one
*/
private static BenefitBalanceComponent findOrAddBenefitBalance(ExplanationOfBenefit eob, ExBenefitcategory benefitCategory) {
Optional<BenefitBalanceComponent> matchingBenefitBalance = eob.getBenefitBalance().stream().filter(bb -> isCodeInConcept(bb.getCategory(), benefitCategory.getSystem(), benefitCategory.toCode())).findAny();
// Found an existing BenefitBalance that matches the coding system
if (matchingBenefitBalance.isPresent()) {
return matchingBenefitBalance.get();
}
CodeableConcept benefitCategoryConcept = new CodeableConcept();
benefitCategoryConcept.addCoding().setSystem(benefitCategory.getSystem()).setCode(benefitCategory.toCode()).setDisplay(benefitCategory.getDisplay());
BenefitBalanceComponent newBenefitBalance = new BenefitBalanceComponent(benefitCategoryConcept);
eob.addBenefitBalance(newBenefitBalance);
return newBenefitBalance;
}
use of org.hl7.fhir.r4b.model.CodeableConcept in project beneficiary-fhir-data by CMSgov.
the class IcdCode method toCodeableConcept.
/**
* @return a {@link CodeableConcept} that contains this {@link IcdCode}
*/
public CodeableConcept toCodeableConcept() {
CodeableConcept codeableConcept = new CodeableConcept();
Coding coding = codeableConcept.addCoding();
String system = getFhirSystem();
coding.setSystem(system);
coding.setCode(icdCode);
coding.setDisplay(TransformerUtils.retrieveIcdCodeDisplay(icdCode));
return codeableConcept;
}
Aggregations