Clinical Quality Language Release 1 STU 3 (1.3)

This is the current officially released version of Clinical Quality Language, 1.3.
For a full list of available versions, see the Directory of published versions .

Clinical Decision Support Work GroupMaturity Level: 4Ballot Status: STU 3

Appendix I – FHIRPath Function Translation

This appendix provides detailed mappings for each FHIRPath function in terms of the ELM output produced.

1. .aggregate()

X.aggregate(<iteration>, <init>) === Aggregate(<iteration>, <init>)

2. .all()

X.all(<condition>) === AllTrue(X $this let a: <condition> where a return a)

3. .allFalse()

X.allFalse() === AllTrue(X A return not A)

4. .allTrue()

X.allTrue() === AllTrue(X)

5. .anyFalse()

X.anyFalse() === AnyTrue(X A return not A)

6. .anyTrue()

X.anyTrue() === AnyTrue(X)

7. .children()

8. .combine()

children(X) === Children(X)

X.combine(Y) === Flatten(\{ X, Y })

9. .conformsTo()

X.conformsTo(Y) === FHIRSupport.ConformsTo(Y)

Note that this mapping relies on an external library, FHIRSupport to provide conformance validation checking.

10. .contains()

X.contains(Y) === PositionOf(Y, X) >= 0

11. .count()

X.count() === Count(X)

12. .descendents()

13. .distinct()

descendents(X) === Descendents(X)

X.distinct() === distinct X

14. .empty()

X.empty() === not exists X

15. .endsWith()

X.endsWith(Y) === EndsWith(X, Y)

16. .exists()

X.exists() === exists X

X.exists(<condition>) === exists (X $this where <condition>)

17. .first()

X.first() === First(X)

18. .hasValue()

X.hasValue() === X is not null

19. .iif()

X.iif(Y) === if X then Y else null

X.iif(Y, Z) === if X then Y else Z

20. .indexOf()

X.indexOf(Y) === PositionOf(Y, X) // Note carefully the order of arguments here, it’s the opposite of IndexOf

21. .isBoolean()

X.isBoolean() === IsBoolean(X)

22. .isDistinct()

X.isDistinct() === Count(X) = Count(distinct X)

23. .isDate()

X.isDate() === IsDate(X)

24. .isDateTime()

X.isDateTime() === IsDateTime(X)

25. .isDecimal()

X.isDecimal() === IsDecimal(X)

26. .isInteger()

X.isInteger() === IsInteger(X)

27. .isQuantity()

X.isQuantity() === IsQuantity(X)

28. .isTime()

X.isTime() === IsTime(X)

29. .last()

X.last() === Last(X)

30. .lastIndexOf()

X.lastIndexOf(Y) === LastPositionOf(Y, X) // Note carefully the order of arguments here, it’s the opposite of lastIndexOf.

31. .length()

X.length() === Length(X)

32. .matches()

X.matches(Y) === Matches(X, Y)

33. .memberOf()

X.memberOf(Y) === InValueSet(X, Y) // where Y is required to be a ValueSetRef

34. .ofType()

X.ofType(T) === X $this where $this is T return $this as <type>

Note that the argument T is required to be a literal string, and is interpreted as the name of a type. For non-named-types, type specifier syntax applies.

35. .not()

X.not() === not X

36. .now()

now() === Now()

37. .repeat()

X.repeat(<element>) === Repeat(X, <element>)

The type of X.repeat(<element>) is inferred as the type of:

X.select(<element>).select(<element>)

38. .replace()

X.replace(Y, Z) === Replace(X, Y, Z)

39. .replaceMatches()

X.replaceMatches(Y, Z) === ReplaceMatches(X, Y, Z)

40. .select()

If the result type of <element> is not list-valued:

X.select(<element>) === X $this let a: <element> where a is not null return a

If the result type of <element> is list-valued:

X.select(<element>) === Flatten(X $this let a: <element> where a is not null return a)

41. .single()

X.single() === singleton from X

42. .skip()

X.skip(Y) === Slice(X, Y, null)

43. .startsWith()

X.startsWith(Y) === StartsWith(X, Y)

44. .subsetOf()

X.subsetOf(Y) === X included in Y

45. .substring()

X.substring(Y) === SubString(X, Y)

X.substring(Y, Z) === SubString(X, Y, Z)

46. .subsumes()

X.subsumes(Y) === Subsumes(X, Y)

47. .subsumedBy()

X.subsumedBy(Y) === SubsumedBy(X, Y)

48. .supersetOf()

X.supersetOf(Y) === X includes Y

49. .tail()

X.tail() === Slice(X, 1, null)

50. .take()

X.take(Y) === Slice(X, 0, Coalesce(Y, 0))

51. .toBoolean()

X.toBoolean() === ToBoolean(X)

52. .toChars()

X.toChars() === ToChars(X)

53. .toDateTime()

X.toDateTime() === ToDateTime(X)

54. .today()

today() === Today()

55. .toDecimal()

X.toDecimal() === ToDecimal(X)

56. .toInteger()

X.toInteger() === ToInteger(X)

57. .toString()

X.toString() === ToString(X)

58. .toTime()

X.toTime() === ToTime(X)

59. .trace()

X.output(Y) === Trace(X, Y) // Add to ELM

60. .where()

X.where(<condition>) === X $this where <condition>