repo
stringclasses
1k values
file_url
stringlengths
96
373
file_path
stringlengths
11
294
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
6 values
commit_sha
stringclasses
1k values
retrieved_at
stringdate
2026-01-04 14:45:56
2026-01-04 18:30:23
truncated
bool
2 classes
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/common/sensitiveinfo/CommonGenerationSensitiveInfoServiceImpl.java
src/main/java/org/ohdsi/webapi/common/sensitiveinfo/CommonGenerationSensitiveInfoServiceImpl.java
package org.ohdsi.webapi.common.sensitiveinfo; import org.ohdsi.webapi.common.generation.CommonGenerationDTO; import org.springframework.stereotype.Service; import java.util.Map; @Service public class CommonGenerationSensitiveInfoServiceImpl<T extends CommonGenerationDTO> extends AbstractSensitiveInfoService implements CommonGenerationSensitiveInfoService<T> { @Override public T filterSensitiveInfo(T generation, Map<String, Object> variables, boolean isAdmin) { String value = filterSensitiveInfo(generation.getExitMessage(), variables, isAdmin); generation.setExitMessage(value); return generation; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/common/sensitiveinfo/CommonGenerationSensitiveInfoService.java
src/main/java/org/ohdsi/webapi/common/sensitiveinfo/CommonGenerationSensitiveInfoService.java
package org.ohdsi.webapi.common.sensitiveinfo; import org.ohdsi.webapi.common.generation.CommonGenerationDTO; public interface CommonGenerationSensitiveInfoService<T extends CommonGenerationDTO> extends SensitiveInfoService<T> { }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/common/sensitiveinfo/CohortGenerationSensitiveInfoService.java
src/main/java/org/ohdsi/webapi/common/sensitiveinfo/CohortGenerationSensitiveInfoService.java
package org.ohdsi.webapi.common.sensitiveinfo; import org.ohdsi.webapi.cohortdefinition.CohortGenerationInfo; public interface CohortGenerationSensitiveInfoService extends SensitiveInfoService<CohortGenerationInfo> { }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/common/sensitiveinfo/AbstractAdminService.java
src/main/java/org/ohdsi/webapi/common/sensitiveinfo/AbstractAdminService.java
package org.ohdsi.webapi.common.sensitiveinfo; import org.ohdsi.webapi.Constants; import org.ohdsi.webapi.shiro.Entities.RoleEntity; import org.ohdsi.webapi.shiro.Entities.UserEntity; import org.ohdsi.webapi.shiro.PermissionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import java.util.Objects; import java.util.Set; public abstract class AbstractAdminService { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAdminService.class); @Value("${sensitiveinfo.admin.role}") private String adminRole; @Value("${sensitiveinfo.moderator.role}") private String moderatorRole; @Value("${security.provider}") private String securityProvider; @Autowired private PermissionManager permissionManager; protected boolean isSecured() { return !Constants.SecurityProviders.DISABLED.equals(securityProvider); } protected boolean isAdmin() { return isInRole(this.adminRole); } protected boolean isModerator() { return isInRole(this.moderatorRole); } private boolean isInRole(final String role) { if (!isSecured()) { return true; } try { UserEntity currentUser = permissionManager.getCurrentUser(); if (Objects.nonNull(currentUser)) { Set<RoleEntity> roles = permissionManager.getUserRoles(currentUser.getId()); return roles.stream().anyMatch(r -> Objects.nonNull(r.getName()) && r.getName().equalsIgnoreCase(role)); } } catch (Exception e) { LOGGER.warn("Failed to check rights, fallback to regular", e); } return false; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/common/sensitiveinfo/SensitiveInfoService.java
src/main/java/org/ohdsi/webapi/common/sensitiveinfo/SensitiveInfoService.java
package org.ohdsi.webapi.common.sensitiveinfo; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; public interface SensitiveInfoService<T> { T filterSensitiveInfo(T source, Map<String, Object> variables, boolean isAdmin); default T filterSensitiveInfo(T source, Map<String, Object> variables) { return filterSensitiveInfo(source, variables, isAdmin()); } boolean isAdmin(); default List<T> filterSensitiveInfo(List<T> source, Map<String, Object> variables, boolean isAdmin) { List<T> result = new ArrayList<>(); for(T val : source) { result.add(filterSensitiveInfo(val, variables, isAdmin)); } return result; } default List<T> filterSensitiveInfo(List<T> source, VariablesResolver<T> resolver) { if (Objects.isNull(resolver)) { throw new IllegalArgumentException("variable resolver is required"); } List<T> result = new ArrayList<>(); boolean isAdmin = isAdmin(); for(T val : source) { result.add(filterSensitiveInfo(val, resolver.resolveVariables(val), isAdmin)); } return result; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/common/sensitiveinfo/CohortGenerationSensitiveInfoServiceImpl.java
src/main/java/org/ohdsi/webapi/common/sensitiveinfo/CohortGenerationSensitiveInfoServiceImpl.java
package org.ohdsi.webapi.common.sensitiveinfo; import org.ohdsi.webapi.cohortdefinition.CohortGenerationInfo; import org.springframework.stereotype.Service; import java.util.Map; @Service public class CohortGenerationSensitiveInfoServiceImpl extends AbstractSensitiveInfoService implements CohortGenerationSensitiveInfoService { @Override public CohortGenerationInfo filterSensitiveInfo(CohortGenerationInfo source, Map<String, Object> variables, boolean isAdmin) { String value = filterSensitiveInfo(source.getFailMessage(), variables, isAdmin); source.setFailMessage(value); return source; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/analysis/AnalysisCohortDefinition.java
src/main/java/org/ohdsi/webapi/analysis/AnalysisCohortDefinition.java
package org.ohdsi.webapi.analysis; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import java.text.SimpleDateFormat; import org.ohdsi.analysis.Cohort; import org.ohdsi.circe.cohortdefinition.CohortExpression; import org.ohdsi.webapi.cohortdefinition.CohortDefinition; import org.ohdsi.webapi.cohortdefinition.ExpressionType; @JsonIgnoreProperties(ignoreUnknown=true) public class AnalysisCohortDefinition implements Cohort { String dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; private SimpleDateFormat dateFormatter; @JsonProperty("id") private Integer id; @JsonProperty("name") private String name; @JsonProperty("description") private String description; @JsonProperty("expression") private CohortExpression expression; @JsonProperty("expressionType") private ExpressionType expressionType; @JsonProperty("createdBy") private String createdBy; @JsonProperty("createdDate") private String createdDate; @JsonProperty("modifiedBy") private String modifiedBy; @JsonProperty("modifiedDate") private String modifiedDate; /** * * @param def */ public AnalysisCohortDefinition(CohortDefinition def) { this.dateFormatter = new SimpleDateFormat(this.dateFormat); this.id = def.getId(); this.name = def.getName(); this.description = def.getDescription(); this.expression = def.getDetails().getExpressionObject(); this.expressionType = def.getExpressionType(); this.createdBy = def.getCreatedBy() != null ? def.getCreatedBy().getLogin() : null; this.createdDate = def.getCreatedDate() != null ? this.dateFormatter.format(def.getCreatedDate()) : null; this.modifiedBy = def.getModifiedBy() != null ? def.getModifiedBy().getLogin() : null; this.modifiedDate = def.getModifiedDate() != null ? this.dateFormatter.format(def.getModifiedDate()) : null; } /** * Constructor */ public AnalysisCohortDefinition() { } /** * * @return */ @Override public Integer getId() { return id; } /** * * @param id */ public void setId(Integer id) { this.id = id; } /** * * @return */ @Override public String getName() { return name; } /** * * @param name */ public void setName(String name) { this.name = name; } /** * * @return */ @Override public String getDescription() { return description; } /** * * @param description */ public void setDescription(String description) { this.description = description; } /** * * @return */ public ExpressionType getExpressionType() { return expressionType; } /** * * @param expressionType */ public void setExpressionType(ExpressionType expressionType) { this.expressionType = expressionType; } /** * * @return */ @Override public CohortExpression getExpression() { return expression; } /** * * @param expression */ public void setExpression(CohortExpression expression) { this.expression = expression; } /** * @return the createdBy */ public String getCreatedBy() { return createdBy; } /** * @param createdBy the createdBy to set */ public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } /** * @return the createdDate */ public String getCreatedDate() { return createdDate; } /** * @param createdDate the createdDate to set */ public void setCreatedDate(String createdDate) { this.createdDate = createdDate; } /** * @return the modifiedBy */ public String getModifiedBy() { return modifiedBy; } /** * @param modifiedBy the modifiedBy to set */ public void setModifiedBy(String modifiedBy) { this.modifiedBy = modifiedBy; } /** * @return the modifiedDate */ public String getModifiedDate() { return modifiedDate; } /** * @param modifiedDate the modifiedDate to set */ public void setModifiedDate(String modifiedDate) { this.modifiedDate = modifiedDate; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/analysis/AnalysisConceptSet.java
src/main/java/org/ohdsi/webapi/analysis/AnalysisConceptSet.java
package org.ohdsi.webapi.analysis; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.ohdsi.circe.cohortdefinition.ConceptSet; @JsonIgnoreProperties(ignoreUnknown=true) public class AnalysisConceptSet extends ConceptSet { }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/analysis/converter/AnalysisCohortDefinitionToCohortDefinitionConverter.java
src/main/java/org/ohdsi/webapi/analysis/converter/AnalysisCohortDefinitionToCohortDefinitionConverter.java
package org.ohdsi.webapi.analysis.converter; import org.ohdsi.analysis.Utils; import org.ohdsi.webapi.analysis.AnalysisCohortDefinition; import org.ohdsi.webapi.cohortdefinition.CohortDefinition; import org.ohdsi.webapi.cohortdefinition.CohortDefinitionDetails; import org.ohdsi.webapi.converter.BaseConversionServiceAwareConverter; import org.springframework.stereotype.Component; @Component public class AnalysisCohortDefinitionToCohortDefinitionConverter<T extends AnalysisCohortDefinition> extends BaseConversionServiceAwareConverter<T, CohortDefinition> { @Override public CohortDefinition convert(T source) { CohortDefinition cohortDefinition = new CohortDefinition(); cohortDefinition.setId(source.getId()); cohortDefinition.setDescription(source.getDescription()); cohortDefinition.setExpressionType(source.getExpressionType()); cohortDefinition.setName(source.getName()); CohortDefinitionDetails details = new CohortDefinitionDetails(); details.setCohortDefinition(cohortDefinition); details.setExpression(Utils.serialize(source.getExpression())); cohortDefinition.setDetails(details); return cohortDefinition; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/analysis/converter/AnalysisConceptSetToConceptSetConverter.java
src/main/java/org/ohdsi/webapi/analysis/converter/AnalysisConceptSetToConceptSetConverter.java
package org.ohdsi.webapi.analysis.converter; import org.ohdsi.webapi.analysis.AnalysisConceptSet; import org.ohdsi.webapi.converter.BaseConversionServiceAwareConverter; import org.ohdsi.webapi.service.dto.ConceptSetDTO; import org.springframework.stereotype.Component; @Component public class AnalysisConceptSetToConceptSetConverter<T extends AnalysisConceptSet> extends BaseConversionServiceAwareConverter<T, ConceptSetDTO> { @Override public ConceptSetDTO convert(T source) { ConceptSetDTO cs = new ConceptSetDTO(); cs.setName(source.name); return cs; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/Checker.java
src/main/java/org/ohdsi/webapi/check/Checker.java
package org.ohdsi.webapi.check; import org.ohdsi.webapi.check.warning.Warning; import java.util.List; public interface Checker<T> { List<Warning> check(T value); }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/CheckResult.java
src/main/java/org/ohdsi/webapi/check/CheckResult.java
package org.ohdsi.webapi.check; import com.fasterxml.jackson.annotation.JsonProperty; import org.ohdsi.webapi.check.warning.Warning; import org.ohdsi.webapi.check.warning.WarningSeverity; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; public class CheckResult { private List<Warning> warnings; public CheckResult(List<Warning> warnings) { this.warnings = warnings; } @JsonProperty("warnings") public List<Warning> getWarnings() { return warnings; } public void setWarnings(List<Warning> warnings) { this.warnings = warnings; } public boolean hasCriticalErrors() { return getErrorsBySeverity(WarningSeverity.CRITICAL).size() > 0; } private List<Warning> getErrorsBySeverity(WarningSeverity severity) { if (Objects.nonNull(warnings) && Objects.nonNull(severity)) { return warnings.stream() .filter(w -> severity.equals(w.getSeverity())) .collect(Collectors.toList()); } return Collections.emptyList(); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/Comparisons.java
src/main/java/org/ohdsi/webapi/check/Comparisons.java
package org.ohdsi.webapi.check; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.circe.cohortdefinition.Period; import java.time.LocalDate; import java.time.format.DateTimeParseException; import java.util.Objects; public class Comparisons { public Comparisons() { } public static Boolean isDateValid(String date) { try { LocalDate.parse(date); return true; } catch (DateTimeParseException ignored) { return false; } } public static Boolean startIsGreaterThanEnd(NumericRange r) { return Objects.nonNull(r.value) && Objects.nonNull(r.extent) && r.value.intValue() > r.extent.intValue(); } public static Boolean startIsGreaterThanEnd(DateRange r) { try { return Objects.nonNull(r.value) && Objects.nonNull(r.extent) && LocalDate.parse(r.value).isAfter(LocalDate.parse(r.extent)); } catch (DateTimeParseException ignored) { return false; } } public static Boolean startIsGreaterThanEnd(Period p) { try{ if (Objects.nonNull(p.startDate) && Objects.nonNull(p.endDate)) { LocalDate startDate = LocalDate.parse(p.startDate); LocalDate endDate = LocalDate.parse(p.endDate); return startDate.isAfter(endDate); } }catch (DateTimeParseException ignored) { } return false; } public static Boolean isStartNegative(NumericRange r) { return Objects.nonNull(r.value) && r.value.intValue() < 0; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/DuplicateValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/DuplicateValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import java.util.Collection; import java.util.function.Function; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.common.DuplicateValidator; public class DuplicateValidatorBuilder<T, V> extends PredicateValidatorBuilder<Collection<? extends T>> { private Function<T, V> elementGetter; public DuplicateValidatorBuilder<T, V> elementGetter(Function<T, V> elementGetter) { this.elementGetter = elementGetter; return this; } @Override public Validator<Collection<? extends T>> build() { return new DuplicateValidator<>(createChildPath(), severity, errorMessage, predicate, elementGetter); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/PredicateValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/PredicateValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import java.util.function.Function; import java.util.function.Predicate; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.common.PredicateValidator; public class PredicateValidatorBuilder<T> extends ValidatorBuilder<T> { protected Predicate<T> predicate; public PredicateValidatorBuilder<T> predicate(Predicate<T> predicate) { this.predicate = predicate; return this; } @Override public Validator<T> build() { return new PredicateValidator<>(createChildPath(), severity, errorMessage, predicate, attrNameValueGetter); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/AbstractForEachValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/AbstractForEachValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.ValidatorGroup; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; public abstract class AbstractForEachValidatorBuilder<T, V> extends ValidatorBuilder<V> { private List<ValidatorBuilder<T>> validatorBuilders = new ArrayList<>(); private List<ValidatorGroupBuilder<T, ?>> validatorGroupBuilders = new ArrayList<>(); public AbstractForEachValidatorBuilder<T, V> validators(List<ValidatorBuilder<T>> validators) { this.validatorBuilders.addAll(validators); return this; } public AbstractForEachValidatorBuilder<T, V> groups(List<ValidatorGroupBuilder<T, ?>> groups) { this.validatorGroupBuilders.addAll(groups); return this; } @SafeVarargs public final AbstractForEachValidatorBuilder<T, V> validators(ValidatorBuilder<T>... validators) { this.validatorBuilders.addAll(Arrays.asList(validators)); return this; } @SafeVarargs public final AbstractForEachValidatorBuilder<T, V> groups(ValidatorGroupBuilder<T, ?>... groups) { this.validatorGroupBuilders.addAll(Arrays.asList(groups)); return this; } protected List<ValidatorGroup<T, ?>> initGroups() { return initAndBuildGroupList(this.validatorGroupBuilders); } // Note: exact same functionality as initAndBuildList, just needed a different call signature. // This method was added to enable development using Eclipse private List<ValidatorGroup<T, ?>> initAndBuildGroupList(List<ValidatorGroupBuilder<T, ?>> builders) { builders.forEach(builder -> { if (Objects.isNull(builder.getBasePath())) { builder.basePath(createChildPath()); } if (Objects.isNull(builder.getErrorMessage())) { builder.errorMessage(this.errorMessage); } if (Objects.isNull(builder.getSeverity())) { builder.severity(this.severity); } if (Objects.isNull(builder.getAttrName())) { builder.attrName(this.attrName); } }); return builders.stream() .map(ValidatorBaseBuilder::build) .collect(Collectors.toList()); } protected List<Validator<T>> initValidators() { return initAndBuildList(this.validatorBuilders); } private <U> List<U> initAndBuildList(List<? extends ValidatorBaseBuilder<T, U, ?>> builders) { builders.forEach(builder -> { if (Objects.isNull(builder.getBasePath())) { builder.basePath(createChildPath()); } if (Objects.isNull(builder.getErrorMessage())) { builder.errorMessage(this.errorMessage); } if (Objects.isNull(builder.getSeverity())) { builder.severity(this.severity); } if (Objects.isNull(builder.getAttrName())) { builder.attrName(this.attrName); } }); return builders.stream() .map(ValidatorBaseBuilder::build) .collect(Collectors.toList()); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/ArrayForEachValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/ArrayForEachValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.ValidatorGroup; import org.ohdsi.webapi.check.validator.common.ArrayForEachValidator; import java.util.List; public class ArrayForEachValidatorBuilder<T> extends AbstractForEachValidatorBuilder<T, T[]> { @Override public Validator<T[]> build() { List<ValidatorGroup<T, ?>> groups = initGroups(); List<Validator<T>> validators = initValidators(); return new ArrayForEachValidator<>(createChildPath(), severity, errorMessage, validators, groups); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/DateRangeValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/DateRangeValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.common.DateRangeValidator; public class DateRangeValidatorBuilder<T extends DateRange> extends ValidatorBuilder<T> { @Override public Validator<T> build() { return new DateRangeValidator<>(createChildPath(), severity, errorMessage); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/ValidatorGroupBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/ValidatorGroupBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.ValidatorGroup; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; public class ValidatorGroupBuilder<T, V> extends ValidatorBaseBuilder<T, ValidatorGroup<T, V>, ValidatorGroupBuilder<T, V>> { protected List<ValidatorBuilder<V>> validatorBuilders = new ArrayList<>(); protected List<ValidatorGroupBuilder<V, ?>> validatorGroupBuilders = new ArrayList<>(); protected Function<T, V> valueGetter; protected Function<T, Boolean> conditionGetter = t -> true; public ValidatorGroupBuilder<T, V> valueGetter(Function<T, V> valueGetter) { this.valueGetter = valueGetter; return this; } public ValidatorGroupBuilder<T, V> conditionGetter(Function<T, Boolean> conditionGetter) { this.conditionGetter = conditionGetter; return this; } public ValidatorGroupBuilder<T, V> validators(List<ValidatorBuilder<V>> validators) { this.validatorBuilders.addAll(validators); return this; } public ValidatorGroupBuilder<T, V> groups(List<ValidatorGroupBuilder<V, ?>> groups) { this.validatorGroupBuilders.addAll(groups); return this; } @SafeVarargs public final ValidatorGroupBuilder<T, V> validators(ValidatorBuilder<V>... validators) { this.validatorBuilders.addAll(Arrays.asList(validators)); return this; } @SafeVarargs public final ValidatorGroupBuilder<T, V> groups(ValidatorGroupBuilder<V, ?>... groups) { this.validatorGroupBuilders.addAll(Arrays.asList(groups)); return this; } protected Path createChildPath() { return Path.createPath(this.basePath, this.attrName); } public ValidatorGroup<T, V> build() { List<ValidatorGroup<V, ?>> groups = initAndBuildGroupList(this.validatorGroupBuilders); List<Validator<V>> validators = initAndBuildList(this.validatorBuilders); return new ValidatorGroup<>(validators, groups, valueGetter, conditionGetter); } // Note: exact same functionality as initAndBuildList, just needed a different call signature. // This method was added to enable development using Eclipse private List<ValidatorGroup<V, ?>> initAndBuildGroupList(List<ValidatorGroupBuilder<V, ?>> builders) { builders.forEach(builder -> { if (Objects.nonNull(this.errorMessage)) { builder.errorMessage(this.errorMessage); } if (Objects.isNull(builder.getBasePath())) { builder.basePath(createChildPath()); } if (Objects.isNull(builder.severity)) { builder.severity(this.severity); } }); return builders.stream() .map(ValidatorBaseBuilder::build) .collect(Collectors.toList()); } private <U> List<U> initAndBuildList(List<? extends ValidatorBaseBuilder<V, U, ?>> builders) { builders.forEach(builder -> { if (Objects.nonNull(this.errorMessage)) { builder.errorMessage(this.errorMessage); } if (Objects.isNull(builder.getBasePath())) { builder.basePath(createChildPath()); } if (Objects.isNull(builder.severity)) { builder.severity(this.severity); } }); return builders.stream() .map(ValidatorBaseBuilder::build) .collect(Collectors.toList()); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/NotNullNotEmptyValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/NotNullNotEmptyValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.common.NotNullNotEmptyValidator; public class NotNullNotEmptyValidatorBuilder<T> extends ValidatorBuilder<T> { @Override public Validator<T> build() { return new NotNullNotEmptyValidator<>(createChildPath(), severity, errorMessage); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/NumericRangeValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/NumericRangeValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.common.NumericRangeValidator; public class NumericRangeValidatorBuilder<T extends NumericRange> extends ValidatorBuilder<T> { @Override public Validator<T> build() { return new NumericRangeValidator<>(createChildPath(), severity, errorMessage); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/ValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/ValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.webapi.check.validator.Validator; public abstract class ValidatorBuilder<T> extends ValidatorBaseBuilder<T, Validator<T>, ValidatorBuilder<T>> { public abstract Validator<T> build(); }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/PeriodValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/PeriodValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.circe.cohortdefinition.Period; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.common.PeriodValidator; public class PeriodValidatorBuilder<T extends Period> extends ValidatorBuilder<T> { @Override public Validator<T> build() { return new PeriodValidator<>(createChildPath(), severity, errorMessage); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/IterableForEachValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/IterableForEachValidatorBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.ValidatorGroup; import org.ohdsi.webapi.check.validator.common.IterableForEachValidator; import java.util.Collection; import java.util.List; public class IterableForEachValidatorBuilder<T> extends AbstractForEachValidatorBuilder<T, Collection<? extends T>> { @Override public Validator<Collection<? extends T>> build() { List<ValidatorGroup<T, ?>> groups = initGroups(); List<Validator<T>> validators = initValidators(); return new IterableForEachValidator<>(createChildPath(), severity, errorMessage, validators, groups); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/ValidatorBaseBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/ValidatorBaseBuilder.java
package org.ohdsi.webapi.check.builder; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.warning.WarningSeverity; import java.util.function.Function; import java.util.function.Supplier; public abstract class ValidatorBaseBuilder<T, V, R extends ValidatorBaseBuilder<T, V, R>> { protected Path basePath; protected String attrName; protected Function<T, String> attrNameValueGetter; protected WarningSeverity severity; protected String errorMessage; public abstract V build(); public R basePath(Path basePath) { this.basePath = basePath; return (R)this; } public R attrName(String attrName) { this.attrName = attrName; return (R)this; } public R errorMessage(String errorMessage) { this.errorMessage = errorMessage; return (R)this; } public R severity(WarningSeverity severity) { this.severity = severity; return (R)this; } public R attrNameValueGetter(Function<T, String> attrNameValueGetter) { this.attrNameValueGetter = attrNameValueGetter; return (R)this; } protected Path createChildPath() { return Path.createPath(this.basePath, this.attrName); } public Path getBasePath() { return basePath; } public String getErrorMessage() { return errorMessage; } public String getAttrName() { return attrName; } public WarningSeverity getSeverity() { return severity; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/concept/ConceptValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/concept/ConceptValidatorBuilder.java
package org.ohdsi.webapi.check.builder.concept; import org.ohdsi.circe.vocabulary.Concept; import org.ohdsi.webapi.check.builder.ValidatorBuilder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.concept.ConceptValidator; public class ConceptValidatorBuilder extends ValidatorBuilder<Concept[]> { @Override public Validator build() { return new ConceptValidator(createChildPath(), severity, errorMessage); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/criteria/CriteriaGroupValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/criteria/CriteriaGroupValidatorBuilder.java
package org.ohdsi.webapi.check.builder.criteria; import org.ohdsi.circe.cohortdefinition.CriteriaGroup; import org.ohdsi.webapi.check.builder.ValidatorBuilder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.criteria.CriteriaGroupValidator; public class CriteriaGroupValidatorBuilder<T extends CriteriaGroup> extends ValidatorBuilder<T> { @Override public Validator<T> build() { return new CriteriaGroupValidator<>(createChildPath(), severity, errorMessage); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/criteria/CorelatedCriteriaValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/criteria/CorelatedCriteriaValidatorBuilder.java
package org.ohdsi.webapi.check.builder.criteria; import org.ohdsi.circe.cohortdefinition.CorelatedCriteria; import org.ohdsi.webapi.check.builder.ValidatorBuilder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.criteria.CorelatedCriteriaValidator; public class CorelatedCriteriaValidatorBuilder<T extends CorelatedCriteria> extends ValidatorBuilder<T> { @Override public Validator<T> build() { return new CorelatedCriteriaValidator<>(createChildPath(), severity, errorMessage); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/criteria/CriteriaValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/criteria/CriteriaValidatorBuilder.java
package org.ohdsi.webapi.check.builder.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.webapi.check.builder.ValidatorBuilder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.criteria.CriteriaValidator; public class CriteriaValidatorBuilder<T extends Criteria> extends ValidatorBuilder<T> { @Override public Validator<T> build() { return new CriteriaValidator<>(createChildPath(), severity, errorMessage); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/conceptset/ConceptSetSelectionValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/conceptset/ConceptSetSelectionValidatorBuilder.java
package org.ohdsi.webapi.check.builder.conceptset; import org.ohdsi.circe.cohortdefinition.ConceptSetSelection; import org.ohdsi.webapi.check.builder.ValidatorBuilder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.conceptset.ConceptSetSelectionValidator; public class ConceptSetSelectionValidatorBuilder<T extends ConceptSetSelection> extends ValidatorBuilder<T> { @Override public Validator<T> build() { return new ConceptSetSelectionValidator<>(createChildPath(), severity, errorMessage); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/builder/tag/MandatoryTagValidatorBuilder.java
src/main/java/org/ohdsi/webapi/check/builder/tag/MandatoryTagValidatorBuilder.java
package org.ohdsi.webapi.check.builder.tag; import org.ohdsi.webapi.check.builder.ValidatorBuilder; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.tag.MandatoryTagValidator; import org.ohdsi.webapi.tag.TagService; import org.ohdsi.webapi.tag.dto.TagDTO; import java.util.Collection; public class MandatoryTagValidatorBuilder<T extends Collection<? extends TagDTO>> extends ValidatorBuilder<T> { private final TagService tagService; public MandatoryTagValidatorBuilder(TagService tagService) { this.tagService = tagService; } @Override public Validator<T> build() { return new MandatoryTagValidator<>(createChildPath(), severity, errorMessage, this.tagService); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/BaseChecker.java
src/main/java/org/ohdsi/webapi/check/checker/BaseChecker.java
package org.ohdsi.webapi.check.checker; import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; import org.ohdsi.webapi.check.Checker; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.builder.ValidatorBuilder; import org.ohdsi.webapi.check.validator.Context; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.ValidatorGroup; import org.ohdsi.webapi.check.warning.DefaultWarning; import org.ohdsi.webapi.check.warning.Warning; public abstract class BaseChecker<T> implements Checker<T> { private ValidatorGroup<T, T> validator; public final List<Warning> check(T value) { Context context = new Context(); validator.validate(value, context); return getWarnings(context); } protected void createValidator() { validator = new ValidatorGroupBuilder<T, T>() .basePath(Path.createPath()) .valueGetter(Function.identity()) .validators(getValidatorBuilders()) .groups(getGroupBuilder()) .build(); } public List<Warning> getWarnings(Context context) { return context.getWarnings().stream() .map(warning -> new DefaultWarning( warning.getSeverity(), String.format("%s - %s", warning.getPath().getPath(), warning.getMessage())) ) .collect(Collectors.toList()); } protected List<ValidatorBuilder<T>> getValidatorBuilders() { return Collections.emptyList(); } protected List<ValidatorGroupBuilder<T, ?>> getGroupBuilder() { return Collections.emptyList(); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/cohort/CohortChecker.java
src/main/java/org/ohdsi/webapi/check/checker/cohort/CohortChecker.java
package org.ohdsi.webapi.check.checker.cohort; import org.ohdsi.analysis.estimation.comparativecohortanalysis.design.CohortMethodAnalysis; import org.ohdsi.analysis.estimation.comparativecohortanalysis.design.ComparativeCohortAnalysis; import org.ohdsi.webapi.check.builder.DuplicateValidatorBuilder; import org.ohdsi.webapi.check.builder.IterableForEachValidatorBuilder; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.checker.BaseChecker; import org.ohdsi.webapi.check.checker.tag.helper.TagHelper; import org.ohdsi.webapi.cohortcharacterization.dto.BaseCcDTO; import org.ohdsi.webapi.cohortcharacterization.dto.CohortCharacterizationDTO; import org.ohdsi.webapi.cohortdefinition.dto.CohortDTO; import org.ohdsi.webapi.feanalysis.dto.FeAnalysisShortDTO; import org.ohdsi.webapi.service.dto.CommonEntityExtDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.Arrays; import java.util.Collection; import java.util.List; import static org.ohdsi.webapi.check.checker.characterization.helper.CharacterizationHelper.prepareCohortBuilder; import static org.ohdsi.webapi.check.checker.characterization.helper.CharacterizationHelper.prepareFeatureAnalysesBuilder; import static org.ohdsi.webapi.check.checker.characterization.helper.CharacterizationHelper.prepareStratifyRuleBuilder; @Component public class CohortChecker extends BaseChecker<CohortDTO> { private final TagHelper<CohortDTO> tagHelper; public CohortChecker(TagHelper<CohortDTO> tagHelper) { this.tagHelper = tagHelper; } @PostConstruct public void init() { createValidator(); } @Override protected List<ValidatorGroupBuilder<CohortDTO, ?>> getGroupBuilder() { return Arrays.asList( tagHelper.prepareTagBuilder() ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/ir/IRChecker.java
src/main/java/org/ohdsi/webapi/check/checker/ir/IRChecker.java
package org.ohdsi.webapi.check.checker.ir; import java.util.Arrays; import java.util.List; import javax.annotation.PostConstruct; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.checker.BaseChecker; import org.ohdsi.webapi.check.checker.ir.helper.IRHelper; import org.ohdsi.webapi.check.checker.tag.helper.TagHelper; import org.ohdsi.webapi.cohortcharacterization.dto.CohortCharacterizationDTO; import org.ohdsi.webapi.service.dto.IRAnalysisDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class IRChecker extends BaseChecker<IRAnalysisDTO> { private final TagHelper<IRAnalysisDTO> tagHelper; public IRChecker(TagHelper<IRAnalysisDTO> tagHelper) { this.tagHelper = tagHelper; } @PostConstruct public void init() { createValidator(); } @Override protected List<ValidatorGroupBuilder<IRAnalysisDTO, ?>> getGroupBuilder() { return Arrays.asList( tagHelper.prepareTagBuilder(), IRHelper.prepareAnalysisExpressionBuilder() ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/ir/helper/IRHelper.java
src/main/java/org/ohdsi/webapi/check/checker/ir/helper/IRHelper.java
package org.ohdsi.webapi.check.checker.ir.helper; import org.ohdsi.analysis.Utils; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.ircalc.IncidenceRateAnalysisExpression; import org.ohdsi.webapi.service.dto.IRAnalysisDTO; import java.util.function.Function; public class IRHelper { public static ValidatorGroupBuilder<IRAnalysisDTO, IncidenceRateAnalysisExpression> prepareAnalysisExpressionBuilder() { Function<IRAnalysisDTO, IncidenceRateAnalysisExpression> valueGetter = t -> Utils.deserialize(t.getExpression(), IncidenceRateAnalysisExpression.class); ValidatorGroupBuilder<IRAnalysisDTO, IncidenceRateAnalysisExpression> builder = new ValidatorGroupBuilder<IRAnalysisDTO, IncidenceRateAnalysisExpression>() .valueGetter(valueGetter) .validators( new NotNullNotEmptyValidatorBuilder<IncidenceRateAnalysisExpression>() .attrName("expression") ) .groups( IRAnalysisExpressionHelper.prepareTargetCohortsBuilder(), IRAnalysisExpressionHelper.prepareOutcomeCohortsBuilder(), IRAnalysisExpressionHelper.prepareStratifyRuleBuilder(), IRAnalysisExpressionHelper.prepareStudyWindowBuilder() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/ir/helper/IRStrataHelper.java
src/main/java/org/ohdsi/webapi/check/checker/ir/helper/IRStrataHelper.java
package org.ohdsi.webapi.check.checker.ir.helper; import org.ohdsi.circe.cohortdefinition.CriteriaGroup; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.ircalc.StratifyRule; import static org.ohdsi.webapi.check.checker.criteria.CorelatedCriteriaHelper.prepareCorelatedCriteriaBuilder; import static org.ohdsi.webapi.check.checker.criteria.CriteriaGroupHelper.prepareCriteriaGroupArrayBuilder; import static org.ohdsi.webapi.check.checker.criteria.DemographicHelper.prepareDemographicBuilder; public class IRStrataHelper { public static ValidatorGroupBuilder<StratifyRule, CriteriaGroup> prepareStrataBuilder() { ValidatorGroupBuilder<StratifyRule, CriteriaGroup> builder = new ValidatorGroupBuilder<StratifyRule, CriteriaGroup>() .attrName("stratify criteria") .valueGetter(t -> t.expression) .groups( prepareCriteriaGroupArrayBuilder(), prepareDemographicBuilder(), prepareCorelatedCriteriaBuilder() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/ir/helper/IRAnalysisExpressionHelper.java
src/main/java/org/ohdsi/webapi/check/checker/ir/helper/IRAnalysisExpressionHelper.java
package org.ohdsi.webapi.check.checker.ir.helper; import org.apache.commons.lang3.StringUtils; import org.ohdsi.webapi.check.builder.IterableForEachValidatorBuilder; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.PredicateValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.ircalc.DateRange; import org.ohdsi.webapi.ircalc.IncidenceRateAnalysisExpression; import org.ohdsi.webapi.ircalc.StratifyRule; import java.util.Collection; import java.util.List; public class IRAnalysisExpressionHelper { public static ValidatorGroupBuilder<IncidenceRateAnalysisExpression, List<Integer>> prepareOutcomeCohortsBuilder() { ValidatorGroupBuilder<IncidenceRateAnalysisExpression, List<Integer>> builder = new ValidatorGroupBuilder<IncidenceRateAnalysisExpression, List<Integer>>() .attrName("outcome cohorts") .valueGetter(t -> t.outcomeIds) .validators( new NotNullNotEmptyValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<IncidenceRateAnalysisExpression, List<Integer>> prepareTargetCohortsBuilder() { ValidatorGroupBuilder<IncidenceRateAnalysisExpression, List<Integer>> builder = new ValidatorGroupBuilder<IncidenceRateAnalysisExpression, List<Integer>>() .attrName("target cohorts") .valueGetter(t -> t.targetIds) .validators( new NotNullNotEmptyValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<IncidenceRateAnalysisExpression, DateRange> prepareStudyWindowBuilder() { return new ValidatorGroupBuilder<IncidenceRateAnalysisExpression, DateRange>() .attrName("study window") .valueGetter(t -> t.studyWindow) .validators( new PredicateValidatorBuilder<DateRange>().predicate(w -> StringUtils.isNotBlank(w.startDate) && StringUtils.isNotBlank(w.endDate)) ); } public static ValidatorGroupBuilder<IncidenceRateAnalysisExpression, Collection<? extends StratifyRule>> prepareStratifyRuleBuilder() { return new ValidatorGroupBuilder<IncidenceRateAnalysisExpression, Collection<? extends StratifyRule>>() .valueGetter(t -> t.strata) .validators( new IterableForEachValidatorBuilder<StratifyRule>() .groups(IRStrataHelper.prepareStrataBuilder()) ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/pathway/PathwayChecker.java
src/main/java/org/ohdsi/webapi/check/checker/pathway/PathwayChecker.java
package org.ohdsi.webapi.check.checker.pathway; import java.util.Arrays; import java.util.List; import javax.annotation.PostConstruct; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.checker.BaseChecker; import org.ohdsi.webapi.check.checker.pathway.helper.PathwayHelper; import org.ohdsi.webapi.check.checker.tag.helper.TagHelper; import org.ohdsi.webapi.pathway.dto.PathwayAnalysisDTO; import org.ohdsi.webapi.service.dto.IRAnalysisDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class PathwayChecker extends BaseChecker<PathwayAnalysisDTO> { private final TagHelper<PathwayAnalysisDTO> tagHelper; public PathwayChecker(TagHelper<PathwayAnalysisDTO> tagHelper) { this.tagHelper = tagHelper; } @PostConstruct public void init() { createValidator(); } @Override protected List<ValidatorGroupBuilder<PathwayAnalysisDTO, ?>> getGroupBuilder() { return Arrays.asList( tagHelper.prepareTagBuilder(), PathwayHelper.prepareTargetCohortsBuilder(), PathwayHelper.prepareEventCohortsBuilder(), PathwayHelper.prepareCombinationWindowBuilder(), PathwayHelper.prepareCellCountWindowBuilder(), PathwayHelper.prepareMaxPathLengthBuilder() ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/pathway/helper/PathwayHelper.java
src/main/java/org/ohdsi/webapi/check/checker/pathway/helper/PathwayHelper.java
package org.ohdsi.webapi.check.checker.pathway.helper; import java.util.List; import org.ohdsi.analysis.CohortMetadata; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.PredicateValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.pathway.dto.BasePathwayAnalysisDTO; import org.ohdsi.webapi.pathway.dto.PathwayAnalysisDTO; public class PathwayHelper { public static ValidatorGroupBuilder<PathwayAnalysisDTO, Integer> prepareMaxPathLengthBuilder() { ValidatorGroupBuilder<PathwayAnalysisDTO, Integer> builder = new ValidatorGroupBuilder<PathwayAnalysisDTO, Integer>() .attrName("maximum path length") .valueGetter(BasePathwayAnalysisDTO::getMaxDepth) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 1 && v <= 10) .errorMessage("must be between 1 and 10") ); return builder; } public static ValidatorGroupBuilder<PathwayAnalysisDTO, Integer> prepareCellCountWindowBuilder() { ValidatorGroupBuilder<PathwayAnalysisDTO, Integer> builder = new ValidatorGroupBuilder<PathwayAnalysisDTO, Integer>() .attrName("minimum cell count") .valueGetter(BasePathwayAnalysisDTO::getMinCellCount) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 0) .errorMessage("must be greater or equal to 0") ); return builder; } public static ValidatorGroupBuilder<PathwayAnalysisDTO, Integer> prepareCombinationWindowBuilder() { ValidatorGroupBuilder<PathwayAnalysisDTO, Integer> builder = new ValidatorGroupBuilder<PathwayAnalysisDTO, Integer>() .attrName("combination window") .valueGetter(BasePathwayAnalysisDTO::getCombinationWindow) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 0) .errorMessage("must be greater or equal to 0") ); return builder; } public static ValidatorGroupBuilder<PathwayAnalysisDTO, List<? extends CohortMetadata>> prepareEventCohortsBuilder() { ValidatorGroupBuilder<PathwayAnalysisDTO, List<? extends CohortMetadata>> builder = new ValidatorGroupBuilder<PathwayAnalysisDTO, List<? extends CohortMetadata>>() .attrName("event cohorts") .valueGetter(BasePathwayAnalysisDTO::getEventCohorts) .validators( new NotNullNotEmptyValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<PathwayAnalysisDTO, List<? extends CohortMetadata>> prepareTargetCohortsBuilder() { ValidatorGroupBuilder<PathwayAnalysisDTO, List<? extends CohortMetadata>> builder = new ValidatorGroupBuilder<PathwayAnalysisDTO, List<? extends CohortMetadata>>() .attrName("target cohorts") .valueGetter(BasePathwayAnalysisDTO::getTargetCohorts) .validators( new NotNullNotEmptyValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/prediction/PredictionChecker.java
src/main/java/org/ohdsi/webapi/check/checker/prediction/PredictionChecker.java
package org.ohdsi.webapi.check.checker.prediction; import java.util.Arrays; import java.util.List; import javax.annotation.PostConstruct; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.checker.BaseChecker; import org.ohdsi.webapi.check.checker.prediction.helper.PredictionBuilderHelper; import org.ohdsi.webapi.prediction.dto.PredictionAnalysisDTO; import org.springframework.stereotype.Component; @Component public class PredictionChecker extends BaseChecker<PredictionAnalysisDTO> { @PostConstruct public void init() { createValidator(); } @Override protected List<ValidatorGroupBuilder<PredictionAnalysisDTO, ?>> getGroupBuilder() { return Arrays.asList( PredictionBuilderHelper.prepareAnalysisExpressionBuilder() ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/prediction/helper/PredictionSpecificationBuilderHelper.java
src/main/java/org/ohdsi/webapi/check/checker/prediction/helper/PredictionSpecificationBuilderHelper.java
package org.ohdsi.webapi.check.checker.prediction.helper; import java.math.BigDecimal; import java.util.Collection; import org.ohdsi.analysis.Utils; import org.ohdsi.analysis.featureextraction.design.CovariateSettings; import org.ohdsi.analysis.prediction.design.CreateStudyPopulationArgs; import org.ohdsi.analysis.prediction.design.ModelSettings; import org.ohdsi.analysis.prediction.design.PatientLevelPredictionAnalysis; import org.ohdsi.analysis.prediction.design.RunPlpArgs; import org.ohdsi.webapi.check.builder.DuplicateValidatorBuilder; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class PredictionSpecificationBuilderHelper { public static ValidatorGroupBuilder<PatientLevelPredictionAnalysis, RunPlpArgs> prepareRunPlpArgsBuilder() { ValidatorGroupBuilder<PatientLevelPredictionAnalysis, RunPlpArgs> builder = new ValidatorGroupBuilder<PatientLevelPredictionAnalysis, RunPlpArgs>() .attrName("settings") .valueGetter(PatientLevelPredictionAnalysis::getRunPlpArgs) .validators( new NotNullNotEmptyValidatorBuilder<>() ) .groups( RunPlpArgsBuilderHelper.prepareMinCovariateFractionBuilder(), RunPlpArgsBuilderHelper.prepareTestFractionBuilder() ); return builder; } public static ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<BigDecimal>> prepareOutcomeCohortsBuilder() { ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<BigDecimal>> builder = new ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<BigDecimal>>() .attrName("outcome cohorts") .valueGetter(PatientLevelPredictionAnalysis::getOutcomeIds) .validators( new NotNullNotEmptyValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<BigDecimal>> prepareTargetCohortsBuilder() { ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<BigDecimal>> builder = new ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<BigDecimal>>() .attrName("target cohorts") .valueGetter(PatientLevelPredictionAnalysis::getTargetIds) .validators( new NotNullNotEmptyValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<? extends ModelSettings>> prepareModelSettingsBuilder() { ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<? extends ModelSettings>> builder = new ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<? extends ModelSettings>>() .attrName("model settings") .valueGetter(PatientLevelPredictionAnalysis::getModelSettings) .validators( new NotNullNotEmptyValidatorBuilder<>(), new DuplicateValidatorBuilder<ModelSettings, String>() .elementGetter(Utils::serialize) ); return builder; } public static ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<? extends CovariateSettings>> prepareCovariateSettingsBuilder() { ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<? extends CovariateSettings>> builder = new ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<? extends CovariateSettings>>() .attrName("covariate settings") .valueGetter(PatientLevelPredictionAnalysis::getCovariateSettings) .validators( new NotNullNotEmptyValidatorBuilder<>(), new DuplicateValidatorBuilder<CovariateSettings, String>() .elementGetter(Utils::serialize) ); return builder; } public static ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<? extends CreateStudyPopulationArgs>> preparePopulationSettingsBuilder() { ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<? extends CreateStudyPopulationArgs>> builder = new ValidatorGroupBuilder<PatientLevelPredictionAnalysis, Collection<? extends CreateStudyPopulationArgs>>() .attrName("population settings") .valueGetter(PatientLevelPredictionAnalysis::getPopulationSettings) .validators( new NotNullNotEmptyValidatorBuilder<>(), new DuplicateValidatorBuilder<CreateStudyPopulationArgs, String>() .elementGetter(Utils::serialize) ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/prediction/helper/RunPlpArgsBuilderHelper.java
src/main/java/org/ohdsi/webapi/check/checker/prediction/helper/RunPlpArgsBuilderHelper.java
package org.ohdsi.webapi.check.checker.prediction.helper; import org.ohdsi.analysis.prediction.design.RunPlpArgs; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.PredicateValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class RunPlpArgsBuilderHelper { public static ValidatorGroupBuilder<RunPlpArgs, Float> prepareTestFractionBuilder() { ValidatorGroupBuilder<RunPlpArgs, Float> builder = new ValidatorGroupBuilder<RunPlpArgs, Float>() .attrName("test fraction") .valueGetter(RunPlpArgs::getTestFraction) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Float>() .predicate(v -> v >= 0.0 && v <= 1.0) .errorMessage("must be between 0 and 100") ); return builder; } public static ValidatorGroupBuilder<RunPlpArgs, Float> prepareMinCovariateFractionBuilder() { ValidatorGroupBuilder<RunPlpArgs, Float> builder = new ValidatorGroupBuilder<RunPlpArgs, Float>() .attrName("minimum covariate fraction") .valueGetter(RunPlpArgs::getMinCovariateFraction) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Float>() .predicate(v -> v >= 0.0) .errorMessage("must be greater or equal to 0") ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/prediction/helper/PredictionBuilderHelper.java
src/main/java/org/ohdsi/webapi/check/checker/prediction/helper/PredictionBuilderHelper.java
package org.ohdsi.webapi.check.checker.prediction.helper; import org.ohdsi.analysis.Utils; import org.ohdsi.analysis.prediction.design.PatientLevelPredictionAnalysis; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.prediction.dto.PredictionAnalysisDTO; import org.ohdsi.webapi.prediction.specification.PatientLevelPredictionAnalysisImpl; public class PredictionBuilderHelper { public static ValidatorGroupBuilder<PredictionAnalysisDTO, PatientLevelPredictionAnalysis> prepareAnalysisExpressionBuilder() { ValidatorGroupBuilder<PredictionAnalysisDTO, PatientLevelPredictionAnalysis> builder = new ValidatorGroupBuilder<PredictionAnalysisDTO, PatientLevelPredictionAnalysis>() .attrName("specification") .valueGetter(predictionAnalysis -> Utils.deserialize(predictionAnalysis.getSpecification(), PatientLevelPredictionAnalysisImpl.class) ) .validators( new NotNullNotEmptyValidatorBuilder<>() ) .groups(PredictionSpecificationBuilderHelper.prepareOutcomeCohortsBuilder(), PredictionSpecificationBuilderHelper.prepareModelSettingsBuilder(), PredictionSpecificationBuilderHelper.prepareTargetCohortsBuilder(), PredictionSpecificationBuilderHelper.prepareCovariateSettingsBuilder(), PredictionSpecificationBuilderHelper.preparePopulationSettingsBuilder(), PredictionSpecificationBuilderHelper.prepareRunPlpArgsBuilder() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/characterization/CharacterizationChecker.java
src/main/java/org/ohdsi/webapi/check/checker/characterization/CharacterizationChecker.java
package org.ohdsi.webapi.check.checker.characterization; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.checker.BaseChecker; import org.ohdsi.webapi.check.checker.tag.helper.TagHelper; import org.ohdsi.webapi.cohortcharacterization.dto.CohortCharacterizationDTO; import org.ohdsi.webapi.cohortdefinition.dto.CohortDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.Arrays; import java.util.List; import static org.ohdsi.webapi.check.checker.characterization.helper.CharacterizationHelper.prepareCohortBuilder; import static org.ohdsi.webapi.check.checker.characterization.helper.CharacterizationHelper.prepareFeatureAnalysesBuilder; import static org.ohdsi.webapi.check.checker.characterization.helper.CharacterizationHelper.prepareStratifyRuleBuilder; @Component public class CharacterizationChecker extends BaseChecker<CohortCharacterizationDTO> { private final TagHelper<CohortCharacterizationDTO> tagHelper; public CharacterizationChecker(TagHelper<CohortCharacterizationDTO> tagHelper) { this.tagHelper = tagHelper; } @PostConstruct public void init() { createValidator(); } @Override protected List<ValidatorGroupBuilder<CohortCharacterizationDTO, ?>> getGroupBuilder() { return Arrays.asList( tagHelper.prepareTagBuilder(), prepareCohortBuilder(), prepareFeatureAnalysesBuilder(), prepareStratifyRuleBuilder() ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/characterization/helper/CharacterizationStrataHelper.java
src/main/java/org/ohdsi/webapi/check/checker/characterization/helper/CharacterizationStrataHelper.java
package org.ohdsi.webapi.check.checker.characterization.helper; import org.ohdsi.circe.cohortdefinition.CriteriaGroup; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.cohortcharacterization.dto.CcStrataDTO; import static org.ohdsi.webapi.check.checker.criteria.CorelatedCriteriaHelper.prepareCorelatedCriteriaBuilder; import static org.ohdsi.webapi.check.checker.criteria.CriteriaGroupHelper.prepareCriteriaGroupArrayBuilder; import static org.ohdsi.webapi.check.checker.criteria.DemographicHelper.prepareDemographicBuilder; public class CharacterizationStrataHelper { public static ValidatorGroupBuilder<CcStrataDTO, CriteriaGroup> prepareStrataBuilder() { ValidatorGroupBuilder<CcStrataDTO, CriteriaGroup> builder = new ValidatorGroupBuilder<CcStrataDTO, CriteriaGroup>() .attrName("subgroup analyses") .valueGetter(t -> t.getCriteria()) .groups( prepareCriteriaGroupArrayBuilder(), prepareDemographicBuilder(), prepareCorelatedCriteriaBuilder() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/characterization/helper/CharacterizationHelper.java
src/main/java/org/ohdsi/webapi/check/checker/characterization/helper/CharacterizationHelper.java
package org.ohdsi.webapi.check.checker.characterization.helper; import org.ohdsi.webapi.check.builder.IterableForEachValidatorBuilder; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.cohortcharacterization.dto.BaseCcDTO; import org.ohdsi.webapi.cohortcharacterization.dto.CcStrataDTO; import org.ohdsi.webapi.cohortcharacterization.dto.CohortCharacterizationDTO; import org.ohdsi.webapi.cohortdefinition.dto.CohortMetadataDTO; import org.ohdsi.webapi.cohortdefinition.dto.CohortMetadataImplDTO; import org.ohdsi.webapi.feanalysis.dto.FeAnalysisShortDTO; import java.util.Collection; public class CharacterizationHelper { public static ValidatorGroupBuilder<CohortCharacterizationDTO, Collection<FeAnalysisShortDTO>> prepareFeatureAnalysesBuilder() { ValidatorGroupBuilder<CohortCharacterizationDTO, Collection<FeAnalysisShortDTO>> builder = new ValidatorGroupBuilder<CohortCharacterizationDTO, Collection<FeAnalysisShortDTO>>() .attrName("feature analyses") .valueGetter(BaseCcDTO::getFeatureAnalyses) .validators(new NotNullNotEmptyValidatorBuilder<>()); return builder; } public static ValidatorGroupBuilder<CohortCharacterizationDTO, Collection<CohortMetadataImplDTO>> prepareCohortBuilder() { ValidatorGroupBuilder<CohortCharacterizationDTO, Collection<CohortMetadataImplDTO>> builder = new ValidatorGroupBuilder<CohortCharacterizationDTO, Collection<CohortMetadataImplDTO>>() .attrName("cohorts") .valueGetter(BaseCcDTO::getCohorts) .validators(new NotNullNotEmptyValidatorBuilder<>()); return builder; } public static ValidatorGroupBuilder<CohortCharacterizationDTO, Collection<? extends CcStrataDTO>> prepareStratifyRuleBuilder() { return new ValidatorGroupBuilder<CohortCharacterizationDTO, Collection<? extends CcStrataDTO>>() .valueGetter(t -> t.getStratas()) .validators( new IterableForEachValidatorBuilder<CcStrataDTO>() .groups(CharacterizationStrataHelper.prepareStrataBuilder()) ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/concept/ConceptArrayHelper.java
src/main/java/org/ohdsi/webapi/check/checker/concept/ConceptArrayHelper.java
package org.ohdsi.webapi.check.checker.concept; import org.ohdsi.circe.vocabulary.Concept; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.builder.concept.ConceptValidatorBuilder; import java.util.function.Function; public class ConceptArrayHelper { public static <T> ValidatorGroupBuilder<T, Concept[]> prepareConceptBuilder( Function<T, Concept[]> valueGetter, String attrName) { return new ValidatorGroupBuilder<T, Concept[]>() .attrName(attrName) .valueGetter(valueGetter) .validators( new ConceptValidatorBuilder() ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/SpecimenHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/SpecimenHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.circe.cohortdefinition.Specimen; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class SpecimenHelper { public static ValidatorGroupBuilder<Criteria, Specimen> prepareSpecimenBuilder() { ValidatorGroupBuilder<Criteria, Specimen> builder = new ValidatorGroupBuilder<Criteria, Specimen>() .attrName("specimen") .conditionGetter(t -> t instanceof Specimen) .valueGetter(t -> (Specimen) t) .groups( prepareAgeBuilder(), prepareStartDateBuilder(), prepareQuantityBuilder() ); return builder; } private static ValidatorGroupBuilder<Specimen, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<Specimen, NumericRange> builder = new ValidatorGroupBuilder<Specimen, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Specimen, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<Specimen, DateRange> builder = new ValidatorGroupBuilder<Specimen, DateRange>() .attrName("occurrence start date") .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Specimen, NumericRange> prepareQuantityBuilder() { ValidatorGroupBuilder<Specimen, NumericRange> builder = new ValidatorGroupBuilder<Specimen, NumericRange>() .attrName("quantity") .valueGetter(t -> t.quantity) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/ObservationPeriodHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/ObservationPeriodHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.circe.cohortdefinition.ObservationPeriod; import org.ohdsi.circe.cohortdefinition.Period; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.PeriodValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class ObservationPeriodHelper { public static ValidatorGroupBuilder<Criteria, ObservationPeriod> prepareObservationPeriodBuilder() { ValidatorGroupBuilder<Criteria, ObservationPeriod> builder = new ValidatorGroupBuilder<Criteria, ObservationPeriod>() .attrName("dose era") .conditionGetter(t -> t instanceof ObservationPeriod) .valueGetter(t -> (ObservationPeriod) t) .groups( prepareAgeAtStartBuilder(), prepareAgeAtEndBuilder(), preparePeriodStartBuilder(), preparePeriodEndBuilder(), preparePeriodLengthBuilder(), prepareUserDefinedPeriodBuilder() ); return builder; } private static ValidatorGroupBuilder<ObservationPeriod, NumericRange> prepareAgeAtStartBuilder() { ValidatorGroupBuilder<ObservationPeriod, NumericRange> builder = new ValidatorGroupBuilder<ObservationPeriod, NumericRange>() .attrName("age at start") .valueGetter(t -> t.ageAtStart) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ObservationPeriod, NumericRange> prepareAgeAtEndBuilder() { ValidatorGroupBuilder<ObservationPeriod, NumericRange> builder = new ValidatorGroupBuilder<ObservationPeriod, NumericRange>() .attrName("age at end") .valueGetter(t -> t.ageAtEnd) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ObservationPeriod, DateRange> preparePeriodStartBuilder() { ValidatorGroupBuilder<ObservationPeriod, DateRange> builder = new ValidatorGroupBuilder<ObservationPeriod, DateRange>() .attrName("period start date") .valueGetter(t -> t.periodStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ObservationPeriod, DateRange> preparePeriodEndBuilder() { ValidatorGroupBuilder<ObservationPeriod, DateRange> builder = new ValidatorGroupBuilder<ObservationPeriod, DateRange>() .attrName("period end date") .valueGetter(t -> t.periodEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ObservationPeriod, NumericRange> preparePeriodLengthBuilder() { ValidatorGroupBuilder<ObservationPeriod, NumericRange> builder = new ValidatorGroupBuilder<ObservationPeriod, NumericRange>() .attrName("period length") .valueGetter(t -> t.periodLength) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<ObservationPeriod, Period> prepareUserDefinedPeriodBuilder() { ValidatorGroupBuilder<ObservationPeriod, Period> builder = new ValidatorGroupBuilder<ObservationPeriod, Period>() .attrName("user defined period") .valueGetter(t -> t.userDefinedPeriod) .validators( new PeriodValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/DeathHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/DeathHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.Death; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class DeathHelper { public static ValidatorGroupBuilder<Criteria, Death> prepareDeathBuilder() { ValidatorGroupBuilder<Criteria, Death> builder = new ValidatorGroupBuilder<Criteria, Death>() .attrName("death") .conditionGetter(t -> t instanceof Death) .valueGetter(t -> (Death) t) .groups( prepareAgeBuilder(), prepareOccurrenceStartDateBuilder() ); return builder; } private static ValidatorGroupBuilder<Death, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<Death, NumericRange> builder = new ValidatorGroupBuilder<Death, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Death, DateRange> prepareOccurrenceStartDateBuilder() { ValidatorGroupBuilder<Death, DateRange> builder = new ValidatorGroupBuilder<Death, DateRange>() .attrName("occurrence start date") .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/CriteriaGroupHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/CriteriaGroupHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.CriteriaGroup; import org.ohdsi.webapi.check.builder.ArrayForEachValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.builder.criteria.CriteriaGroupValidatorBuilder; import static org.ohdsi.webapi.check.checker.criteria.CorelatedCriteriaHelper.prepareCorelatedCriteriaBuilder; import static org.ohdsi.webapi.check.checker.criteria.DemographicHelper.prepareDemographicBuilder; public class CriteriaGroupHelper { private static ValidatorGroupBuilder<CriteriaGroup, CriteriaGroup[]> prepareGroupBuilder() { ValidatorGroupBuilder<CriteriaGroup, CriteriaGroup[]> builder = new ValidatorGroupBuilder<CriteriaGroup, CriteriaGroup[]>() .valueGetter(t -> t.groups) .validators( new ArrayForEachValidatorBuilder<CriteriaGroup>() .validators( new CriteriaGroupValidatorBuilder<>() ) ); return builder; } public static ValidatorGroupBuilder<CriteriaGroup, CriteriaGroup[]> prepareCriteriaGroupArrayBuilder() { ValidatorGroupBuilder<CriteriaGroup, CriteriaGroup[]> builder = new ValidatorGroupBuilder<CriteriaGroup, CriteriaGroup[]>() .valueGetter(t -> t.groups) .validators( new ArrayForEachValidatorBuilder<CriteriaGroup>() .groups( prepareDemographicBuilder(), prepareCorelatedCriteriaBuilder(), prepareGroupBuilder()) ); return builder; } public static ValidatorGroupBuilder<Criteria, CriteriaGroup> prepareCriteriaGroupBuilder() { ValidatorGroupBuilder<Criteria, CriteriaGroup> builder = new ValidatorGroupBuilder<Criteria, CriteriaGroup>() .valueGetter(t -> t.CorrelatedCriteria) .groups( prepareDemographicBuilder(), prepareCorelatedCriteriaBuilder(), prepareGroupBuilder() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/DrugExposureHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/DrugExposureHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.DrugExposure; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class DrugExposureHelper { public static ValidatorGroupBuilder<Criteria, DrugExposure> prepareDrugExposureBuilder() { ValidatorGroupBuilder<Criteria, DrugExposure> builder = new ValidatorGroupBuilder<Criteria, DrugExposure>() .attrName("drug exposure") .conditionGetter(t -> t instanceof DrugExposure) .valueGetter(t -> (DrugExposure) t) .groups( prepareAgeBuilder(), prepareStartDateBuilder(), prepareEndDateBuilder(), prepareRefillsBuilder(), prepareQuantityBuilder(), prepareDaysSupplyBuilder(), prepareEffectiveDrugDoseBuilder() ); return builder; } private static ValidatorGroupBuilder<DrugExposure, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<DrugExposure, NumericRange> builder = new ValidatorGroupBuilder<DrugExposure, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DrugExposure, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<DrugExposure, DateRange> builder = new ValidatorGroupBuilder<DrugExposure, DateRange>() .attrName("occurrence start date") .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DrugExposure, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<DrugExposure, DateRange> builder = new ValidatorGroupBuilder<DrugExposure, DateRange>() .attrName("occurrence end date") .valueGetter(t -> t.occurrenceEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DrugExposure, NumericRange> prepareRefillsBuilder() { ValidatorGroupBuilder<DrugExposure, NumericRange> builder = new ValidatorGroupBuilder<DrugExposure, NumericRange>() .attrName("refills") .valueGetter(t -> t.refills) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DrugExposure, NumericRange> prepareQuantityBuilder() { ValidatorGroupBuilder<DrugExposure, NumericRange> builder = new ValidatorGroupBuilder<DrugExposure, NumericRange>() .attrName("quantity") .valueGetter(t -> t.quantity) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DrugExposure, NumericRange> prepareDaysSupplyBuilder() { ValidatorGroupBuilder<DrugExposure, NumericRange> builder = new ValidatorGroupBuilder<DrugExposure, NumericRange>() .attrName("days supply") .valueGetter(t -> t.daysSupply) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<DrugExposure, NumericRange> prepareEffectiveDrugDoseBuilder() { ValidatorGroupBuilder<DrugExposure, NumericRange> builder = new ValidatorGroupBuilder<DrugExposure, NumericRange>() .attrName("effective drug dose") .valueGetter(t -> t.effectiveDrugDose) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/VisitDetailHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/VisitDetailHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.ConceptSetSelection; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.circe.cohortdefinition.VisitDetail; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.builder.conceptset.ConceptSetSelectionValidatorBuilder; public class VisitDetailHelper { public static ValidatorGroupBuilder<Criteria, VisitDetail> prepareVisitDetailBuilder() { ValidatorGroupBuilder<Criteria, VisitDetail> builder = new ValidatorGroupBuilder<Criteria, VisitDetail>() .attrName("VisitDetail") .conditionGetter(t -> t instanceof VisitDetail) .valueGetter(t -> (VisitDetail) t) .groups( prepareAgeBuilder(), prepareStartDateBuilder(), prepareEndDateBuilder(), prepareVisitDetailLengthBuilder(), prepareVisitDetailTypeBuilder(), prepareGenderBuilder(), prepareProviderSpecialtyBuilder(), preparePlaceOfServiceCBuilder() ); return builder; } private static ValidatorGroupBuilder<VisitDetail, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<VisitDetail, NumericRange> builder = new ValidatorGroupBuilder<VisitDetail, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitDetail, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<VisitDetail, DateRange> builder = new ValidatorGroupBuilder<VisitDetail, DateRange>() .attrName("visit detail start date") .valueGetter(t -> t.visitDetailStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitDetail, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<VisitDetail, DateRange> builder = new ValidatorGroupBuilder<VisitDetail, DateRange>() .attrName("visit detail end date") .valueGetter(t -> t.visitDetailEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitDetail, NumericRange> prepareVisitDetailLengthBuilder() { ValidatorGroupBuilder<VisitDetail, NumericRange> builder = new ValidatorGroupBuilder<VisitDetail, NumericRange>() .attrName("visit detail length") .valueGetter(t -> t.visitDetailLength) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitDetail, ConceptSetSelection> prepareVisitDetailTypeBuilder() { ValidatorGroupBuilder<VisitDetail, ConceptSetSelection> builder = new ValidatorGroupBuilder<VisitDetail, ConceptSetSelection>() .attrName("visit detail type") .valueGetter(t -> t.visitDetailTypeCS) .validators( new ConceptSetSelectionValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitDetail, ConceptSetSelection> prepareGenderBuilder() { ValidatorGroupBuilder<VisitDetail, ConceptSetSelection> builder = new ValidatorGroupBuilder<VisitDetail, ConceptSetSelection>() .attrName("visit detail gender") .valueGetter(t -> t.genderCS) .validators( new ConceptSetSelectionValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitDetail, ConceptSetSelection> prepareProviderSpecialtyBuilder() { ValidatorGroupBuilder<VisitDetail, ConceptSetSelection> builder = new ValidatorGroupBuilder<VisitDetail, ConceptSetSelection>() .attrName("visit detail provider speciality") .valueGetter(t -> t.providerSpecialtyCS) .validators( new ConceptSetSelectionValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitDetail, ConceptSetSelection> preparePlaceOfServiceCBuilder() { ValidatorGroupBuilder<VisitDetail, ConceptSetSelection> builder = new ValidatorGroupBuilder<VisitDetail, ConceptSetSelection>() .attrName("visit detail place of service") .valueGetter(t -> t.placeOfServiceCS) .validators( new ConceptSetSelectionValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/DrugEraHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/DrugEraHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.DrugEra; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class DrugEraHelper { public static ValidatorGroupBuilder<Criteria, DrugEra> prepareDrugEraBuilder() { ValidatorGroupBuilder<Criteria, DrugEra> builder = new ValidatorGroupBuilder<Criteria, DrugEra>() .attrName("drug era") .conditionGetter(t -> t instanceof DrugEra) .valueGetter(t -> (DrugEra) t) .groups( prepareAgeAtStartBuilder(), prepareAgeAtEndBuilder(), prepareStartDateBuilder(), prepareEndDateBuilder(), prepareLengthBuilder(), prepareOccurrenceCountBuilder(), prepareGapDaysBuilder() ); return builder; } private static ValidatorGroupBuilder<DrugEra, NumericRange> prepareAgeAtStartBuilder() { ValidatorGroupBuilder<DrugEra, NumericRange> builder = new ValidatorGroupBuilder<DrugEra, NumericRange>() .attrName("age at start") .valueGetter(t -> t.ageAtStart) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DrugEra, NumericRange> prepareAgeAtEndBuilder() { ValidatorGroupBuilder<DrugEra, NumericRange> builder = new ValidatorGroupBuilder<DrugEra, NumericRange>() .attrName("age at end") .valueGetter(t -> t.ageAtEnd) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DrugEra, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<DrugEra, DateRange> builder = new ValidatorGroupBuilder<DrugEra, DateRange>() .attrName("era start date") .valueGetter(t -> t.eraStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DrugEra, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<DrugEra, DateRange> builder = new ValidatorGroupBuilder<DrugEra, DateRange>() .attrName("era end date") .valueGetter(t -> t.eraEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DrugEra, NumericRange> prepareLengthBuilder() { ValidatorGroupBuilder<DrugEra, NumericRange> builder = new ValidatorGroupBuilder<DrugEra, NumericRange>() .attrName("era length") .valueGetter(t -> t.eraLength) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<DrugEra, NumericRange> prepareOccurrenceCountBuilder() { ValidatorGroupBuilder<DrugEra, NumericRange> builder = new ValidatorGroupBuilder<DrugEra, NumericRange>() .attrName("occurrence count") .valueGetter(t -> t.occurrenceCount) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<DrugEra, NumericRange> prepareGapDaysBuilder() { ValidatorGroupBuilder<DrugEra, NumericRange> builder = new ValidatorGroupBuilder<DrugEra, NumericRange>() .attrName("gap days") .valueGetter(t -> t.gapDays) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/ConditionEraHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/ConditionEraHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.ConditionEra; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class ConditionEraHelper { public static ValidatorGroupBuilder<Criteria, ConditionEra> prepareConditionEraBuilder() { ValidatorGroupBuilder<Criteria, ConditionEra> builder = new ValidatorGroupBuilder<Criteria, ConditionEra>() .attrName("condition era") .conditionGetter(t -> t instanceof ConditionEra) .valueGetter(t -> (ConditionEra) t) .groups( prepareAgeAtStartBuilder(), prepareAgeAtEndBuilder(), prepareStartDateBuilder(), prepareEndDateBuilder(), prepareLengthBuilder(), prepareOccurrenceCountBuilder() ); return builder; } private static ValidatorGroupBuilder<ConditionEra, NumericRange> prepareAgeAtStartBuilder() { ValidatorGroupBuilder<ConditionEra, NumericRange> builder = new ValidatorGroupBuilder<ConditionEra, NumericRange>() .attrName("age in years at era start") .valueGetter(t -> t.ageAtStart) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ConditionEra, NumericRange> prepareAgeAtEndBuilder() { ValidatorGroupBuilder<ConditionEra, NumericRange> builder = new ValidatorGroupBuilder<ConditionEra, NumericRange>() .attrName("age in years at era end") .valueGetter(t -> t.ageAtEnd) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ConditionEra, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<ConditionEra, DateRange> builder = new ValidatorGroupBuilder<ConditionEra, DateRange>() .attrName("era start date") .valueGetter(t -> t.eraStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ConditionEra, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<ConditionEra, DateRange> builder = new ValidatorGroupBuilder<ConditionEra, DateRange>() .attrName("era end date") .valueGetter(t -> t.eraEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ConditionEra, NumericRange> prepareLengthBuilder() { ValidatorGroupBuilder<ConditionEra, NumericRange> builder = new ValidatorGroupBuilder<ConditionEra, NumericRange>() .attrName("era length") .valueGetter(t -> t.eraLength) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<ConditionEra, NumericRange> prepareOccurrenceCountBuilder() { ValidatorGroupBuilder<ConditionEra, NumericRange> builder = new ValidatorGroupBuilder<ConditionEra, NumericRange>() .attrName("occurrence count") .valueGetter(t -> t.occurrenceCount) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/VisitOccurrenceHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/VisitOccurrenceHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.circe.cohortdefinition.VisitOccurrence; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class VisitOccurrenceHelper { public static ValidatorGroupBuilder<Criteria, VisitOccurrence> prepareVisitOccurrenceBuilder() { ValidatorGroupBuilder<Criteria, VisitOccurrence> builder = new ValidatorGroupBuilder<Criteria, VisitOccurrence>() .attrName("VisitOccurrence") .conditionGetter(t -> t instanceof VisitOccurrence) .valueGetter(t -> (VisitOccurrence) t) .groups( prepareAgeBuilder(), prepareStartDateBuilder(), prepareEndDateBuilder(), prepareVisitLengthBuilder() ); return builder; } private static ValidatorGroupBuilder<VisitOccurrence, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<VisitOccurrence, NumericRange> builder = new ValidatorGroupBuilder<VisitOccurrence, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitOccurrence, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<VisitOccurrence, DateRange> builder = new ValidatorGroupBuilder<VisitOccurrence, DateRange>() .attrName("occurrence start date") .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitOccurrence, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<VisitOccurrence, DateRange> builder = new ValidatorGroupBuilder<VisitOccurrence, DateRange>() .attrName("occurrence end date") .valueGetter(t -> t.occurrenceEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<VisitOccurrence, NumericRange> prepareVisitLengthBuilder() { ValidatorGroupBuilder<VisitOccurrence, NumericRange> builder = new ValidatorGroupBuilder<VisitOccurrence, NumericRange>() .attrName("visit length") .valueGetter(t -> t.visitLength) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/CorelatedCriteriaHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/CorelatedCriteriaHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.CorelatedCriteria; import org.ohdsi.circe.cohortdefinition.CriteriaGroup; import org.ohdsi.webapi.check.builder.ArrayForEachValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.builder.criteria.CorelatedCriteriaValidatorBuilder; public class CorelatedCriteriaHelper { public static ValidatorGroupBuilder<CriteriaGroup, CorelatedCriteria[]> prepareCorelatedCriteriaBuilder() { ValidatorGroupBuilder<CriteriaGroup, CorelatedCriteria[]> builder = new ValidatorGroupBuilder<CriteriaGroup, CorelatedCriteria[]>() .valueGetter(t -> t.criteriaList) .validators( new ArrayForEachValidatorBuilder<CorelatedCriteria>() .validators( new CorelatedCriteriaValidatorBuilder<>() ) ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/PayerPlanPeriodHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/PayerPlanPeriodHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.circe.cohortdefinition.PayerPlanPeriod; import org.ohdsi.circe.cohortdefinition.Period; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.PeriodValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class PayerPlanPeriodHelper { public static ValidatorGroupBuilder<Criteria, PayerPlanPeriod> preparePayerPlanPeriodBuilder() { ValidatorGroupBuilder<Criteria, PayerPlanPeriod> builder = new ValidatorGroupBuilder<Criteria, PayerPlanPeriod>() .attrName("payer plan period") .conditionGetter(t -> t instanceof PayerPlanPeriod) .valueGetter(t -> (PayerPlanPeriod) t) .groups( prepareStartDateBuilder(), prepareEndDateBuilder(), prepareLengthBuilder(), prepareAgeAtStartBuilder(), prepareAgeAtEndBuilder(), prepareUserDefinedPeriod() ); return builder; } private static ValidatorGroupBuilder<PayerPlanPeriod, NumericRange> prepareAgeAtStartBuilder() { ValidatorGroupBuilder<PayerPlanPeriod, NumericRange> builder = new ValidatorGroupBuilder<PayerPlanPeriod, NumericRange>() .attrName("age at start") .valueGetter(t -> t.ageAtStart) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<PayerPlanPeriod, NumericRange> prepareAgeAtEndBuilder() { ValidatorGroupBuilder<PayerPlanPeriod, NumericRange> builder = new ValidatorGroupBuilder<PayerPlanPeriod, NumericRange>() .attrName("age at end") .valueGetter(t -> t.ageAtEnd) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<PayerPlanPeriod, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<PayerPlanPeriod, DateRange> builder = new ValidatorGroupBuilder<PayerPlanPeriod, DateRange>() .attrName("period start date") .valueGetter(t -> t.periodStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<PayerPlanPeriod, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<PayerPlanPeriod, DateRange> builder = new ValidatorGroupBuilder<PayerPlanPeriod, DateRange>() .attrName("period end date") .valueGetter(t -> t.periodEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<PayerPlanPeriod, NumericRange> prepareLengthBuilder() { ValidatorGroupBuilder<PayerPlanPeriod, NumericRange> builder = new ValidatorGroupBuilder<PayerPlanPeriod, NumericRange>() .attrName("period length") .valueGetter(t -> t.periodLength) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<PayerPlanPeriod, Period> prepareUserDefinedPeriod() { ValidatorGroupBuilder<PayerPlanPeriod, Period> builder = new ValidatorGroupBuilder<PayerPlanPeriod, Period>() .attrName("user defined period") .valueGetter(t -> t.userDefinedPeriod) .validators( new PeriodValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/ConditionOccurrenceHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/ConditionOccurrenceHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.ConditionOccurrence; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class ConditionOccurrenceHelper { public static ValidatorGroupBuilder<Criteria, ConditionOccurrence> prepareConditionOccurrenceBuilder() { ValidatorGroupBuilder<Criteria, ConditionOccurrence> builder = new ValidatorGroupBuilder<Criteria, ConditionOccurrence>() .attrName("condition occurence") .conditionGetter(t -> t instanceof ConditionOccurrence) .valueGetter(t -> (ConditionOccurrence) t) .groups( prepareAgeBuilder(), prepareStartDateBuilder(), prepareEndDateBuilder() ); return builder; } private static ValidatorGroupBuilder<ConditionOccurrence, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<ConditionOccurrence, NumericRange> builder = new ValidatorGroupBuilder<ConditionOccurrence, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ConditionOccurrence, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<ConditionOccurrence, DateRange> builder = new ValidatorGroupBuilder<ConditionOccurrence, DateRange>() .attrName("occurrence start date") .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ConditionOccurrence, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<ConditionOccurrence, DateRange> builder = new ValidatorGroupBuilder<ConditionOccurrence, DateRange>() .attrName("occurrence end date") .valueGetter(t -> t.occurrenceEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/ObservationHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/ObservationHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.circe.cohortdefinition.Observation; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class ObservationHelper { public static ValidatorGroupBuilder<Criteria, Observation> prepareObservationBuilder() { ValidatorGroupBuilder<Criteria, Observation> builder = new ValidatorGroupBuilder<Criteria, Observation>() .attrName("Observation") .conditionGetter(t -> t instanceof Observation) .valueGetter(t -> (Observation) t) .groups( prepareOccurrenceStartDateBuilder(), prepareValueAsNumberBuilder(), prepareAgeBuilder() ); return builder; } private static ValidatorGroupBuilder<Observation, DateRange> prepareOccurrenceStartDateBuilder() { ValidatorGroupBuilder<Observation, DateRange> builder = new ValidatorGroupBuilder<Observation, DateRange>() .attrName("occurrence start date") .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Observation, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<Observation, NumericRange> builder = new ValidatorGroupBuilder<Observation, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Observation, NumericRange> prepareValueAsNumberBuilder() { ValidatorGroupBuilder<Observation, NumericRange> builder = new ValidatorGroupBuilder<Observation, NumericRange>() .attrName("value as number") .valueGetter(t -> t.valueAsNumber) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/DeviceExposureHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/DeviceExposureHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.DeviceExposure; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class DeviceExposureHelper { public static ValidatorGroupBuilder<Criteria, DeviceExposure> prepareDeviceExposureBuilder() { ValidatorGroupBuilder<Criteria, DeviceExposure> builder = new ValidatorGroupBuilder<Criteria, DeviceExposure>() .attrName("device exposure") .conditionGetter(t -> t instanceof DeviceExposure) .valueGetter(t -> (DeviceExposure) t) .groups( prepareAgeBuilder(), prepareStartDateBuilder(), prepareEndDateBuilder(), prepareQuantityBuilder() ); return builder; } private static ValidatorGroupBuilder<DeviceExposure, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<DeviceExposure, NumericRange> builder = new ValidatorGroupBuilder<DeviceExposure, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DeviceExposure, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<DeviceExposure, DateRange> builder = new ValidatorGroupBuilder<DeviceExposure, DateRange>() .attrName("occurrence start date") .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DeviceExposure, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<DeviceExposure, DateRange> builder = new ValidatorGroupBuilder<DeviceExposure, DateRange>() .attrName("occurrence end date") .valueGetter(t -> t.occurrenceEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DeviceExposure, NumericRange> prepareQuantityBuilder() { ValidatorGroupBuilder<DeviceExposure, NumericRange> builder = new ValidatorGroupBuilder<DeviceExposure, NumericRange>() .attrName("quantity") .valueGetter(t -> t.quantity) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/DemographicHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/DemographicHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.CriteriaGroup; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.DemographicCriteria; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.builder.ArrayForEachValidatorBuilder; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.warning.WarningSeverity; public class DemographicHelper { public static ValidatorGroupBuilder<CriteriaGroup, DemographicCriteria[]> prepareDemographicBuilder() { ValidatorGroupBuilder<CriteriaGroup, DemographicCriteria[]> builder = new ValidatorGroupBuilder<CriteriaGroup, DemographicCriteria[]>() .attrName("demographic") .valueGetter(t -> t.demographicCriteriaList) .validators( new ArrayForEachValidatorBuilder<DemographicCriteria>() .groups( prepareAgeBuilder(), prepareOccurrenceStartDateBuilder(), prepareOccurrenceEndDateBuilder() ) ); return builder; } private static ValidatorGroupBuilder<DemographicCriteria, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<DemographicCriteria, NumericRange> builder = new ValidatorGroupBuilder<DemographicCriteria, NumericRange>() .attrName("age") .severity(WarningSeverity.CRITICAL) .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DemographicCriteria, DateRange> prepareOccurrenceStartDateBuilder() { ValidatorGroupBuilder<DemographicCriteria, DateRange> builder = new ValidatorGroupBuilder<DemographicCriteria, DateRange>() .attrName("occurrence start date") .severity(WarningSeverity.CRITICAL) .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DemographicCriteria, DateRange> prepareOccurrenceEndDateBuilder() { ValidatorGroupBuilder<DemographicCriteria, DateRange> builder = new ValidatorGroupBuilder<DemographicCriteria, DateRange>() .attrName("occurrence end date") .severity(WarningSeverity.CRITICAL) .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/MeasurementHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/MeasurementHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.Measurement; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class MeasurementHelper { public static ValidatorGroupBuilder<Criteria, Measurement> prepareMeasurementBuilder() { ValidatorGroupBuilder<Criteria, Measurement> builder = new ValidatorGroupBuilder<Criteria, Measurement>() .attrName("measurement") .conditionGetter(t -> t instanceof Measurement) .valueGetter(t -> (Measurement) t) .groups( prepareOccurrenceStartDateBuilder(), prepareValueAsNumberBuilder(), prepareRangeLowBuilder(), prepareRangeHighBuilder(), prepareRangeLowRatioBuilder(), prepareRangeHighRatioBuilder(), prepareAgeBuilder() ); return builder; } private static ValidatorGroupBuilder<Measurement, DateRange> prepareOccurrenceStartDateBuilder() { ValidatorGroupBuilder<Measurement, DateRange> builder = new ValidatorGroupBuilder<Measurement, DateRange>() .attrName("occurrence start date") .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Measurement, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<Measurement, NumericRange> builder = new ValidatorGroupBuilder<Measurement, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Measurement, NumericRange> prepareValueAsNumberBuilder() { ValidatorGroupBuilder<Measurement, NumericRange> builder = new ValidatorGroupBuilder<Measurement, NumericRange>() .attrName("value as number") .valueGetter(t -> t.valueAsNumber) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Measurement, NumericRange> prepareRangeLowBuilder() { ValidatorGroupBuilder<Measurement, NumericRange> builder = new ValidatorGroupBuilder<Measurement, NumericRange>() .attrName("range low") .valueGetter(t -> t.rangeLow) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Measurement, NumericRange> prepareRangeHighBuilder() { ValidatorGroupBuilder<Measurement, NumericRange> builder = new ValidatorGroupBuilder<Measurement, NumericRange>() .attrName("range high") .valueGetter(t -> t.rangeHigh) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Measurement, NumericRange> prepareRangeLowRatioBuilder() { ValidatorGroupBuilder<Measurement, NumericRange> builder = new ValidatorGroupBuilder<Measurement, NumericRange>() .attrName("range low ratio") .valueGetter(t -> t.rangeLowRatio) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<Measurement, NumericRange> prepareRangeHighRatioBuilder() { ValidatorGroupBuilder<Measurement, NumericRange> builder = new ValidatorGroupBuilder<Measurement, NumericRange>() .attrName("range high ratio") .valueGetter(t -> t.rangeHighRatio) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/LocationRegionHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/LocationRegionHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.LocationRegion; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class LocationRegionHelper { public static ValidatorGroupBuilder<Criteria, LocationRegion> prepareLocationRegionBuilder() { ValidatorGroupBuilder<Criteria, LocationRegion> builder = new ValidatorGroupBuilder<Criteria, LocationRegion>() .attrName("location region") .conditionGetter(t -> t instanceof LocationRegion) .valueGetter(t -> (LocationRegion) t) .groups( prepareStartDateBuilder(), prepareEndDateBuilder() ); return builder; } private static ValidatorGroupBuilder<LocationRegion, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<LocationRegion, DateRange> builder = new ValidatorGroupBuilder<LocationRegion, DateRange>() .attrName("location region start date") .valueGetter(t -> t.startDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<LocationRegion, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<LocationRegion, DateRange> builder = new ValidatorGroupBuilder<LocationRegion, DateRange>() .attrName("location region end date") .valueGetter(t -> t.endDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/CriteriaHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/CriteriaHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.CorelatedCriteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.builder.criteria.CriteriaValidatorBuilder; import org.ohdsi.webapi.check.warning.WarningSeverity; import static org.ohdsi.webapi.check.checker.criteria.ConditionEraHelper.prepareConditionEraBuilder; import static org.ohdsi.webapi.check.checker.criteria.ConditionOccurrenceHelper.prepareConditionOccurrenceBuilder; import static org.ohdsi.webapi.check.checker.criteria.DeathHelper.prepareDeathBuilder; import static org.ohdsi.webapi.check.checker.criteria.DeviceExposureHelper.prepareDeviceExposureBuilder; import static org.ohdsi.webapi.check.checker.criteria.DoseEraHelper.prepareDoseEraBuilder; import static org.ohdsi.webapi.check.checker.criteria.DrugEraHelper.prepareDrugEraBuilder; import static org.ohdsi.webapi.check.checker.criteria.DrugExposureHelper.prepareDrugExposureBuilder; import static org.ohdsi.webapi.check.checker.criteria.LocationRegionHelper.prepareLocationRegionBuilder; import static org.ohdsi.webapi.check.checker.criteria.MeasurementHelper.prepareMeasurementBuilder; import static org.ohdsi.webapi.check.checker.criteria.ObservationHelper.prepareObservationBuilder; import static org.ohdsi.webapi.check.checker.criteria.ObservationPeriodHelper.prepareObservationPeriodBuilder; import static org.ohdsi.webapi.check.checker.criteria.PayerPlanPeriodHelper.preparePayerPlanPeriodBuilder; import static org.ohdsi.webapi.check.checker.criteria.ProcedureOccurrenceHelper.prepareProcedureOccurrenceBuilder; import static org.ohdsi.webapi.check.checker.criteria.SpecimenHelper.prepareSpecimenBuilder; import static org.ohdsi.webapi.check.checker.criteria.VisitDetailHelper.prepareVisitDetailBuilder; import static org.ohdsi.webapi.check.checker.criteria.VisitOccurrenceHelper.prepareVisitOccurrenceBuilder; public class CriteriaHelper { public static ValidatorGroupBuilder<CorelatedCriteria, Criteria> prepareCriteriaBuilder() { ValidatorGroupBuilder<CorelatedCriteria, Criteria> builder = new ValidatorGroupBuilder<CorelatedCriteria, Criteria>() .valueGetter(t -> t.criteria) .severity(WarningSeverity.CRITICAL) .validators( new CriteriaValidatorBuilder<>() ) .groups( prepareConditionEraBuilder(), prepareConditionOccurrenceBuilder(), prepareDeathBuilder(), prepareDeviceExposureBuilder(), prepareDoseEraBuilder(), prepareDrugEraBuilder(), prepareDrugExposureBuilder(), prepareLocationRegionBuilder(), prepareMeasurementBuilder(), prepareObservationBuilder(), prepareObservationPeriodBuilder(), preparePayerPlanPeriodBuilder(), prepareProcedureOccurrenceBuilder(), prepareSpecimenBuilder(), prepareVisitOccurrenceBuilder(), prepareVisitDetailBuilder() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/ProcedureOccurrenceHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/ProcedureOccurrenceHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.circe.cohortdefinition.ProcedureOccurrence; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class ProcedureOccurrenceHelper { public static ValidatorGroupBuilder<Criteria, ProcedureOccurrence> prepareProcedureOccurrenceBuilder() { ValidatorGroupBuilder<Criteria, ProcedureOccurrence> builder = new ValidatorGroupBuilder<Criteria, ProcedureOccurrence>() .attrName("procedure occurrence") .conditionGetter(t -> t instanceof ProcedureOccurrence) .valueGetter(t -> (ProcedureOccurrence) t) .groups( prepareAgeBuilder(), prepareStartDateBuilder(), prepareQuantityBuilder() ); return builder; } private static ValidatorGroupBuilder<ProcedureOccurrence, NumericRange> prepareAgeBuilder() { ValidatorGroupBuilder<ProcedureOccurrence, NumericRange> builder = new ValidatorGroupBuilder<ProcedureOccurrence, NumericRange>() .attrName("age") .valueGetter(t -> t.age) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ProcedureOccurrence, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<ProcedureOccurrence, DateRange> builder = new ValidatorGroupBuilder<ProcedureOccurrence, DateRange>() .attrName("occurrence start date") .valueGetter(t -> t.occurrenceStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<ProcedureOccurrence, NumericRange> prepareQuantityBuilder() { ValidatorGroupBuilder<ProcedureOccurrence, NumericRange> builder = new ValidatorGroupBuilder<ProcedureOccurrence, NumericRange>() .attrName("quantity") .valueGetter(t -> t.quantity) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/criteria/DoseEraHelper.java
src/main/java/org/ohdsi/webapi/check/checker/criteria/DoseEraHelper.java
package org.ohdsi.webapi.check.checker.criteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.circe.cohortdefinition.DoseEra; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.builder.DateRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.NumericRangeValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class DoseEraHelper { public static ValidatorGroupBuilder<Criteria, DoseEra> prepareDoseEraBuilder() { ValidatorGroupBuilder<Criteria, DoseEra> builder = new ValidatorGroupBuilder<Criteria, DoseEra>() .attrName("dose era") .conditionGetter(t -> t instanceof DoseEra) .valueGetter(t -> (DoseEra) t) .groups( prepareAgeAtStartBuilder(), prepareAgeAtEndBuilder(), prepareStartDateBuilder(), prepareEndDateBuilder(), prepareLengthBuilder(), prepareDoseValueBuilder() ); return builder; } private static ValidatorGroupBuilder<DoseEra, NumericRange> prepareAgeAtStartBuilder() { ValidatorGroupBuilder<DoseEra, NumericRange> builder = new ValidatorGroupBuilder<DoseEra, NumericRange>() .attrName("age at start") .valueGetter(t -> t.ageAtStart) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DoseEra, NumericRange> prepareAgeAtEndBuilder() { ValidatorGroupBuilder<DoseEra, NumericRange> builder = new ValidatorGroupBuilder<DoseEra, NumericRange>() .attrName("age at end") .valueGetter(t -> t.ageAtEnd) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DoseEra, DateRange> prepareStartDateBuilder() { ValidatorGroupBuilder<DoseEra, DateRange> builder = new ValidatorGroupBuilder<DoseEra, DateRange>() .attrName("era start date") .valueGetter(t -> t.eraStartDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DoseEra, DateRange> prepareEndDateBuilder() { ValidatorGroupBuilder<DoseEra, DateRange> builder = new ValidatorGroupBuilder<DoseEra, DateRange>() .attrName("era end date") .valueGetter(t -> t.eraEndDate) .validators( new DateRangeValidatorBuilder<>() ); return builder; } private static ValidatorGroupBuilder<DoseEra, NumericRange> prepareLengthBuilder() { ValidatorGroupBuilder<DoseEra, NumericRange> builder = new ValidatorGroupBuilder<DoseEra, NumericRange>() .attrName("era length") .valueGetter(t -> t.eraLength) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<DoseEra, NumericRange> prepareDoseValueBuilder() { ValidatorGroupBuilder<DoseEra, NumericRange> builder = new ValidatorGroupBuilder<DoseEra, NumericRange>() .attrName("dose value") .valueGetter(t -> t.doseValue) .validators( new NumericRangeValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/conceptset/ConceptSetChecker.java
src/main/java/org/ohdsi/webapi/check/checker/conceptset/ConceptSetChecker.java
package org.ohdsi.webapi.check.checker.conceptset; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.checker.BaseChecker; import org.ohdsi.webapi.check.checker.tag.helper.TagHelper; import org.ohdsi.webapi.cohortdefinition.dto.CohortDTO; import org.ohdsi.webapi.service.dto.ConceptSetDTO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.Arrays; import java.util.List; @Component public class ConceptSetChecker extends BaseChecker<ConceptSetDTO> { private final TagHelper<ConceptSetDTO> tagHelper; public ConceptSetChecker(TagHelper<ConceptSetDTO> tagHelper) { this.tagHelper = tagHelper; } @PostConstruct public void init() { createValidator(); } @Override protected List<ValidatorGroupBuilder<ConceptSetDTO, ?>> getGroupBuilder() { return Arrays.asList( tagHelper.prepareTagBuilder() ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/tag/helper/TagHelper.java
src/main/java/org/ohdsi/webapi/check/checker/tag/helper/TagHelper.java
package org.ohdsi.webapi.check.checker.tag.helper; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.builder.tag.MandatoryTagValidatorBuilder; import org.ohdsi.webapi.check.warning.WarningSeverity; import org.ohdsi.webapi.service.dto.CommonEntityExtDTO; import org.ohdsi.webapi.tag.TagService; import org.ohdsi.webapi.tag.dto.TagDTO; import org.ohdsi.webapi.tag.repository.TagRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import java.util.Collection; @Component public class TagHelper<T extends CommonEntityExtDTO> { private final TagService tagService; @Value("${tag.enabled}") private boolean enabled; public TagHelper(TagService tagService) { this.tagService = tagService; } public ValidatorGroupBuilder<T, Collection<? extends TagDTO>> prepareTagBuilder() { ValidatorGroupBuilder<T, Collection<? extends TagDTO>> builder = new ValidatorGroupBuilder<T, Collection<? extends TagDTO>>() .attrName("Tags") .conditionGetter(t -> enabled) .severity(WarningSeverity.WARNING) .valueGetter(T::getTags) .validators( new MandatoryTagValidatorBuilder<>(tagService) ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/estimation/EstimationChecker.java
src/main/java/org/ohdsi/webapi/check/checker/estimation/EstimationChecker.java
package org.ohdsi.webapi.check.checker.estimation; import static org.ohdsi.webapi.check.checker.estimation.helper.EstimationHelper.*; import java.util.Arrays; import java.util.List; import javax.annotation.PostConstruct; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.checker.BaseChecker; import org.ohdsi.webapi.estimation.dto.EstimationDTO; import org.springframework.stereotype.Component; @Component public class EstimationChecker extends BaseChecker<EstimationDTO> { @PostConstruct public void init() { createValidator(); } @Override protected List<ValidatorGroupBuilder<EstimationDTO, ?>> getGroupBuilder() { return Arrays.asList( prepareAnalysisExpressionBuilder() ); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/NegativeControlOutcomeCohortExpressionHelper.java
src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/NegativeControlOutcomeCohortExpressionHelper.java
package org.ohdsi.webapi.check.checker.estimation.helper; import java.util.List; import org.ohdsi.analysis.estimation.design.NegativeControlOutcomeCohortExpression; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class NegativeControlOutcomeCohortExpressionHelper { public static ValidatorGroupBuilder<NegativeControlOutcomeCohortExpression, String> prepareOccurrenceTypeBuilder() { return new ValidatorGroupBuilder<NegativeControlOutcomeCohortExpression, String>() .attrName("type of occurrence of the event when selecting from the domain") .valueGetter(NegativeControlOutcomeCohortExpression::getOccurrenceType) .validators( new NotNullNotEmptyValidatorBuilder<>() ); } public static ValidatorGroupBuilder<NegativeControlOutcomeCohortExpression, Boolean> prepareDetectOnDescendantsBuilder() { ValidatorGroupBuilder<NegativeControlOutcomeCohortExpression, Boolean> builder = new ValidatorGroupBuilder<NegativeControlOutcomeCohortExpression, Boolean>() .attrName("using of descendant concepts for the negative control outcome") .valueGetter(NegativeControlOutcomeCohortExpression::getDetectOnDescendants) .validators( new NotNullNotEmptyValidatorBuilder<>() ); return builder; } public static ValidatorGroupBuilder<NegativeControlOutcomeCohortExpression, List<String>> prepareDomainsBuilder() { ValidatorGroupBuilder<NegativeControlOutcomeCohortExpression, List<String>> builder = new ValidatorGroupBuilder<NegativeControlOutcomeCohortExpression, List<String>>() .attrName("domains to detect negative control outcomes") .valueGetter(NegativeControlOutcomeCohortExpression::getDomains) .validators( new NotNullNotEmptyValidatorBuilder<>() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/PositiveControlSynthesisArgsHelper.java
src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/PositiveControlSynthesisArgsHelper.java
package org.ohdsi.webapi.check.checker.estimation.helper; import org.ohdsi.analysis.estimation.design.PositiveControlSynthesisArgs; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.PredicateValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class PositiveControlSynthesisArgsHelper { public static ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> prepareMinOutcomeCountForInjectionBuilder() { ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> builder = new ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer>() .attrName("minimum number of outcome events required to inject a signal") .errorMessage("must be greater or equal to 0") .valueGetter(PositiveControlSynthesisArgs::getMinOutcomeCountForInjection) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 0) ); return builder; } public static ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> prepareMinOutcomeCountForModelBuilder() { ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> builder = new ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer>() .attrName("minimum number of outcome events required to build a model") .errorMessage("must be greater or equal to 0") .valueGetter(PositiveControlSynthesisArgs::getMinOutcomeCountForModel) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 0) ); return builder; } public static ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> prepareOutcomeIdOffsetBuilder() { ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> builder = new ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer>() .attrName("first new outcome ID that is to be created") .errorMessage("must be greater or equal to 0") .valueGetter(PositiveControlSynthesisArgs::getOutputIdOffset) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 0) ); return builder; } public static ValidatorGroupBuilder<PositiveControlSynthesisArgs, Float> prepareRatioBetweenPositiveControlSynthesisArgsargetAndInjectedBuilder() { ValidatorGroupBuilder<PositiveControlSynthesisArgs, Float> builder = new ValidatorGroupBuilder<PositiveControlSynthesisArgs, Float>() .attrName("allowed ratio between target and injected signal size") .errorMessage("must be greater or equal to 0") .valueGetter(PositiveControlSynthesisArgs::getPrecision) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Float>() .predicate(v -> v >= 0) ); return builder; } public static ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> prepareMaxPeopleFitModelBuilder() { ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> builder = new ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer>() .attrName("maximum number of people used to fit an outcome model") .errorMessage("must be greater or equal to 0") .valueGetter(PositiveControlSynthesisArgs::getMaxSubjectsForModel) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 0) ); return builder; } public static ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> prepareMinRequiredObservationBuilder() { ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> builder = new ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer>() .attrName("minimum required continuous observation time") .errorMessage("must be greater or equal to 0") .valueGetter(PositiveControlSynthesisArgs::getWashoutPeriod) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 0) ); return builder; } public static ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> prepareWindowEndBuilder() { ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> builder = new ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer>() .attrName("time-at-risk window end") .errorMessage("must be greater or equal to 0") .valueGetter(PositiveControlSynthesisArgs::getRiskWindowEnd) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 0) ); return builder; } public static ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> prepareWindowStartBuilder() { ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer> builder = new ValidatorGroupBuilder<PositiveControlSynthesisArgs, Integer>() .attrName("time-at-risk window start") .errorMessage("must be greater or equal to 0") .valueGetter(PositiveControlSynthesisArgs::getRiskWindowStart) .validators( new NotNullNotEmptyValidatorBuilder<>(), new PredicateValidatorBuilder<Integer>() .predicate(v -> v >= 0) ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/EstimationSpecificationHelper.java
src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/EstimationSpecificationHelper.java
package org.ohdsi.webapi.check.checker.estimation.helper; import static org.ohdsi.webapi.check.checker.estimation.helper.EstimationSettingsHelper.*; import static org.ohdsi.webapi.check.checker.estimation.helper.NegativeControlOutcomeCohortExpressionHelper.*; import static org.ohdsi.webapi.check.checker.estimation.helper.PositiveControlSynthesisArgsHelper.*; import java.util.Collection; import org.ohdsi.analysis.ConceptSetCrossReference; import org.ohdsi.analysis.estimation.design.EstimationAnalysis; import org.ohdsi.analysis.estimation.design.EstimationAnalysisSettings; import org.ohdsi.analysis.estimation.design.NegativeControlOutcomeCohortExpression; import org.ohdsi.analysis.estimation.design.PositiveControlSynthesisArgs; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.PredicateValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.estimation.EstimationServiceImpl; public class EstimationSpecificationHelper { public static ValidatorGroupBuilder<EstimationAnalysis, ?> prepareNegativeControlBuilder() { PredicateValidatorBuilder<Collection<? extends ConceptSetCrossReference>> validatorBuilder = new PredicateValidatorBuilder<>(); validatorBuilder.predicate(v -> { if (v != null) { return v.stream() .anyMatch(r -> EstimationServiceImpl.CONCEPT_SET_XREF_KEY_NEGATIVE_CONTROL_OUTCOMES.equalsIgnoreCase(r.getTargetName())); } return false; }); ValidatorGroupBuilder<EstimationAnalysis, Collection<? extends ConceptSetCrossReference>> builder = new ValidatorGroupBuilder<EstimationAnalysis, Collection<? extends ConceptSetCrossReference>>() .attrName("negative control") .valueGetter(EstimationAnalysis::getConceptSetCrossReference) .validators( validatorBuilder ); return builder; } public static ValidatorGroupBuilder<EstimationAnalysis, NegativeControlOutcomeCohortExpression> prepareNegativeControlOutcomeBuilder() { ValidatorGroupBuilder<EstimationAnalysis, NegativeControlOutcomeCohortExpression> builder = new ValidatorGroupBuilder<EstimationAnalysis, NegativeControlOutcomeCohortExpression>() .attrName("negative control outcome") .valueGetter(EstimationAnalysis::getNegativeControlOutcomeCohortDefinition) .groups( prepareOccurrenceTypeBuilder(), prepareDetectOnDescendantsBuilder(), prepareDomainsBuilder() ); return builder; } public static ValidatorGroupBuilder<EstimationAnalysis, PositiveControlSynthesisArgs> preparePositiveSynthesisBuilder() { ValidatorGroupBuilder<EstimationAnalysis, PositiveControlSynthesisArgs> builder = new ValidatorGroupBuilder<EstimationAnalysis, PositiveControlSynthesisArgs>() .attrName("positive control synthesis") .valueGetter(value -> Boolean.TRUE.equals(value.getDoPositiveControlSynthesis()) ? value.getPositiveControlSynthesisArgs() : null ) .groups( prepareWindowStartBuilder(), prepareWindowEndBuilder(), prepareMinRequiredObservationBuilder(), prepareMaxPeopleFitModelBuilder(), prepareRatioBetweenPositiveControlSynthesisArgsargetAndInjectedBuilder(), prepareOutcomeIdOffsetBuilder(), prepareMinOutcomeCountForModelBuilder(), prepareMinOutcomeCountForInjectionBuilder() ); return builder; } public static ValidatorGroupBuilder<EstimationAnalysis, EstimationAnalysisSettings> prepareAnalysisSettingsBuilder() { ValidatorGroupBuilder<EstimationAnalysis, EstimationAnalysisSettings> builder = new ValidatorGroupBuilder<EstimationAnalysis, EstimationAnalysisSettings>() .valueGetter(EstimationAnalysis::getEstimationAnalysisSettings) .validators( new NotNullNotEmptyValidatorBuilder<>() ) .groups( prepareAnalysisSpecificationBuilder() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/EstimationAnalysisSpecificationHelper.java
src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/EstimationAnalysisSpecificationHelper.java
package org.ohdsi.webapi.check.checker.estimation.helper; import org.ohdsi.analysis.Utils; import org.ohdsi.analysis.estimation.comparativecohortanalysis.design.CohortMethodAnalysis; import org.ohdsi.analysis.estimation.comparativecohortanalysis.design.ComparativeCohortAnalysis; import org.ohdsi.analysis.estimation.comparativecohortanalysis.design.TargetComparatorOutcomes; import org.ohdsi.webapi.check.builder.DuplicateValidatorBuilder; import org.ohdsi.webapi.check.builder.IterableForEachValidatorBuilder; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.PredicateValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.estimation.comparativecohortanalysis.specification.CohortMethodAnalysisImpl; import java.util.Collection; import java.util.function.Function; public class EstimationAnalysisSpecificationHelper { public static ValidatorGroupBuilder<ComparativeCohortAnalysis, Collection<? extends TargetComparatorOutcomes>> prepareTargetComparatorBuilder() { ValidatorBuilder<TargetComparatorOutcomes> predicateValidatorBuilder = new PredicateValidatorBuilder<TargetComparatorOutcomes>() .predicate(t -> { if (t != null) { return t.getComparatorId() != null && t.getTargetId() != null && t.getOutcomeIds().size() > 0; } return false; }) .errorMessage("no target, comparator or outcome"); ValidatorGroupBuilder<ComparativeCohortAnalysis, Collection<? extends TargetComparatorOutcomes>> builder = new ValidatorGroupBuilder<ComparativeCohortAnalysis, Collection<? extends TargetComparatorOutcomes>>() .attrName("target comparator outcome") .valueGetter(ComparativeCohortAnalysis::getTargetComparatorOutcomes) .validators( new NotNullNotEmptyValidatorBuilder<>(), new DuplicateValidatorBuilder<TargetComparatorOutcomes, String>() .elementGetter(t -> String.format("%s,%s", t.getTargetId(), t.getComparatorId())), new IterableForEachValidatorBuilder<TargetComparatorOutcomes>() .validators(predicateValidatorBuilder) ); return builder; } public static ValidatorGroupBuilder<ComparativeCohortAnalysis, Collection<? extends CohortMethodAnalysis>> prepareAnalysisSettingsBuilder() { Function<CohortMethodAnalysis, String> elementGetter = value -> { CohortMethodAnalysisImpl analysis = ((CohortMethodAnalysisImpl) value); Integer analysisId = analysis.getAnalysisId(); String description = analysis.getDescription(); // remove identifier and description analysis.setAnalysisId(null); analysis.setDescription(null); String json = Utils.serialize(analysis); // restore identifier and description analysis.setAnalysisId(analysisId); analysis.setDescription(description); return json; }; ValidatorBuilder<CohortMethodAnalysis> iptwValidatorBuilder = new PredicateValidatorBuilder<CohortMethodAnalysis>() .predicate(t -> { if (t != null && t.getFitOutcomeModelArgs() != null) { if (Boolean.TRUE.equals(t.getFitOutcomeModelArgs().getInversePtWeighting())) { return Boolean.TRUE.equals(t.getCreatePs()); } else { return true; } } return false; }) .attrNameValueGetter(t -> t.getDescription()) .errorMessage("createPs should be set to true when inverse probability of treatment weighting (IPTW) for the outcome model is specified "); ValidatorGroupBuilder<ComparativeCohortAnalysis, Collection<? extends CohortMethodAnalysis>> builder = new ValidatorGroupBuilder<ComparativeCohortAnalysis, Collection<? extends CohortMethodAnalysis>>() .attrName("analysis settings") .valueGetter(ComparativeCohortAnalysis::getCohortMethodAnalysisList) .validators( new NotNullNotEmptyValidatorBuilder<>(), new DuplicateValidatorBuilder<CohortMethodAnalysis, String>() .elementGetter(elementGetter), new IterableForEachValidatorBuilder<CohortMethodAnalysis>() .validators(iptwValidatorBuilder) ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/EstimationSettingsHelper.java
src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/EstimationSettingsHelper.java
package org.ohdsi.webapi.check.checker.estimation.helper; import static org.ohdsi.webapi.check.checker.estimation.helper.EstimationAnalysisSpecificationHelper.*; import org.ohdsi.analysis.estimation.comparativecohortanalysis.design.ComparativeCohortAnalysis; import org.ohdsi.analysis.estimation.design.EstimationAnalysisSettings; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; public class EstimationSettingsHelper { public static ValidatorGroupBuilder<EstimationAnalysisSettings, ComparativeCohortAnalysis> prepareAnalysisSpecificationBuilder() { ValidatorGroupBuilder<EstimationAnalysisSettings, ComparativeCohortAnalysis> builder = new ValidatorGroupBuilder<EstimationAnalysisSettings, ComparativeCohortAnalysis>() .valueGetter(EstimationAnalysisSettings::getAnalysisSpecification) .validators( new NotNullNotEmptyValidatorBuilder<>() ) .groups( prepareTargetComparatorBuilder(), prepareAnalysisSettingsBuilder() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/EstimationHelper.java
src/main/java/org/ohdsi/webapi/check/checker/estimation/helper/EstimationHelper.java
package org.ohdsi.webapi.check.checker.estimation.helper; import static org.ohdsi.webapi.check.checker.estimation.helper.EstimationSpecificationHelper.*; import org.ohdsi.analysis.Utils; import org.ohdsi.analysis.estimation.design.EstimationAnalysis; import org.ohdsi.webapi.check.builder.NotNullNotEmptyValidatorBuilder; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.estimation.dto.EstimationDTO; import org.ohdsi.webapi.estimation.specification.EstimationAnalysisImpl; public class EstimationHelper { public static ValidatorGroupBuilder<EstimationDTO, EstimationAnalysis> prepareAnalysisExpressionBuilder() { ValidatorGroupBuilder<EstimationDTO, EstimationAnalysis> builder = new ValidatorGroupBuilder<EstimationDTO, EstimationAnalysis>() .attrName("specification") .valueGetter(estimation -> Utils.deserialize(estimation.getSpecification(), EstimationAnalysisImpl.class)) .validators( new NotNullNotEmptyValidatorBuilder<>() ) .groups( prepareAnalysisSettingsBuilder(), preparePositiveSynthesisBuilder(), prepareNegativeControlOutcomeBuilder(), prepareNegativeControlBuilder() ); return builder; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/operations/Operations.java
src/main/java/org/ohdsi/webapi/check/operations/Operations.java
/* * Copyright 2017 Observational Health Data Sciences and Informatics * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Authors: Vitaly Koulakov * */ package org.ohdsi.webapi.check.operations; import java.util.Objects; import java.util.function.Consumer; import java.util.function.Function; public class Operations<T, V> implements ConditionalOperations<T, V>, ExecutiveOperations<T, V> { private Boolean result; private final T value; private V returnValue; private Operations(T value, V defaultReturnValue) { this.value = value; this.returnValue = defaultReturnValue; } public static <T, V> ConditionalOperations<T, V> match(T value, V defaultReturnValue) { return new Operations<>(value, defaultReturnValue); } public ExecutiveOperations<T, V> when(Function<T, Boolean> condition) { result = Objects.nonNull(value) && condition.apply(value); return this; } public ExecutiveOperations<T, V> isA(Class<?> clazz) { result = Objects.nonNull(clazz) && Objects.nonNull(value) && clazz.isAssignableFrom(value.getClass()); return this; } public ConditionalOperations<T, V> then(Consumer<T> consumer) { if (result) { consumer.accept(value); } return this; } public ConditionalOperations<T, V> then(Execution execution) { if (result) { execution.apply(); } return this; } public ConditionalOperations<T, V> thenReturn(Function<T, V> function) { if (result) { returnValue = function.apply(value); } return this; } public ConditionalOperations<T, V> orElse(Consumer<T> consumer) { if (!result) { consumer.accept(value); } return this; } public ConditionalOperations<T, V> orElseReturn(Function<T, V> function) { if (!result) { returnValue = function.apply(value); } return this; } public V value() { return returnValue; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/operations/ExecutiveOperations.java
src/main/java/org/ohdsi/webapi/check/operations/ExecutiveOperations.java
/* * Copyright 2017 Observational Health Data Sciences and Informatics * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Authors: Vitaly Koulakov * */ package org.ohdsi.webapi.check.operations; import java.util.function.Consumer; import java.util.function.Function; public interface ExecutiveOperations<T, V> { ConditionalOperations<T, V> then(Consumer<T> consumer); ConditionalOperations<T, V> then(Execution execution); ConditionalOperations<T, V> thenReturn(Function<T, V> function); }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/operations/ConditionalOperations.java
src/main/java/org/ohdsi/webapi/check/operations/ConditionalOperations.java
/* * Copyright 2017 Observational Health Data Sciences and Informatics * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Authors: Vitaly Koulakov * */ package org.ohdsi.webapi.check.operations; import java.util.function.Consumer; import java.util.function.Function; public interface ConditionalOperations<T, V> { ExecutiveOperations<T, V> when(Function<T, Boolean> condition); ExecutiveOperations<T, V> isA(Class<?> clazz); ConditionalOperations<T, V> orElse(Consumer<T> consumer); ConditionalOperations<T, V> orElseReturn(Function<T, V> function); V value(); }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/operations/Execution.java
src/main/java/org/ohdsi/webapi/check/operations/Execution.java
/* * Copyright 2017 Observational Health Data Sciences and Informatics * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Authors: Vitaly Koulakov * */ package org.ohdsi.webapi.check.operations; @FunctionalInterface public interface Execution { void apply(); }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/warning/Warning.java
src/main/java/org/ohdsi/webapi/check/warning/Warning.java
package org.ohdsi.webapi.check.warning; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = DefaultWarning.class, name = "DefaultWarning"), @JsonSubTypes.Type(value = ConceptSetWarning.class, name = "ConceptSetWarning") }) public interface Warning { @JsonProperty("message") String toMessage(); @JsonProperty("severity") WarningSeverity getSeverity(); }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/warning/ConceptSetWarning.java
src/main/java/org/ohdsi/webapi/check/warning/ConceptSetWarning.java
package org.ohdsi.webapi.check.warning; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import org.ohdsi.circe.cohortdefinition.ConceptSet; import java.util.Objects; public class ConceptSetWarning extends BaseWarning implements Warning { private final String template; private final ConceptSet conceptSet; public ConceptSetWarning(WarningSeverity severity, String template, ConceptSet conceptSet) { super(severity); this.template = template; this.conceptSet = conceptSet; } @JsonIgnore public ConceptSet getConceptSet() { return conceptSet; } @JsonProperty("conceptSetId") public Integer getConceptSetId() { return Objects.nonNull(conceptSet) ? conceptSet.id : 0; } @Override public String toMessage() { return String.format(template, conceptSet.name); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/warning/DefaultWarning.java
src/main/java/org/ohdsi/webapi/check/warning/DefaultWarning.java
package org.ohdsi.webapi.check.warning; import com.fasterxml.jackson.annotation.JsonProperty; public class DefaultWarning extends BaseWarning implements Warning { private final String message; public DefaultWarning(WarningSeverity severity, String message) { super(severity); this.message = message; } @Override @JsonProperty("message") public String toMessage() { return message; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/warning/WarningSeverity.java
src/main/java/org/ohdsi/webapi/check/warning/WarningSeverity.java
package org.ohdsi.webapi.check.warning; public enum WarningSeverity { INFO, WARNING, CRITICAL }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/warning/BaseWarning.java
src/main/java/org/ohdsi/webapi/check/warning/BaseWarning.java
package org.ohdsi.webapi.check.warning; import com.fasterxml.jackson.annotation.JsonProperty; public abstract class BaseWarning implements Warning { private final WarningSeverity severity; public BaseWarning(WarningSeverity severity) { this.severity = severity; } @Override public WarningSeverity getSeverity() { return severity; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/warning/WarningUtils.java
src/main/java/org/ohdsi/webapi/check/warning/WarningUtils.java
package org.ohdsi.webapi.check.warning; public class WarningUtils { public static Warning convertCirceWarning(org.ohdsi.circe.check.Warning circeWarning) { WarningSeverity severity = convertCirceWarningSeverity( ((org.ohdsi.circe.check.warnings.BaseWarning) circeWarning).getSeverity()); Warning warning; if (circeWarning instanceof org.ohdsi.circe.check.warnings.ConceptSetWarning) { warning = new ConceptSetWarning(severity, circeWarning.toMessage(), ((org.ohdsi.circe.check.warnings.ConceptSetWarning) circeWarning).getConceptSet()); } else { warning = new DefaultWarning(severity, circeWarning.toMessage()); } return warning; } private static WarningSeverity convertCirceWarningSeverity( org.ohdsi.circe.check.WarningSeverity circeWarningSeverity) { WarningSeverity severity = WarningSeverity.WARNING; switch (circeWarningSeverity) { case CRITICAL: { severity = WarningSeverity.CRITICAL; break; } case INFO: { severity = WarningSeverity.INFO; break; } } return severity; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/ValidatorGroup.java
src/main/java/org/ohdsi/webapi/check/validator/ValidatorGroup.java
package org.ohdsi.webapi.check.validator; import java.util.List; import java.util.Objects; import java.util.function.Function; public class ValidatorGroup<T, V> { private final List<Validator<V>> validators; private final List<ValidatorGroup<V, ?>> validatorGroups; private final Function<T, V> valueForValidationGetter; private final Function<T, Boolean> conditionGetter; public ValidatorGroup(List<Validator<V>> validators, List<ValidatorGroup<V, ?>> validatorGroups, Function<T, V> valueForValidationGetter, Function<T, Boolean> conditionGetter) { this.validators = validators; this.validatorGroups = validatorGroups; this.valueForValidationGetter = valueForValidationGetter; this.conditionGetter = conditionGetter; } public boolean validate(T value, Context context) { if (Objects.isNull(value)) { return true; } Boolean validatorsResult = this.validators.stream() .filter(v -> conditionGetter.apply(value)) .map(v -> v.validate(valueForValidationGetter.apply(value), context)) .reduce(true, (left, right) -> left && right); Boolean groupsResult = this.validatorGroups.stream() .filter(v -> conditionGetter.apply(value)) .map(v -> v.validate(valueForValidationGetter.apply(value), context)) .reduce(true, (left, right) -> left && right); return validatorsResult && groupsResult; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/Path.java
src/main/java/org/ohdsi/webapi/check/validator/Path.java
package org.ohdsi.webapi.check.validator; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.List; import java.util.Objects; public class Path { private static final String DEFAULT_SEPARATOR = " :: "; private final List<String> items; private Path(List<String> items) { this.items = items; } public static Path createPath(Path path, String item) { List<String> tempItems; if (Objects.isNull(path)) { tempItems = new ArrayList<>(); } else { tempItems = new ArrayList<>(path.items); } if (item != null) { tempItems.add(item); } return new Path(tempItems); } public static Path createPath(String item) { return createPath(null, item); } public static Path createPath() { return createPath(null); } public String getPath() { return getPath(DEFAULT_SEPARATOR); } public String getPath(String separator) { return StringUtils.join(this.items, separator); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/Context.java
src/main/java/org/ohdsi/webapi/check/validator/Context.java
package org.ohdsi.webapi.check.validator; import java.util.ArrayList; import java.util.List; import org.ohdsi.webapi.check.warning.WarningSeverity; public class Context { private List<Warning> warnings = new ArrayList<>(); public void addWarning(WarningSeverity severity, String message, Path path) { warnings.add(new Warning(severity, message, path)); } public List<Warning> getWarnings() { return warnings; } public static class Warning { private WarningSeverity severity; private String message; private Path path; public Warning(WarningSeverity severity, String message, Path path) { this.severity = severity; this.message = message; this.path = path; } public WarningSeverity getSeverity() { return severity; } public String getMessage() { return message; } public Path getPath() { return path; } } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/Validator.java
src/main/java/org/ohdsi/webapi/check/validator/Validator.java
package org.ohdsi.webapi.check.validator; import org.ohdsi.webapi.check.warning.WarningSeverity; import java.util.function.Function; public abstract class Validator<T> { private final static String DEFAULT_ERROR_MESSAGE = "error"; private final static WarningSeverity DEFAULT_SEVERITY = WarningSeverity.CRITICAL; protected Path path; protected WarningSeverity severity; protected String errorMessage; protected Function<T, String> attrNameValueGetter; public Validator(Path path, WarningSeverity severity, String errorMessage) { this.path = path; this.severity = severity; this.errorMessage = errorMessage; } public Validator(Path path, WarningSeverity severity, String errorMessage, Function<T, String> attrNameValueGetter) { this(path, severity, errorMessage); this.attrNameValueGetter = attrNameValueGetter; } public abstract boolean validate(T value, Context context); protected String getErrorMessage(T value, Object... params) { StringBuilder sb = new StringBuilder(); if (this.attrNameValueGetter != null) { sb.append("(") .append(this.attrNameValueGetter.apply(value)) .append(") - "); } String msg = this.errorMessage != null ? this.errorMessage : getDefaultErrorMessage(); if (params.length > 0) { msg = String.format(msg, params); } sb.append(msg); return sb.toString(); } protected WarningSeverity getSeverity() { return this.severity != null ? this.severity : getDefaultSeverity(); } protected String getDefaultErrorMessage() { return DEFAULT_ERROR_MESSAGE; } protected WarningSeverity getDefaultSeverity() { return DEFAULT_SEVERITY; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/common/IterableForEachValidator.java
src/main/java/org/ohdsi/webapi/check/validator/common/IterableForEachValidator.java
package org.ohdsi.webapi.check.validator.common; import org.ohdsi.webapi.check.validator.Context; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.ValidatorGroup; import org.ohdsi.webapi.check.warning.WarningSeverity; import java.util.Collection; import java.util.List; public class IterableForEachValidator<T> extends Validator<Collection<? extends T>> { private final List<Validator<T>> validators; private final List<ValidatorGroup<T, ?>> validatorGroups; public IterableForEachValidator(Path path, WarningSeverity severity, String errorMessage, List<Validator<T>> validators, List<ValidatorGroup<T, ?>> validatorGroups) { super(path, severity, errorMessage); this.validators = validators; this.validatorGroups = validatorGroups; } @Override public boolean validate(Collection<? extends T> value, Context context) { if (value == null) { return true; } return value.stream() .map(item -> { Boolean validatorsResult = this.validators.stream() .map(v -> v.validate(item, context)) .reduce(true, (left, right) -> left && right); Boolean groupsResult = this.validatorGroups.stream() .map(v -> v.validate(item, context)) .reduce(true, (left, right) -> left && right); return validatorsResult && groupsResult; }) .reduce(true, (left, right) -> left && right); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/common/PeriodValidator.java
src/main/java/org/ohdsi/webapi/check/validator/common/PeriodValidator.java
package org.ohdsi.webapi.check.validator.common; import org.ohdsi.circe.cohortdefinition.Period; import org.ohdsi.webapi.check.Comparisons; import org.ohdsi.webapi.check.validator.Context; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.warning.WarningSeverity; import java.util.Objects; import java.util.function.Function; import static org.ohdsi.webapi.check.Comparisons.isDateValid; import static org.ohdsi.webapi.check.operations.Operations.match; public class PeriodValidator<T extends Period> extends Validator<T> { private static final String START_GREATER_THAN_END = "start value greater than end"; private static final String DATE_IS_INVALID = "invalid date value"; public PeriodValidator(Path path, WarningSeverity severity, String errorMessage) { super(path, severity, errorMessage); } @Override public boolean validate(Period period, Context context) { if (period == null) { return true; } Function<String, Boolean> warning = (message) -> { context.addWarning(severity, message, path); return false; }; return match(period, true) .when(x -> Objects.nonNull(x.startDate) && !isDateValid(x.startDate)) .thenReturn(x -> warning.apply(DATE_IS_INVALID)) .when(x -> Objects.nonNull(x.endDate) && !isDateValid(x.endDate)) .thenReturn(x -> warning.apply(DATE_IS_INVALID)) .when(Comparisons::startIsGreaterThanEnd) .thenReturn(x -> warning.apply(START_GREATER_THAN_END)) .value(); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/common/PredicateValidator.java
src/main/java/org/ohdsi/webapi/check/validator/common/PredicateValidator.java
package org.ohdsi.webapi.check.validator.common; import java.util.function.Function; import java.util.function.Predicate; import org.ohdsi.webapi.check.validator.Context; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.warning.WarningSeverity; public class PredicateValidator<T> extends Validator<T> { private static final String INVALID = "invalid"; protected Predicate<T> predicate; public PredicateValidator(Path path, WarningSeverity severity, String errorMessage, Predicate<T> predicate) { super(path, severity, errorMessage); this.predicate = predicate; } public PredicateValidator(Path path, WarningSeverity severity, String errorMessage, Predicate<T> predicate, Function<T, String> attrNameValueGetter) { this(path, severity, errorMessage, predicate); this.attrNameValueGetter = attrNameValueGetter; } @Override public boolean validate(T value, Context context) { if (value == null) { return true; } boolean isValid = predicate.test(value); if (!isValid) { context.addWarning(getSeverity(), getErrorMessage(value), path); } return isValid; } protected String getDefaultErrorMessage() { return INVALID; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/common/NotNullNotEmptyValidator.java
src/main/java/org/ohdsi/webapi/check/validator/common/NotNullNotEmptyValidator.java
package org.ohdsi.webapi.check.validator.common; import java.lang.reflect.Array; import java.util.Collection; import java.util.Map; import java.util.Objects; import org.ohdsi.webapi.check.validator.Context; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.warning.WarningSeverity; public class NotNullNotEmptyValidator<T> extends Validator<T> { private static final String NULL_OR_EMPTY = "null or empty"; public NotNullNotEmptyValidator(Path path, WarningSeverity severity, String errorMessage) { super(path, severity, errorMessage); } @Override public boolean validate(T value, Context context) { boolean isValid = true; if (Objects.isNull(value)) { isValid = false; } else { if (value instanceof Collection) { isValid = ((Collection) value).size() > 0; } else if (value instanceof String) { isValid = !((String) value).isEmpty(); } else if (value.getClass().isArray()) { isValid = Array.getLength(value) > 0; } else if (value instanceof Map) { isValid = ((Map) value).size() > 0; } } if (!isValid) { context.addWarning(getSeverity(), getErrorMessage(value), path); } return isValid; } protected String getDefaultErrorMessage() { return NULL_OR_EMPTY; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/common/ArrayForEachValidator.java
src/main/java/org/ohdsi/webapi/check/validator/common/ArrayForEachValidator.java
package org.ohdsi.webapi.check.validator.common; import org.ohdsi.webapi.check.validator.Context; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.ValidatorGroup; import org.ohdsi.webapi.check.warning.WarningSeverity; import java.util.Arrays; import java.util.List; import java.util.stream.Stream; public class ArrayForEachValidator<T> extends Validator<T[]> { private final List<Validator<T>> validators; private final List<ValidatorGroup<T, ?>> validatorGroups; public ArrayForEachValidator(Path path, WarningSeverity severity, String errorMessage, List<Validator<T>> validators, List<ValidatorGroup<T, ?>> validatorGroups) { super(path, severity, errorMessage); this.validators = validators; this.validatorGroups = validatorGroups; } @Override public boolean validate(T[] value, Context context) { if (value == null) { return true; } Stream<T> valueStream = Arrays.stream(value); return valueStream .map(item -> { Boolean validatorsResult = this.validators.stream() .map(v -> v.validate(item, context)) .reduce(true, (left, right) -> left && right); Boolean groupsResult = this.validatorGroups.stream() .map(v -> v.validate(item, context)) .reduce(true, (left, right) -> left && right); return validatorsResult && groupsResult; }) .reduce(true, (left, right) -> left && right); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/common/DuplicateValidator.java
src/main/java/org/ohdsi/webapi/check/validator/common/DuplicateValidator.java
package org.ohdsi.webapi.check.validator.common; import java.util.Collection; import java.util.HashSet; import java.util.Set; import java.util.function.Function; import java.util.function.Predicate; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.warning.WarningSeverity; public class DuplicateValidator<T, V> extends PredicateValidator<Collection<? extends T>> { private static final String DUPLICATE = "duplicate values"; private Function<T, V> elementGetter; public DuplicateValidator(Path path, WarningSeverity severity, String errorMessage, Predicate<Collection<? extends T>> predicate, Function<T, V> elementGetter) { super(path, severity, errorMessage, predicate); this.predicate = this::areAllUniqueValues; this.elementGetter = elementGetter; } protected String getDefaultErrorMessage() { return DUPLICATE; } private boolean areAllUniqueValues(Collection<? extends T> t) { Set<V> set = new HashSet<>(); for (T value : t) { V apply = elementGetter.apply(value); if (!set.add(apply)) { return false; } } return true; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/common/NumericRangeValidator.java
src/main/java/org/ohdsi/webapi/check/validator/common/NumericRangeValidator.java
package org.ohdsi.webapi.check.validator.common; import static org.ohdsi.webapi.check.operations.Operations.match; import java.util.Objects; import java.util.function.Function; import org.ohdsi.circe.cohortdefinition.NumericRange; import org.ohdsi.webapi.check.Comparisons; import org.ohdsi.webapi.check.validator.Context; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.warning.WarningSeverity; public class NumericRangeValidator<T extends NumericRange> extends Validator<T> { private static final String EMPTY_START_VALUE = "empty start value"; private static final String EMPTY_END_VALUE = "empty end value"; private static final String START_GREATER_THAN_END = "start value greater than end"; private static final String START_IS_NEGATIVE = "start value is negative"; public NumericRangeValidator(Path path, WarningSeverity severity, String errorMessage) { super(path, severity, errorMessage); } @Override public boolean validate(NumericRange range, Context context) { if (range == null) { return true; } Function<String, Boolean> warning = (message) -> { context.addWarning(severity, message, path); return false; }; return match(range, true) .when(Comparisons::isStartNegative) .thenReturn(x -> warning.apply(START_IS_NEGATIVE)) .when(x -> Objects.isNull(x.value)) .thenReturn(x -> warning.apply(EMPTY_START_VALUE)) .when(r -> Objects.nonNull(r.op) && r.op.endsWith("bt")) .thenReturn(r -> match(r, true) .when(x -> Objects.isNull(x.extent)) .thenReturn(x -> warning.apply(EMPTY_END_VALUE)) .when(Comparisons::startIsGreaterThanEnd) .thenReturn(x -> warning.apply(START_GREATER_THAN_END)) .value()) .value(); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/common/DateRangeValidator.java
src/main/java/org/ohdsi/webapi/check/validator/common/DateRangeValidator.java
package org.ohdsi.webapi.check.validator.common; import static org.ohdsi.webapi.check.Comparisons.isDateValid; import static org.ohdsi.webapi.check.operations.Operations.match; import java.util.Objects; import java.util.function.Function; import org.ohdsi.circe.cohortdefinition.DateRange; import org.ohdsi.webapi.check.Comparisons; import org.ohdsi.webapi.check.validator.Context; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.warning.WarningSeverity; public class DateRangeValidator<T extends DateRange> extends Validator<T> { private static final String EMPTY_START_VALUE = "empty start value"; private static final String EMPTY_END_VALUE = "empty end value"; private static final String START_GREATER_THAN_END = "start value greater than end"; private static final String DATE_IS_INVALID = "invalid date value"; public DateRangeValidator(Path path, WarningSeverity severity, String errorMessage) { super(path, severity, errorMessage); } @Override public boolean validate(DateRange range, Context context) { if (range == null) { return true; } Function<String, Boolean> warning = (message) -> { context.addWarning(severity, message, path); return false; }; return match(range, true) .when(r -> Objects.nonNull(r.value) && !isDateValid(r.value)) .thenReturn(x -> warning.apply(DATE_IS_INVALID)) .when(r -> Objects.nonNull(r.op) && r.op.endsWith("bt")) .thenReturn(r -> match(r, true) .when(x -> Objects.isNull(x.value)) .thenReturn(x -> warning.apply(EMPTY_START_VALUE)) .when(x -> Objects.isNull(x.extent)) .thenReturn(x -> warning.apply(EMPTY_END_VALUE)) .when(x -> Objects.nonNull(x.extent) && !isDateValid(x.extent)) .thenReturn(x -> warning.apply(DATE_IS_INVALID)) .when(Comparisons::startIsGreaterThanEnd) .thenReturn(x -> warning.apply(START_GREATER_THAN_END)) .value()) .orElseReturn(r -> match(r, true).when(x -> Objects.isNull(x.value)) .thenReturn(x -> warning.apply(EMPTY_START_VALUE)) .value() ).value(); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/concept/ConceptValidator.java
src/main/java/org/ohdsi/webapi/check/validator/concept/ConceptValidator.java
package org.ohdsi.webapi.check.validator.concept; import org.ohdsi.circe.vocabulary.Concept; import org.ohdsi.webapi.check.validator.Context; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.warning.WarningSeverity; import java.util.Objects; public class ConceptValidator extends Validator<Concept[]> { private static final String EMPTY = "empty"; public ConceptValidator(Path path, WarningSeverity severity, String errorMessage) { super(path, severity, errorMessage); } @Override public boolean validate(Concept[] value, Context context) { boolean isValid = true; if (Objects.nonNull(value) && value.length == 0) { context.addWarning(getSeverity(), getErrorMessage(value), path); isValid = false; } return isValid; } protected String getDefaultErrorMessage() { return EMPTY; } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false
OHDSI/WebAPI
https://github.com/OHDSI/WebAPI/blob/b22d7bf02d98c0cf78c46801877368d6ecad2245/src/main/java/org/ohdsi/webapi/check/validator/criteria/AbstractCriteriaValidator.java
src/main/java/org/ohdsi/webapi/check/validator/criteria/AbstractCriteriaValidator.java
package org.ohdsi.webapi.check.validator.criteria; import org.ohdsi.circe.cohortdefinition.CorelatedCriteria; import org.ohdsi.circe.cohortdefinition.Criteria; import org.ohdsi.circe.cohortdefinition.CriteriaGroup; import org.ohdsi.circe.cohortdefinition.DemographicCriteria; import org.ohdsi.webapi.check.builder.ValidatorGroupBuilder; import org.ohdsi.webapi.check.validator.Path; import org.ohdsi.webapi.check.validator.Validator; import org.ohdsi.webapi.check.validator.ValidatorGroup; import org.ohdsi.webapi.check.warning.WarningSeverity; import static org.ohdsi.webapi.check.checker.criteria.CorelatedCriteriaHelper.prepareCorelatedCriteriaBuilder; import static org.ohdsi.webapi.check.checker.criteria.CriteriaGroupHelper.prepareCriteriaGroupArrayBuilder; import static org.ohdsi.webapi.check.checker.criteria.CriteriaGroupHelper.prepareCriteriaGroupBuilder; import static org.ohdsi.webapi.check.checker.criteria.CriteriaHelper.prepareCriteriaBuilder; import static org.ohdsi.webapi.check.checker.criteria.DemographicHelper.prepareDemographicBuilder; public abstract class AbstractCriteriaValidator<T> extends Validator<T> { public AbstractCriteriaValidator(Path path, WarningSeverity severity, String errorMessage) { super(path, severity, errorMessage); } protected ValidatorGroup<CriteriaGroup, DemographicCriteria[]> getDemographicCriteriaValidator() { ValidatorGroupBuilder<CriteriaGroup, DemographicCriteria[]> builder = prepareDemographicBuilder(); builder.basePath(this.path); return builder.build(); } protected ValidatorGroup<CriteriaGroup, CriteriaGroup[]> getCriteriaGroupArrayValidator() { ValidatorGroupBuilder<CriteriaGroup, CriteriaGroup[]> builder = prepareCriteriaGroupArrayBuilder(); builder.basePath(this.path); return builder.build(); } protected ValidatorGroup<Criteria, CriteriaGroup> getCriteriaGroupValidator() { ValidatorGroupBuilder<Criteria, CriteriaGroup> builder = prepareCriteriaGroupBuilder(); builder.basePath(this.path); return builder.build(); } protected ValidatorGroup<CriteriaGroup, CorelatedCriteria[]> getCorelatedCriteriaValidator() { ValidatorGroupBuilder<CriteriaGroup, CorelatedCriteria[]> builder = prepareCorelatedCriteriaBuilder(); builder.basePath(this.path); return builder.build(); } protected ValidatorGroup<CorelatedCriteria, Criteria> getCriteriaValidator() { ValidatorGroupBuilder<CorelatedCriteria, Criteria> builder = prepareCriteriaBuilder(); builder.basePath(this.path); return builder.build(); } }
java
Apache-2.0
b22d7bf02d98c0cf78c46801877368d6ecad2245
2026-01-05T02:37:20.475642Z
false