Skip to content

Commit

Permalink
Maps of health tooltip fix (#140)
Browse files Browse the repository at this point in the history
* Fix tooltip when no first OD + no first RX

* Simplify

* Fix tooltips for other maps of health
  • Loading branch information
edlu77 authored Feb 19, 2024
1 parent 141f90d commit 6151e1c
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 30 deletions.
34 changes: 24 additions & 10 deletions src/assets/pages/vis6-maps-of-health/vis.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,27 @@
]
},
{
"calculate": "-datum.OD_DIFF",
"calculate": "datum.OVERDOSES == 0",
"as": "NO_FIRST_OD"
},
{
"calculate": "datum.TOTAL_PRESCRIPTIONS == 0",
"as": "NO_FIRST_RX"
},
{
"calculate": "datum.NO_FIRST_OD ? 'N/A' : year(datetime(datum.TIME_FIRST_OD)) + ' Q' + quarter(datetime(datum.TIME_FIRST_OD))",
"as": "TIME_FIRST_OD_VALUE"
},
{
"calculate": "datum.NO_FIRST_RX ? 'N/A' : year(datetime(datum.TIME_FIRST_RX)) + ' Q' + quarter(datetime(datum.TIME_FIRST_RX))",
"as": "TIME_FIRST_RX_VALUE"
},
{
"calculate": "datum.NO_FIRST_OD ? 'N/A' : -datum.OD_DIFF",
"as": "OD_DIFF_VALUE"
},
{
"calculate": "-datum.RX_DIFF",
"calculate": "datum.NO_FIRST_RX ? 'N/A' : -datum.RX_DIFF",
"as": "RX_DIFF_VALUE"
}
],
Expand Down Expand Up @@ -309,25 +325,23 @@
"title": "Total # of Prescriptions"
},
{
"field": "TIME_FIRST_OD",
"type": "temporal",
"timeUnit": "yearquarter",
"field": "TIME_FIRST_OD_VALUE",
"type": "nominal",
"title": "Time of 1st overdose"
},
{
"field": "TIME_FIRST_RX",
"type": "temporal",
"timeUnit": "yearquarter",
"field": "TIME_FIRST_RX_VALUE",
"type": "nominal",
"title": "Time of 1st prescription"
},
{
"field": "OD_DIFF_VALUE",
"type": "quantitative",
"type": "nominal",
"title": "Days from 1st overdose to death"
},
{
"field": "RX_DIFF_VALUE",
"type": "quantitative",
"type": "nominal",
"title": "Days from 1st prescription to death"
}
]
Expand Down
34 changes: 24 additions & 10 deletions src/assets/pages/vis6-maps-of-health/vis2.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,27 @@
]
},
{
"calculate": "-datum.OD_DIFF",
"calculate": "datum.OVERDOSES == 0",
"as": "NO_FIRST_OD"
},
{
"calculate": "datum.TOTAL_PRESCRIPTIONS == 0",
"as": "NO_FIRST_RX"
},
{
"calculate": "datum.NO_FIRST_OD ? 'N/A' : year(datetime(datum.TIME_FIRST_OD)) + ' Q' + quarter(datetime(datum.TIME_FIRST_OD))",
"as": "TIME_FIRST_OD_VALUE"
},
{
"calculate": "datum.NO_FIRST_RX ? 'N/A' : year(datetime(datum.TIME_FIRST_RX)) + ' Q' + quarter(datetime(datum.TIME_FIRST_RX))",
"as": "TIME_FIRST_RX_VALUE"
},
{
"calculate": "datum.NO_FIRST_OD ? 'N/A' : -datum.OD_DIFF",
"as": "OD_DIFF_VALUE"
},
{
"calculate": "-datum.RX_DIFF",
"calculate": "datum.NO_FIRST_RX ? 'N/A' : -datum.RX_DIFF",
"as": "RX_DIFF_VALUE"
}
],
Expand Down Expand Up @@ -310,25 +326,23 @@
"title": "Total # of Prescriptions"
},
{
"field": "TIME_FIRST_OD",
"type": "temporal",
"timeUnit": "yearquarter",
"field": "TIME_FIRST_OD_VALUE",
"type": "nominal",
"title": "Time of 1st overdose"
},
{
"field": "TIME_FIRST_RX",
"type": "temporal",
"timeUnit": "yearquarter",
"field": "TIME_FIRST_RX_VALUE",
"type": "nominal",
"title": "Time of 1st prescription"
},
{
"field": "OD_DIFF_VALUE",
"type": "quantitative",
"type": "nominal",
"title": "Days from 1st overdose to death"
},
{
"field": "RX_DIFF_VALUE",
"type": "quantitative",
"type": "nominal",
"title": "Days from 1st prescription to death"
}
]
Expand Down
34 changes: 24 additions & 10 deletions src/assets/pages/vis6-maps-of-health/vis3.vl.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,27 @@
]
},
{
"calculate": "-datum.OD_DIFF",
"calculate": "datum.OVERDOSES == 0",
"as": "NO_FIRST_OD"
},
{
"calculate": "datum.TOTAL_PRESCRIPTIONS == 0",
"as": "NO_FIRST_RX"
},
{
"calculate": "datum.NO_FIRST_OD ? 'N/A' : year(datetime(datum.TIME_FIRST_OD)) + ' Q' + quarter(datetime(datum.TIME_FIRST_OD))",
"as": "TIME_FIRST_OD_VALUE"
},
{
"calculate": "datum.NO_FIRST_RX ? 'N/A' : year(datetime(datum.TIME_FIRST_RX)) + ' Q' + quarter(datetime(datum.TIME_FIRST_RX))",
"as": "TIME_FIRST_RX_VALUE"
},
{
"calculate": "datum.NO_FIRST_OD ? 'N/A' : -datum.OD_DIFF",
"as": "OD_DIFF_VALUE"
},
{
"calculate": "-datum.RX_DIFF",
"calculate": "datum.NO_FIRST_RX ? 'N/A' : -datum.RX_DIFF",
"as": "RX_DIFF_VALUE"
}
],
Expand Down Expand Up @@ -304,25 +320,23 @@
"title": "Total # of Prescriptions"
},
{
"field": "TIME_FIRST_OD",
"type": "temporal",
"timeUnit": "yearquarter",
"field": "TIME_FIRST_OD_VALUE",
"type": "nominal",
"title": "Time of 1st overdose"
},
{
"field": "TIME_FIRST_RX",
"type": "temporal",
"timeUnit": "yearquarter",
"field": "TIME_FIRST_RX_VALUE",
"type": "nominal",
"title": "Time of 1st prescription"
},
{
"field": "OD_DIFF_VALUE",
"type": "quantitative",
"type": "nominal",
"title": "Days from 1st overdose to death"
},
{
"field": "RX_DIFF_VALUE",
"type": "quantitative",
"type": "nominal",
"title": "Days from 1st prescription to death"
}
]
Expand Down

0 comments on commit 6151e1c

Please sign in to comment.