UNPKG

@phema/cql-execution

Version:

An execution framework for the Clinical Quality Language (CQL)

135 lines (134 loc) 3.73 kB
<html> <head> <script src="cql4browsers.js"></script> <script> function exec() { f = document.getElementById('form'); eval('elm = ' + f.elm.value) if (f.parameters.value.trim()) { eval('params = ' + f.parameters.value) } else { params = {} } f.results.value = JSON.stringify(executeSimpleELM(elm, new cql.PatientSource([]), [], 'Math', '1', null, params), null, 2) } </script> </head> <body> <form id="form"> <table width="800"> <tr> <td width="150">ELM JSON</td> <td><textarea name="elm" style="width:100%;height:250px"> { "library" : { "identifier" : { "id" : "Math", "version" : "1" }, "schemaIdentifier" : { "id" : "urn:hl7-org:elm", "version" : "r1" }, "usings" : { "def" : [ { "localIdentifier" : "System", "uri" : "urn:hl7-org:elm-types:r1" } ] }, "parameters" : { "def" : [ { "name" : "A", "accessLevel" : "Public", "default" : { "valueType" : "{urn:hl7-org:elm-types:r1}Decimal", "value" : "10.0", "type" : "Literal" } }, { "name" : "B", "accessLevel" : "Public", "default" : { "valueType" : "{urn:hl7-org:elm-types:r1}Decimal", "value" : "5.0", "type" : "Literal" } } ] }, "statements" : { "def" : [ { "name" : "Add", "context" : "Unfiltered", "accessLevel" : "Public", "expression" : { "type" : "Add", "operand" : [ { "name" : "A", "type" : "ParameterRef" }, { "name" : "B", "type" : "ParameterRef" } ] } }, { "name" : "Subtract", "context" : "Unfiltered", "accessLevel" : "Public", "expression" : { "type" : "Subtract", "operand" : [ { "name" : "A", "type" : "ParameterRef" }, { "name" : "B", "type" : "ParameterRef" } ] } }, { "name" : "Multiply", "context" : "Unfiltered", "accessLevel" : "Public", "expression" : { "type" : "Multiply", "operand" : [ { "name" : "A", "type" : "ParameterRef" }, { "name" : "B", "type" : "ParameterRef" } ] } }, { "name" : "Divide", "context" : "Unfiltered", "accessLevel" : "Public", "expression" : { "type" : "Divide", "operand" : [ { "name" : "A", "type" : "ParameterRef" }, { "name" : "B", "type" : "ParameterRef" } ] } } ] } } } </textarea></td> </tr> <tr> <td>Parameters JSON</td> <td><textarea name="parameters" style="width:100%;height:100px"> { "A" : 50, "B" : 10 } </textarea></td></tr> <tr><td>Results</td><td><textarea name="results" style="width:100%;height:250px"></textarea></td></tr> </table> </form> <button type="button" onclick="exec()">Execute ELM</button> </body> </html>