Last active
June 4, 2017 18:05
-
-
Save zalazhar/21969f0f3d854fd403575a577698291a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function workflow (age){ | |
co(function *(){ | |
// initialize views | |
document.getElementById('plot_le').innerHTML = "Please wait, loading graphs ..." | |
document.getElementById('plot_le_time').innerHTML = "Please wait, loading graphs ..." | |
// generate the R objects: | |
var stochasticSet = yield createRobject(Riskmodel,"loadSimData",{}) ; | |
var expectedLife = yield createRobject(Riskmodel,"eex", | |
{'listQx':stochasticSet.headers.get("X-ocpu-session"),"age":age}); | |
var rplot_exx = yield createRobject(Riskmodel,"histLifeExpectancy", | |
{'eex':expectedLife.headers.get("X-ocpu-session")}); | |
var rplot_exx_time= yield createRobject(Riskmodel,"drawLifeExpectancyOverTime", | |
{'startYear':2014,'endYear':2025,'age':age}); | |
var rquantile = yield createRobject(Riskmodel,"calculate_quantile",{"stochast":expectedLife.headers.get("X-ocpu-session")}); | |
// generate the views: | |
// histogram | |
document.getElementById('plot_le').innerHTML = "<img src ='" + rplot_exx.headers.get("Location") | |
+ "/graphics/1/png?height=300&width=300'/>" | |
document.getElementById('plot_le_time').innerHTML = "<img src ='" + rplot_exx_time.headers.get("Location") | |
+ "/graphics/1/png?height=300&width=300'/>" | |
document.getElementById('table_quantile').innerHTML = yield loadRobject(rquantile.headers.get("Location")+"R") | |
document.getElementById('table_le').innerHTML = yield loadRobject(expectedLife.headers.get("Location")+"R/.val") | |
}).catch(onerror); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment