Skip to content

Commit

Permalink
MAT-6901 observation associations for ratio and cv
Browse files Browse the repository at this point in the history
  • Loading branch information
adongare committed Mar 8, 2024
1 parent f6441bc commit b6f5e36
Show file tree
Hide file tree
Showing 4 changed files with 625 additions and 584 deletions.
22 changes: 22 additions & 0 deletions src/main/java/generated/gov/cms/madie/simplexml/ClauseType.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* <element name="cqlaggfunction" type="{}cqlaggfunctionType" minOccurs="0"/>
* </choice>
* </sequence>
* <attribute name="associatedPopulationUUID" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="displayName" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="isInGrouping" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
Expand All @@ -44,6 +45,9 @@ public class ClauseType {
protected CqldefinitionType cqldefinition;
protected CqlaggfunctionType cqlaggfunction;

@XmlAttribute(name = "associatedPopulationUUID")
protected String associatedPopulationUUID;

@XmlAttribute(name = "displayName")
protected String displayName;

Expand Down Expand Up @@ -92,6 +96,24 @@ public void setCqlaggfunction(CqlaggfunctionType value) {
this.cqlaggfunction = value;
}

/**
* Gets the value of the associatedPopulationUUID property.
*
* @return possible object is {@link String }
*/
public String getAssociatedPopulationUUID() {
return associatedPopulationUUID;
}

/**
* Sets the value of the associatedPopulationUUID property.
*
* @param value allowed object is {@link String }
*/
public void setAssociatedPopulationUUID(String value) {
this.associatedPopulationUUID = value;
}

/**
* Gets the value of the displayName property.
*
Expand Down
23 changes: 19 additions & 4 deletions src/main/java/gov/cms/madie/services/MeasureMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,20 @@ default List<ClauseType> groupToClauseTypes(Group group, CqlLookups cqlLookups)
observation -> {
CQLDefinition cqlDefinition =
getCqlDefinition(observation.getDefinition(), cqlDefinitions);
return observationToClauseType(observation, cqlDefinition);
String associatedPopulationUUID = "";
if ("Ratio".equals(group.getScoring())) {
Population associatedPopulation =
group.getPopulations().stream()
.filter(
population ->
population.getId().equals(observation.getCriteriaReference()))
.findFirst()
.orElse(null);
associatedPopulationUUID =
associatedPopulation != null ? associatedPopulation.getId() : "";
}
return observationToClauseType(
observation, cqlDefinition, associatedPopulationUUID);
})
.toList());
}
Expand Down Expand Up @@ -218,7 +231,7 @@ default CQLDefinition getCqlDefinition(String definition, Set<CQLDefinition> cql
target = "isInGrouping",
expression =
"java(String.valueOf(org.apache.commons.lang3.StringUtils.isNotBlank(population.getDefinition())))")
@Mapping(target = "uuid", expression = "java(java.util.UUID.randomUUID().toString())")
@Mapping(target = "uuid", source = "population.id")
@Mapping(
target = "cqldefinition",
expression = "java(populationToCqlDefinition(population, cqlDefinition))")
Expand All @@ -237,13 +250,15 @@ default CQLDefinition getCqlDefinition(String definition, Set<CQLDefinition> cql
target = "isInGrouping",
expression =
"java(String.valueOf(org.apache.commons.lang3.StringUtils.isNotBlank(observation.getDefinition())))")
@Mapping(target = "uuid", expression = "java(java.util.UUID.randomUUID().toString())")
@Mapping(target = "uuid", source = "observation.id")
@Mapping(target = "type", constant = "measureObservation")
@Mapping(target = "displayName", constant = "Measure Observation")
@Mapping(target = "associatedPopulationUUID", source = "associatedPopulationUUID")
@Mapping(
target = "cqlaggfunction",
expression = "java(observationToCqlAggFunction(observation, cqlDefinition))")
ClauseType observationToClauseType(MeasureObservation observation, CQLDefinition cqlDefinition);
ClauseType observationToClauseType(
MeasureObservation observation, CQLDefinition cqlDefinition, String associatedPopulationUUID);

@Mapping(target = "displayName", source = "observation.aggregateMethod")
@Mapping(
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/schemas/SimpleXML-QDM-5-6.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
<xs:element type="cqlaggfunctionType" name="cqlaggfunction" minOccurs="0"/>
</xs:choice>
</xs:sequence>
<xs:attribute type="xs:string" name="associatedPopulationUUID"/>
<xs:attribute type="xs:string" name="displayName"/>
<xs:attribute type="xs:string" name="isInGrouping"/>
<xs:attribute type="xs:string" name="type"/>
Expand Down
Loading

0 comments on commit b6f5e36

Please sign in to comment.