Interface FhirTypeConverter


  • public interface FhirTypeConverter
    Provides functions for converting from CQL-to-FHIR and vice versa. The return types on the functions represent the most derived common type or interface across all FHIR versions. The implementations of this interface are expected to return the appropriate version specific structure for a given conversion (e.g. the interface for toFhirBoolean is defined as IPrimitiveType<Boolean> but it will return an dstu3.model.BooleanType or r4.model.BooleanType and so on).
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Boolean isCqlType​(Object value)
      Tests if an Object is a CQL type
      Boolean isFhirType​(Object value)
      Tests if an Object is a FHIR structure
      Object toCqlAny​(org.hl7.fhir.instance.model.api.IBase value)
      Converts a FHIR Any to a CQL Any
      Boolean toCqlBoolean​(org.hl7.fhir.instance.model.api.IPrimitiveType<Boolean> value)
      Converts a FHIR Boolean to a CQL Boolean
      Code toCqlCode​(org.hl7.fhir.instance.model.api.IBaseCoding value)
      Converts a FHIR Coding to a CQL Code
      Concept toCqlConcept​(org.hl7.fhir.instance.model.api.ICompositeType value)
      Converts a FHIR CodeableConcept to a CQL Concept
      Date toCqlDate​(org.hl7.fhir.instance.model.api.IPrimitiveType<Date> value)
      Converts a FHIR Date to a CQL Date
      DateTime toCqlDateTime​(org.hl7.fhir.instance.model.api.IPrimitiveType<Date> value)
      Converts a FHIR DateTime to a CQL DateTime
      BigDecimal toCqlDecimal​(org.hl7.fhir.instance.model.api.IPrimitiveType<BigDecimal> value)
      Converts a FHIR Decimal to a CQL Decimal
      String toCqlId​(org.hl7.fhir.instance.model.api.IIdType value)
      Converts a FHIR Id to a CQL String
      Integer toCqlInteger​(org.hl7.fhir.instance.model.api.IPrimitiveType<Integer> value)
      Converts a FHIR Integer to a CQL Integer
      Interval toCqlInterval​(org.hl7.fhir.instance.model.api.ICompositeType value)
      Converts a FHIR Range or Period to a CQL Interval
      Quantity toCqlQuantity​(org.hl7.fhir.instance.model.api.ICompositeType value)
      Converts a FHIR Quantity to a CQL Quantity
      Ratio toCqlRatio​(org.hl7.fhir.instance.model.api.ICompositeType value)
      Converts a FHIR Ratio to a CQL Ratio
      String toCqlString​(org.hl7.fhir.instance.model.api.IPrimitiveType<String> value)
      Converts a FHIR String to a CQL String
      BaseTemporal toCqlTemporal​(org.hl7.fhir.instance.model.api.IPrimitiveType<Date> value)
      Converts a FHIR DateTime, Date, or Instance to a CQL BaseTemporal
      Time toCqlTime​(org.hl7.fhir.instance.model.api.IPrimitiveType<String> value)
      Converts a FHIR Time to a CQL Time
      Tuple toCqlTuple​(org.hl7.fhir.instance.model.api.IBase value)
      Converts a FHIR Structure to a CQL Tuple
      Object toCqlType​(Object value)
      Converts an Object to a CQL type.
      Iterable<Object> toCqlTypes​(Iterable<?> values)
      Converts an iterable of Objects to CQL types.
      org.hl7.fhir.instance.model.api.IBase toFhirAny​(Object value)
      Converts a CQL Any to a FHIR Any
      org.hl7.fhir.instance.model.api.IPrimitiveType<Boolean> toFhirBoolean​(Boolean value)
      Converts a Boolean to a FHIR Boolean
      org.hl7.fhir.instance.model.api.ICompositeType toFhirCodeableConcept​(Concept value)
      Converts a CQL Concept to a FHIR CodeableConcept
      org.hl7.fhir.instance.model.api.IBaseCoding toFhirCoding​(Code value)
      Converts a CQL Code to a FHIR Coding
      org.hl7.fhir.instance.model.api.IPrimitiveType<Date> toFhirDate​(Date value)
      Converts a CQL Date to a FHIR Date
      org.hl7.fhir.instance.model.api.IPrimitiveType<Date> toFhirDateTime​(DateTime value)
      Converts a CQL DateTime to a FHIR DateTime
      org.hl7.fhir.instance.model.api.IPrimitiveType<BigDecimal> toFhirDecimal​(BigDecimal value)
      Converts a BigDecimal to a FHIR Decimal
      org.hl7.fhir.instance.model.api.IIdType toFhirId​(String value)
      Converts a String to a FHIR Id
      org.hl7.fhir.instance.model.api.IPrimitiveType<Integer> toFhirInteger​(Integer value)
      Converts an Integer to a FHIR Integer
      org.hl7.fhir.instance.model.api.ICompositeType toFhirInterval​(Interval value)
      Converts a CQL Interval to FHIR Range or Period
      org.hl7.fhir.instance.model.api.ICompositeType toFhirPeriod​(Interval value)
      Converts a CQL Interval to a FHIR Period
      org.hl7.fhir.instance.model.api.ICompositeType toFhirQuantity​(Quantity value)
      Converts a CQL Quantity to a FHIR Quantity
      org.hl7.fhir.instance.model.api.ICompositeType toFhirRange​(Interval value)
      Converts a CQL Interval to a FHIR Range
      org.hl7.fhir.instance.model.api.ICompositeType toFhirRatio​(Ratio value)
      Converts a CQL Ratio to a FHIR Ratio
      org.hl7.fhir.instance.model.api.IPrimitiveType<String> toFhirString​(String value)
      Converts a String to a FHIR String
      org.hl7.fhir.instance.model.api.IPrimitiveType<String> toFhirTime​(Time value)
      Converts a CQL Time to a FHIR Time
      org.hl7.fhir.instance.model.api.IBase toFhirTuple​(Tuple value)
      Converts a CQL Tuple to a FHIR Structure
      org.hl7.fhir.instance.model.api.IBase toFhirType​(Object value)
      Converts an Object to a FHIR structure.
      Iterable<Object> toFhirTypes​(Iterable<?> values)
      Converts an iterable of Objects to FHIR structures.
    • Method Detail

      • isFhirType

        Boolean isFhirType​(Object value)
        Tests if an Object is a FHIR structure
        Parameters:
        value - the value to test
        Returns:
        true if value is a FHIR structure, false otherwise
        Throws:
        NullPointerException - if value is null
      • toFhirType

        org.hl7.fhir.instance.model.api.IBase toFhirType​(Object value)
        Converts an Object to a FHIR structure.
        Parameters:
        value - the value to convert
        Returns:
        a FHIR structure
        Throws:
        IllegalArgumentException - is value is an Iterable
      • toFhirTypes

        Iterable<Object> toFhirTypes​(Iterable<?> values)
        Converts an iterable of Objects to FHIR structures. Preserves ordering, nulls, and sublist hierarchy
        Parameters:
        values - an Iterable containing CQL structures, nulls, or sublists
        Returns:
        an Iterable containing FHIR types, nulls, and sublists
      • toFhirId

        org.hl7.fhir.instance.model.api.IIdType toFhirId​(String value)
        Converts a String to a FHIR Id
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Id
      • toFhirBoolean

        org.hl7.fhir.instance.model.api.IPrimitiveType<Boolean> toFhirBoolean​(Boolean value)
        Converts a Boolean to a FHIR Boolean
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Boolean
      • toFhirInteger

        org.hl7.fhir.instance.model.api.IPrimitiveType<Integer> toFhirInteger​(Integer value)
        Converts an Integer to a FHIR Integer
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Integer
      • toFhirDecimal

        org.hl7.fhir.instance.model.api.IPrimitiveType<BigDecimal> toFhirDecimal​(BigDecimal value)
        Converts a BigDecimal to a FHIR Decimal
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Decimal
      • toFhirDate

        org.hl7.fhir.instance.model.api.IPrimitiveType<Date> toFhirDate​(Date value)
        Converts a CQL Date to a FHIR Date
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Date
      • toFhirDateTime

        org.hl7.fhir.instance.model.api.IPrimitiveType<Date> toFhirDateTime​(DateTime value)
        Converts a CQL DateTime to a FHIR DateTime
        Parameters:
        value - the value to convert
        Returns:
        a FHIR DateTime
      • toFhirTime

        org.hl7.fhir.instance.model.api.IPrimitiveType<String> toFhirTime​(Time value)
        Converts a CQL Time to a FHIR Time
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Time
      • toFhirString

        org.hl7.fhir.instance.model.api.IPrimitiveType<String> toFhirString​(String value)
        Converts a String to a FHIR String
        Parameters:
        value - the value to convert
        Returns:
        a FHIR String
      • toFhirQuantity

        org.hl7.fhir.instance.model.api.ICompositeType toFhirQuantity​(Quantity value)
        Converts a CQL Quantity to a FHIR Quantity
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Quantity
      • toFhirRatio

        org.hl7.fhir.instance.model.api.ICompositeType toFhirRatio​(Ratio value)
        Converts a CQL Ratio to a FHIR Ratio
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Ratio
      • toFhirAny

        org.hl7.fhir.instance.model.api.IBase toFhirAny​(Object value)
        Converts a CQL Any to a FHIR Any
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Any
      • toFhirCoding

        org.hl7.fhir.instance.model.api.IBaseCoding toFhirCoding​(Code value)
        Converts a CQL Code to a FHIR Coding
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Coding
      • toFhirCodeableConcept

        org.hl7.fhir.instance.model.api.ICompositeType toFhirCodeableConcept​(Concept value)
        Converts a CQL Concept to a FHIR CodeableConcept
        Parameters:
        value - the value to convert
        Returns:
        a FHIR CodeableConcept
      • toFhirPeriod

        org.hl7.fhir.instance.model.api.ICompositeType toFhirPeriod​(Interval value)
        Converts a CQL Interval to a FHIR Period
        Parameters:
        value - a Date or DateTime Interval
        Returns:
        a FHIR Period
      • toFhirRange

        org.hl7.fhir.instance.model.api.ICompositeType toFhirRange​(Interval value)
        Converts a CQL Interval to a FHIR Range
        Parameters:
        value - a Quantity Interval
        Returns:
        a FHIR Range
      • toFhirInterval

        org.hl7.fhir.instance.model.api.ICompositeType toFhirInterval​(Interval value)
        Converts a CQL Interval to FHIR Range or Period
        Parameters:
        value - a Quantity, Date, or DateTime interval
        Returns:
        A FHIR Range or Period
      • toFhirTuple

        org.hl7.fhir.instance.model.api.IBase toFhirTuple​(Tuple value)
        Converts a CQL Tuple to a FHIR Structure
        Parameters:
        value - the value to convert
        Returns:
        a FHIR Structure
      • isCqlType

        Boolean isCqlType​(Object value)
        Tests if an Object is a CQL type
        Parameters:
        value - the value to convert
        Returns:
        true if value is a CQL type, false otherwise
        Throws:
        NullPointerException - if value is null
      • toCqlType

        Object toCqlType​(Object value)
        Converts an Object to a CQL type.
        Parameters:
        value - the value to convert a FHIR structure
        Returns:
        a CQL type
        Throws:
        IllegalArgumentException - is value is an Iterable
      • toCqlTypes

        Iterable<Object> toCqlTypes​(Iterable<?> values)
        Converts an iterable of Objects to CQL types. Preserves ordering, nulls, and sublist hierarchy
        Parameters:
        values - the values to convert an Iterable containing FHIR structures, nulls, or sublists
        Returns:
        an Iterable containing CQL types, nulls, and sublists
      • toCqlId

        String toCqlId​(org.hl7.fhir.instance.model.api.IIdType value)
        Converts a FHIR Id to a CQL String
        Parameters:
        value - the value to convert
        Returns:
        a String
      • toCqlBoolean

        Boolean toCqlBoolean​(org.hl7.fhir.instance.model.api.IPrimitiveType<Boolean> value)
        Converts a FHIR Boolean to a CQL Boolean
        Parameters:
        value - the value to convert
        Returns:
        a Boolean
      • toCqlInteger

        Integer toCqlInteger​(org.hl7.fhir.instance.model.api.IPrimitiveType<Integer> value)
        Converts a FHIR Integer to a CQL Integer
        Parameters:
        value - the value to convert
        Returns:
        an Integer
      • toCqlDecimal

        BigDecimal toCqlDecimal​(org.hl7.fhir.instance.model.api.IPrimitiveType<BigDecimal> value)
        Converts a FHIR Decimal to a CQL Decimal
        Parameters:
        value - the value to convert
        Returns:
        a BigDecimal
      • toCqlDate

        Date toCqlDate​(org.hl7.fhir.instance.model.api.IPrimitiveType<Date> value)
        Converts a FHIR Date to a CQL Date
        Parameters:
        value - the value to convert
        Returns:
        a CQL Date
        Throws:
        IllegalArgumentException - if value is not a Date
      • toCqlDateTime

        DateTime toCqlDateTime​(org.hl7.fhir.instance.model.api.IPrimitiveType<Date> value)
        Converts a FHIR DateTime to a CQL DateTime
        Parameters:
        value - the value to convert
        Returns:
        a CQL DateTime
        Throws:
        IllegalArgumentException - if value is not a DateTime
      • toCqlTemporal

        BaseTemporal toCqlTemporal​(org.hl7.fhir.instance.model.api.IPrimitiveType<Date> value)
        Converts a FHIR DateTime, Date, or Instance to a CQL BaseTemporal
        Parameters:
        value - the value to convert
        Returns:
        a CQL BaseTemporal
        Throws:
        IllegalArgumentException - if value is not a DateTime, Date, or Instant
      • toCqlTime

        Time toCqlTime​(org.hl7.fhir.instance.model.api.IPrimitiveType<String> value)
        Converts a FHIR Time to a CQL Time
        Parameters:
        value - the value to convert
        Returns:
        a CQL Time
        Throws:
        IllegalArgumentException - if value is not a Time
      • toCqlString

        String toCqlString​(org.hl7.fhir.instance.model.api.IPrimitiveType<String> value)
        Converts a FHIR String to a CQL String
        Parameters:
        value - the value to convert
        Returns:
        a String
      • toCqlQuantity

        Quantity toCqlQuantity​(org.hl7.fhir.instance.model.api.ICompositeType value)
        Converts a FHIR Quantity to a CQL Quantity
        Parameters:
        value - the value to convert
        Returns:
        a CQL Quantity
        Throws:
        IllegalArgumentException - if value is not a Quantity
      • toCqlRatio

        Ratio toCqlRatio​(org.hl7.fhir.instance.model.api.ICompositeType value)
        Converts a FHIR Ratio to a CQL Ratio
        Parameters:
        value - the value to convert
        Returns:
        a CQL Ratio
        Throws:
        IllegalArgumentException - if value is not a Ratio
      • toCqlAny

        Object toCqlAny​(org.hl7.fhir.instance.model.api.IBase value)
        Converts a FHIR Any to a CQL Any
        Parameters:
        value - the value to convert
        Returns:
        a CQL Any
      • toCqlCode

        Code toCqlCode​(org.hl7.fhir.instance.model.api.IBaseCoding value)
        Converts a FHIR Coding to a CQL Code
        Parameters:
        value - the value to convert
        Returns:
        a CQL Code
      • toCqlConcept

        Concept toCqlConcept​(org.hl7.fhir.instance.model.api.ICompositeType value)
        Converts a FHIR CodeableConcept to a CQL Concept
        Parameters:
        value - the value to convert
        Returns:
        a CQL Concept
        Throws:
        IllegalArgumentException - if value is not a CodeableConcept
      • toCqlInterval

        Interval toCqlInterval​(org.hl7.fhir.instance.model.api.ICompositeType value)
        Converts a FHIR Range or Period to a CQL Interval
        Parameters:
        value - the value to convert
        Returns:
        a CQL Interval
        Throws:
        IllegalArgumentException - if value is not a Range or Period
      • toCqlTuple

        Tuple toCqlTuple​(org.hl7.fhir.instance.model.api.IBase value)
        Converts a FHIR Structure to a CQL Tuple
        Parameters:
        value - the value to convert
        Returns:
        a CQL Tuple