cql
cql copied to clipboard
Elm Supports Aggregrate Path should this CQL engine support aggagregate path
This is more a discussion as opposed to an issue, but I see that there are no public discussions on github and there is a private google repo where this probably occurs.
I see in the model.go // TODO: b/347346351 - In ELM it's modeled as an AggregateExpression, but for now we model it as an
CQL aggregrate functions look like in the spec look like
Sum([1, 2, 3])
ELM aggregate expressions support
Sum(Patient.observations.value)
Is this something desirable to support?
If yes this was my rough idea on howto add support
type IAggregateExpression interface {
IExpression
GetSource() IExpression
GetPath() string
IsDistinct() bool
// To differentiate IAggregateExpression from other interfaces
isAggregateExpression()
}
type AggregateExpression struct {
*Expression
Source IExpression
Path string // Optional path to apply to each element
Distinct bool // Whether to apply distinct to the source before aggregation
}
func (a *AggregateExpression) GetSource() IExpression { return a.Source }
func (a *AggregateExpression) GetPath() string { return a.Path }
func (a *AggregateExpression) IsDistinct() bool { return a.Distinct }
func (a *AggregateExpression) isAggregateExpression() {}