clarify icon indicating copy to clipboard operation
clarify copied to clipboard

Handle new-style "Web02" Clarity sites

Open dwillis opened this issue 7 years ago • 11 comments

Like West Virginia, which clarify fails to parse and return any information from.

dwillis avatar Oct 26 '18 12:10 dwillis

Is the example for Kentucky a new-style Clarity site? I’m seeing this error when following the README and curious if it’s part of this issue:

>>> import clarify
>>> j = clarify.Jurisdiction(url='http://results.enr.clarityelections.com/KY/15261/30235/en/summary.html', level='state')
>>> j.report_url('xml')
'https://results.enr.clarityelections.com/KY/15261/30235/reports/detailxml.zip'
>>> subs = j.get_subjurisdictions()
>>> subs[0].name
'Boone'
>>> subs[-1].report_url('xml')
'https://results.enr.clarityelections.com/KY/Woodford/15382/27566/reports/detailxml.zip'

(At this point I download and extract the Woodford XML to /tmp/detail.xml)

>>> p = clarify.Parser()
>>> p.parse("/tmp/detail.xml")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/private/tmp/clarify/.venv/lib/python3.6/site-packages/clarify/parser.py", line 47, in parse
    self.voter_turnout = float(election_voter_turnout[2])
IndexError: list index out of range

migurski avatar Oct 29 '18 17:10 migurski

@migurski No, Kentucky is an older Clarity site, so this looks like a separate issue. Thanks for flagging it, though!

dwillis avatar Oct 29 '18 17:10 dwillis

Ah cool — is there a current Clarity example that demonstrates working behavior?

migurski avatar Oct 29 '18 17:10 migurski

Just updated the README to use one.

dwillis avatar Oct 29 '18 17:10 dwillis

Oh boo

jonrobinson2 avatar Nov 01 '18 18:11 jonrobinson2

Also Colorado, if you need another test case.

cjwinchester avatar Nov 10 '18 21:11 cjwinchester

The README example is Georgia, which uses the new Clarity 'Web02' format for new elections, but the README example is for an older GA election that uses the older summary.html results URL format. The most recent GA election result page is "http://results.enr.clarityelections.com/GA/91639/Web02-state.221451/#/". The "j.report_url('xml')" step from the README does NOT work with the new Web02 format, but "j.get_subjurisdictions()" does work properly. There's a get_latest_summary_url() method that works with Web02, but the report_url() does not use this.

kyoung2112 avatar Nov 15 '18 16:11 kyoung2112

@kyoung2112 Thanks - we'll get that fixed on j.report_url('xml')

dwillis avatar Nov 18 '18 14:11 dwillis

It looks like there's now a new URL format that behaves pretty similarly to the WV and GA cases, but not exactly so it again breaks the code: https://results.enr.clarityelections.com/KY/103779/web.255599/#/reporting

bxjw avatar Jul 09 '20 18:07 bxjw

@bxjw Thanks - just pushed a fix for this but have not done a release yet. If you install directly from GitHub it should work.

dwillis avatar Jul 23 '20 01:07 dwillis

@dwillis Most 2020 elections are now using the web.XXXXXX URL format, for example the GA 2020 general election here: https://results.enr.clarityelections.com/GA/105369/web.264614/#/summary

Installing from source current as of posting, neither this link nor the KY link posted previously work for j.report_url('xml') - it returns None.

Edit: KY and GA do work for subjurisdictions it just takes a bit.

JDWarner avatar Jan 04 '21 18:01 JDWarner