use of org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse in project quality-measure-and-cohort-service by Alvearie.
the class FHIRRestUtils method toMeasureParameterInfo.
private static MeasureParameterInfo toMeasureParameterInfo(ParameterDefinition parameterDefinition) {
MeasureParameterInfo retVal = new MeasureParameterInfo();
String defaultValue = complicatedTypes.contains(parameterDefinition.getType()) ? complicatedTypeValueConstructor(parameterDefinition) : null;
retVal.name(parameterDefinition.getName()).type(parameterDefinition.getType()).min(parameterDefinition.getMin()).max(parameterDefinition.getMax()).documentation(parameterDefinition.getDocumentation());
Optional.ofNullable(parameterDefinition.getUse()).map(ParameterUse::getDisplay).ifPresent(retVal::setUse);
parameterDefinition.getExtension().stream().filter(MeasureEvaluationSeeder::isDefaultValue).findFirst().map(Extension::getValue).map(x -> {
if (defaultValue != null) {
return defaultValue;
} else
return x.toString();
}).ifPresent(retVal::setDefaultValue);
return retVal;
}
Aggregations