use of org.hl7.fhir.dstu2016may.model.Coding 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 org.hl7.fhir.dstu2016may.model.Coding in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createExtensionDate.
/**
* @param ccwVariable the {@link CcwCodebookInterface} being mapped
* @param dateYear 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 createExtensionDate(CcwCodebookInterface ccwVariable, Optional<BigDecimal> dateYear) {
Extension extension = null;
if (!dateYear.isPresent()) {
throw new NoSuchElementException();
}
try {
String stringDate = String.format("%04d", dateYear.get().intValue());
DateType dateYearValue = new DateType(stringDate);
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
extension = new Extension(extensionUrl, dateYearValue);
} catch (DataFormatException e) {
throw new InvalidRifValueException(String.format("Unable to create DateType with reference year: '%s'.", dateYear.get()), e);
}
return extension;
}
use of org.hl7.fhir.dstu2016may.model.Coding in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createExtensionCoding.
/**
* @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link Extension}
* will be contained in
* @param ccwVariable the {@link CcwCodebookInterface} being coded
* @param code the value to use for {@link Coding#getCode()} for the resulting {@link Coding}
* @return the output {@link Extension}, with {@link Extension#getValue()} set to a new {@link
* Coding} to represent the specified input values
*/
static Extension createExtensionCoding(IAnyResource rootResource, CcwCodebookInterface ccwVariable, Optional<?> code) {
if (!code.isPresent())
throw new IllegalArgumentException();
Coding coding = createCoding(rootResource, ccwVariable, code.get());
String extensionUrl = CCWUtils.calculateVariableReferenceUrl(ccwVariable);
Extension extension = new Extension(extensionUrl, coding);
return extension;
}
use of org.hl7.fhir.dstu2016may.model.Coding in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createExtensionCoding.
/**
* @param rootResource the root FHIR {@link IAnyResource} that the resultant {@link Extension}
* will be contained in
* @param ccwVariable the {@link CcwCodebookInterface being coded
* @param code the value to use for {@link Coding#getCode()} for the resulting {@link Coding}
* @return the output {@link Extension}, with {@link Extension#getValue()} set to a new {@link
* Coding} to represent the specified input values
*/
static Extension createExtensionCoding(IAnyResource rootResource, CcwCodebookInterface ccwVariable, String yearMonth, Optional<?> code) {
if (!code.isPresent())
throw new IllegalArgumentException();
Coding coding = createCoding(rootResource, ccwVariable, yearMonth, code.get());
String extensionUrl = String.format("%s/%s", CCWUtils.calculateVariableReferenceUrl(ccwVariable), yearMonth);
Extension extension = new Extension(extensionUrl, coding);
return extension;
}
use of org.hl7.fhir.dstu2016may.model.Coding in project beneficiary-fhir-data by CMSgov.
the class TransformerUtils method createIdentifierReference.
/**
* @param identifierType the {@link gov.cms.bfd.server.war.stu3.providers.IdentifierType}
* @param identifierValue the {@link Identifier#getValue()} to use in {@link
* Reference#getIdentifier()}
* @return a {@link Reference} with the specified {@link Identifier}
*/
static Reference createIdentifierReference(IdentifierType identifierType, String identifierValue) {
Reference reference = new Reference();
Coding coding = new Coding().setSystem(identifierType.getSystem()).setCode(identifierType.getCode()).setDisplay(identifierType.getDisplay());
List<Coding> codingList = new ArrayList<Coding>();
codingList.add(coding);
CodeableConcept codeableConcept = new CodeableConcept().setCoding(codingList);
return reference.setIdentifier(new Identifier().setSystem(identifierType.getSystem()).setValue(identifierValue).setType(codeableConcept)).setDisplay(retrieveNpiCodeDisplay(identifierValue));
}
Aggregations