Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,26 @@ void multipleExpressions() {
assertEquals(codeableConcept2, result3.get(0));
assertEquals(codeableConcept2.getCodingFirstRep().getDisplay(), ((StringType) result4.get(0)).getValue());
}

@Test
void fhirPathJoinFunction() {
// Test for .join() FHIRPath function which is used in SDC populate operations
// This test currently FAILS because join() is not supported in the CQL FHIRPath implementation
var patientId = "Patient/Patient1";
var patient = new Patient()
.addName(new HumanName().addGiven("Alice").addGiven("Marie").setFamily("Smith"))
.setId(patientId);

var params = parameters();
params.addParameter(part("%subject", patient));

// Test joining given names with a space separator
var expression = new CqfExpression(
"text/fhirpath",
"%subject.name.first().given.join(' ')",
null);

var result = libraryEngine.resolveExpression(patientId, expression, params, null, null, null, null);
assertEquals("Alice Marie", ((StringType) result.get(0)).getValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.opencds.cqf.fhir.utility.Constants;
import org.opencds.cqf.fhir.utility.CqfExpression;
import org.opencds.cqf.fhir.utility.FhirPathCache;
import org.opencds.cqf.fhir.utility.adapter.IQuestionnaireItemComponentAdapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down