use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class SubsumesFunctionTest method createCodingArg.
CodingPath createCodingArg() {
final Dataset<Row> dataset = new DatasetBuilder(spark).withIdColumn().withStructTypeColumns(codingStructType()).withIdValueRows(ALL_RES_IDS, id -> rowFromCoding(CODING_MEDIUM)).withIdValueRows(ALL_RES_IDS, id -> rowFromCoding(CODING_OTHER3)).buildWithStructValue();
final ElementPath argument = new ElementPathBuilder(spark).fhirType(FHIRDefinedType.CODING).dataset(dataset).idAndValueColumns().build();
return (CodingPath) argument;
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class CodingLiteralPathTest method roundTripWithQuotedComponentWithComma.
@Test
void roundTripWithQuotedComponentWithComma() {
final String expression = "http://snomed.info/sct|'46,2'|http://snomed.info/sct/32506021000036107/version/20201231";
final CodingLiteralPath codingLiteralPath = CodingLiteralPath.fromString(expression, inputContext);
final Coding literalValue = codingLiteralPath.getLiteralValue();
assertEquals("http://snomed.info/sct", literalValue.getSystem());
assertEquals("http://snomed.info/sct/32506021000036107/version/20201231", literalValue.getVersion());
assertEquals("46,2", literalValue.getCode());
final String actualExpression = codingLiteralPath.getExpression();
assertEquals(expression, actualExpression);
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class CodingLiteralPathTest method roundTripWithQuotedComponentWithSingleQuote.
@Test
void roundTripWithQuotedComponentWithSingleQuote() {
final String expression = "'Someone\\'s CodeSystem'|166056000";
final CodingLiteralPath codingLiteralPath = CodingLiteralPath.fromString(expression, inputContext);
final Coding literalValue = codingLiteralPath.getLiteralValue();
assertEquals("Someone's CodeSystem", literalValue.getSystem());
assertEquals("166056000", literalValue.getCode());
final String actualExpression = codingLiteralPath.getExpression();
assertEquals(expression, actualExpression);
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class CodingLiteralPathTest method roundTripWithQuotedComponentWithSpace.
@Test
void roundTripWithQuotedComponentWithSpace() {
final String expression = "'Some CodeSystem'|166056000";
final CodingLiteralPath codingLiteralPath = CodingLiteralPath.fromString(expression, inputContext);
final Coding literalValue = codingLiteralPath.getLiteralValue();
assertEquals("Some CodeSystem", literalValue.getSystem());
assertEquals("166056000", literalValue.getCode());
final String actualExpression = codingLiteralPath.getExpression();
assertEquals(expression, actualExpression);
}
use of org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL in project pathling by aehrc.
the class CombineOperatorTest method worksWithLiteralAndNonLiteralCodingValues.
@Test
void worksWithLiteralAndNonLiteralCodingValues() {
final Dataset<Row> leftDataset = new DatasetBuilder(spark).withIdColumn(idColumnName).withEidColumn().withStructTypeColumns(codingStructType()).withRow("observation-1", makeEid(0), rowFromCoding(new Coding("http://snomed.info/sct", "18001011000036104", null))).buildWithStructValue();
final ElementPath left = new ElementPathBuilder(spark).fhirType(FHIRDefinedType.CODING).dataset(leftDataset).idAndEidAndValueColumns().expression("valueCoding").singular(false).build();
final CodingLiteralPath right = CodingLiteralPath.fromString("http://snomed.info/sct|373882004", parserContext.getInputContext());
final OperatorInput combineInput = new OperatorInput(parserContext, left, right);
final FhirPath result = Operator.getInstance("combine").invoke(combineInput);
final Dataset<Row> expectedDataset = new DatasetBuilder(spark).withIdColumn(idColumnName).withStructTypeColumns(codingStructType()).withRow("observation-1", rowFromCoding(new Coding("http://snomed.info/sct", "18001011000036104", null))).withRow("observation-1", rowFromCoding(new Coding("http://snomed.info/sct", "373882004", null))).withRow("observation-2", rowFromCoding(new Coding("http://snomed.info/sct", "373882004", null))).withRow("observation-3", rowFromCoding(new Coding("http://snomed.info/sct", "373882004", null))).buildWithStructValue();
assertThat(result).hasExpression("valueCoding combine http://snomed.info/sct|373882004").isNotSingular().isElementPath(CodingPath.class).selectResult().hasRowsUnordered(expectedDataset);
}
Aggregations