Skip to content

Commit

Permalink
Merge pull request #836 from samply/release-v0.18.4
Browse files Browse the repository at this point in the history
Release v0.18.4
  • Loading branch information
alexanderkiel authored Nov 12, 2022
2 parents 62e2046 + 99fc73f commit 439c252
Show file tree
Hide file tree
Showing 18 changed files with 239 additions and 216 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ jobs:
- name: Evaluate CQL Query 34 - Subject List
run: .github/scripts/evaluate-measure-subject-list.sh modules/operation-measure-evaluate-measure/test/blaze/fhir/operation/evaluate_measure/q37-overlaps.cql 24

- name: Evaluate CQL Query 46
run: .github/scripts/evaluate-measure.sh modules/operation-measure-evaluate-measure/test/blaze/fhir/operation/evaluate_measure//q46-between-date.cql 19

- name: Forwarded Header HTTPS
run: .github/scripts/forwarded-header.sh https

Expand Down Expand Up @@ -919,6 +922,9 @@ jobs:
- name: Evaluate CQL Query 34 - Subject List
run: .github/scripts/evaluate-measure-subject-list.sh modules/operation-measure-evaluate-measure/test/blaze/fhir/operation/evaluate_measure/q37-overlaps.cql 24

- name: Evaluate CQL Query 46
run: .github/scripts/evaluate-measure.sh modules/operation-measure-evaluate-measure/test/blaze/fhir/operation/evaluate_measure//q46-between-date.cql 19

- name: Forwarded Header HTTPS
run: .github/scripts/forwarded-header.sh https

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## v0.18.4

### Bugfixes

* Fix CQL Function Argument Hiding ([#835](https://github.com/samply/blaze/pull/835))

The full changelog can be found [here](https://github.com/samply/blaze/milestone/55?closed=1).

## v0.18.3

### Operation
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The goal of this project is to provide a FHIR® Store with an internal CQL Evalu

Blaze passes all [Touchstone FHIR 4.0.1 Basic Tests][12] and almost all [CQL Tests][3]. Please refer to the [Conformance](docs/conformance.md) section and report any issues you encounter during evaluation.

Latest release: [v0.18.3][5]
Latest release: [v0.18.4][5]

## Quick Start

Expand Down Expand Up @@ -73,7 +73,7 @@ Unless required by applicable law or agreed to in writing, software distributed

[3]: <https://cql.hl7.org/tests.html>
[4]: <https://alexanderkiel.gitbook.io/blaze/deployment>
[5]: <https://github.com/samply/blaze/releases/tag/v0.18.3>
[5]: <https://github.com/samply/blaze/releases/tag/v0.18.4>
[6]: <https://www.yourkit.com/java/profiler/>
[7]: <https://www.yourkit.com/.net/profiler/>
[8]: <https://www.yourkit.com/youmonitor/>
Expand Down
4 changes: 2 additions & 2 deletions docs/deployment/docker-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Blaze should log something like this:
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:64] - JVM version: 16.0.2
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:65] - Maximum available memory: 1738 MiB
2021-06-27T11:02:37.835Z ee086ef908c1 main INFO [blaze.core:66] - Number of available processors: 8
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.18.3 in 8.2 seconds
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.18.4 in 8.2 seconds
```

In order to test connectivity, query the health endpoint:
Expand All @@ -47,7 +47,7 @@ that should return:
```json
{
"name": "Blaze",
"version": "0.18.3"
"version": "0.18.4"
}
```

Expand Down
12 changes: 6 additions & 6 deletions docs/deployment/manual-deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

The installation works under Windows, Linux and macOS. The only dependency is an installed OpenJDK 11 or 17 with 17 recommended. Blaze is tested with [Eclipse Temurin][1].

Blaze runs on the JVM and comes as single JAR file. Download the most recent version [here](https://github.com/samply/blaze/releases/tag/v0.18.3). Look for `blaze-0.18.3-standalone.jar`.
Blaze runs on the JVM and comes as single JAR file. Download the most recent version [here](https://github.com/samply/blaze/releases/tag/v0.18.4). Look for `blaze-0.18.4-standalone.jar`.

After the download, you can start blaze with the following command (Linux, macOS):

```sh
java -jar blaze-0.18.3-standalone.jar -m blaze.core
java -jar blaze-0.18.4-standalone.jar -m blaze.core
```

Blaze will run with an in-memory, volatile database for testing and demo purposes.
Expand All @@ -17,14 +17,14 @@ Blaze can be run with durable storage by setting the environment variables `STOR
Under Linux/macOS:

```sh
STORAGE=standalone java -jar blaze-0.18.3-standalone.jar -m blaze.core
STORAGE=standalone java -jar blaze-0.18.4-standalone.jar -m blaze.core
```

Under Windows, you need to set the Environment variables in the PowerShell before starting Blaze:

```powershell
$Env:STORAGE="standalone"
java -jar blaze-0.18.3-standalone.jar -m blaze.core
java -jar blaze-0.18.4-standalone.jar -m blaze.core
```

This will create three directories called `index`, `transaction` and `resource` inside the current working directory, one for each database part used.
Expand All @@ -42,7 +42,7 @@ The output should look like this:
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:64] - JVM version: 16.0.2
2021-06-27T11:02:37.834Z ee086ef908c1 main INFO [blaze.core:65] - Maximum available memory: 1738 MiB
2021-06-27T11:02:37.835Z ee086ef908c1 main INFO [blaze.core:66] - Number of available processors: 8
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.18.3 in 8.2 seconds
2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.18.4 in 8.2 seconds
```

In order to test connectivity, query the health endpoint:
Expand All @@ -62,7 +62,7 @@ that should return:
```json
{
"name": "Blaze",
"version": "0.18.3"
"version": "0.18.4"
}
```

Expand Down
4 changes: 3 additions & 1 deletion modules/cql/src/blaze/elm/compiler/macros.clj
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
(reify core/Expression
(~'-eval [~'_ context# resource# scope#]
(let [~operands-binding (mapv #(core/-eval % context# resource# scope#) operands#)]
~@body))))))
~@body))
(~'-form [~'_]
(cons (quote ~name) (map core/-form operands#)))))))


(defmacro defaggop
Expand Down
122 changes: 56 additions & 66 deletions modules/cql/src/blaze/elm/compiler/queries.clj
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@


(defprotocol XformFactory
(-create [_ context resource]
(-create [_ context resource scope]
"Creates a xform which filters and/or shapes query sources.")
(-form [_]))


(defrecord WithXformFactory
[rhs rhs-operand such-that lhs-operand single-query-scope]
[rhs rhs-operand rhs-alias such-that lhs-operand lhs-alias]
XformFactory
(-create [_ context resource]
(let [rhs (core/-eval rhs context resource nil)
indexer #(core/-eval rhs-operand context resource %)]
(-create [_ context resource scope]
(let [rhs (core/-eval rhs context resource scope)
indexer #(core/-eval rhs-operand context resource
(assoc scope rhs-alias %))]
(if (some? such-that)
(let [index (group-by indexer rhs)]
(filter
Expand All @@ -39,12 +40,13 @@
(get index))]
(some
#(core/-eval such-that context resource
{single-query-scope lhs-entity alias %})
(assoc scope lhs-alias lhs-entity rhs-alias %))
rhs-entities)))))
(let [index (into #{} (map indexer) rhs)]
(filter
(fn eval-with-clause [lhs-entity]
(some->> (core/-eval lhs-operand context resource lhs-entity)
(some->> (core/-eval lhs-operand context resource
(assoc scope lhs-alias lhs-entity))
(contains? index))))))))
(-form [_]
(list 'with (core/-form rhs))))
Expand All @@ -56,54 +58,58 @@
(filter #(with-clause context resource %)))))


(defrecord WhereXformFactory [expr]
(defrecord WhereXformFactory [alias expr]
XformFactory
(-create [_ context resource]
(filter #(core/-eval expr context resource %)))
(-create [_ context resource scope]
(filter #(core/-eval expr context resource (assoc scope alias %))))
(-form [_]
`(~'where ~(core/-form expr))))
`(~'where ~(symbol alias) ~(core/-form expr))))


(defn- where-xform-factory [expr]
(->WhereXformFactory expr))
(defn- where-xform-factory [alias expr]
(->WhereXformFactory alias expr))


(defrecord ReturnXformFactory [expr]
(defrecord ReturnXformFactory [alias expr]
XformFactory
(-create [_ context resource]
(map #(core/-eval expr context resource %))))
(-create [_ context resource scope]
(map #(core/-eval expr context resource (assoc scope alias %))))
(-form [_]
`(~'return ~(symbol alias) ~(core/-form expr))))


(defrecord DistinctXformFactory []
XformFactory
(-create [_ _ _]
(-create [_ _ _ _]
(distinct))
(-form [_]
'distinct))


(defrecord ComposedDistinctXformFactory [xform-factory]
XformFactory
(-create [_ context resource]
(-create [_ context resource scope]
(comp
(-create xform-factory context resource)
(distinct))))
(-create xform-factory context resource scope)
(distinct)))
(-form [_]
`(~'distinct ~(-form xform-factory))))


(defn- return-xform-factory [expr distinct]
(defn- return-xform-factory [alias expr distinct]
(if (some? expr)
(if distinct
(-> (->ReturnXformFactory expr)
(-> (->ReturnXformFactory alias expr)
(->ComposedDistinctXformFactory))
(->ReturnXformFactory expr))
(->ReturnXformFactory alias expr))
(when distinct
(->DistinctXformFactory))))


(defrecord ComposedXformFactory [factories]
XformFactory
(-create [_ context resource]
(transduce (map #(-create % context resource)) comp factories))
(-create [_ context resource scope]
(transduce (map #(-create % context resource scope)) comp factories))
(-form [_]
`(~'comp ~@(map -form factories))))

Expand Down Expand Up @@ -133,7 +139,7 @@
core/Expression
(-eval [_ context resource scope]
(coll/eduction
(-create xform-factory context resource)
(-create xform-factory context resource scope)
(core/-eval source context resource scope)))
(-form [_]
`(~'eduction-query ~(-form xform-factory) ~(core/-form source))))
Expand All @@ -148,7 +154,7 @@
(-eval [_ context resource scope]
(into
[]
(-create xform-factory context resource)
(-create xform-factory context resource scope)
(core/-eval source context resource scope)))
(-form [_]
`(~'vector-query ~(-form xform-factory) ~(core/-form source))))
Expand Down Expand Up @@ -215,7 +221,7 @@
;; TODO: build a comparator of all sort by items
(->> (into
[]
(-create xform-factory context resource)
(-create xform-factory context resource scope)
(core/-eval source context resource scope))
(sort-by
(if-let [expr (:expression sort-by-item)]
Expand Down Expand Up @@ -278,12 +284,11 @@
(let [{:keys [expression alias]} (first sources)
context (dissoc context :optimizations)
source (core/compile* context expression)
context (assoc context :life/single-query-scope alias)
with-equiv-clauses (filter (comp #{"WithEquiv"} :type) relationships)
with-xform-factories (map #(compile-with-equiv-clause context %) with-equiv-clauses)
where-xform-factory (some->> where (core/compile* context) (where-xform-factory))
with-xform-factories (map #(compile-with-equiv-clause context alias %) with-equiv-clauses)
where-xform-factory (some->> where (core/compile* context) (where-xform-factory alias))
distinct (if (contains? optimizations :non-distinct) false distinct)
return-xform-factory (return-xform-factory (some->> return (core/compile* context)) distinct)
return-xform-factory (return-xform-factory alias (some->> return (core/compile* context)) distinct)
xform-factory (xform-factory with-xform-factories where-xform-factory return-xform-factory)
sort-by-items (mapv #(compile-sort-by-item context %) sort-by-items)]
(if (empty? sort-by-items)
Expand All @@ -305,23 +310,14 @@
(defrecord AliasRefExpression [key]
core/Expression
(-eval [_ _ _ scopes]
(get scopes key)))


(defrecord SingleScopeAliasRefExpression []
core/Expression
(-eval [_ _ _ scope]
scope))


(def single-scope-alias-ref-expression (->SingleScopeAliasRefExpression))
(get scopes key))
(-form [_]
`(~'alias-ref ~(symbol key))))


(defmethod core/compile* :elm.compiler.type/alias-ref
[{:life/keys [single-query-scope]} {:keys [name]}]
(if (= single-query-scope name)
single-scope-alias-ref-expression
(->AliasRefExpression name)))
[_ {:keys [name]}]
(->AliasRefExpression name))


;; 10.7 IdentifierRef
Expand Down Expand Up @@ -358,26 +354,20 @@
the semi-join here.
Returns an XformFactory."
{:arglists '([context with-equiv-clause])}
[context {:keys [alias] rhs :expression equiv-operands :equivOperand
such-that :suchThat}]
(if-let [single-query-scope (:life/single-query-scope context)]
(if-let [rhs-operand (find-operand-with-alias equiv-operands alias)]
(if-let [lhs-operand (find-operand-with-alias equiv-operands
single-query-scope)]
(let [rhs (core/compile* context rhs)
rhs-operand (core/compile* (assoc context :life/single-query-scope alias)
rhs-operand)
lhs-operand (core/compile* context lhs-operand)
such-that (some->> such-that
(core/compile* (dissoc context :life/single-query-scope)))]
(->WithXformFactory rhs rhs-operand such-that lhs-operand
single-query-scope))
(throw-anom missing-lhs-operand-anom))
(throw-anom (missing-rhs-operand-anom alias)))
(throw-anom
(ba/incorrect
(format "Unsupported call without single query scope.")))))
{:arglists '([context lhs-alias with-equiv-clause])}
[context
lhs-alias
{rhs-alias :alias rhs :expression equiv-operands :equivOperand
such-that :suchThat}]
(if-let [rhs-operand (find-operand-with-alias equiv-operands rhs-alias)]
(if-let [lhs-operand (find-operand-with-alias equiv-operands lhs-alias)]
(let [rhs (core/compile* context rhs)
rhs-operand (core/compile* context rhs-operand)
lhs-operand (core/compile* context lhs-operand)
such-that (some->> such-that (core/compile* context))]
(->WithXformFactory rhs rhs-operand rhs-alias such-that lhs-operand lhs-alias))
(throw-anom missing-lhs-operand-anom))
(throw-anom (missing-rhs-operand-anom rhs-alias))))


;; TODO 10.15. Without
6 changes: 2 additions & 4 deletions modules/cql/src/blaze/elm/compiler/structured_values.clj
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,11 @@


(defmethod core/compile* :elm.compiler.type/property
[{:life/keys [single-query-scope] :as context} {:keys [source scope path]}]
[context {:keys [source scope path]}]
(let [key (path->key path)]
(cond
source
(->SourcePropertyExpression (core/compile* context source) key)

scope
(if (= single-query-scope scope)
(->SingleScopePropertyExpression key)
(->ScopePropertyExpression scope key)))))
(->ScopePropertyExpression scope key))))
Loading

0 comments on commit 439c252

Please sign in to comment.