Skip to content

Commit

Permalink
Merge pull request #32 from optimamodel/include-results
Browse files Browse the repository at this point in the history
Include results
  • Loading branch information
cliffckerr authored May 18, 2018
2 parents 66e1012 + 385c93c commit b6888e1
Show file tree
Hide file tree
Showing 14 changed files with 1,141 additions and 426 deletions.
3 changes: 1 addition & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "HealthPrior",
"version": "0.3.0",
"version": "0.4.0",
"description": "HealthPrior GUI",
"author": "HealthPrior Working Group <[email protected]>",
"private": true,
Expand All @@ -15,7 +15,6 @@
"dependencies": {
"axios": "^0.16.2",
"babel-preset-es2015": "^6.24.1",
"bokehjs": "0.12.14",
"bootstrap": "^3.3.7",
"chartist": "^0.11.0",
"crypto-api": "^0.7.3",
Expand Down
119 changes: 43 additions & 76 deletions client/src/components/app/DiseaseBurdenPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ Last update: 2018-05-02
</div>

<div class="PageSection UIPlaceholder" v-if="activeBurdenSet.burdenset != undefined">
<button class="btn" @click="makeGraph(activeBurdenSet)">Visualize</button>

<div>
<div id="fig01" style="float:left" ></div>
Expand All @@ -122,7 +121,6 @@ Last update: 2018-05-02




<table class="table table-bordered table-hover table-striped" style="width: 100%; margin-top: 10px;">
<thead>
<tr>
Expand Down Expand Up @@ -183,7 +181,7 @@ Last update: 2018-05-02
<tbody>
<tr v-for="disease in sortedDiseases">
<td style="text-align: center">
<input type="checkbox"
<input type="checkbox"
v-model="disease.active"/>
</td>
<td>
Expand Down Expand Up @@ -404,6 +402,8 @@ Last update: 2018-05-02
},
applyNameFilter(sets) {
console.log('CK TEST1')
console.log(sets)
return sets.filter(theSet => theSet.burdenset.name.toLowerCase().indexOf(this.filterText.toLowerCase()) !== -1)
},
Expand Down Expand Up @@ -450,6 +450,9 @@ Last update: 2018-05-02
// Reset the bottom table sorting state.
this.sortColumn2 = 'name'
this.sortReverse2 = false
// Plot graphs
this.makeGraph(burdenSet)
})
this.$notifications.notify({
Expand All @@ -461,6 +464,31 @@ Last update: 2018-05-02
});
},
makeGraph(burdenSet) {
console.log('makeGraph() called for ' + burdenSet.burdenset.name)
// Set the active project to the matched project.
this.activeBurdenSet = burdenSet
// Go to the server to get the diseases from the burden set.
rpcservice.rpcProjectCall('get_project_burden_plots',
[this.$store.state.activeProject.project.id, this.activeBurdenSet.burdenset.numindex])
.then(response => {
this.serverresponse = response.data // Pull out the response data.
let theFig = response.data.graph1 // Extract hack info.
mpld3.draw_figure('fig01', response.data.graph1) // Draw the figure.
mpld3.draw_figure('fig02', response.data.graph2) // Draw the figure.
mpld3.draw_figure('fig03', response.data.graph3) // Draw the figure.
})
.catch(error => {
// Pull out the error message.
this.serverresponse = 'There was an error: ' + error.message
// Set the server error.
this.servererror = error.message
})
},
copyBurdenSet(burdenSet) {
console.log('copyBurdenSet() called for ' + burdenSet.burdenset.name)
Expand Down Expand Up @@ -529,67 +557,6 @@ Last update: 2018-05-02
})
},
makeGraph(burdenSet) {
console.log('makeGraph() called for ' + burdenSet.burdenset.name)
// Set the active project to the matched project.
this.activeBurdenSet = burdenSet
// Go to the server to get the diseases from the burden set.
rpcservice.rpcProjectCall('get_project_burden_plots',
[this.$store.state.activeProject.project.id, this.activeBurdenSet.burdenset.numindex])
.then(response => {
// Pull out the response data.
this.serverresponse = response.data
// mpld3 drawing code
// Extract hack info.
let theFig = response.data.graph1
// Run the script passed in with the graph.
// eval(response.data.graph1.script)
// Draw the figure.
mpld3.draw_figure('fig01', response.data.graph1)
// Run the script passed in with the graph.
// eval(response.data.graph2.script)
// Draw the figure.
mpld3.draw_figure('fig02', response.data.graph2)
// Run the script passed in with the graph.
// eval(response.data.graph3.script)
// Draw the figure.
mpld3.draw_figure('fig03', response.data.graph3)
// bokeh drawing code
// Draw the figure in the 'fig01' div tag.
/* console.log('About to replace');
document.getElementById("fig01").innerHTML = response.data.graph1.div;
console.log('About to eval');
console.log(response.data.graph1.script);
eval(response.data.graph1.script); */
/* console.log('TEMP complete')
document.getElementById("fig02").innerHTML = response.data.graph2.div;
eval(response.data.graph2.script); */
})
.catch(error => {
// Pull out the error message.
this.serverresponse = 'There was an error: ' + error.message
// Set the server error.
this.servererror = error.message
})
},
updateSorting2(sortColumn) {
console.log('updateSorting2() called')
Expand Down Expand Up @@ -628,34 +595,34 @@ Last update: 2018-05-02
}
)
},
updateDisease(disease) {
console.log('Update to be made')
console.log('Index: ', disease.numindex)
console.log('Index: ', disease.numindex)
console.log('Active?: ', disease.active)
console.log('Cause: ', disease.cause)
console.log('DALYs: ', disease.dalys)
console.log('Deaths: ', disease.deaths)
console.log('Prevalence: ', disease.prevalence)
// Do format filtering to prepare the data to pass to the RPC.
let filterActive = disease.active ? 1 : 0
// Go to the server to update the disease from the burden set.
// Note: filter out commas in the numeric fields.
rpcservice.rpcProjectCall('update_burden_set_disease',
[this.$store.state.activeProject.project.id,
this.activeBurdenSet.burdenset.numindex,
disease.numindex,
[filterActive, disease.cause,
disease.dalys.replace(/,/g, ''),
disease.deaths.replace(/,/g, ''),
[this.$store.state.activeProject.project.id,
this.activeBurdenSet.burdenset.numindex,
disease.numindex,
[filterActive, disease.cause,
disease.dalys.replace(/,/g, ''),
disease.deaths.replace(/,/g, ''),
disease.prevalence.replace(/,/g, '')]])
.then(response => {
// Update the display of the disease list by rerunning the active
// Update the display of the disease list by rerunning the active
// burden set.
this.viewBurdenSet(this.activeBurdenSet)
})
})
}
}
Expand Down
Loading

0 comments on commit b6888e1

Please sign in to comment.