use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.
the class R4RestFhirTerminologyProviderTest method inOperationHandlesNullSystem.
@Test
public void inOperationHandlesNullSystem() throws Exception {
ValueSetInfo info = new ValueSetInfo();
info.setId("urn:oid:Test");
Code code = new Code();
code.setCode(TEST_CODE);
code.setDisplay(TEST_DISPLAY);
Parameters parameters = new Parameters();
parameters.getParameterFirstRep().setName("result").setValue(new BooleanType(true));
mockFhirResourceRetrieval("/ValueSet/Test/$validate-code?code=" + urlencode(code.getCode()) + "&_format=json", parameters);
boolean result = provider.in(code, info);
assertTrue(result);
}
use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.
the class SparkDataRow method getValue.
@Override
public Object getValue(String fieldName) {
Object result = null;
Object sparkVal = sparkRow.getAs(fieldName);
if (sparkVal != null) {
boolean isCode = false;
/**
* The following logic uses column metadata fields provided in the Spark schema
* to identify columns
*/
Metadata metadata = MetadataUtils.getColumnMetadata(sparkRow.schema(), fieldName);
isCode = MetadataUtils.isCodeCol(metadata);
if (isCode) {
Code code = new Code().withCode((String) sparkVal);
String system = MetadataUtils.getDefaultSystem(metadata);
if (system != null) {
code.withSystem(system);
}
String systemCol = MetadataUtils.getSystemCol(metadata);
if (systemCol != null) {
code.withSystem(sparkRow.getAs(systemCol));
}
String displayCol = MetadataUtils.getDisplayCol(metadata);
if (displayCol != null) {
code.withDisplay(sparkRow.getAs(displayCol));
}
result = code;
} else {
result = doDefaultConversion(sparkVal);
}
}
return result;
}
use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.
the class R4FileSystemFhirTerminologyProviderTest method lookupOperationSuccess.
@Test(expected = UnsupportedOperationException.class)
public void lookupOperationSuccess() throws Exception {
CodeSystemInfo info = new CodeSystemInfo();
info.setId(TEST_SYSTEM);
info.setVersion(TEST_SYSTEM_VERSION1);
Code code = new Code();
code.setCode(TEST_CODE);
code.setSystem(TEST_SYSTEM);
code.setDisplay(TEST_DISPLAY);
provider.lookup(code, info);
}
use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.
the class R4FileSystemFhirTerminologyProviderTest method expandOperationReturnsCorrectCodesMoreThanZero.
@Test
public void expandOperationReturnsCorrectCodesMoreThanZero() {
ValueSetInfo info = new ValueSetInfo();
info.setId(setId);
ValueSet valueSet = new ValueSet();
valueSet.setId("Test");
valueSet.getExpansion().getContainsFirstRep().setSystem(TEST_SYSTEM).setCode(TEST_CODE);
Iterable<Code> codes = provider.expand(info);
List<Code> list = StreamSupport.stream(codes.spliterator(), false).collect(Collectors.toList());
assertEquals(list.size(), 4);
for (Code code : list) {
if (code.getCode() == null || code.getCode().isEmpty()) {
Assert.fail("Code not present");
}
if (code.getSystem() == null || code.getSystem().isEmpty()) {
Assert.fail("CodeSystem not present");
}
if (code.getVersion() == null || code.getVersion().isEmpty()) {
Assert.fail("Version not present");
}
if (code.getDisplay() == null || code.getDisplay().isEmpty()) {
Assert.fail("Display not present");
}
}
}
use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.
the class R4FileSystemFhirTerminologyProviderTest method inOperationReturnsTrueWithVersion1.
@Test
public void inOperationReturnsTrueWithVersion1() throws Exception {
ValueSetInfo info = new ValueSetInfo();
info.setId(setId);
Code code = new Code();
code.setSystem(TEST_SYSTEM);
code.setCode(TEST_CODE);
code.setDisplay(TEST_DISPLAY);
code.setVersion(TEST_SYSTEM_VERSION1);
boolean result = provider.in(code, info);
assertTrue(result);
}
Aggregations