diff --git a/pom.xml b/pom.xml index 34b744ba2..a0e021a28 100644 --- a/pom.xml +++ b/pom.xml @@ -133,7 +133,7 @@ gov.cms.madie madie-java-models - 0.6.73-SNAPSHOT + 0.6.74-SNAPSHOT gov.cms.madie @@ -162,7 +162,7 @@ gov.cms.madie.packaging packaging-utility - 0.2.5 + 0.2.6 org.springdoc diff --git a/src/main/java/cms/gov/madie/measure/services/VersionService.java b/src/main/java/cms/gov/madie/measure/services/VersionService.java index a7ea0539d..2cc5595f9 100644 --- a/src/main/java/cms/gov/madie/measure/services/VersionService.java +++ b/src/main/java/cms/gov/madie/measure/services/VersionService.java @@ -1,9 +1,6 @@ package cms.gov.madie.measure.services; -import cms.gov.madie.measure.exceptions.BadVersionRequestException; -import cms.gov.madie.measure.exceptions.CqlElmTranslationErrorException; -import cms.gov.madie.measure.exceptions.MeasureNotDraftableException; -import cms.gov.madie.measure.exceptions.ResourceNotFoundException; +import cms.gov.madie.measure.exceptions.*; import cms.gov.madie.measure.repositories.CqmMeasureRepository; import cms.gov.madie.measure.repositories.ExportRepository; import cms.gov.madie.measure.repositories.MeasureRepository; @@ -12,6 +9,8 @@ import gov.cms.madie.models.common.Version; import gov.cms.madie.models.cqm.CqmMeasure; import gov.cms.madie.models.measure.*; +import gov.cms.madie.packaging.utils.PackagingUtility; +import gov.cms.madie.packaging.utils.PackagingUtilityFactory; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -19,6 +18,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.lang.reflect.InvocationTargetException; import java.time.Instant; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; @@ -366,8 +366,23 @@ public String generateLibraryContentLine(String cqlLibraryName, Version version) } private void saveMeasureBundle(Measure savedMeasure, String measureBundle, String username) { + String humanReadableWithCss; + try { + PackagingUtility utility = PackagingUtilityFactory.getInstance(savedMeasure.getModel()); + humanReadableWithCss = utility.getHumanReadableWithCSS(measureBundle); + } catch (InstantiationException + | IllegalAccessException + | InvocationTargetException + | NoSuchMethodException + | ClassNotFoundException e) { + throw new BundleOperationException("Measure", savedMeasure.getId(), e); + } Export export = - Export.builder().measureId(savedMeasure.getId()).measureBundleJson(measureBundle).build(); + Export.builder() + .measureId(savedMeasure.getId()) + .measureBundleJson(measureBundle) + .humanReadable(humanReadableWithCss) + .build(); Export savedExport = exportRepository.save(export); log.info( "User [{}] successfully saved versioned measure's export data with ID [{}]", diff --git a/src/main/resources/templates/HumanReadable.liquid b/src/main/resources/templates/HumanReadable.liquid deleted file mode 100644 index d2f034c9e..000000000 --- a/src/main/resources/templates/HumanReadable.liquid +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - human_readable_content_holder - - \ No newline at end of file diff --git a/src/main/resources/templates/Library.liquid b/src/main/resources/templates/Library.liquid deleted file mode 100644 index 0b34a7d9a..000000000 --- a/src/main/resources/templates/Library.liquid +++ /dev/null @@ -1,394 +0,0 @@ -
- - {% if Library.id.exists() %} - - - - - {% endif %} - {% if Library.url.exists() %} - - - - - {% endif %} - {% if Library.version.exists() %} - - - - - {% endif %} - {% for identifier in Library.identifier %} - - - - - {% endfor %} - {% if Library.name.exists() %} - - - - - {% endif %} - {% if Library.title.exists() %} - - - - - {% endif %} - {% if Library.subtitle.exists() %} - - - - - {% endif %} - {% if Library.status.exists() %} - - - - - {% endif %} - {% if Library.experimental.exists() %} - - - - - {% endif %} - {% if Library.type.exists() %} - - - - - {% endif %} - {% if Library.subject.exists() %} - - - {%if Library.subject is CodeableConcept %} - - {% endif %} - {% if Library.subject is Reference %} - - {% endif %} - - {% endif %} - {% if Library.date.exists() %} - - - - - {% endif %} - {% if Library.publisher.exists() %} - - - - - {% endif %} - {% if Library.description.exists() %} - - - - - {% endif %} - {% if Library.extension.where(url = 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability').exists() %} - - - - - {% endif %} - {% if Library.extension.where(url = 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeRepresentationLevel').exists() %} - - - - - {% endif %} - {% if Library.useContext.exists() %} - - - - - {% endif %} - {% if Library.jurisdiction.exists() %} - - - - - {% endif %} - {% if Library.purpose.exists() %} - - - - - {% endif %} - {% if Library.usage.exists() %} - - - - - {% endif %} - {% if Library.copyright.exists() %} - - - - - {% endif %} - {% if Library.approvalDate.exists() %} - - - - - {% endif %} - {% if Library.lastReviewDate.exists() %} - - - - - {% endif %} - {% if Library.effectivePeriod.exists() %} - - - - - {% endif %} - {% if Library.relatedArtifact.exists() %} - - - - - {% endif %} - {% if Library.parameter.exists() %} - - - - - {% endif %} - {% if Library.dataRequirement.exists() %} - - - - - {% endif %} - {% for c in Library.content %} - {% if c.contentType = 'text/cql' %} - - - - {% endif %} - {% if c.contentType != 'text/cql' %} - - - - {% endif %} - {% endfor %} -
Id: {{Library.id}}
Url: {{Library.url}}
Version: {{Library.version}}
Identifier: - {% if identifier.type.exists() %} -

- type: {{identifier.type.value}} -

- {% endif %} - {% if identifier.value.exists() %} -

- value: {{identifier.value}} -

- {% endif %} -
Name: {{Library.name}}
Title: {{Library.title.escape('html')}}
Subtitle: {{Library.subtitle.escape('html')}}
Status: {{Library.status.value}}
Experimental: {{Library.experimental.value}}
Type: - {% if Library.type.coding.exists() %} - {% for coding in Library.type.coding %} - {% if coding.system.exists() %} -

- system: {{coding.system}} -

- {% endif %} - {% if coding.code.exists() %} -

- code: {{coding.code}} -

- {% endif %} - {% if coding.display.exists() %} -

- display: {{coding.display.escape('html')}} -

- {% endif %} - {% endfor %} - {% endif %} - {% if Library.type.coding.exists().not and Library.type.text.exists() %} - {{Library.type.text}} - {% endif %} -
Subject: - {% if Library.subject.coding.exists() %} - {% for coding in Library.subject.coding %} - {% if coding.system.exists() %} -

- system: {{coding.system}} -

- {% endif %} - {% if coding.code.exists() %} -

- code: {{coding.code}} -

- {% endif %} - {% if coding.display.exists() %} -

- display: {{coding.display.escape('html')}} -

- {% endif %} - {% endfor %} - {% endif %} - {% if Library.subject.coding.exists().not and Library.subject.text.exists() %} - {{Library.subject.text}} - {% endif %} -
- {% if Library.subject.reference.exists() %} -

- reference: {{Library.subject.reference}} -

- {% endif %} - {% if Library.subject.type.exists() %} -

- type: {{Library.subject.type}} -

- {% endif %} - {% if Library.subject.display.exists() %} -

- code: {{Library.subject.display.escape('html')}} -

- {% endif %} -
Date: {{Library.date}}
Publisher: {{Library.publisher.escape('html')}}
Description: {{Library.description.escape('html')}}
Knowledge Capability: - {% for extension in Library.extension.where(url = 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability') %}{{extension.value}} {% endfor %} -
Knowledge Representation Level: - {% for extension in Library.extension.where(url = 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeRepresentationLevel') %}{{extension.value}}{% endfor %} -
Use Context: - - - {% for useContext in Library.useContext %} - - - - - - {% endfor %} -
codevaluedisplay
{{useContext.code.code}}{{useContext.value.coding.first().code}}{{useContext.value.coding.first().display.escape('html')}}
-
Jurisdiction: {{Library.jurisdiction.first().coding.first().code}}
Purpose: {{Library.purpose.escape('html')}}
Usage: {{Library.usage.escape('html')}}
Copyright: {{Library.copyright.escape('html')}}
Approval Date: {{Library.approvalDate}}
Last Review Date: {{Library.lastReviewDate}}
Effective Period: {{Library.effectivePeriod.start}}..{{Library.effectivePeriod.end}}
Related Artifacts: - {% if Library.relatedArtifact.where(type = 'documentation' or type = 'justification').exists() %} -

Documentation

- - {% endif %} - {% if Library.relatedArtifact.where(type = 'citation').exists() %} -

References

-
    - {% for artifact in Library.relatedArtifact.where(type = 'citation') %} -
  • {{artifact.citation}}
    {{artifact.url}}
  • - {% endfor %} -
- {% endif %} - {% if Library.relatedArtifact.where(type = 'depends-on').exists() %} -

Dependencies

-
    - {% for artifact in Library.relatedArtifact.where(type = 'depends-on') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} - {% if Library.relatedArtifact.where(type = 'composed-of').exists() %} -

Components

-
    - {% for artifact in Library.relatedArtifact.where(type = 'composed-of') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} - {% if Library.relatedArtifact.where(type = 'derived-from').exists() %} -

Derived From

-
    - {% for artifact in Library.relatedArtifact.where(type = 'derived-from') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} - {% if Library.relatedArtifact.where(type = 'successor').exists() %} -

Successor

-
    - {% for artifact in Library.relatedArtifact.where(type = 'successor') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} - {% if Library.relatedArtifact.where(type = 'predecessor').exists() %} -

Predecessor

-
    - {% for artifact in Library.relatedArtifact.where(type = 'predecessor') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} -
Parameters: - - - {% for param in Library.parameter %} - - {% endfor %} -
NameTypeMinMaxIn/Out
{{param.name}}{{param.type}}{{param.min}}{{param.max}}{{param.use}}
-
Data Requirements: - - - {% for requirement in Library.dataRequirement %} - - - - - - - {% endfor %} -
TypeProfileMSCode Filter
{{requirement.type.value}}{% for profile in requirement.profile %}{{profile.value}}{% endfor %}{% for support in requirement.mustSupport %}{{mustSupport}};{% endfor %} - {% for cfilter in requirement.codeFilter %} - code filter: - {% if cfilter.path.exists() or cfilter.valueSet.exists() or cfilter.code.exists() %} -
- {% endif %} - {% if cfilter.path.exists() %} - - path: {{cfilter.path}} - - {% if cfilter.valueSet.exists() or cfilter.code.exists() %} -
- {% endif %} - {% endif %} - {% if cfilter.valueSet.exists() %} - - value set: {{cfilter.valueSet.value}} - - {% endif %} - {% for coding in cfilter.code %} - {% if coding.system.exists() %} -

- system: {{coding.system}} -

- {% endif %} - {% if coding.code.exists() %} -

- code: {{coding.code}} -

- {% endif %} - {% if coding.display.exists() %} -

- display: {{coding.display.escape('html')}} -

- {% endif %} - {% endfor %} - {% endfor %} -
-
- - - -
Content: {{c.contentType}}
{{c.data.decode('base64').escape('html')}}
-
- - - -
Content: {{c.contentType}}
{{'Encoded data (' + c.data.length().toString() + ' characters)'}}
-
-
\ No newline at end of file diff --git a/src/main/resources/templates/Measure.liquid b/src/main/resources/templates/Measure.liquid deleted file mode 100644 index e366966ce..000000000 --- a/src/main/resources/templates/Measure.liquid +++ /dev/null @@ -1,707 +0,0 @@ -
- - {% if Measure.id.exists() %} - - - - - - - - - {% endif %} - {% if Measure.url.exists() %} - - - - - {% endif %} - {% if Measure.version.exists() %} - - - - - {% endif %} - {% for identifier in Measure.identifier %} - - - - - {% endfor %} - {% if Measure.name.exists() %} - - - - - {% endif %} - {% if Measure.title.exists() %} - - - - - {% endif %} - {% if Measure.subtitle.exists() %} - - - - - {% endif %} - {% if Measure.status.exists() %} - - - - - {% endif %} - {% if Measure.experimental.exists() %} - - - - - {% endif %} - {% if Measure.scoring.exists() %} - - - - - {% endif %} - {% if Measure.improvementNotation.exists() %} - - - - - {% endif %} - {% if Measure.type.exists() %} - - - - - {% endif %} - {% if Measure.subject.exists() %} - - - {%if Measure.subject is CodeableConcept %} - - {% endif %} - {% if Measure.subject is Reference %} - - {% endif %} - - {% endif %} - {% if Measure.date.exists() %} - - - - - {% endif %} - {% if Measure.publisher.exists() %} - - - - - {% endif %} - {% if Measure.description.exists() %} - - - - - {% endif %} - {% if Measure.group.exists() %} - {% if Measure.group[0].population.description.exists() %} - - - - - {% endif %} - {% endif %} - {% if Measure.extension.where(url = 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability').exists() %} - - - - - {% endif %} - {% if Measure.extension.where(url = 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeRepresentationLevel').exists() %} - - - - - {% endif %} - {% if Measure.useContext.exists() %} - - - - - {% endif %} - {% if Measure.jurisdiction.exists() %} - - - - - {% endif %} - {% if Measure.topic.exists() %} - - - - - {% endif %} - {% if Measure.purpose.exists() %} - - - - - {% endif %} - {% if Measure.usage.exists() %} - - - - - {% endif %} - {% if Measure.copyright.exists() %} - - - - - {% endif %} - {% if Measure.disclaimer.exists() %} - - - - - {% endif %} - {% if Measure.approvalDate.exists() %} - - - - - {% endif %} - {% if Measure.lastReviewDate.exists() %} - - - - - {% endif %} - {% if Measure.effectivePeriod.exists() %} - - - - - {% endif %} - {% if Measure.relatedArtifact.exists() %} - - - - - {% endif %} - {% if Measure.library.exists() %} - - - - - {% endif %} - {% if Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-effectiveDataRequirements').exists() %} - {% for contained in Measure.contained.where(id = 'effective-data-requirements') %} - - - - - - - - - - - - - {% if contained.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode').exists() %} - - - - - {% endif %} - {% if contained.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition').exists() %} - - - - - {% endif %} - {% endfor %} - {% else %} - {% if Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-dataRequirement').exists() %} - {% if Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-parameter').exists() %} - - - - - {% endif %} - {% if Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-dataRequirement').exists() %} - - - - - {% endif %} - {% if Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode').exists() %} - - - - - {% endif %} - {% if Measure.group.exists() %} - - - - - {% endif %} - {% if Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition').exists() %} - - - - - {% endif %} - {% endif %} - {% endif %} - {% if Measure.supplementalData.usage.coding.where(code = 'supplemental-data').exists() %} - - - - - {% endif %} - {% if Measure.supplementalData.usage.coding.where(code = 'risk-adjustment-factor').exists() %} - {% for supplementalData in Measure.supplementalData.where(usage.coding.where(code = 'risk-adjustment-factor').exists()) %} - - - - - {% endfor %} - {% endif %} -
Id: {{Measure.id}}
Download cql: Library-{{Measure.id}}.cql
Url: {{Measure.url}}
Version: {{Measure.version}}
Identifier: - {% if identifier.type.exists() %} -

- type: {{identifier.type.text}} -

- {% endif %} - {% if identifier.value.exists() %} -

- value: {{identifier.value}} -

- {% endif %} -
Name: {{Measure.name}}
Title: {{Measure.title}}
Subtitle: {{Measure.subtitle}}
Status: {{Measure.status.value}}
Experimental: {{Measure.experimental.value}}
Scoring: - {% if Measure.scoring.coding.exists() %} - {% for coding in Measure.scoring.coding %} -

- {{iif(coding.display.exists(), coding.display, coding.code)}} {{iif(coding.system != 'http://terminology.hl7.org/CodeSystem/measure-scoring', '(' + coding.system + ')', '')}} -

- {% endfor %} - {% endif %} - {% if Measure.scoring.coding.exists().not and Measure.scoring.text.exists() %} - {{Measure.scoring.text}} - {% endif %} -
Improvement Notation: - {% if Measure.improvementNotation.coding.exists() %} - {% for coding in Measure.improvementNotation.coding %} -

- {{iif(coding.display.exists(), coding.display, coding.code)}} {{iif(coding.system != 'http://terminology.hl7.org/CodeSystem/measure-improvement-notation', '(' + coding.system + ')', '')}} -

- {% endfor %} - {% endif %} - {% if Measure.improvementNotation.coding.exists().not and Measure.improvementNotation.text.exists() %} - {{Measure.improvementNotation.text}} - {% endif %} -
Type: - {% if Measure.type.coding.exists() %} - {% for coding in Measure.type.coding %} -

- {{iif(coding.display.exists(), coding.display, coding.code)}} {{iif(coding.system != 'http://terminology.hl7.org/CodeSystem/measure-type', '(' + coding.system + ')', '')}} -

- {% endfor %} - {% endif %} - {% if Measure.type.coding.exists().not and Measure.type.text.exists() %} - {{Measure.type.text}} - {% endif %} -
Subject: - {% if Measure.subject.coding.exists() %} - {% for coding in Measure.subject.coding %} -

- {{iif(coding.display.exists(), coding.display, coding.code)}} {{iif(coding.system.exists(), '(' + coding.system + ')', '')}} -

- {% endfor %} - {% endif %} - {% if Measure.subject.coding.exists().not and Measure.subject.text.exists() %} - {{Measure.subject.text}} - {% endif %} -
- {% if Measure.subject.reference.exists() %} -

- reference: {{Measure.subject.reference}} -

- {% endif %} - {% if Measure.subject.type.exists() %} -

- type: {{Measure.subject.type}} -

- {% endif %} - {% if Measure.subject.display.exists() %} -

- code: {{Measure.subject.display}} -

- {% endif %} -
Date: {{Measure.date}}
Publisher: {{Measure.publisher.escape('html')}}
Description: {{Measure.description.escape('html')}}
Population Criteria: - {% for group in Measure.group %} - - {% if group.id.exists() %} - - - - {% endif %} - {% for population in group.population %} - - - - - {% endfor %} -
{{group.id}}
{{population.code.coding[0].display}}: {{population.description.escape('html')}}
- {% endfor %} -
Knowledge Capability: - {% for extension in Measure.extension.where(url = 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability') %}{{extension.value}} {% endfor %} -
Knowledge Representation Level: - {% for extension in Measure.extension.where(url = 'http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeRepresentationLevel') %}{{extension.value}}{% endfor %} -
Use Context: - - - {% for useContext in Measure.useContext %} - - - - - {% endfor %} -
codevalue
{{useContext.code.code}}{{useContext.value.text}}
-
Jurisdiction: {{Measure.jurisdiction.first().coding.first().code}}
Topic: {{Measure.topic.first().coding.first().code}}
Purpose: {{Measure.purpose.escape('html')}}
Usage: {{Measure.usage.escape('html')}}
Copyright: {{Measure.copyright.escape('html')}}
Disclaimer: {{Measure.disclaimer.escape('html')}}
Approval Date: {{Measure.approvalDate}}
Last Review Date: {{Measure.lastReviewDate}}
Effective Period: {{Measure.effectivePeriod.start}}..{{Measure.effectivePeriod.end}}
Related Artifacts: - {% if Measure.relatedArtifact.where(type = 'documentation' or type = 'justification').exists() %} -

Documentation

- - {% endif %} - {% if Measure.relatedArtifact.where(type = 'citation').exists() %} -

References

-
    - {% for artifact in Measure.relatedArtifact.where(type = 'citation') %} -
  • {{artifact.citation}}
    {{artifact.url}}
  • - {% endfor %} -
- {% endif %} - {% if Measure.relatedArtifact.where(type = 'depends-on').exists() and - Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-effectiveDataRequirements').exists().not %} -

Dependencies

-
    - {% for artifact in Measure.relatedArtifact.where(type = 'depends-on') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} - {% if Measure.relatedArtifact.where(type = 'composed-of').exists() %} -

Components

-
    - {% for artifact in Measure.relatedArtifact.where(type = 'composed-of') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} - {% if Measure.relatedArtifact.where(type = 'derived-from').exists() %} -

Derived From

-
    - {% for artifact in Measure.relatedArtifact.where(type = 'derived-from') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} - {% if Measure.relatedArtifact.where(type = 'successor').exists() %} -

Successor

-
    - {% for artifact in Measure.relatedArtifact.where(type = 'successor') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} - {% if Measure.relatedArtifact.where(type = 'predecessor').exists() %} -

Predecessor

-
    - {% for artifact in Measure.relatedArtifact.where(type = 'predecessor') %} -
  • {{artifact.resource}}
  • - {% endfor %} -
- {% endif %} -
Libraries: - - {% for library in Measure.library %} - - {% endfor %} -
{{library}}
-
Related Artifact Dependencies: - {% for relatedArtifact in contained.relatedArtifact.where(type= 'depends-on') %} -
  • {{relatedArtifact.resource}}
  • - {% endfor %} -
    Parameters: - - - {% for parameter in contained.parameter %} - - - - - - - - {% endfor %} -
    nameuseminmaxtype
    {{parameter.name}}{{parameter.use}}{{parameter.min}}{{parameter.max}}{{parameter.type}}
    -
    DataRequirements: - - - {% for dataRequirement in contained.dataRequirement %} - - - - - - - {% endfor %} -
    TypeMust SupportValueset NameValueset
    {{dataRequirement.type}} - {% for mustSupport in dataRequirement.mustSupport %} - {{ mustSupport }} - {% endfor %} - - {% for relatedArtifact in contained.relatedArtifact.where(resource = dataRequirement.codeFilter.first().valueSet) %} - {% if relatedArtifact.display.startsWith("Value set ") %} - {{ relatedArtifact.display.substring(9).replace(' &', ',') }} - {% else %} - {{ relatedArtifact.display.replace(' &', ',') }} - {% endif %} - {% endfor %} - {{dataRequirement.codeFilter.first().valueSet}}
    -
    Direct Reference Codes: - - - {% for extension in contained.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode') %} - - - - - - {% endfor %} -
    displaycodesystem
    {{extension.value.display}}{{extension.value.code}}{{extension.value.system}}
    -
    Logic Definitions: - {% if Measure.group.exists() %} - - - - - - {% for group in Measure.group %} - - - {% for population in group.population %} - - - - - {% endfor %} - - {% endfor %} - -
    GroupScoringPopulation CriteriaExpression
    {{ group.id }} - {% if group.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring').exists() %} - Group scoring: - {% for extension in group.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring') %} - {{ extension.value.coding.code }} - {% endfor %} - {% endif %} - {% if Measure.scoring.exists() %} - Measure scoring: - {% for coding in Measure.scoring.coding %} -

    - {{iif(coding.display.exists(), coding.display, coding.code)}} -

    - {% endfor %} - {% endif %} -
    - - {{ population.code.first().coding.first().display }} - {% if population.criteria.expression %} -
    {{ (Measure.contained.where(id = 'effective-data-requirements').extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition' and extension.where(url = 'name' and value = population.criteria.expression)).extension.where(url = 'statement').value).escape('html') }}
    - {% endif %} -
    - {% endif %} - - {% for extension in contained.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition') %} - - - {% for lNameExtension in extension.extension.where(url = 'libraryName') %} - - {% endfor %} - {% for nameExtension in extension.extension.where(url = 'name') %} - - {% endfor %} - - - {% for statementExtension in extension.extension.where(url = 'statement') %} - - - {% endfor %} - - {% endfor %} -
    Library NameName
    {{lNameExtension.value}}{{nameExtension.value}}
    {{statementExtension.value.escape('html')}}
    -
    Parameters: - - - {% for extension in Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-parameter') %} - - - - - - - - {% endfor %} -
    nameuseminmaxtype
    {{extension.value.name}}{{extension.value.use}}{{extension.value.min}}{{extension.value.max}}{{extension.value.type}}
    -
    Data Requirements: - - - {% for extension in Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-dataRequirement') %} - - - - {% if extension.value.codeFilter.first().valueSet.exists() %} - - - {% endif%} - {% if extension.value.codeFilter.first().code.exists() %} - - - {% endif%} - - {% endfor %} -
    typepathvalueSet or systemcode
    {{extension.value.type}}{{extension.value.codeFilter.first().path}}{{extension.value.codeFilter.first().valueSet}}{{extension.value.codeFilter.first().code.first().system}}{{extension.value.codeFilter.first().code.first().code}}
    -
    Direct Reference Codes: - - - {% for extension in Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode') %} - - - - - - {% endfor %} -
    displaycodesystem
    {{extension.value.display}}{{extension.value.code}}{{extension.value.system}}
    -
    Populations: - - - {% for group in Measure.group %} - - - {% for population in group.population %} - - - - - {% endfor %} - - {% endfor %} -
    GroupPopulationDescription
    {{group.id}}
    - {{population.code.first().coding.first().display}} - {% if population.description %} - {{(population.description.escape('html'))}} - {% endif %} -
    -
    Logic Definitions: - {% if Measure.group.exists() %} - - - - - - {% for group in Measure.group %} - - - {% for population in group.population %} - - - - - {% endfor %} - - {% endfor %} - -
    GroupScoringPopulation CriteriaExpression
    {{ group.id }} - {% if group.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring').exists() %} - Group scoring: - {% for extension in group.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring') %} - {{ extension.value.coding.code }} - {% endfor %} - {% endif %} - {% if Measure.scoring.exists() %} - Measure scoring: - {% for coding in Measure.scoring.coding %} -

    - {{iif(coding.display.exists(), coding.display, coding.code)}} -

    - {% endfor %} - {% endif %} -
    - - {{ population.code.first().coding.first().display }} - {% if population.criteria.expression %} -
    {{ (Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition' and extension.where(url = 'name' and value = population.criteria.expression)).extension.where(url = 'statement').value) }}
    - {% endif %} -
    - {% endif %} - {% for extension in Measure.extension.where(url = 'http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition') %} - - - - {% for lNameExtension in extension.extension.where(url = 'libraryName') %} - - {% endfor %} - {% for nameExtension in extension.extension.where(url = 'name') %} - - {% endfor %} - -
    Library NameName
    {{lNameExtension.value}}{{nameExtension.value}}
    - {% for statementExtension in extension.extension.where(url = 'statement') %} -
    {{statementExtension.value.escape('html')}}
    - {% endfor %} -

    - {% endfor %} -
    Supplemental Data Elements: - {% for supplementalData in Measure.supplementalData.where(usage.coding.where(code = 'supplemental-data').exists()) %} - {% if supplementalData.code.exists() %} - {{iif(supplementalData.code.text.exists(), supplementalData.code.text, iif(supplementalData.code.coding.first().display.exists(), supplementalData.code.coding.first().display, supplementalData.code.coding.first().code))}} - {% else %} - {%if supplementalData.description.exists() %} - {{supplementalData.description.escape('html')}} - {% else %} - {%if supplementalData.criteria.description.exists() %} - {{supplementalData.criteria.description.escape('html')}} - {% else %} - {{supplementalData.criteria.expression}} - {% endif %} - {% endif %} - {% endif %} - {% endfor %} -
    Risk Adjustment Factor: -

    - {% if supplementalData.code.exists() %} - {{iif(supplementalData.code.text.exists(), supplementalData.code.text, iif(supplementalData.code.coding.first().display.exists(), supplementalData.code.coding.first().display, supplementalData.code.coding.first().code))}} - {% else %} - {%if supplementalData.description.exists() %} - {{supplementalData.description.escape('html')}} - {% else %} - {%if supplementalData.criteria.description.exists() %} - {{supplementalData.criteria.description.escape('html')}} - {% else %} - {{supplementalData.criteria.expression}} - {% endif %} - {% endif %} - {% endif %} -

    -
    -
    \ No newline at end of file diff --git a/src/test/java/cms/gov/madie/measure/services/VersionServiceTest.java b/src/test/java/cms/gov/madie/measure/services/VersionServiceTest.java index 4323a65fc..34c2bf0d4 100644 --- a/src/test/java/cms/gov/madie/measure/services/VersionServiceTest.java +++ b/src/test/java/cms/gov/madie/measure/services/VersionServiceTest.java @@ -50,33 +50,25 @@ public class VersionServiceTest { @Mock private MeasureRepository measureRepository; @Mock private CqmMeasureRepository cqmMeasureRepository; + @Mock private ExportRepository exportRepository; @Mock ActionLogService actionLogService; - - @Mock ElmTranslatorClient elmTranslatorClient; - - @Mock FhirServicesClient fhirServicesClient; - - @Mock ExportRepository exportRepository; - @Mock MeasureService measureService; - - @Mock QdmPackageService qdmPackageService; - @Mock ExportService exportService; - @Mock TestCaseSequenceService sequenceService; + @Mock QdmPackageService qdmPackageService; @Mock AppConfigService appConfigService; - @Mock ElmToJsonService elmToJsonService; - @InjectMocks VersionService versionService; + @Mock ElmTranslatorClient elmTranslatorClient; + @Mock FhirServicesClient fhirServicesClient; @Captor private ArgumentCaptor measureCaptor; @Captor private ArgumentCaptor cqmMeasureCaptor; - @Captor private ArgumentCaptor exportArgumentCaptor; + @InjectMocks VersionService versionService; + private final String ELMJON_ERROR = "{\n" + "\"errorExceptions\" : \n" + "[ {\"error\":\"error translating cql\" } ]\n" + "}"; private final String ELMJON_NO_ERROR = "{\n" + "\"errorExceptions\" : \n" + "[]\n" + "}"; @@ -443,7 +435,7 @@ public void testCreateVersionMajorSuccess() throws Exception { .measureSetId("testMeasureSetId") .createdBy("testUser") .cql("library Test1CQLLib version '2.3.001'") - .model(ModelType.QDM_5_6.getValue()) + .model(ModelType.QI_CORE.getValue()) .measureSet(measureSet) .build(); MeasureMetaData metaData = new MeasureMetaData(); @@ -470,16 +462,20 @@ public void testCreateVersionMajorSuccess() throws Exception { updatedMeasure.setMeasureMetaData(updatedMetaData); when(measureRepository.save(any(Measure.class))).thenReturn(updatedMeasure); + String measureBundleJson = + """ + {"resourceType": "Bundle","entry": [ { + "resource": { + "resourceType": "Measure","text":{"div":"humanReadable"}}}]}"""; Export measureExport = Export.builder() .id("testId") .measureId("testMeasureId") - .measureBundleJson("test measure json") + .measureBundleJson(measureBundleJson) .build(); when(exportRepository.save(any(Export.class))).thenReturn(measureExport); when(fhirServicesClient.getMeasureBundle(any(), anyString(), anyString())) - .thenReturn("test measure json"); - + .thenReturn(measureBundleJson); versionService.createVersion("testMeasureId", "MAJOR", "testUser", "accesstoken"); verify(measureRepository, times(1)).save(measureCaptor.capture()); @@ -564,7 +560,7 @@ public void testCreateFhirVersionPatchSuccess() throws Exception { FhirMeasure.builder() .id("testMeasureId") .measureSetId("testMeasureSetId") - .model(ModelType.QDM_5_6.getValue()) + .model(ModelType.QI_CORE_6_0_0.getValue()) .createdBy("testUser") .cql("library Test1CQLLib version '2.3.001'") .measureSet(measureSet) @@ -595,15 +591,20 @@ public void testCreateFhirVersionPatchSuccess() throws Exception { updatedMeasure.setMeasureMetaData(updatedMetaData); when(measureRepository.save(any(Measure.class))).thenReturn(updatedMeasure); + String measureBundleJson = + """ + {"resourceType": "Bundle","entry": [ { + "resource": { + "resourceType": "Measure","text":{"div":"humanReadable"}}}]}"""; Export measureExport = Export.builder() .id("testId") .measureId("testMeasureId") - .measureBundleJson("test measure json") + .measureBundleJson(measureBundleJson) .build(); when(exportRepository.save(any(Export.class))).thenReturn(measureExport); when(fhirServicesClient.getMeasureBundle(any(), anyString(), anyString())) - .thenReturn("test measure json"); + .thenReturn(measureBundleJson); versionService.createVersion("testMeasureId", "PATCH", "testUser", "accesstoken");