model

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package model provides an ELM-like data structure for an intermediate representation of CQL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessLevel

type AccessLevel string

AccessLevel defines the access modifier for a definition (ExpressionDef, ParameterDef, ValueSetDef). If the user does not specify an access modifier the default is public. If the library is unnamed then the interpreter should treat all definitions as private even if the access modifier is public.

const (
	// Public means other CQL libraries can access the definition.
	Public AccessLevel = "PUBLIC"
	// Private means only the local CQL libraries can access the definition.
	Private AccessLevel = "PRIVATE"
)

type Add

type Add struct{ *BinaryExpression }

Add ELM Expression https://cql.hl7.org/04-logicalspecification.html#add

func (*Add) GetName

func (a *Add) GetName() string

GetName returns the name of the system operator.

type After

After ELM expression from https://cql.hl7.org/04-logicalspecification.html#after.

func (*After) GetName

func (a *After) GetName() string

GetName returns the name of the system operator.

type AggregateClause

type AggregateClause struct {
	*Element
	Expression IExpression
	// Starting is the starting value of the aggregate variable. It is always set. If the user does
	// not set it the parser will insert a null literal.
	Starting IExpression
	// Identifier is the alias for the aggregate variable.
	Identifier string
	Distinct   bool
}

AggregateClause for a Query expression.

type AliasRef

type AliasRef struct {
	*Expression
	Name string
}

AliasRef defines a reference to a source within the scope of a query.

type AliasedSource

type AliasedSource struct {
	*Expression
	Alias  string
	Source IExpression
}

AliasedSource is a query source with an alias.

type And

type And struct{ *BinaryExpression }

And is https://cql.hl7.org/04-logicalspecification.html#and.

func (*And) GetName

func (a *And) GetName() string

GetName returns the name of the system operator.

type As

type As struct {
	*UnaryExpression
	AsTypeSpecifier types.IType
	Strict          bool
}

As is https://cql.hl7.org/09-b-cqlreference.html#as.

func (*As) GetName

func (a *As) GetName() string

GetName returns the name of the system operator.

type Before

Before ELM expression from https://cql.hl7.org/04-logicalspecification.html#before.

func (*Before) GetName

func (a *Before) GetName() string

GetName returns the name of the system operator.

type BinaryExpression

type BinaryExpression struct {
	*Expression
	Operands []IExpression
}

BinaryExpression is a CQL expression that has two operands. The ELM representation may have additional operands (ex BinaryExpressionWithPrecision).

func (*BinaryExpression) Left

func (b *BinaryExpression) Left() IExpression

Left returns the Left expression (first operand) of the BinaryExpression. If not present, returns nil.

func (*BinaryExpression) Right

func (b *BinaryExpression) Right() IExpression

Right returns the Right expression (second operand) of the BinaryExpression. If not present, returns nil.

func (*BinaryExpression) SetOperands

func (b *BinaryExpression) SetOperands(left, right IExpression)

SetOperands sets the BinaryExpression's operands.

type BinaryExpressionWithPrecision

type BinaryExpressionWithPrecision struct {
	*BinaryExpression
	// Precision returns the precision of this BinaryExpression. It must be one of the following:
	// https://cql.hl7.org/19-l-cqlsyntaxdiagrams.html#dateTimePrecision.
	Precision DateTimePrecision
}

BinaryExpressionWithPrecision represents a BinaryExpression with a precision property.

type CalculateAge

type CalculateAge struct {
	*UnaryExpression
	Precision DateTimePrecision
}

CalculateAge CQL expression type

func (*CalculateAge) GetName

func (a *CalculateAge) GetName() string

GetName returns the name of the system operator.

type CalculateAgeAt

type CalculateAgeAt BinaryExpressionWithPrecision

CalculateAgeAt ELM expression from https://cql.hl7.org/04-logicalspecification.html#calculateageat.

func (*CalculateAgeAt) GetName

func (a *CalculateAgeAt) GetName() string

GetName returns the name of the system operator.

type CanConvertQuantity

type CanConvertQuantity struct{ *BinaryExpression }

CanConvertQuantity ELM Expression from https://cql.hl7.org/04-logicalspecification.html#canconvertquantity.

func (*CanConvertQuantity) GetName

func (a *CanConvertQuantity) GetName() string

GetName returns the name of the system operator.

type Case

type Case struct {
	*Expression
	// If comparand is provided it is compared against each When in the CaseItems. The CaseItems are
	// expected to be of the same type or implicitly convertible to the same type as the Comparand. If
	// the comparand is not provided then each When must have resultType boolean.
	Comparand IExpression
	CaseItem  []*CaseItem
	// Else must always be provided.
	Else IExpression
}

Case is a conditional case expression https://cql.hl7.org/04-logicalspecification.html#case.

type CaseItem

type CaseItem struct {
	*Element
	When IExpression
	Then IExpression
}

CaseItem is a single case item in a Case expression.

type Coalesce

type Coalesce struct{ *NaryExpression }

Coalesce is https://cql.hl7.org/04-logicalspecification.html#coalesce.

func (*Coalesce) GetName

func (a *Coalesce) GetName() string

GetName returns the name of the system operator.

type Code

type Code struct {
	*Expression
	System  *CodeSystemRef
	Code    string
	Display string
}

Code is a literal code selector.

type CodeDef

type CodeDef struct {
	*Element
	Name        string
	Code        string         // 1..1
	CodeSystem  *CodeSystemRef // 0..1
	Display     string         // 0..1
	AccessLevel AccessLevel
}

CodeDef is a named definition that references an external code from a CodeSystem by ID.

type CodeRef

type CodeRef struct {
	*Expression
	Name string
	// LibraryName is empty for Codes defined in the local CQL library. Otherwise it is the
	// local identifier of the included library.
	LibraryName string
}

CodeRef defines a reference to a Code definition used in CQL expressions.

type CodeSystemDef

type CodeSystemDef struct {
	*Element
	Name        string
	ID          string // 1..1
	Version     string // 0..1
	AccessLevel AccessLevel
}

CodeSystemDef is a named definition that references an external code system by ID and version.

type CodeSystemRef

type CodeSystemRef struct {
	*Expression
	Name string
	// LibraryName is empty for CodeSystems defined in the local CQL library. Otherwise it is the
	// local identifier of the included library.
	LibraryName string
}

CodeSystemRef defines a reference to a CodeSystemDef definition used in CQL expressions.

type Concatenate

type Concatenate struct{ *NaryExpression }

Concatenate is https://cql.hl7.org/04-logicalspecification.html#concatenate.

func (*Concatenate) GetName

func (a *Concatenate) GetName() string

GetName returns the name of the system operator.

type ConceptDef

type ConceptDef struct {
	*Element
	Name        string
	Codes       []*CodeRef // 1..*
	Display     string     // 0..1
	AccessLevel AccessLevel
}

ConceptDef is a named definition that represents a terminology concept. It is made up of code(s) from one or more CodeSystems. At least one code is required.

type ConceptRef

type ConceptRef struct {
	*Expression
	Name string
	// LibraryName is empty for Concepts defined in the local CQL library. Otherwise it is the
	// local identifier of the included library.
	LibraryName string
}

ConceptRef defines a reference to a ConceptDef definition used in CQL expressions.

type Contains

Contains ELM expression from https://cql.hl7.org/04-logicalspecification.html#contains.

func (*Contains) GetName

func (a *Contains) GetName() string

GetName returns the name of the system operator.

type Date

type Date struct{ *NaryExpression }

Date is the functional syntax to create a Date https://cql.hl7.org/09-b-cqlreference.html#date-1.

func (*Date) GetName

func (a *Date) GetName() string

GetName returns the name of the system operator.

type DateTime

type DateTime struct{ *NaryExpression }

DateTime is the functional syntax to create a to create a CQL DateTime https://cql.hl7.org/09-b-cqlreference.html#datetime-1.

func (*DateTime) GetName

func (a *DateTime) GetName() string

GetName returns the name of the system operator.

type DateTimePrecision

type DateTimePrecision string

DateTimePrecision represents the precision of a DateTimeValue (or soon, TimeValue). This is a string and not an integer value so that the default JSON marshaled value is readable and useful.

const (
	// UNSETDATETIMEPRECISION represents unknown precision.
	UNSETDATETIMEPRECISION DateTimePrecision = ""
	// YEAR represents year precision.
	YEAR DateTimePrecision = "year"
	// MONTH represents month precision.
	MONTH DateTimePrecision = "month"
	// WEEK represents a week precision. Not valid for Date / DateTime values.
	WEEK DateTimePrecision = "week"
	// DAY represents day precision.
	DAY DateTimePrecision = "day"
	// HOUR represents an hour precision.
	HOUR DateTimePrecision = "hour"
	// MINUTE represents a minute precision.
	MINUTE DateTimePrecision = "minute"
	// SECOND represents second precision.
	SECOND DateTimePrecision = "second"
	// MILLISECOND represents millisecond precision.
	MILLISECOND DateTimePrecision = "millisecond"
)

type DifferenceBetween

type DifferenceBetween BinaryExpressionWithPrecision

DifferenceBetween ELM expression from https://cql.hl7.org/04-logicalspecification.html#differencebetween.

func (*DifferenceBetween) GetName

func (a *DifferenceBetween) GetName() string

GetName returns the name of the system operator.

type Divide

type Divide struct{ *BinaryExpression }

Divide ELM Expression https://cql.hl7.org/04-logicalspecification.html#divide

func (*Divide) GetName

func (a *Divide) GetName() string

GetName returns the name of the system operator.

type Element

type Element struct {
	// TODO(b/298104167): Add common row, column.
	ResultType types.IType
}

Element is the base for all CQL nodes.

func (*Element) Col

func (t *Element) Col() int

Col returns the element's column in the source file.

func (*Element) GetResultType

func (t *Element) GetResultType() types.IType

GetResultType returns the type of the result which may be nil if unknown or not yet implemented.

func (*Element) Row

func (t *Element) Row() int

Row returns the element's row in the source file.

type End

type End struct{ *UnaryExpression }

End is https://cql.hl7.org/04-logicalspecification.html#end.

func (*End) GetName

func (a *End) GetName() string

GetName returns the name of the system operator.

type Equal

type Equal struct{ *BinaryExpression }

Equal ELM Expression from https://cql.hl7.org/04-logicalspecification.html#equal.

func (*Equal) GetName

func (a *Equal) GetName() string

GetName returns the name of the system operator.

type Equivalent

type Equivalent struct{ *BinaryExpression }

Equivalent ELM Expression from https://cql.hl7.org/04-logicalspecification.html#equivalent.

func (*Equivalent) GetName

func (a *Equivalent) GetName() string

GetName returns the name of the system operator.

type Except

type Except struct{ *BinaryExpression }

Except ELM Expression https://cql.hl7.org/04-logicalspecification.html#except Except is a nary expression but we are only supporting two operands.

func (*Except) GetName

func (a *Except) GetName() string

GetName returns the name of the system operator.

type Exists

type Exists struct{ *UnaryExpression }

Exists is https://cql.hl7.org/04-logicalspecification.html#exists.

func (*Exists) GetName

func (e *Exists) GetName() string

GetName returns the name of the system operator.

type Expression

type Expression struct {
	*Element
}

Expression is a base type containing common metadata for all CQL expression types.

func ResultType

func ResultType(t types.IType) *Expression

ResultType is a helper function to set the resultType in a model.Element.

func (*Expression) GetResultType

func (e *Expression) GetResultType() types.IType

GetResultType returns the type of the result which may be nil if unknown or not yet implemented.

type ExpressionDef

type ExpressionDef struct {
	*Element
	Name        string
	Context     string
	Expression  IExpression
	AccessLevel AccessLevel
}

ExpressionDef is a top-level named definition of a CQL expression.

func (*ExpressionDef) GetAccessLevel

func (e *ExpressionDef) GetAccessLevel() AccessLevel

GetAccessLevel returns the access level of the definition.

func (*ExpressionDef) GetContext

func (e *ExpressionDef) GetContext() string

GetContext returns the context of the definition.

func (*ExpressionDef) GetExpression

func (e *ExpressionDef) GetExpression() IExpression

GetExpression returns the expression of the definition.

func (*ExpressionDef) GetName

func (e *ExpressionDef) GetName() string

GetName returns the name of the definition.

type ExpressionRef

type ExpressionRef struct {
	*Expression
	Name string
	// LibraryName is empty for expressions defined in the local CQL library. Otherwise it is the
	// local identifier of the included library.
	LibraryName string
}

ExpressionRef defines a reference to a ExpressionDef definition used in CQL expressions.

type First

type First struct {
	*UnaryExpression
}

First ELM expression from https://cql.hl7.org/04-logicalspecification.html#first

func (*First) GetName

func (f *First) GetName() string

GetName returns the name of the system operator.

type FunctionDef

type FunctionDef struct {
	// The body of the function is represented by the Expression field in the ExpressionDef. The
	// return type is the ResultType set in the Element.
	*ExpressionDef
	Operands []OperandDef
	Fluent   bool
	// External functions do not have a function body.
	External bool
}

FunctionDef represents a user defined function. All CQL built-in functions have their own struct defined below.

type FunctionRef

type FunctionRef struct {
	*Expression
	Name string
	// LibraryName is empty for expressions defined in the local CQL library. Otherwise it is the
	// local identifier of the included library.
	LibraryName string
	Operands    []IExpression
}

FunctionRef defines a reference to a user defined function.

type Greater

type Greater struct{ *BinaryExpression }

Greater ELM Expression https://cql.hl7.org/04-logicalspecification.html#greater

func (*Greater) GetName

func (a *Greater) GetName() string

GetName returns the name of the system operator.

type GreaterOrEqual

type GreaterOrEqual struct{ *BinaryExpression }

GreaterOrEqual ELM Expression https://cql.hl7.org/04-logicalspecification.html#greaterorequal

func (*GreaterOrEqual) GetName

func (a *GreaterOrEqual) GetName() string

GetName returns the name of the system operator.

type IBinaryExpression

type IBinaryExpression interface {
	IExpression
	// GetName returns the name of the BinaryExpression.
	GetName() string
	// Left returns the Left expression (first operand) of the BinaryExpression. If not present,
	// returns nil.
	Left() IExpression
	// Right returns the Right expression (second operand) of the BinaryExpression. If not present,
	// returns nil.
	Right() IExpression
	SetOperands(left, right IExpression)
	// contains filtered or unexported methods
}

IBinaryExpression is an interface that all Binary Expressions meet. Get prefixes are used below so as to not conflict with struct property names.

type IElement

type IElement interface {
	Row() int
	Col() int
	GetResultType() types.IType
}

IElement is an interface implemented by all CQL Element structs.

type IExpression

type IExpression interface {
	IElement
	// contains filtered or unexported methods
}

IExpression is an interface implemented by all CQL Expression structs

type IExpressionDef

type IExpressionDef interface {
	IElement
	GetName() string
	GetContext() string
	GetExpression() IExpression
	GetAccessLevel() AccessLevel
}

IExpressionDef is implemented by both ExpressionDef and FunctionDef.

type INaryExpression

type INaryExpression interface {
	IExpression
	GetName() string
	GetOperands() []IExpression
	SetOperands([]IExpression)
	// contains filtered or unexported methods
}

INaryExpression is an interface that Expressions with any number of operands meet.

type IRelationshipClause

type IRelationshipClause interface {
	IElement
	// contains filtered or unexported methods
}

IRelationshipClause is an interface that all With and Without meet.

type ISortByItem

type ISortByItem interface {
	IElement
	// contains filtered or unexported methods
}

ISortByItem defines one or more items that a query can be sorted by. Follows format outlined in https://cql.hl7.org/elm/schema/expression.xsd.

type IUnaryExpression

type IUnaryExpression interface {
	IExpression
	GetName() string
	GetOperand() IExpression
	SetOperand(IExpression)
	// contains filtered or unexported methods
}

IUnaryExpression is an interface that all Unary expressions meet.

type IfThenElse

type IfThenElse struct {
	*Expression
	Condition IExpression
	Then      IExpression
	Else      IExpression
}

IfThenElse Elm expression from https://cql.hl7.org/04-logicalspecification.html#if

type Implies

type Implies struct{ *BinaryExpression }

Implies is https://cql.hl7.org/04-logicalspecification.html#implies

func (*Implies) GetName

func (a *Implies) GetName() string

GetName returns the name of the system operator.

type In

In ELM expression from https://cql.hl7.org/04-logicalspecification.html#in.

func (*In) GetName

func (a *In) GetName() string

GetName returns the name of the system operator.

type InCodeSystem

type InCodeSystem struct{ *BinaryExpression }

InCodeSystem is https://cql.hl7.org/09-b-cqlreference.html#in-codesystem. This is not technically 1:1 with the ELM definition. The ELM defines Code, CodeSystem and CodeSystemExpression arguments, the last being seemingly impossible to set for for now we're treating this as a binary expression.

func (*InCodeSystem) GetName

func (a *InCodeSystem) GetName() string

GetName returns the name of the system operator.

type InValueSet

type InValueSet struct{ *BinaryExpression }

InValueSet is https://cql.hl7.org/09-b-cqlreference.html#in-valueset. This is not technically 1:1 with the ELM definition. The ELM defines Code, ValueSet and ValueSetExpression arguments, the last being seemingly impossible to set for for now we're treating this as a binary expression.

func (*InValueSet) GetName

func (a *InValueSet) GetName() string

GetName returns the name of the system operator.

type Include

type Include struct {
	*Element
	Identifier *LibraryIdentifier
}

Include defines an Include library statement in CQL.

type IncludedIn

IncludedIn ELM expression from https://cql.hl7.org/04-logicalspecification.html#included-in.

func (*IncludedIn) GetName

func (a *IncludedIn) GetName() string

GetName returns the name of the system operator.

type Instance

type Instance struct {
	*Expression
	ClassType types.IType
	Elements  []*InstanceElement
}

Instance represents an instance of a Class (aka Named Structured Value), see https://cql.hl7.org/04-logicalspecification.html#instance

type InstanceElement

type InstanceElement struct {
	Name  string
	Value IExpression
}

InstanceElement is an element in a CQL structure Instance.

type Intersect

type Intersect struct{ *BinaryExpression }

Intersect ELM Expression https://cql.hl7.org/04-logicalspecification.html#intersect Intersect is a nary expression but we are only supporting two operands.

func (*Intersect) GetName

func (a *Intersect) GetName() string

GetName returns the name of the system operator.

type Interval

type Interval struct {
	*Expression
	Low  IExpression
	High IExpression

	// Either LowClosedExpression or LowInclusive should be set.
	LowClosedExpression IExpression
	LowInclusive        bool

	// Either HighClosedExpression or HighInclusive should be set.
	HighClosedExpression IExpression
	HighInclusive        bool
}

An Interval expression.

func NewInclusiveInterval

func NewInclusiveInterval(low, high string, t types.IType) *Interval

NewInclusiveInterval returns an Interval[NewLiteral(low), NewLiteral(high)] where the low and high are literals of type t.

type Is

type Is struct {
	*UnaryExpression
	IsTypeSpecifier types.IType
}

Is is https://cql.hl7.org/04-logicalspecification.html#is.

func (*Is) GetName

func (i *Is) GetName() string

GetName returns the name of the system operator.

type IsFalse

type IsFalse struct{ *UnaryExpression }

IsFalse is https://cql.hl7.org/04-logicalspecification.html#isfalse.

func (*IsFalse) GetName

func (a *IsFalse) GetName() string

GetName returns the name of the system operator.

type IsNull

type IsNull struct{ *UnaryExpression }

IsNull is https://cql.hl7.org/04-logicalspecification.html#isnull.

func (*IsNull) GetName

func (a *IsNull) GetName() string

GetName returns the name of the system operator.

type IsTrue

type IsTrue struct{ *UnaryExpression }

IsTrue is https://cql.hl7.org/04-logicalspecification.html#istrue.

func (*IsTrue) GetName

func (a *IsTrue) GetName() string

GetName returns the name of the system operator.

type Last

type Last struct {
	*UnaryExpression
}

Last ELM expression from https://cql.hl7.org/04-logicalspecification.html#last.

func (*Last) GetName

func (l *Last) GetName() string

GetName returns the name of the system operator.

type Less

type Less struct{ *BinaryExpression }

Less ELM Expression https://cql.hl7.org/04-logicalspecification.html#less

func (*Less) GetName

func (a *Less) GetName() string

GetName returns the name of the system operator.

type LessOrEqual

type LessOrEqual struct{ *BinaryExpression }

LessOrEqual ELM Expression https://cql.hl7.org/04-logicalspecification.html#lessorequal

func (*LessOrEqual) GetName

func (a *LessOrEqual) GetName() string

GetName returns the name of the system operator.

type LetClause

type LetClause struct {
	*Element
	Expression IExpression
	Identifier string
}

LetClause is https://cql.hl7.org/04-logicalspecification.html#letclause.

type Library

type Library struct {
	Identifier  *LibraryIdentifier
	Usings      []*Using
	Includes    []*Include
	Parameters  []*ParameterDef
	CodeSystems []*CodeSystemDef
	Concepts    []*ConceptDef
	Valuesets   []*ValuesetDef
	Codes       []*CodeDef
	Statements  *Statements
}

Library represents a base level CQL library, typically from one CQL file.

func (*Library) String

func (l *Library) String() string

type LibraryIdentifier

type LibraryIdentifier struct {
	*Element
	Local     string
	Qualified string // The full identifier of the library.
	Version   string
}

LibraryIdentifier for the library definition. This matches up with the ELM VersionedIdentifier (https://cql.hl7.org/04-logicalspecification.html#versionedidentifier). If nil then this is an unnamed library.

type List

type List struct {
	*Expression
	List []IExpression
}

A List expression.

func NewList

func NewList(elems []string, t types.IType) *List

NewList returns a List{NewLiteral(elems[0]), NewLiteral(elems[1]), ...} where the elements of the list are literals of type t constructed from elems.

type Literal

type Literal struct {
	*Expression
	Value string
}

Literal represents a CQL literal.

func NewLiteral

func NewLiteral(value string, t types.IType) *Literal

NewLiteral is a helper function to build a model.Literal.

type MaxValue

type MaxValue struct {
	*Expression
	ValueType types.IType
}

MaxValue ELM expression from https://cql.hl7.org/04-logicalspecification.html#maxvalue

type Message

type Message struct {
	*Expression
	Source    IExpression
	Condition IExpression
	Code      IExpression
	Severity  IExpression
	Message   IExpression
}

Message is a CQL expression that represents a message, which is the equivalent of print in most other languages. https://cql.hl7.org/04-logicalspecification.html#message

type MessageSeverity

type MessageSeverity string

A MessageSeverity determines the type of the message and how it will be processed.

const (
	// UNSETMESSAGESEVERITY denotes a message severity that shouldn't be allowed.
	UNSETMESSAGESEVERITY MessageSeverity = ""
	// TRACE denotes a message that should be printed with trace information.
	TRACE MessageSeverity = "Trace"
	// MESSAGE denotes a simple message that should be printed.
	MESSAGE MessageSeverity = "Message"
	// WARNING denotes a message that should log a warning to users.
	WARNING MessageSeverity = "Warning"
	// ERROR denotes an error message that should also halt execution.
	ERROR MessageSeverity = "Error"
)

type MinValue

type MinValue struct {
	*Expression
	ValueType types.IType
}

MinValue ELM expression from https://cql.hl7.org/04-logicalspecification.html#minvalue

type Modulo

type Modulo struct{ *BinaryExpression }

Modulo ELM Expression https://cql.hl7.org/04-logicalspecification.html#modulo

func (*Modulo) GetName

func (a *Modulo) GetName() string

GetName returns the name of the system operator.

type Multiply

type Multiply struct{ *BinaryExpression }

Multiply ELM Expression https://cql.hl7.org/04-logicalspecification.html#multiply

func (*Multiply) GetName

func (a *Multiply) GetName() string

GetName returns the name of the system operator.

type NaryExpression

type NaryExpression struct {
	*Expression
	Operands []IExpression
}

NaryExpression that takes any number of operands including zero. The ELM representation may have additional operands.

func (*NaryExpression) GetOperands

func (n *NaryExpression) GetOperands() []IExpression

GetOperands returns the operands of the NaryExpression.

func (*NaryExpression) SetOperands

func (n *NaryExpression) SetOperands(ops []IExpression)

SetOperands sets the NaryExpression's operands.

type Negate

type Negate struct{ *UnaryExpression }

Negate is https://cql.hl7.org/04-logicalspecification.html#negate.

func (*Negate) GetName

func (a *Negate) GetName() string

GetName returns the name of the system operator.

type Not

type Not struct{ *UnaryExpression }

Not is https://cql.hl7.org/04-logicalspecification.html#not.

func (*Not) GetName

func (n *Not) GetName() string

GetName returns the name of the system operator.

type Now

type Now struct{ *NaryExpression }

Now is https://cql.hl7.org/04-logicalspecification.html#now. Note: in the future we may implement the OperatorExpression, and should convert this to one of those at that point.

func (*Now) GetName

func (a *Now) GetName() string

GetName returns the name of the system operator.

type OperandDef

type OperandDef struct {
	// The type of the operand is the ResultType set in the Element.
	*Expression
	Name string
}

OperandDef defines an operand for a user defined function.

type OperandRef

type OperandRef struct {
	*Expression
	Name string
}

OperandRef defines a reference to an operand within a function.

type Or

type Or struct{ *BinaryExpression }

Or is https://cql.hl7.org/04-logicalspecification.html#or

func (*Or) GetName

func (a *Or) GetName() string

GetName returns the name of the system operator.

type ParameterDef

type ParameterDef struct {
	*Element
	Name        string
	Default     IExpression
	AccessLevel AccessLevel
}

ParameterDef is a top-level statement that defines a named CQL parameter.

type ParameterRef

type ParameterRef struct {
	*Expression
	Name string
	// LibraryName is empty for parameters defined in the local CQL library. Otherwise it is the
	// local identifier of the included library.
	LibraryName string
}

ParameterRef defines a reference to a ParameterDef definition used in CQL expressions.

type Predecessor

type Predecessor struct{ *UnaryExpression }

Predecessor ELM expression from https://cql.hl7.org/04-logicalspecification.html#predecessor.

func (*Predecessor) GetName

func (a *Predecessor) GetName() string

GetName returns the name of the system operator.

type Property

type Property struct {
	*Expression
	Source IExpression
	Path   string
}

Property gets a property from an expression. In ELM if the expression is an AliasRef then Scope is set instead of Source. In our model Source is set to AliasRef; there is no Scope.

type Quantity

type Quantity struct {
	*Expression
	Value float64
	Unit  Unit
}

Quantity is an expression representation of a clinical quantity. https://cql.hl7.org/04-logicalspecification.html#quantity

type Query

type Query struct {
	*Expression
	Source       []*AliasedSource
	Let          []*LetClause
	Relationship []IRelationshipClause
	Where        IExpression
	Sort         *SortClause
	Aggregate    *AggregateClause // Only aggregate or Return can be populated, not both.
	Return       *ReturnClause
}

A Query expression.

type QueryLetRef

type QueryLetRef struct {
	*Expression
	Name string
}

QueryLetRef is similar to an AliasRef except specific to references to let clauses.

type Ratio

type Ratio struct {
	*Expression
	Numerator   Quantity
	Denominator Quantity
}

A Ratio is an expression that expresses a ratio between two Quantities. https://cql.hl7.org/04-logicalspecification.html#ratio

type RelationshipClause

type RelationshipClause struct {
	*Element
	// Expression is the source of the inclusion clause.
	Expression IExpression
	Alias      string
	SuchThat   IExpression
}

RelationshipClause for a Query expression.

type Retrieve

type Retrieve struct {
	*Expression
	// TODO(b/312172420): Changing DataType to a named type would make life much easier.
	DataType     string
	TemplateID   string
	CodeProperty string
	// Codes is an expression that returns a list of code values.
	Codes IExpression
}

A Retrieve expression.

type ReturnClause

type ReturnClause struct {
	*Element
	Expression IExpression
	Distinct   bool
}

ReturnClause for a Query expression.

type SameOrAfter

SameOrAfter ELM expression from https://cql.hl7.org/04-logicalspecification.html#sameorafter.

func (*SameOrAfter) GetName

func (a *SameOrAfter) GetName() string

GetName returns the name of the system operator.

type SameOrBefore

type SameOrBefore BinaryExpressionWithPrecision

SameOrBefore ELM expression from https://cql.hl7.org/04-logicalspecification.html#sameorbefore.

func (*SameOrBefore) GetName

func (a *SameOrBefore) GetName() string

GetName returns the name of the system operator.

type SingletonFrom

type SingletonFrom struct{ *UnaryExpression }

SingletonFrom is https://cql.hl7.org/04-logicalspecification.html#singletonfrom.

func (*SingletonFrom) GetName

func (s *SingletonFrom) GetName() string

GetName returns the name of the system operator.

type SortByColumn

type SortByColumn struct {
	*SortByItem
	Path string
}

SortByColumn enables sorting by a given column and direction.

type SortByDirection

type SortByDirection struct {
	*SortByItem
}

SortByDirection enables sorting non-tuple values by direction

type SortByItem

type SortByItem struct {
	*Element
	Direction SortDirection
}

SortByItem is the base abstract type for all query types.

type SortClause

type SortClause struct {
	*Element
	ByItems []ISortByItem
}

SortClause for a Query expression.

type SortDirection

type SortDirection string

A SortDirection determines what ordering to use for a query if sorting is enabled.

const (
	// UNSETSORTDIRECTION denotes a sort direction that shouldn't be allowed.
	UNSETSORTDIRECTION SortDirection = ""
	// ASCENDING denotes query sorting from smallest to largest values.
	ASCENDING SortDirection = "ASCENDING"
	// DESCENDING denotes query sorting from largest to smallest values.
	DESCENDING SortDirection = "DESCENDING"
)

type Start

type Start struct{ *UnaryExpression }

Start is https://cql.hl7.org/04-logicalspecification.html#start.

func (*Start) GetName

func (a *Start) GetName() string

GetName returns the name of the system operator.

type Statements

type Statements struct {
	Defs []IExpressionDef
}

Statements is a collection of expression and function definitions, similar to the ELM structure.

type Subtract

type Subtract struct{ *BinaryExpression }

Subtract ELM Expression https://cql.hl7.org/04-logicalspecification.html#subtract

func (*Subtract) GetName

func (a *Subtract) GetName() string

GetName returns the name of the system operator.

type Successor

type Successor struct{ *UnaryExpression }

Successor ELM expression from https://cql.hl7.org/04-logicalspecification.html#successor.

func (*Successor) GetName

func (a *Successor) GetName() string

GetName returns the name of the system operator.

type Time

type Time struct{ *NaryExpression }

Time is the functional syntax to create a CQL Time https://cql.hl7.org/09-b-cqlreference.html#time-1.

func (*Time) GetName

func (a *Time) GetName() string

GetName returns the name of the system operator.

type TimeOfDay

type TimeOfDay struct{ *NaryExpression }

TimeOfDay is https://cql.hl7.org/04-logicalspecification.html#timeofday Note: in the future we may implement the OperatorExpression, and should convert this to one of those at that point.

func (*TimeOfDay) GetName

func (a *TimeOfDay) GetName() string

GetName returns the name of the system operator.

type ToBoolean

type ToBoolean struct{ *UnaryExpression }

ToBoolean ELM expression from https://cql.hl7.org/09-b-cqlreference.html#toboolean.

func (*ToBoolean) GetName

func (a *ToBoolean) GetName() string

GetName returns the name of the system operator.

type ToConcept

type ToConcept struct{ *UnaryExpression }

ToConcept ELM expression from https://cql.hl7.org/09-b-cqlreference.html#toconcept.

func (*ToConcept) GetName

func (a *ToConcept) GetName() string

GetName returns the name of the system operator.

type ToDate

type ToDate struct{ *UnaryExpression }

ToDate ELM expression from https://cql.hl7.org/04-logicalspecification.html#todate.

func (*ToDate) GetName

func (a *ToDate) GetName() string

GetName returns the name of the system operator.

type ToDateTime

type ToDateTime struct{ *UnaryExpression }

ToDateTime ELM expression from https://cql.hl7.org/04-logicalspecification.html#todatetime

func (*ToDateTime) GetName

func (a *ToDateTime) GetName() string

GetName returns the name of the system operator.

type ToDecimal

type ToDecimal struct{ *UnaryExpression }

ToDecimal ELM expression from https://cql.hl7.org/04-logicalspecification.html#todecimal.

func (*ToDecimal) GetName

func (a *ToDecimal) GetName() string

GetName returns the name of the system operator.

type ToInteger

type ToInteger struct{ *UnaryExpression }

ToInteger ELM expression from https://cql.hl7.org/09-b-cqlreference.html#tointeger.

func (*ToInteger) GetName

func (a *ToInteger) GetName() string

GetName returns the name of the system operator.

type ToLong

type ToLong struct{ *UnaryExpression }

ToLong ELM expression from https://cql.hl7.org/04-logicalspecification.html#tolong.

func (*ToLong) GetName

func (a *ToLong) GetName() string

GetName returns the name of the system operator.

type ToQuantity

type ToQuantity struct{ *UnaryExpression }

ToQuantity ELM expression from https://cql.hl7.org/04-logicalspecification.html#toquantity.

func (*ToQuantity) GetName

func (a *ToQuantity) GetName() string

GetName returns the name of the system operator.

type ToString

type ToString struct{ *UnaryExpression }

ToString ELM expression from https://cql.hl7.org/09-b-cqlreference.html#tostring.

func (*ToString) GetName

func (a *ToString) GetName() string

GetName returns the name of the system operator.

type ToTime

type ToTime struct{ *UnaryExpression }

ToTime ELM expression from https://cql.hl7.org/09-b-cqlreference.html#totime.

func (*ToTime) GetName

func (a *ToTime) GetName() string

GetName returns the name of the system operator.

type Today

type Today struct{ *NaryExpression }

Today is https://cql.hl7.org/04-logicalspecification.html#today. Note: in the future we may implement the OperatorExpression, and should convert this to one of thse at that point.

func (*Today) GetName

func (a *Today) GetName() string

GetName returns the name of the system operator.

type TruncatedDivide

type TruncatedDivide struct{ *BinaryExpression }

TruncatedDivide ELM Expression https://cql.hl7.org/04-logicalspecification.html#truncateddivide

func (*TruncatedDivide) GetName

func (a *TruncatedDivide) GetName() string

GetName returns the name of the system operator.

type Tuple

type Tuple struct {
	*Expression
	Elements []*TupleElement
}

Tuple represents a tuple (aka Structured Value), see https://cql.hl7.org/04-logicalspecification.html#tuple

type TupleElement

type TupleElement struct {
	Name  string
	Value IExpression
}

TupleElement is an element in a CQL Tuple.

type UnaryExpression

type UnaryExpression struct {
	*Expression
	Operand IExpression
}

UnaryExpression is a CQL expression that has one operand. The ELM representation may have additional operands.

func (*UnaryExpression) GetOperand

func (a *UnaryExpression) GetOperand() IExpression

GetOperand returns the unary expression's operand.

func (*UnaryExpression) SetOperand

func (a *UnaryExpression) SetOperand(operand IExpression)

SetOperand sets the unary expression's operand.

type Union

type Union struct{ *BinaryExpression }

Union ELM Expression https://cql.hl7.org/04-logicalspecification.html#union Union is a nary expression but we are only supporting two operands.

func (*Union) GetName

func (a *Union) GetName() string

GetName returns the name of the system operator.

type Unit

type Unit string

Unit represents the unit for a QuantityValue.

const (
	// UNSETUNIT represents unknown unit.
	UNSETUNIT Unit = ""
	// ONEUNIT defines a base unit.
	// This is often the result of dividing quantities with the same unit, canceling the unit out.
	ONEUNIT Unit = "1"
	// YEARUNIT represents year unit.
	YEARUNIT Unit = "year"
	// MONTHUNIT represents month unit.
	MONTHUNIT Unit = "month"
	// WEEKUNIT represents a week unit.
	WEEKUNIT Unit = "week"
	// DAYUNIT represents day unit.
	DAYUNIT Unit = "day"
	// HOURUNIT represents an hour unit.
	HOURUNIT Unit = "hour"
	// MINUTEUNIT represents a minute unit.
	MINUTEUNIT Unit = "minute"
	// SECONDUNIT represents second unit.
	SECONDUNIT Unit = "second"
	// MILLISECONDUNIT represents millisecond unit.
	MILLISECONDUNIT Unit = "millisecond"
)

TODO(b/319155752) Add support for UCUM values.

type Using

type Using struct {
	*Element
	LocalIdentifier string
	// URI is the URL specified at the top of the modelinfo, for FHIR "http://hl7.org/fhir".
	URI     string
	Version string
}

Using defines a Using directive in CQL.

type ValuesetDef

type ValuesetDef struct {
	*Element
	Name        string
	ID          string           // 1..1
	Version     string           // 0..1
	CodeSystems []*CodeSystemRef // 0..*
	AccessLevel AccessLevel
}

ValuesetDef is a named valueset definition that references a value set by ID.

type ValuesetRef

type ValuesetRef struct {
	*Expression
	Name string
	// LibraryName is empty for valuesets defined in the local CQL library. Otherwise it is the
	// local identifier of the included library.
	LibraryName string
}

ValuesetRef defines a reference to a ValuesetDef definition used in CQL expressions.

type XOr

type XOr struct{ *BinaryExpression }

XOr is https://cql.hl7.org/04-logicalspecification.html#xor

func (*XOr) GetName

func (a *XOr) GetName() string

GetName returns the name of the system operator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL