Skip to content

Commit

Permalink
Merge pull request #247 from MeasureAuthoringTool/feature/mat-7437-im…
Browse files Browse the repository at this point in the history
…provement-notation-desc-validation

[MAT-7437] Enforce non-blank Improvement Notation Description for QDM Measures when Improvement Notation is set to 'Other'
  • Loading branch information
jkotanchik-SB authored Oct 10, 2024
2 parents 00e7ca2 + 69f6dc8 commit b322fd3
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>gov.cms.madie</groupId>
<artifactId>madie-java-models</artifactId>
<version>0.6.65-SNAPSHOT</version>
<version>0.6.66-SNAPSHOT</version>
<name>madie-java-models</name>
<description>Java based models for MADiE microservices</description>
<properties>
Expand Down Expand Up @@ -72,6 +72,11 @@
<artifactId>jackson-databind</artifactId>
<version>${fasterxml.jackson.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.17.0</version>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/gov/cms/madie/models/measure/QdmMeasure.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.fasterxml.jackson.annotation.JsonTypeName;
import gov.cms.madie.models.validators.ValidMeasureScoring;
import gov.cms.madie.models.validators.ValidOtherImprovementNotation;
import gov.cms.madie.models.validators.ValidQDMGroupScoring;
import lombok.Builder;
import lombok.Data;
Expand All @@ -18,6 +19,7 @@
@ToString(callSuper = true)
@ValidMeasureScoring
@ValidQDMGroupScoring
@ValidOtherImprovementNotation
public class QdmMeasure extends Measure {

private String scoring;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package gov.cms.madie.models.validators;

import gov.cms.madie.models.measure.*;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

@Slf4j
public class OtherImprovementNotationValidator
implements ConstraintValidator<ValidOtherImprovementNotation, QdmMeasure> {

@Override
public boolean isValid(QdmMeasure measure, ConstraintValidatorContext context) {
if (StringUtils.equalsIgnoreCase(measure.getImprovementNotation(), "Other")) {
return StringUtils.isNotBlank(measure.getImprovementNotationDescription());
}
return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package gov.cms.madie.models.validators;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = OtherImprovementNotationValidator.class)
@Documented
public @interface ValidOtherImprovementNotation {

String message() default "Improvement Notation Description is required when Other is selected";

Class<?>[] groups() default {};

Class<? extends Payload>[] payload() default {};
}

0 comments on commit b322fd3

Please sign in to comment.