Skip to content

Commit

Permalink
Add CPG Feature expression to generated items (#389)
Browse files Browse the repository at this point in the history
Add CPG Feature expression to the list of extensions to copy from input to questionnaire item
  • Loading branch information
barhodes authored Dec 7, 2023
1 parent 8542339 commit 3533fc4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static java.util.Objects.requireNonNull;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseBundle;
Expand All @@ -14,12 +16,16 @@
import org.opencds.cqf.fhir.cql.EvaluationSettings;
import org.opencds.cqf.fhir.cql.LibraryEngine;
import org.opencds.cqf.fhir.cql.engine.model.FhirModelResolverCache;
import org.opencds.cqf.fhir.utility.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class BaseQuestionnaireProcessor<T> {
protected static final Logger logger = LoggerFactory.getLogger(BaseQuestionnaireProcessor.class);

public static final List<String> INPUT_EXTENSION_LIST =
Arrays.asList(Constants.CPG_INPUT_DESCRIPTION, Constants.CPG_FEATURE_EXPRESSION);

protected final ModelResolver modelResolver;
protected final EvaluationSettings evaluationSettings;
protected Repository repository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.opencds.cqf.fhir.cr.questionnaire.dstu3.generator.questionnaireitem;

import static org.opencds.cqf.fhir.cr.questionnaire.BaseQuestionnaireProcessor.INPUT_EXTENSION_LIST;

import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.dstu3.model.DataRequirement;
Expand All @@ -25,7 +27,7 @@ public QuestionnaireItemComponent createQuestionnaireItem(
protected List<Extension> copyExtensions(List<Extension> inputExtensions, List<Extension> profileExtensions) {
var extensions = new ArrayList<Extension>();
inputExtensions.forEach(ext -> {
if (ext.getUrl().equals(Constants.CPG_INPUT_DESCRIPTION)
if (INPUT_EXTENSION_LIST.contains(ext.getUrl())
&& extensions.stream().noneMatch(e -> e.getUrl().equals(ext.getUrl()))) {
extensions.add(ext);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.opencds.cqf.fhir.cr.questionnaire.r4.generator.questionnaireitem;

import static org.opencds.cqf.fhir.cr.questionnaire.BaseQuestionnaireProcessor.INPUT_EXTENSION_LIST;

import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.r4.model.DataRequirement;
Expand All @@ -25,7 +27,7 @@ public QuestionnaireItemComponent createQuestionnaireItem(
protected List<Extension> copyExtensions(List<Extension> inputExtensions, List<Extension> profileExtensions) {
var extensions = new ArrayList<Extension>();
inputExtensions.forEach(ext -> {
if (ext.getUrl().equals(Constants.CPG_INPUT_DESCRIPTION)
if (INPUT_EXTENSION_LIST.contains(ext.getUrl())
&& extensions.stream().noneMatch(e -> e.getUrl().equals(ext.getUrl()))) {
extensions.add(ext);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.opencds.cqf.fhir.cr.questionnaire.r5.generator.questionnaireitem;

import static org.opencds.cqf.fhir.cr.questionnaire.BaseQuestionnaireProcessor.INPUT_EXTENSION_LIST;

import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.r5.model.DataRequirement;
Expand All @@ -25,7 +27,7 @@ public QuestionnaireItemComponent createQuestionnaireItem(
protected List<Extension> copyExtensions(List<Extension> inputExtensions, List<Extension> profileExtensions) {
var extensions = new ArrayList<Extension>();
inputExtensions.forEach(ext -> {
if (ext.getUrl().equals(Constants.CPG_INPUT_DESCRIPTION)
if (INPUT_EXTENSION_LIST.contains(ext.getUrl())
&& extensions.stream().noneMatch(e -> e.getUrl().equals(ext.getUrl()))) {
extensions.add(ext);
}
Expand Down

0 comments on commit 3533fc4

Please sign in to comment.