google / google/cql

Bug Let Clause Does not have access to Source Alias

Open
#136 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
113
Forks
20
PR merge metrics
No merged PRs in 30d

Description

In a shared library likee CDS_Connect_Commons the let clause is evualted before the query aliases are available in scope.

Example.:
```
define function ActiveMedicationStatement(MedList List):
MedList M
let EffectivePeriod: PeriodToInterval(M.effective as FHIR.Period)
where M.status.value = 'active'
and (end of EffectivePeriod is null or end of EffectivePeriod after Now())

```

The interpreter would perform:
```
MedList M // Creates alias "M"
let EffectivePeriod: PeriodToInterval(M.effective) // ❌ "M" not in scope
where M.status.value = 'active' // ✅ "M" would be in scope
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.