Closed rexdouglass closed 3 years ago
@rexdouglass Hello, this seems to be a filter in the worksheet named "All Tests COVID19"
The following get the filters, iterate all the values of Union Key for CMN
column (counties) and get the resulting worksheet All Tests COVID19
for each of them:
from tableauscraper import TableauScraper as TS
url = 'https://www.nh.gov/t/DHHS/views/COVID19TestingDashboard/TestingDashboard'
ts = TS()
ts.loads(url)
ws = ts.getWorksheet("All Tests COVID19")
filters = ws.getFilters()
counties = next(iter([
t["values"]
for t in filters
if t["column"] == "Union Key for CMN"
]))
print(counties)
for county in counties:
print(county)
wb = ws.setFilter('Union Key for CMN', county)
countyWs = wb.getWorksheet("All Tests COVID19")
print(countyWs.data)
repl.it: https://replit.com/@bertrandmartel/TableauCovidNewHampshire
Confirmed that does exactly what I need it to do. Thank you for your generous help and for an awesome package that's directly unlocking COVID data for research.
Hew Hampshire's COVID-19 dashboard has a dropdown box for filtering results to "County" https://www.nh.gov/covid19/dashboard/testing.htm#dash
It does not appear under selectables, parameters, or filters as best as I can find. Here's the output https://pastebin.com/raw/BNuVQrHn) for python prompt.py -get workbook -url "https://www.nh.gov/t/DHHS/views/COVID19TestingDashboard/TestingDashboard?:iid=4&:isGuestRedirectFromVizportal=y&:display_count=n&:showVizHome=n&:origin=viz_share_link"
Is this a use case you are aware of, and is there are part of tableau-scraper I should be using to handle it, perhaps in the "dashboards" part of the code?