Search in sources :

Example 1 with ParameterUse

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;
}
Also used : Extension(org.hl7.fhir.r4.model.Extension) Identifier(org.hl7.fhir.r4.model.Identifier) IBMFhirServerConfig(com.ibm.cohort.fhir.client.config.IBMFhirServerConfig) Range(org.hl7.fhir.r4.model.Range) Measure(org.hl7.fhir.r4.model.Measure) ArrayList(java.util.ArrayList) FhirContext(ca.uhn.fhir.context.FhirContext) FhirVersionEnum(ca.uhn.fhir.context.FhirVersionEnum) JsonNode(com.fasterxml.jackson.databind.JsonNode) Quantity(org.hl7.fhir.r4.model.Quantity) IGenericClient(ca.uhn.fhir.rest.client.api.IGenericClient) ResourceNotFoundException(ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException) MeasureParameterInfo(com.ibm.cohort.engine.api.service.model.MeasureParameterInfo) FhirResourceResolver(com.ibm.cohort.cql.fhir.resolver.FhirResourceResolver) Patient(org.hl7.fhir.r4.model.Patient) IParser(ca.uhn.fhir.parser.IParser) ParameterUse(org.hl7.fhir.r4.model.ParameterDefinition.ParameterUse) Period(org.hl7.fhir.r4.model.Period) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DefaultFhirClientBuilder(com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ParameterDefinition(org.hl7.fhir.r4.model.ParameterDefinition) Collectors(java.util.stream.Collectors) Base64(java.util.Base64) List(java.util.List) HttpHeaders(javax.ws.rs.core.HttpHeaders) Optional(java.util.Optional) MeasureEvaluationSeeder(com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder) Extension(org.hl7.fhir.r4.model.Extension) MeasureParameterInfo(com.ibm.cohort.engine.api.service.model.MeasureParameterInfo) MeasureEvaluationSeeder(com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder)

Aggregations

FhirContext (ca.uhn.fhir.context.FhirContext)1 FhirVersionEnum (ca.uhn.fhir.context.FhirVersionEnum)1 IParser (ca.uhn.fhir.parser.IParser)1 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)1 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 FhirResourceResolver (com.ibm.cohort.cql.fhir.resolver.FhirResourceResolver)1 MeasureParameterInfo (com.ibm.cohort.engine.api.service.model.MeasureParameterInfo)1 MeasureEvaluationSeeder (com.ibm.cohort.engine.measure.seed.MeasureEvaluationSeeder)1 DefaultFhirClientBuilder (com.ibm.cohort.fhir.client.config.DefaultFhirClientBuilder)1 IBMFhirServerConfig (com.ibm.cohort.fhir.client.config.IBMFhirServerConfig)1 ArrayList (java.util.ArrayList)1 Base64 (java.util.Base64)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 HttpHeaders (javax.ws.rs.core.HttpHeaders)1 Extension (org.hl7.fhir.r4.model.Extension)1