Clinical Quality Language Release 1

This page is part of the Clinical Quality Language Specification (v1.5.2: Normative - Normative) based on FHIR R4. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

Clinical Decision Support Work GroupMaturity Level: NStandards Status: Normative

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. .abs()

X.abs() === Abs(X)

3. .all()

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

4. .allFalse()

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

5. .allTrue()

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

6. .anyFalse()

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

7. .anyTrue()

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

8. .as()

X.as(T) === X as T

Note that the type argument T is expected to be a literal string and must resolve to the name of a type.

9. .ceiling()

X.ceiling() === Ceiling(X)

10. .children()

.children(X) === Children(X)

11. .combine()

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

12. .conformsTo()

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

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

13. .contains()

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

14. .convertsToBoolean()

X.convertsToBoolean() === ConvertsToBoolean(X)

15. .convertsToDate()

X.convertsToDate() === ConvertsToDate(X)

16. .convertsToDateTime()

X.convertsToDateTime() === ConvertsToDateTime(X)

17. .convertsToDecimal()

X.convertsToDecimal() === ConvertsToDecimal(X)

18. .convertsToInteger()

X.convertsToInteger() === ConvertsToInteger(X)

19. .convertsToQuantity()

X.convertsToQuantity() === ConvertsToQuantity(X)

20. .convertsToTime()

X.convertsToTime() === ConvertsToTime(X)

21. .count()

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

22. .descendents()

.descendents(X) === Descendents(X)

23. .distinct()

X.distinct() === distinct X

24. .empty()

X.empty() === not exists X

25. .endsWith()

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

26. .exclude()

X.exclude(Y) === X except Y

27. .exists()

X.exists() === exists X

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

28. .exp()

X.exp() === Exp(X)

29. .first()

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

30. .floor()

X.floor() === Floor(X)

31. .hasValue()

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

32. .iif()

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

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

33. .indexOf()

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

34. .intersect()

X.intersect(Y) === X intersect Y

35. .is()

X.is(T) === X is T

Note that the argument T is expected to be a literal string and must resolve to the name of a type.

36. .isDistinct()

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

37. .last()

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

38. .lastIndexOf()

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

39. .length()

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

40. .ln()

X.ln() === Ln(X)

41. .log()

X.log(B) === Log(X, B)

42. .lower()

X.lower() === Lower(X)

43. .matches()

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

44. .memberOf()

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

45. .ofType()

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

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.

46. .not()

X.not() === not X

47. .now()

now() === Now()

48. .power()

X.power(Y) === Power(X, Y)

49. .repeat()

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

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

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

50. .replace()

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

51. .replaceMatches()

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

52. .round()

X.round() === Round(X)
X.round(Y) === Round(X, Y)

53. .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)

54. .single()

X.single() === singleton from X

55. .skip()

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

56. .sqrt()

X.sqrt() === Power(X, 0.5)

57. .startsWith()

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

58. .subsetOf()

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

59. .substring()

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

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

60. .subsumes()

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

61. .subsumedBy()

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

62. .supersetOf()

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

63. .tail()

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

64. .take()

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

65. .timeOfDay()

timeOfDay() === TimeOfDay()

66. .toBoolean()

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

67. .toChars()

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

68. .toDate()

X.toDate() === ToDate(X)

69. .toDateTime()

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

70. .today()

today() === Today()

71. .toDecimal()

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

72. .toInteger()

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

73. .toQuantity()

X.toQuantity() === ToQuantity(X)

74. .toString()

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

75. .toTime()

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

76. .trace()

X.trace(Y) === Message(X, true, Y, 'Trace', ToString(X)))

77. .truncate()

X.truncate() === Truncate(X)

78. .upper()

X.upper() === Upper(X)

79. .where()

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