From a84c303fa36f6b3a09c689522ad31c3834f9a575 Mon Sep 17 00:00:00 2001 From: Alexander Kiel Date: Tue, 5 Jul 2022 15:27:30 +0200 Subject: [PATCH 1/4] Fix Quantity Indexing without Value Closes: #764 --- .../blaze/db/impl/search_param/quantity.clj | 20 ++++++------- .../db/impl/search_param/quantity_test.clj | 28 ++++++++++++++++++- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/modules/db/src/blaze/db/impl/search_param/quantity.clj b/modules/db/src/blaze/db/impl/search_param/quantity.clj index ba4fa9198..91249e913 100644 --- a/modules/db/src/blaze/db/impl/search_param/quantity.clj +++ b/modules/db/src/blaze/db/impl/search_param/quantity.clj @@ -30,19 +30,17 @@ (defn- index-quantity-entries [{:keys [value system code unit]}] - (let [value (type/value value) - system (type/value system) + (let [system (type/value system) code (type/value code) unit (type/value unit)] - (cond-> [] - value - (conj [nil (codec/quantity nil value)]) - code - (conj [nil (codec/quantity code value)]) - (and unit (not= unit code)) - (conj [nil (codec/quantity unit value)]) - (and system code) - (conj [nil (codec/quantity (str system "|" code) value)])))) + (when-let [value (type/value value)] + (cond-> [[nil (codec/quantity nil value)]] + code + (conj [nil (codec/quantity code value)]) + (and unit (not= unit code)) + (conj [nil (codec/quantity unit value)]) + (and system code) + (conj [nil (codec/quantity (str system "|" code) value)]))))) (defmethod index-entries :fhir/Quantity diff --git a/modules/db/test/blaze/db/impl/search_param/quantity_test.clj b/modules/db/test/blaze/db/impl/search_param/quantity_test.clj index f2f117a34..60724a682 100644 --- a/modules/db/test/blaze/db/impl/search_param/quantity_test.clj +++ b/modules/db/test/blaze/db/impl/search_param/quantity_test.clj @@ -362,7 +362,33 @@ :id := "id-155558" :hash-prefix := (hash/prefix hash) :code := "value-quantity" - :v-hash := (codec/quantity "mmHg" 120M)))))) + :v-hash := (codec/quantity "mmHg" 120M))))) + + (testing "without Quantity value" + (let [observation + {:fhir/type :fhir/Observation + :id "id-155558" + :status #fhir/code"final" + :value + #fhir/Quantity + {:code #fhir/code"mm[Hg]" + :system #fhir/uri"http://unitsofmeasure.org"}} + hash (hash/generate observation)] + + (is (empty? (search-param/index-entries + (sr/get search-param-registry "value-quantity" "Observation") + [] hash observation))))) + + (testing "without value" + (let [observation + {:fhir/type :fhir/Observation + :id "id-155558" + :status #fhir/code"final"} + hash (hash/generate observation)] + + (is (empty? (search-param/index-entries + (sr/get search-param-registry "value-quantity" "Observation") + [] hash observation)))))) (testing "FHIRPath evaluation problem" (let [resource {:fhir/type :fhir/Observation :id "foo"} From 579f233f9b90d05541fd199d53901d36e79af38a Mon Sep 17 00:00:00 2001 From: Alexander Kiel Date: Thu, 7 Jul 2022 21:15:10 +0200 Subject: [PATCH 2/4] Implement Functions in CQL Closes: #501 --- docs/conformance/cql.md | 66 ++++++------- modules/cql/src/blaze/elm/compiler/core.clj | 6 +- .../src/blaze/elm/compiler/external_data.clj | 8 +- .../cql/src/blaze/elm/compiler/function.clj | 12 +++ .../cql/src/blaze/elm/compiler/library.clj | 58 +++++++---- .../cql/src/blaze/elm/compiler/queries.clj | 22 ++--- .../src/blaze/elm/compiler/reusing_logic.clj | 38 ++++++- modules/cql/src/blaze/elm/compiler/spec.clj | 4 + modules/cql/src/blaze/elm/spec.clj | 25 +++-- .../blaze/elm/compiler/external_data_test.clj | 98 ++++++++++--------- .../test/blaze/elm/compiler/library_test.clj | 50 ++++++++-- .../test/blaze/elm/compiler/queries_test.clj | 16 ++- .../blaze/elm/compiler/reusing_logic_test.clj | 80 +++++++++++++-- modules/cql/test/blaze/elm/literal.clj | 10 +- modules/cql/test/data_readers.clj | 2 + .../q39-social-sec-num-query.cql | 9 +- 16 files changed, 348 insertions(+), 156 deletions(-) create mode 100644 modules/cql/src/blaze/elm/compiler/function.clj diff --git a/docs/conformance/cql.md b/docs/conformance/cql.md index 6d1b24564..2d8e89517 100644 --- a/docs/conformance/cql.md +++ b/docs/conformance/cql.md @@ -85,7 +85,7 @@ The section numbers refer to the documentation of the [ELM Specification](https: |------|---------------|------------|---------------------------------------------|-------| | 9.1. | ExpressionDef | ✓ | | | | 9.2. | ExpressionRef | ! | only inside same library | | -| 9.3. | FunctionDef | ✗ | | | +| 9.3. | FunctionDef | ✓ | | | | 9.4. | FunctionRef | ! | hard coded implementation of some functions | | ### 10. Queries @@ -322,38 +322,38 @@ The section numbers refer to the documentation of the [ELM Specification](https: ### 22. Type Operators | Num | Group | Expression | State | Notes | -|--------|--------------------|-----------|---------------|-------| -| 22.1. | As | ! | no strictness | | -| 22.2. | CanConvert | ✗ | | | -| 22.3. | CanConvertQuantity | ✓ | | | -| 22.4. | Children | ✓ | | | -| 22.5. | Convert | ✗ | | | -| 22.6. | ConvertQuantity | ✓ | | | -| 22.7. | ConvertsToBoolean | ✓ | | | -| 22.8. | ConvertsToDate | ✓ | | | -| 22.9. | ConvertsToDateTime | ✓ | | | -| 22.10. | ConvertsToDecimal | ✓ | | | -| 22.11. | ConvertsToLong | ✓ | | | -| 22.12. | ConvertsToInteger | ✓ | | | -| 22.13. | ConvertsToQuantity | ✓ | | | -| 22.14. | ConvertsToRatio | ✗ | | | -| 22.15. | ConvertsToString | ✓ | | | -| 22.16. | ConvertsToTime | ✓ | | | -| 22.17. | Descendents | ✓ | | | -| 22.18. | Is | ✗ | | | -| 22.19. | ToBoolean | ✓ | | | -| 22.20. | ToChars | ✓ | | | -| 22.21. | ToConcept | ✗ | | | -| 22.22. | ToDate | ✓ | | | -| 22.23. | ToDateTime | ✓ | | | -| 22.24. | ToDecimal | ✓ | | | -| 22.25. | ToInteger | ✓ | | | -| 22.26. | ToList | ✓ | | | -| 22.27. | ToLong | ✓ | | | -| 22.28. | ToQuantity | ✓ | | | -| 22.29. | ToRatio | ✗ | | | -| 22.30. | ToString | ✓ | | | -| 22.31. | ToTime | ✓ | | | +|--------|--------------------|------------|---------------|-------| +| 22.1. | As | ! | no strictness | | +| 22.2. | CanConvert | ✗ | | | +| 22.3. | CanConvertQuantity | ✓ | | | +| 22.4. | Children | ✓ | | | +| 22.5. | Convert | ✗ | | | +| 22.6. | ConvertQuantity | ✓ | | | +| 22.7. | ConvertsToBoolean | ✓ | | | +| 22.8. | ConvertsToDate | ✓ | | | +| 22.9. | ConvertsToDateTime | ✓ | | | +| 22.10. | ConvertsToDecimal | ✓ | | | +| 22.11. | ConvertsToLong | ✓ | | | +| 22.12. | ConvertsToInteger | ✓ | | | +| 22.13. | ConvertsToQuantity | ✓ | | | +| 22.14. | ConvertsToRatio | ✗ | | | +| 22.15. | ConvertsToString | ✓ | | | +| 22.16. | ConvertsToTime | ✓ | | | +| 22.17. | Descendents | ✓ | | | +| 22.18. | Is | ✗ | | | +| 22.19. | ToBoolean | ✓ | | | +| 22.20. | ToChars | ✓ | | | +| 22.21. | ToConcept | ✗ | | | +| 22.22. | ToDate | ✓ | | | +| 22.23. | ToDateTime | ✓ | | | +| 22.24. | ToDecimal | ✓ | | | +| 22.25. | ToInteger | ✓ | | | +| 22.26. | ToList | ✓ | | | +| 22.27. | ToLong | ✓ | | | +| 22.28. | ToQuantity | ✓ | | | +| 22.29. | ToRatio | ✗ | | | +| 22.30. | ToString | ✓ | | | +| 22.31. | ToTime | ✓ | | | ### 23. Clinical Operators diff --git a/modules/cql/src/blaze/elm/compiler/core.clj b/modules/cql/src/blaze/elm/compiler/core.clj index 0bdc4e32c..6d5521da1 100644 --- a/modules/cql/src/blaze/elm/compiler/core.clj +++ b/modules/cql/src/blaze/elm/compiler/core.clj @@ -41,7 +41,11 @@ (defmulti compile* - "Compiles `expression` in `context`." + "Compiles `expression` in `context`. + + Context consists of: + * :library - the library in it's ELM form + * :node - the database node" {:arglists '([context expression])} (fn [_ {:keys [type] :as expr}] (assert (string? type) (format "Missing :type in expression `%s`." (pr-str expr))) diff --git a/modules/cql/src/blaze/elm/compiler/external_data.clj b/modules/cql/src/blaze/elm/compiler/external_data.clj index e659c46aa..0693b3c5a 100644 --- a/modules/cql/src/blaze/elm/compiler/external_data.clj +++ b/modules/cql/src/blaze/elm/compiler/external_data.clj @@ -18,7 +18,9 @@ (defrecord CompartmentListRetrieveExpression [context data-type] core/Expression (-eval [_ {:keys [db]} {:keys [id]} _] - (d/list-compartment-resource-handles db context id data-type))) + (d/list-compartment-resource-handles db context id data-type)) + (-form [_] + `(~'compartment-list-retrieve ~data-type))) (defrecord CompartmentQueryRetrieveExpression [query data-type clauses] @@ -93,7 +95,9 @@ (defrecord ResourceRetrieveExpression [] core/Expression (-eval [_ _ resource _] - [resource])) + [resource]) + (-form [_] + (list 'retrieve-resource))) (def ^:private resource-expr diff --git a/modules/cql/src/blaze/elm/compiler/function.clj b/modules/cql/src/blaze/elm/compiler/function.clj new file mode 100644 index 000000000..ece770ad5 --- /dev/null +++ b/modules/cql/src/blaze/elm/compiler/function.clj @@ -0,0 +1,12 @@ +(ns blaze.elm.compiler.function + (:require + [blaze.elm.compiler.core :as core])) + + +(defn arity-n [name fn-expr operand-names operands] + (reify core/Expression + (-eval [_ context resource scope] + (let [values (map #(core/-eval % context resource scope) operands)] + (core/-eval fn-expr context resource (merge scope (zipmap operand-names values))))) + (-form [_] + `(~'call ~name ~@(map core/-form operands))))) diff --git a/modules/cql/src/blaze/elm/compiler/library.clj b/modules/cql/src/blaze/elm/compiler/library.clj index f78367791..6b5d5bbc6 100644 --- a/modules/cql/src/blaze/elm/compiler/library.clj +++ b/modules/cql/src/blaze/elm/compiler/library.clj @@ -1,39 +1,57 @@ (ns blaze.elm.compiler.library (:require - [blaze.anomaly :as ba :refer [when-ok]] + [blaze.anomaly :as ba :refer [if-ok when-ok]] [blaze.elm.compiler :as compiler] + [blaze.elm.compiler.function :as function] [blaze.elm.deps-infer :as deps-infer] [blaze.elm.equiv-relationships :as equiv-relationships] [blaze.elm.normalizer :as normalizer])) (defn- compile-expression-def - "Compiles the expression of `expression-def` in `context` and associates the - resulting compiled expression under ::compiler/expression to the - `expression-def` which itself is returned. - - Returns an anomaly on errors." - {:arglists '([context expression-def])} - [context {:keys [expression] :as expression-def}] - (let [context (assoc context :eval-context (:context expression-def))] - (-> (ba/try-anomaly - (assoc expression-def - ::compiler/expression (compiler/compile context expression))) + "Compiles the expression of `def` in `context` and returns a tuple of + `[name compiled-expression]` or an anomaly on errors." + [context {:keys [name expression] :as def}] + (let [context (assoc context :eval-context (:context def))] + (-> (ba/try-anomaly [name (compiler/compile context expression)]) (ba/exceptionally #(assoc % :context context :elm/expression expression))))) -(defn- expr-defs [context library] +(defn- compile-function-def + "Compiles the function of `def` in `context`. + + Returns the compiled function or an anomaly on errors." + [context {:keys [name operand] :as def}] + (when-ok [[_ expression] (compile-expression-def context def)] + (partial function/arity-n name expression (mapv :name operand)))) + + +(defn- compile-function-defs [context library] (transduce - (comp (map (partial compile-expression-def context)) - (halt-when ba/anomaly?)) + (filter (comp #{"FunctionDef"} :type)) (completing - (fn [r {:keys [name] ::compiler/keys [expression]}] - (assoc r name expression))) - {} + (fn [context {:keys [name] :as def}] + (if-ok [function (compile-function-def context def)] + (assoc-in context [:functions name] function) + reduced))) + context (-> library :statements :def))) +(defn- expression-defs [context library] + (when-ok [context (compile-function-defs context library)] + (transduce + (comp (filter (comp nil? :type)) + (map (partial compile-expression-def context)) + (halt-when ba/anomaly?)) + (completing + (fn [r [name expression]] + (assoc r name expression))) + {} + (-> library :statements :def)))) + + (defn- compile-parameter-def "Compiles the default value of `parameter-def` in `context` and associates the resulting compiled default value under :default to the `parameter-def` which @@ -71,7 +89,7 @@ equiv-relationships/find-equiv-rels-library deps-infer/infer-library-deps) context (assoc opts :node node :library library)] - (when-ok [expr-defs (expr-defs context library) + (when-ok [expression-defs (expression-defs context library) parameter-default-values (parameter-default-values context library)] - {:compiled-expression-defs expr-defs + {:compiled-expression-defs expression-defs :parameter-default-values parameter-default-values}))) diff --git a/modules/cql/src/blaze/elm/compiler/queries.clj b/modules/cql/src/blaze/elm/compiler/queries.clj index 1abcfc388..9aa10f81b 100644 --- a/modules/cql/src/blaze/elm/compiler/queries.clj +++ b/modules/cql/src/blaze/elm/compiler/queries.clj @@ -298,18 +298,6 @@ (throw (Exception. (str "Unsupported number of " (count sources) " sources in query."))))) -;; ?.? IdentifierRef -;; -;; The IdentifierRef type defines an expression that references an identifier -;; that is either unresolved, or has been resolved to an attribute in an -;; unambiguous iteration scope such as a sort. Implementations should attempt to -;; resolve the identifier, only throwing an error at compile-time (or run-time -;; for an interpretive system) if the identifier reference cannot be resolved. -(defmethod core/compile* :elm.compiler.type/identifier-ref - [_ {:keys [name]}] - (structured-values/->SingleScopePropertyExpression (keyword name))) - - ;; 10.3. AliasRef ;; ;; The AliasRef expression allows for the reference of a specific source within @@ -336,7 +324,13 @@ (->AliasRefExpression name))) -;; 10.12. With +;; 10.7 IdentifierRef +(defmethod core/compile* :elm.compiler.type/identifier-ref + [_ {:keys [name]}] + (structured-values/->SingleScopePropertyExpression (keyword name))) + + +;; 10.14. With ;; ;; The With clause restricts the elements of a given source to only those ;; elements that have elements in the related source that satisfy the suchThat @@ -386,4 +380,4 @@ (format "Unsupported call without single query scope."))))) -;; TODO 10.13. Without +;; TODO 10.15. Without diff --git a/modules/cql/src/blaze/elm/compiler/reusing_logic.clj b/modules/cql/src/blaze/elm/compiler/reusing_logic.clj index 8100b5678..e3a074302 100644 --- a/modules/cql/src/blaze/elm/compiler/reusing_logic.clj +++ b/modules/cql/src/blaze/elm/compiler/reusing_logic.clj @@ -40,11 +40,17 @@ `(~'expr-ref ~name))) -(defn- find-expression-def - "Returns the expression-def with `name` from `library` or nil if not found." +(defn- find-def + "Returns the def with `name` from `library` or nil if not found." {:arglists '([library name])} - [{{expr-defs :def} :statements} name] - (some #(when (= name (:name %)) %) expr-defs)) + [{{defs :def} :statements} name] + (some #(when (= name (:name %)) %) defs)) + + +(defn- find-expression-def [library name] + (when-let [def (find-def library name)] + (when (nil? (:type def)) + def))) (defn- expression-def-not-found-anom [context name] @@ -157,6 +163,18 @@ `(~'call "ToInterval" ~(core/-form operand)))) +(defn- function-def-not-found-anom [context name] + (ba/incorrect + (format "Function definition `%s` not found." name) + :context context)) + + +(defn compile-function [{:keys [functions] :as context} name operands] + (if-let [function (get functions name)] + (function operands) + (throw-anom (function-def-not-found-anom context name)))) + + ;; 9.4. FunctionRef (defmethod core/compile* :elm.compiler.type/function-ref [context {:keys [name] operands :operand}] @@ -184,4 +202,14 @@ "ToInterval" (->ToIntervalFunctionExpression (first operands)) - (throw (Exception. (str "Unsupported function `" name "` in `FunctionRef` expression.")))))) + (compile-function context name operands)))) + + +;; 9.5 OperandRef +(defmethod core/compile* :elm.compiler.type/operand-ref + [_ {:keys [name]}] + (reify core/Expression + (-eval [_ _ _ scope] + (scope name)) + (-form [_] + `(~'operand-ref ~name)))) diff --git a/modules/cql/src/blaze/elm/compiler/spec.clj b/modules/cql/src/blaze/elm/compiler/spec.clj index 9fab2fc57..896730d14 100644 --- a/modules/cql/src/blaze/elm/compiler/spec.clj +++ b/modules/cql/src/blaze/elm/compiler/spec.clj @@ -10,5 +10,9 @@ core/expr?) +(s/def :blaze.elm.compiler/function + fn?) + + (s/def :elm/compile-context (s/keys :req-un [:elm/library :blaze.db/node])) diff --git a/modules/cql/src/blaze/elm/spec.clj b/modules/cql/src/blaze/elm/spec.clj index 87fa7ffef..61d35e8cf 100644 --- a/modules/cql/src/blaze/elm/spec.clj +++ b/modules/cql/src/blaze/elm/spec.clj @@ -622,8 +622,8 @@ (s/keys :opt-un [:elm/name :elm/libraryName :elm.nary-expression/operand])) -;; ?.? IdentifierRef -(defmethod expression :elm.spec.type/identifier-ref [_] +;; 9.5 OperandRef +(defmethod expression :elm.spec.type/operand-ref [_] (s/keys :opt-un [:elm/name])) @@ -669,14 +669,23 @@ :elm.sort-by-item.by-expression/expression])) -;; 10.9. RelationshipClause +;; 10.7 IdentifierRef +(defmethod expression :elm.spec.type/identifier-ref [_] + (s/keys :req-un [:elm/name] :opt-un [:elm/libraryName])) + + +;; TODO: 10.8. LetClause + +;; TODO 10.9. QueryLetRef + +;; 10.10. RelationshipClause (defmulti relationship-clause :type) (s/def :elm/relationship-clause (s/multi-spec relationship-clause :type)) -;; 10.10. ReturnClause +;; 10.11. ReturnClause (s/def :elm.return-clause/expression :elm/expression) @@ -690,9 +699,9 @@ :opt-un [:elm.return-clause/distinct])) -;; TODO: 10.11. AggregateClause +;; TODO: 10.12. AggregateClause -;; 10.12. SortClause +;; 10.13. SortClause (s/def :elm.sort-clause/by (s/coll-of :elm/sort-by-item :min-count 1)) @@ -701,7 +710,7 @@ (s/keys :req-un [:elm.sort-clause/by])) -;; 10.13. With +;; 10.14. With (defmethod relationship-clause "With" [_] (s/keys :req-un [:elm/expression :elm/alias :elm.query/suchThat])) @@ -711,7 +720,7 @@ :opt-un [:elm.query/suchThat])) -;; 10.14. Without +;; 10.15. Without (defmethod relationship-clause "Without" [_] (s/keys :req-un [:elm/expression :elm/alias :elm.query/suchThat])) diff --git a/modules/cql/test/blaze/elm/compiler/external_data_test.clj b/modules/cql/test/blaze/elm/compiler/external_data_test.clj index d6d38bed8..129077f8f 100644 --- a/modules/cql/test/blaze/elm/compiler/external_data_test.clj +++ b/modules/cql/test/blaze/elm/compiler/external_data_test.clj @@ -75,9 +75,13 @@ db (d/db node) patient (d/resource-handle db "Patient" "0")] - (given (core/-eval expr {:db db} patient nil) - [0 fhir-spec/fhir-type] := :fhir/Patient - [0 :id] := "0")))) + (testing "eval" + (given (core/-eval expr {:db db} patient nil) + [0 fhir-spec/fhir-type] := :fhir/Patient + [0 :id] := "0")) + + (testing "form" + (is (= '(retrieve-resource) (core/-form expr))))))) (testing "Observation" (with-system-data [{:blaze.db/keys [node]} mem-node-system] @@ -94,9 +98,13 @@ db (d/db node) patient (d/resource-handle db "Patient" "0")] - (given (core/-eval expr {:db db} patient nil) - [0 fhir-spec/fhir-type] := :fhir/Observation - [0 :id] := "1"))) + (testing "eval" + (given (core/-eval expr {:db db} patient nil) + [0 fhir-spec/fhir-type] := :fhir/Observation + [0 :id] := "1")) + + (testing "form" + (is (= '(compartment-list-retrieve "Observation") (core/-form expr)))))) (testing "with one code" (with-system-data [{:blaze.db/keys [node]} mem-node-system] @@ -107,10 +115,10 @@ [:put {:fhir/type :fhir/Observation :id "1" :code #fhir/CodeableConcept - {:coding - [#fhir/Coding - {:system #fhir/uri"system-192253" - :code #fhir/code"code-192300"}]} + {:coding + [#fhir/Coding + {:system #fhir/uri"system-192253" + :code #fhir/code"code-192300"}]} :subject #fhir/Reference{:reference "Patient/0"}}]]] @@ -123,9 +131,9 @@ [{:name "sys-def-131750" :id "system-192253"}]}}} elm #elm/retrieve - {:type "Observation" - :codes #elm/list [#elm/code ["sys-def-131750" - "code-192300"]]} + {:type "Observation" + :codes #elm/list [#elm/code ["sys-def-131750" + "code-192300"]]} expr (c/compile context elm) db (d/db node) patient (d/resource-handle db "Patient" "0")] @@ -149,19 +157,19 @@ [:put {:fhir/type :fhir/Observation :id "1" :code #fhir/CodeableConcept - {:coding - [#fhir/Coding - {:system #fhir/uri"system-192253" - :code #fhir/code"code-192300"}]} + {:coding + [#fhir/Coding + {:system #fhir/uri"system-192253" + :code #fhir/code"code-192300"}]} :subject #fhir/Reference{:reference "Patient/0"}}] [:put {:fhir/type :fhir/Observation :id "2" :code #fhir/CodeableConcept - {:coding - [#fhir/Coding - {:system #fhir/uri"system-192253" - :code #fhir/code"code-140541"}]} + {:coding + [#fhir/Coding + {:system #fhir/uri"system-192253" + :code #fhir/code"code-140541"}]} :subject #fhir/Reference{:reference "Patient/0"}}]]] @@ -174,10 +182,10 @@ [{:name "sys-def-131750" :id "system-192253"}]}}} elm #elm/retrieve - {:type "Observation" - :codes - #elm/list [#elm/code ["sys-def-131750" "code-192300"] - #elm/code ["sys-def-131750" "code-140541"]]} + {:type "Observation" + :codes + #elm/list [#elm/code ["sys-def-131750" "code-192300"] + #elm/code ["sys-def-131750" "code-140541"]]} expr (c/compile context elm) db (d/db node) patient (d/resource-handle db "Patient" "0")] @@ -215,10 +223,10 @@ [[[:put {:fhir/type :fhir/Medication :id "0" :code #fhir/CodeableConcept - {:coding - [#fhir/Coding - {:system #fhir/uri"system-225806" - :code #fhir/code"code-225809"}]}}]]] + {:coding + [#fhir/Coding + {:system #fhir/uri"system-225806" + :code #fhir/code"code-225809"}]}}]]] (let [context {:node node @@ -229,9 +237,9 @@ [{:name "sys-def-225944" :id "system-225806"}]}}} elm #elm/retrieve - {:type "Medication" - :codes #elm/list [#elm/code ["sys-def-225944" - "code-225809"]]} + {:type "Medication" + :codes #elm/list [#elm/code ["sys-def-225944" + "code-225809"]]} expr (c/compile context elm) db (d/db node)] @@ -251,10 +259,10 @@ [{:name "sys-def-225944" :id "system-225806"}]}}} elm #elm/retrieve - {:type "Medication" - :codes #elm/list [#elm/code ["sys-def-225944" - "code-225809"]] - :code-property "foo"}] + {:type "Medication" + :codes #elm/list [#elm/code ["sys-def-225944" + "code-225809"]] + :code-property "foo"}] (given (ba/try-anomaly (c/compile context elm)) ::anom/category := ::anom/not-found @@ -270,10 +278,10 @@ [{:name "name-174207" :resultTypeName "{http://hl7.org/fhir}Patient"}]}} elm #elm/retrieve - {:type "Observation" - :context #elm/expression-ref "name-174207" - :codes #elm/list [#elm/code ["sys-def-174848" - "code-174911"]]} + {:type "Observation" + :context #elm/expression-ref "name-174207" + :codes #elm/list [#elm/code ["sys-def-174848" + "code-174911"]]} expr (c/compile {:node node :library library} elm)] (given expr type := WithRelatedContextQueryRetrieveExpression)))) @@ -287,11 +295,11 @@ [{:name "name-174207" :resultTypeName "{http://hl7.org/fhir}Patient"}]}} elm #elm/retrieve - {:type "Observation" - :context #elm/expression-ref "name-174207" - :codes #elm/list [#elm/code ["sys-def-174848" - "code-174911"]] - :code-property "foo"}] + {:type "Observation" + :context #elm/expression-ref "name-174207" + :codes #elm/list [#elm/code ["sys-def-174848" + "code-174911"]] + :code-property "foo"}] (given (ba/try-anomaly (c/compile {:node node :library library} elm)) ::anom/category := ::anom/not-found ::anom/message := "The search-param with code `foo` and type `Observation` was not found."))))) diff --git a/modules/cql/test/blaze/elm/compiler/library_test.clj b/modules/cql/test/blaze/elm/compiler/library_test.clj index fe5924a4e..8928d6eb2 100644 --- a/modules/cql/test/blaze/elm/compiler/library_test.clj +++ b/modules/cql/test/blaze/elm/compiler/library_test.clj @@ -2,6 +2,7 @@ (:require [blaze.cql-translator :as t] [blaze.db.api-stub :refer [mem-node-system]] + [blaze.elm.compiler :as compiler] [blaze.elm.compiler.library :as library] [blaze.elm.compiler.library-spec] [blaze.fhir.spec.type.system :as system] @@ -37,23 +38,52 @@ (given (library/compile-library node library {}) :compiled-expression-defs := {"Foo" true})))) - (testing "one static expression" + (testing "one dynamic expression" (let [library (t/translate "library Test - using FHIR version '4.0.0' - context Patient - define Gender: Patient.gender")] + using FHIR version '4.0.0' + context Patient + define Gender: Patient.gender")] (with-system [{:blaze.db/keys [node]} mem-node-system] (given (library/compile-library node library {}) - [:compiled-expression-defs "Gender" :key] := :gender - [:compiled-expression-defs "Gender" :source :name] := "Patient")))) + [:compiled-expression-defs "Gender" compiler/form] := '(:gender (expr-ref "Patient")))))) - (testing "with compile-time error" + (testing "one function" (let [library (t/translate "library Test - define Error: singleton from {1, 2}")] + using FHIR version '4.0.0' + context Patient + define function Gender(P Patient): P.gender + define InInitialPopulation: Gender(Patient)")] (with-system [{:blaze.db/keys [node]} mem-node-system] (given (library/compile-library node library {}) - ::anom/category := ::anom/conflict - ::anom/message := "More than one element in `SingletonFrom` expression.")))) + [:compiled-expression-defs "InInitialPopulation" compiler/form] := '(call "Gender" (expr-ref "Patient")))))) + + (testing "two functions, one calling the other" + (let [library (t/translate "library Test + using FHIR version '4.0.0' + context Patient + define function Inc(i System.Integer): i + 1 + define function Inc2(i System.Integer): Inc(i) + 1 + define InInitialPopulation: Inc2(1)")] + (with-system [{:blaze.db/keys [node]} mem-node-system] + (given (library/compile-library node library {}) + [:compiled-expression-defs "InInitialPopulation" compiler/form] := '(call "Inc2" 1))))) + + (testing "with compile-time error" + (testing "function" + (let [library (t/translate "library Test + define function Error(): singleton from {1, 2}")] + (with-system [{:blaze.db/keys [node]} mem-node-system] + (given (library/compile-library node library {}) + ::anom/category := ::anom/conflict + ::anom/message := "More than one element in `SingletonFrom` expression.")))) + + (testing "expression" + (let [library (t/translate "library Test + define Error: singleton from {1, 2}")] + (with-system [{:blaze.db/keys [node]} mem-node-system] + (given (library/compile-library node library {}) + ::anom/category := ::anom/conflict + ::anom/message := "More than one element in `SingletonFrom` expression."))))) (testing "with parameter default" (let [library (t/translate "library Test diff --git a/modules/cql/test/blaze/elm/compiler/queries_test.clj b/modules/cql/test/blaze/elm/compiler/queries_test.clj index 4cbba0382..cee6b06bb 100644 --- a/modules/cql/test/blaze/elm/compiler/queries_test.clj +++ b/modules/cql/test/blaze/elm/compiler/queries_test.clj @@ -232,7 +232,21 @@ ::result)) -;; 10.12. With +;; 10.7 IdentifierRef +;; +;; The IdentifierRef type defines an expression that references an identifier +;; that is either unresolved, or has been resolved to an attribute in an +;; unambiguous iteration scope such as a sort. Implementations should attempt to +;; resolve the identifier, only throwing an error at compile-time (or run-time +;; for an interpretive system) if the identifier reference cannot be resolved. +(deftest compile-identifier-ref-test + (let [expr (c/compile {} {:type "IdentifierRef" :name "foo"})] + + (testing "form" + (is (= '(:foo default) (core/-form expr)))))) + + +;; 10.14. With (deftest compile-with-clause-test (testing "Equiv With with two Observations comparing there subjects." (with-system-data [{:blaze.db/keys [node]} mem-node-system] diff --git a/modules/cql/test/blaze/elm/compiler/reusing_logic_test.clj b/modules/cql/test/blaze/elm/compiler/reusing_logic_test.clj index e715f2551..0b19d9bbd 100644 --- a/modules/cql/test/blaze/elm/compiler/reusing_logic_test.clj +++ b/modules/cql/test/blaze/elm/compiler/reusing_logic_test.clj @@ -7,6 +7,7 @@ [blaze.anomaly :as ba] [blaze.elm.compiler :as c] [blaze.elm.compiler.core :as core] + [blaze.elm.compiler.function :as function] [blaze.elm.compiler.test-util :as tu] [blaze.elm.interval :as interval] [blaze.elm.literal :as elm] @@ -66,9 +67,59 @@ ;; The FunctionRef type defines an expression that invokes a previously defined ;; function. The result of evaluating each operand is passed to the function. (deftest compile-function-ref-test + (testing "Throws error on missing function" + (given (ba/try-anomaly (c/compile {} #elm/function-ref ["name-175844"])) + ::anom/category := ::anom/incorrect + ::anom/message := "Function definition `name-175844` not found." + :context := {})) + + (testing "Custom function with arity 0" + (let [function-name "name-210650" + fn-expr (c/compile {} #elm/integer "1") + compile-ctx {:functions {function-name (partial function/arity-n function-name fn-expr [])}} + elm (elm/function-ref [function-name]) + expr (c/compile compile-ctx elm)] + (testing "eval" + (is (= 1 (core/-eval expr {} nil nil)))) + + (testing "form" + (is (= `(~'call ~function-name) (core/-form expr)))))) + + (testing "Custom function with arity 1" + (let [function-name "name-180815" + fn-expr (c/compile {} #elm/negate #elm/operand-ref"x") + compile-ctx {:library {:parameters {:def [{:name "a"}]}} + :functions {function-name (partial function/arity-n function-name fn-expr ["x"])}} + elm (elm/function-ref [function-name #elm/parameter-ref "a"]) + expr (c/compile compile-ctx elm)] + (testing "eval" + (are [a res] (= res (core/-eval expr {:parameters {"a" a}} nil nil)) + 1 -1 + -1 1 + 0 0)) + + (testing "form" + (is (= `(~'call ~function-name (~'param-ref "a")) (core/-form expr)))))) + + (testing "Custom function with arity 2" + (let [function-name "name-184652" + fn-expr (c/compile {} #elm/add [#elm/operand-ref"x" #elm/operand-ref"y"]) + compile-ctx {:library {:parameters {:def [{:name "a"} {:name "b"}]}} + :functions {function-name (partial function/arity-n function-name fn-expr ["x" "y"])}} + elm (elm/function-ref [function-name #elm/parameter-ref "a" #elm/parameter-ref "b"]) + expr (c/compile compile-ctx elm)] + (testing "eval" + (are [a b res] (= res (core/-eval expr {:parameters {"a" a "b" b}} nil nil)) + 1 1 2 + 1 0 1 + 0 1 1)) + + (testing "form" + (is (= `(~'call ~function-name (~'param-ref "a") (~'param-ref "b")) (core/-form expr)))))) + (testing "ToQuantity" (let [compile-ctx {:library {:parameters {:def [{:name "x"}]}}} - elm (elm/function-ref "ToQuantity" #elm/parameter-ref "x") + elm #elm/function-ref ["ToQuantity" #elm/parameter-ref "x"] expr (c/compile compile-ctx elm)] (testing "eval" (are [x res] (= res (core/-eval expr {:parameters {"x" x}} nil nil)) @@ -81,7 +132,7 @@ (testing "ToDateTime" (let [compile-ctx {:library {:parameters {:def [{:name "x"}]}}} - elm (elm/function-ref "ToDateTime" #elm/parameter-ref "x") + elm #elm/function-ref ["ToDateTime" #elm/parameter-ref "x"] expr (c/compile compile-ctx elm) eval-ctx (fn [x] {:now tu/now :parameters {"x" x}})] (testing "eval" @@ -98,7 +149,7 @@ (testing "ToString" (let [compile-ctx {:library {:parameters {:def [{:name "x"}]}}} - elm (elm/function-ref "ToString" #elm/parameter-ref "x") + elm #elm/function-ref ["ToString" #elm/parameter-ref "x"] expr (c/compile compile-ctx elm)] (testing "eval" (are [x res] (= res (core/-eval expr {:parameters {"x" x}} nil nil)) @@ -110,29 +161,38 @@ (testing "ToInterval" (let [compile-ctx {:library {:parameters {:def [{:name "x"}]}}} - elm (elm/function-ref "ToInterval" #elm/parameter-ref "x") + elm #elm/function-ref ["ToInterval" #elm/parameter-ref "x"] expr (c/compile compile-ctx elm) eval-ctx (fn [x] {:now tu/now :parameters {"x" x}})] (testing "eval" (are [x res] (= res (core/-eval expr (eval-ctx x) nil nil)) #fhir/Period - {:start #fhir/dateTime"2021-02-23T15:12:45+01:00" - :end #fhir/dateTime"2021-02-23T16:00:00+01:00"} + {:start #fhir/dateTime"2021-02-23T15:12:45+01:00" + :end #fhir/dateTime"2021-02-23T16:00:00+01:00"} (interval/interval (system/date-time 2021 2 23 14 12 45) (system/date-time 2021 2 23 15 0 0)) #fhir/Period - {:start nil - :end #fhir/dateTime"2021-02-23T16:00:00+01:00"} + {:start nil + :end #fhir/dateTime"2021-02-23T16:00:00+01:00"} (interval/interval nil (system/date-time 2021 2 23 15 0 0)) #fhir/Period - {:start #fhir/dateTime"2021-02-23T15:12:45+01:00" - :end nil} + {:start #fhir/dateTime"2021-02-23T15:12:45+01:00" + :end nil} (interval/interval (system/date-time 2021 2 23 14 12 45) nil))) (testing "form" (is (= '(call "ToInterval" (param-ref "x")) (core/-form expr))))))) + + +;; 9.5 OperandRef +;; +;; The OperandRef expression allows the value of an operand to be referenced as +;; part of an expression within the body of a function definition. +(deftest compile-operand-ref-test + (testing "form" + (is (= '(operand-ref "x") (core/-form (c/compile {} #elm/operand-ref"x")))))) diff --git a/modules/cql/test/blaze/elm/literal.clj b/modules/cql/test/blaze/elm/literal.clj index 04f3f769e..cc3f9635d 100644 --- a/modules/cql/test/blaze/elm/literal.clj +++ b/modules/cql/test/blaze/elm/literal.clj @@ -110,10 +110,16 @@ ;; 9.4. FunctionRef -(defn function-ref [name & ops] +(defn function-ref [[name & ops]] {:type "FunctionRef" :name name - :operand ops}) + :operand (vec ops)}) + + +;; 9.5. OperandRef +(defn operand-ref [name] + {:type "OperandRef" + :name name}) diff --git a/modules/cql/test/data_readers.clj b/modules/cql/test/data_readers.clj index 750db50ac..33ef2a785 100644 --- a/modules/cql/test/data_readers.clj +++ b/modules/cql/test/data_readers.clj @@ -10,6 +10,8 @@ elm/quantity blaze.elm.literal/quantity elm/parameter-ref blaze.elm.literal/parameter-ref elm/expression-ref blaze.elm.literal/expression-ref + elm/function-ref blaze.elm.literal/function-ref + elm/operand-ref blaze.elm.literal/operand-ref elm/retrieve blaze.elm.literal/retrieve elm/equal blaze.elm.literal/equal elm/equivalent blaze.elm.literal/equivalent diff --git a/modules/operation-measure-evaluate-measure/test/blaze/fhir/operation/evaluate_measure/q39-social-sec-num-query.cql b/modules/operation-measure-evaluate-measure/test/blaze/fhir/operation/evaluate_measure/q39-social-sec-num-query.cql index c06674931..d4f62ff66 100644 --- a/modules/operation-measure-evaluate-measure/test/blaze/fhir/operation/evaluate_measure/q39-social-sec-num-query.cql +++ b/modules/operation-measure-evaluate-measure/test/blaze/fhir/operation/evaluate_measure/q39-social-sec-num-query.cql @@ -4,12 +4,11 @@ include FHIRHelpers version '4.0.0' context Patient +define function IntegerParts(s String): + from (Split(s, '-')) S where ConvertsToInteger(S) + define SocialSecurityNumber: First(Patient.identifier.where(system = 'http://hl7.org/fhir/sid/us-ssn').value) -define IntegerParts: - from (Split(SocialSecurityNumber, '-')) S - where ConvertsToInteger(S) - define InInitialPopulation: - Count(IntegerParts) = 3 + Count(IntegerParts(SocialSecurityNumber)) = 3 From a5c2552d295507604fe2025e289c16a693b39719 Mon Sep 17 00:00:00 2001 From: Alexander Kiel Date: Wed, 13 Jul 2022 13:46:56 +0200 Subject: [PATCH 3/4] Fix Deserialisation of Primitive Values in Extensions Closes: #767 --- .../src/blaze/fhir/spec/type.clj | 2 +- .../test/blaze/fhir/spec/type/system_test.clj | 2 +- .../test/blaze/fhir/spec_test.clj | 31 +++++++++++++------ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/modules/fhir-structure/src/blaze/fhir/spec/type.clj b/modules/fhir-structure/src/blaze/fhir/spec/type.clj index 96a1736b6..19dc7360a 100644 --- a/modules/fhir-structure/src/blaze/fhir/spec/type.clj +++ b/modules/fhir-structure/src/blaze/fhir/spec/type.clj @@ -1119,7 +1119,7 @@ (declare extension) -(def-complex-type Extension [^String id extension ^String url ^:polymorph value] +(def-complex-type Extension [^String id extension ^String url ^:polymorph ^:primitive value] :hash-num 39 :interned (and (nil? id) (p/-interned extension) (p/-interned value))) diff --git a/modules/fhir-structure/test/blaze/fhir/spec/type/system_test.clj b/modules/fhir-structure/test/blaze/fhir/spec/type/system_test.clj index 0a38ea876..655f56a7e 100644 --- a/modules/fhir-structure/test/blaze/fhir/spec/type/system_test.clj +++ b/modules/fhir-structure/test/blaze/fhir/spec/type/system_test.clj @@ -298,7 +298,7 @@ (LocalDate/of 2020 1 1))) (testing "comparable" - (are [a b] (pos? (.compareTo a b)) + (are [a b] (pos? (compare a b)) (system/date-time 2021) (system/date-time 2020) (system/date-time 2020 2) (system/date-time 2020 1) (system/date-time 2020 1 2) (system/date-time 2020 1 1))) diff --git a/modules/fhir-structure/test/blaze/fhir/spec_test.clj b/modules/fhir-structure/test/blaze/fhir/spec_test.clj index 77485a03b..cf1370b7f 100644 --- a/modules/fhir-structure/test/blaze/fhir/spec_test.clj +++ b/modules/fhir-structure/test/blaze/fhir/spec_test.clj @@ -3045,7 +3045,10 @@ #fhir/Extension{:url "foo" :value #fhir/Reference{:reference "bar"}} {:url "foo" :valueCodeableConcept {:text "bar"}} - #fhir/Extension{:url "foo" :value #fhir/CodeableConcept{:text #fhir/string"bar"}})) + #fhir/Extension{:url "foo" :value #fhir/CodeableConcept{:text #fhir/string"bar"}} + + {:url "foo" :extension [{:url "bar" :_valueDateTime {:extension [{:url "baz" :valueCode "qux"}]}}]} + #fhir/Extension{:url "foo" :extension [#fhir/Extension{:url "bar" :value #fhir/dateTime{:extension [#fhir/Extension{:url "baz" :value #fhir/code"qux"}]}}]})) (testing "XML" (are [xml fhir] (= fhir (s2/conform :fhir.xml/Extension xml)) @@ -3059,7 +3062,10 @@ #fhir/Extension{:url "foo" :value #fhir/Reference{:reference "bar"}} (sexp [nil {:url "foo"} [::f/valueCodeableConcept {} [::f/text {:value "bar"}]]]) - #fhir/Extension{:url "foo" :value #fhir/CodeableConcept{:text #fhir/string"bar"}})) + #fhir/Extension{:url "foo" :value #fhir/CodeableConcept{:text #fhir/string"bar"}} + + (sexp [nil {:url "foo"} [::f/extension {:url "bar"} [::f/valueDateTime {} [::f/extension {:url "baz"} [::f/valueCode {:value "qux"}]]]]]) + #fhir/Extension{:url "foo" :extension [#fhir/Extension{:url "bar" :value #fhir/dateTime{:extension [#fhir/Extension{:url "baz" :value #fhir/code"qux"}]}}]})) (testing "CBOR" (are [json fhir] (= fhir (s2/conform :fhir.cbor/Extension json)) @@ -3073,7 +3079,10 @@ #fhir/Extension{:url "foo" :value #fhir/Reference{:reference "bar"}} {:url "foo" :valueCodeableConcept {:text "bar"}} - #fhir/Extension{:url "foo" :value #fhir/CodeableConcept{:text #fhir/string"bar"}}))) + #fhir/Extension{:url "foo" :value #fhir/CodeableConcept{:text #fhir/string"bar"}} + + {:url "foo" :extension [{:url "bar" :_valueDateTime {:extension [{:url "baz" :valueCode "qux"}]}}]} + #fhir/Extension{:url "foo" :extension [#fhir/Extension{:url "bar" :value #fhir/dateTime{:extension [#fhir/Extension{:url "baz" :value #fhir/code"qux"}]}}]}))) (testing "unforming" (testing "JSON" @@ -3102,15 +3111,14 @@ #fhir/Extension{:value #fhir/CodeableConcept{:text #fhir/string"text-104840"}} {:valueCodeableConcept {:text "text-104840"}} - #fhir/Extension - {:value - #fhir/CodeableConcept - {:coding - [#fhir/Coding{:system #fhir/uri"system-105127"}]}} + #fhir/Extension{:value #fhir/CodeableConcept{:coding [#fhir/Coding{:system #fhir/uri"system-105127"}]}} {:valueCodeableConcept {:coding [{:system "system-105127"}]}} #fhir/Extension{:value {:fhir/type :fhir/Annotation :text "text-105422"}} - {:valueAnnotation {:text "text-105422"}})) + {:valueAnnotation {:text "text-105422"}} + + #fhir/Extension{:url "foo" :extension [#fhir/Extension{:url "bar" :value #fhir/dateTime{:extension [#fhir/Extension{:url "baz" :value #fhir/code"qux"}]}}]} + {:url "foo" :extension [{:url "bar" :_valueDateTime {:extension [{:url "baz" :valueCode "qux"}]}}]})) (testing "CBOR" (are [fhir cbor] (= cbor (fhir-spec/parse-cbor (fhir-spec/unform-cbor fhir))) @@ -3139,7 +3147,10 @@ {:valueAddress {}} #fhir/Extension{:value #fhir/Address{:city "foo"}} - {:valueAddress {:city "foo"}})))) + {:valueAddress {:city "foo"}} + + #fhir/Extension{:url "foo" :extension [#fhir/Extension{:url "bar" :value #fhir/dateTime{:extension [#fhir/Extension{:url "baz" :value #fhir/code"qux"}]}}]} + {:url "foo" :extension [{:url "bar" :_valueDateTime {:extension [{:url "baz" :valueCode "qux"}]}}]})))) (deftest coding-test From 02f2409893ee3e5a716ef925ea36e81c8a5fc755 Mon Sep 17 00:00:00 2001 From: Alexander Kiel Date: Wed, 13 Jul 2022 16:22:10 +0200 Subject: [PATCH 4/4] Release v0.17.11 --- CHANGELOG.md | 17 +++++++++++++++-- README.md | 4 ++-- docs/deployment/docker-deployment.md | 4 ++-- docs/deployment/manual-deployment.md | 12 ++++++------ .../src/blaze/rest_api/capabilities.clj | 2 +- perf-test/gatling/pom.xml | 2 +- pom.xml | 2 +- src/blaze/system.clj | 2 +- 8 files changed, 29 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dde33f72d..8c0e533cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,26 @@ # Changelog -## v0.17.10 +## v0.17.11 ### Bugfixes -* Fix Reference Resolution on Extended Primitive References +* Fix Quantity Indexing without Value ([#764](https://github.com/samply/blaze/issues/764)) +* Fix Deserialisation of Primitive Values in Extensions ([#767](https://github.com/samply/blaze/issues/767)) ### Other Improvements ([#758](https://github.com/samply/blaze/issues/758)) +* Implement Functions in CQL ([#766](https://github.com/samply/blaze/pull/766)) + +The full changelog can be found [here](https://github.com/samply/blaze/milestone/50?closed=1). + +## v0.17.10 + +### Bugfixes + +* Fix Reference Resolution on Extended Primitive References ([#758](https://github.com/samply/blaze/issues/758)) + +### Other Improvements + * Implement CQL ConvertsToTime ([#759](https://github.com/samply/blaze/pull/759)) The full changelog can be found [here](https://github.com/samply/blaze/milestone/48?closed=1). diff --git a/README.md b/README.md index a80017f79..6a84a0de1 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,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.17.10][5] +Latest release: [v0.17.11][5] ## Quick Start @@ -72,7 +72,7 @@ Unless required by applicable law or agreed to in writing, software distributed [3]: [4]: -[5]: +[5]: [6]: [7]: [8]: diff --git a/docs/deployment/docker-deployment.md b/docs/deployment/docker-deployment.md index dd67cdc78..e4a018a21 100644 --- a/docs/deployment/docker-deployment.md +++ b/docs/deployment/docker-deployment.md @@ -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.17.10 in 8.2 seconds +2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.17.11 in 8.2 seconds ``` In order to test connectivity, query the health endpoint: @@ -47,7 +47,7 @@ that should return: ```json { "name": "Blaze", - "version": "0.17.10" + "version": "0.17.11" } ``` diff --git a/docs/deployment/manual-deployment.md b/docs/deployment/manual-deployment.md index ee5595e1e..d8c9ba8a4 100644 --- a/docs/deployment/manual-deployment.md +++ b/docs/deployment/manual-deployment.md @@ -2,12 +2,12 @@ The installation works under Windows, Linux and macOS. The only dependency is an installed OpenJDK 11. Blaze is tested with [AdoptOpenJDK][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.17.10). Look for `blaze-0.17.10-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.17.11). Look for `blaze-0.17.11-standalone.jar`. After the download, you can start blaze with the following command (Linux, macOS): ```sh -java -jar blaze-0.17.10-standalone.jar -m blaze.core +java -jar blaze-0.17.11-standalone.jar -m blaze.core ``` Blaze will run with an in-memory, volatile database for testing and demo purposes. @@ -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.17.10-standalone.jar -m blaze.core +STORAGE=standalone java -jar blaze-0.17.11-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.17.10-standalone.jar -m blaze.core +java -jar blaze-0.17.11-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. @@ -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.17.10 in 8.2 seconds +2021-06-27T11:02:37.836Z ee086ef908c1 main INFO [blaze.core:67] - Successfully started Blaze version 0.17.11 in 8.2 seconds ``` In order to test connectivity, query the health endpoint: @@ -62,7 +62,7 @@ that should return: ```json { "name": "Blaze", - "version": "0.17.10" + "version": "0.17.11" } ``` diff --git a/modules/rest-api/src/blaze/rest_api/capabilities.clj b/modules/rest-api/src/blaze/rest_api/capabilities.clj index c7b5d142b..062d32ab4 100644 --- a/modules/rest-api/src/blaze/rest_api/capabilities.clj +++ b/modules/rest-api/src/blaze/rest_api/capabilities.clj @@ -117,7 +117,7 @@ :copyright #fhir/markdown"Copyright 2019 - 2022 The Samply Community\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License." :kind #fhir/code"instance" - :date #fhir/dateTime"2022-07-04" + :date #fhir/dateTime"2022-07-13" :software {:name "Blaze" :version version} diff --git a/perf-test/gatling/pom.xml b/perf-test/gatling/pom.xml index 7249eeee8..728352914 100644 --- a/perf-test/gatling/pom.xml +++ b/perf-test/gatling/pom.xml @@ -5,7 +5,7 @@ samply.blaze gatling - 0.17.10 + 0.17.11 1.8 diff --git a/pom.xml b/pom.xml index 93c70a15a..5dac3ebfe 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 samply blaze - 0.17.10 + 0.17.11 blaze A FHIR Store with internal, fast CQL Evaluation Engine diff --git a/src/blaze/system.clj b/src/blaze/system.clj index 01f5c3177..8870448c7 100644 --- a/src/blaze/system.clj +++ b/src/blaze/system.clj @@ -85,7 +85,7 @@ (def ^:private root-config - {:blaze/version "0.17.10" + {:blaze/version "0.17.11" :blaze/clock {}