use of gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createExtensionQuantity.
/**
* @param ccwVariable the {@link CcwCodebookInterface} being mapped
* @param quantityValue the value to use for {@link Coding#getCode()} for the resulting {@link
* Coding}
* @return the output {@link Extension}, with {@link Extension#getValue()} set to represent the
* specified input values
*/
static Extension createExtensionQuantity(CcwCodebookInterface ccwVariable, Optional<? extends Number> quantityValue) {
if (!quantityValue.isPresent())
throw new IllegalArgumentException();
Quantity quantity;
if (quantityValue.get() instanceof BigDecimal)
quantity = new Quantity().setValue((BigDecimal) quantityValue.get());
else
throw new BadCodeMonkeyException();
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
Extension extension = new Extension(extensionUrl, quantity);
return extension;
}
use of gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createMoney.
/**
* @param amountValue the value to use for {@link Money#getValue()}
* @return a new {@link Money} instance, with the specified {@link Money#getValue()}
*/
static Money createMoney(Optional<? extends Number> amountValue) {
if (!amountValue.isPresent())
throw new IllegalArgumentException();
Money money = new Money();
money.setSystem(TransformerConstants.CODING_MONEY);
money.setCode(TransformerConstants.CODED_MONEY_USD);
if (amountValue.get() instanceof BigDecimal)
money.setValue((BigDecimal) amountValue.get());
else
throw new BadCodeMonkeyException();
return money;
}
use of gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException in project beneficiary-fhir-data by CMSgov.
the class HospiceClaimTransformer method transform.
/**
* @param metricRegistry the {@link MetricRegistry} to use
* @param claim the CCW {@link HospiceClaim} to transform
* @param includeTaxNumbers whether or not to include tax numbers in the result (see {@link
* ExplanationOfBenefitResourceProvider#HEADER_NAME_INCLUDE_TAX_NUMBERS}, defaults to <code>
* false</code>)
* @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
* HospiceClaim}
*/
@Trace
static ExplanationOfBenefit transform(MetricRegistry metricRegistry, Object claim, Optional<Boolean> includeTaxNumbers) {
Timer.Context timer = metricRegistry.timer(MetricRegistry.name(HospiceClaimTransformer.class.getSimpleName(), "transform")).time();
if (!(claim instanceof HospiceClaim))
throw new BadCodeMonkeyException();
ExplanationOfBenefit eob = transformClaim((HospiceClaim) claim);
timer.stop();
return eob;
}
use of gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException in project beneficiary-fhir-data by CMSgov.
the class InpatientClaimTransformer method transform.
/**
* @param metricRegistry the {@link MetricRegistry} to use
* @param claim the CCW {@link InpatientClaim} to transform
* @param includeTaxNumbers whether or not to include tax numbers in the result (see {@link
* ExplanationOfBenefitResourceProvider#HEADER_NAME_INCLUDE_TAX_NUMBERS}, defaults to <code>
* false</code>)
* @return a FHIR {@link ExplanationOfBenefit} resource that represents the specified {@link
* InpatientClaim}
*/
@Trace
static ExplanationOfBenefit transform(MetricRegistry metricRegistry, Object claim, Optional<Boolean> includeTaxNumbers) {
Timer.Context timer = metricRegistry.timer(MetricRegistry.name(InpatientClaimTransformer.class.getSimpleName(), "transform")).time();
if (!(claim instanceof InpatientClaim))
throw new BadCodeMonkeyException();
ExplanationOfBenefit eob = transformClaim((InpatientClaim) claim);
timer.stop();
return eob;
}
use of gov.cms.bfd.sharedutils.exceptions.BadCodeMonkeyException in project beneficiary-fhir-data by CMSgov.
the class TransformerUtilsV2 method createExtensionQuantity.
/**
* @param ccwVariable the {@link CcwCodebookInterface} being mapped
* @param quantityValue the value to use for {@link Coding#getCode()} for the resulting {@link
* Coding}
* @return the output {@link Extension}, with {@link Extension#getValue()} set to represent the
* specified input values
*/
static Extension createExtensionQuantity(CcwCodebookInterface ccwVariable, Optional<? extends Number> quantityValue) {
if (!quantityValue.isPresent()) {
throw new IllegalArgumentException();
}
Quantity quantity;
if (quantityValue.get() instanceof BigDecimal) {
quantity = new Quantity().setValue((BigDecimal) quantityValue.get());
} else {
throw new BadCodeMonkeyException();
}
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
Extension extension = new Extension(extensionUrl, quantity);
return extension;
}
Aggregations