Commit 4bd85e68 authored by Sigbjørn Revheim's avatar Sigbjørn Revheim

Adding support for some of the latest changes in SDTL

parent b4fb5cd4
This diff is collapsed.
...@@ -41,25 +41,67 @@ ...@@ -41,25 +41,67 @@
(filter (comp not nil?) (map #(:target %) variables)) (filter (comp not nil?) (map #(:target %) variables))
) )
(defn transform-recode-rule (defn transform-recode-rule
[& args]
(m/filter-vals
some?
{:FromValue (cond
(= (first (first args)) "min") [{"$type" "NumericMinimumValueExpression"}]
(= (first (first args)) "max") [{"$type" "NumericMaximumValueExpression"}]
(= (first (first args)) "missing") [{"$type" "UnhandledMissingValuesExpression"}]
(= (first (first args)) "nonmissing") [{"$type" "UnhandledNonmissingValuesExpression"}]
(= (first (first args)) "else") [{"$type" "UnhandledValuesExpression"}]
:default args)
:To (second args)
:Label (if (> (count args) 2) (nth args 2))}))
(defn transform-recode-rule2
[& args]
(m/filter-vals
some?
{:FromValue (cond
(= (first (first args)) "min") [{"$type" "NumericMinimumValueExpression"}]
(= (first (first args)) "max") [{"$type" "NumericMaximumValueExpression"}]
:default (let [values (filter number? (first args))
ranges (filter map? (first args))]
(cond-> {:args args :fTo (second args), :Label (if (> (count args) 2) (nth args 2))}
(not-empty values) (assoc :FromValue values)
(not-empty ranges) (assoc :fromValueRange ranges)
)
))
:To (second args)
:Label (if (> (count args) 2) (nth args 2))}))
(defn transform-recode-rule_test
[& args]
(m/filter-vals
some?
{:specialFromValue (first args)
:to (second args)
:label (if (> (count args) 2) (nth args 2))})
)
(defn transform-recode-rule_original
[& args] [& args]
(m/filter-vals (m/filter-vals
some? some?
(if (string? (first args)) (if (string? (first args))
{:specialFromValue (first args) {:specialFromValue (first args)
:to (second args) :to (second args)
:label (if (> (count args) 2) (nth args 2))} :label (if (> (count args) 2) (nth args 2))}
;; else ;; else
(let [values (filter number? (first args)) (let [values (filter number? (first args))
ranges (filter map? (first args))] ranges (filter map? (first args))]
(cond-> {:to (second args), :label (if (> (count args) 2) (nth args 2))} (cond-> {:to (second args), :label (if (> (count args) 2) (nth args 2))}
(not-empty values) (assoc :fromValue values) (not-empty values) (assoc :fromValue values)
(not-empty ranges) (assoc :fromValueRange ranges) (not-empty ranges) (assoc :fromValueRange ranges)
) )
) )
)) ))
) )
(defn make-seq-comparable [s] (defn make-seq-comparable [s]
(let [digit-set #{\0 \1 \2 \3 \4 \5 \6 \7 \8 \9}] (let [digit-set #{\0 \1 \2 \3 \4 \5 \6 \7 \8 \9}]
{:content s {:content s
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment