Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Who you gonna call? Google Civic Information client & website

by 1nickt (Canon)
on Feb 07, 2021 at 04:27 UTC ( [id://11127999]=CUFP: print w/replies, xml ) Need Help??

Google has an API called Civic Information from which one can obtain all the elected officials (from head of state to city council) for a given US address. It's a very cool tool designed to facilitate citizen engagement in government, and I strongly support that.

I wrote the Perl client for the API (Net::Google::CivicInformation), and based a Dancer2 web app on it, online now at https://contactmyreps.com.

(At the urging of some of the Dancer2 team I made public the source code repository for the web app. Hope it comes in handy for someone learning to build with Dancer2.)

In a future release I plan to implement the elections information the API provides. Because silence betokes consent ✌️

enjoy!

edit: removed planned feature that's now implemented; added note about public github repo


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re: Who you gonna call? Google Civic Information client & website
by hippo (Bishop) on Feb 07, 2021 at 12:40 UTC

    Great idea! (++)

    Unfortunately, at present it seems that whatever I enter into the address field on https://contactmyreps.com/ just returns a 500. What format should the address have? The POD suggests "123 Main St Springfield MO 12345", but even that format fails on the site. Hopefully just a teething issue.

    Good to see it advertising the fact that it is written in Perl in the footer!


    🦛

      That's unfortunate timing. I was installing a reCaptcha. Thanks for looking!


      The way forward always starts with a minimal test.

        Just to confirm: the site now works for me.

        For my own projects and any others where I have enough influence, captchas (and especially reCaptcha) are avoided. Restricting by count and IP address (or IPv6 range) is much less user-antagonistic and rarely impactful on the servers. I'd be surprised if such a facility were not already integrated into Dancer2. Maybe worth investigating?


        🦛

Re: Who you gonna call? Google Civic Information client & website
by Your Mother (Archbishop) on Feb 07, 2021 at 21:18 UTC

    Fantastic. Best thing anyone has done on here since webperl.

Re: Who you gonna call? Google Civic Information client & website
by BaldManTom (Friar) on Feb 07, 2021 at 17:23 UTC
    This is spectacular, 1nickt, and is one of those rare posts that I wish I could upvote more than once. I've shared your site with friends and family, because we need to be letting those we elect to act on our behalf know how we feel about the job they're doing, both the good and the bad, and we need to hold them accountable.

      Thank you, I really appreciate the feedback.


      The way forward always starts with a minimal test.
Re: Who you gonna call? Google Civic Information client & website
by bliako (Monsignor) on Feb 07, 2021 at 17:38 UTC

    Way to go brother!

    If I said: "Things like these do make a change" it would be like watering my wine but yes I will say it, they can make a change. If not but teaching "ordinary" people that they are the only source and fuel of change.

    If I may say that your site can grow into a campaign-tracking site where it shows next to each so-called elected servant all the public requests/letters/campaigns/demands people have already asked via your site so you track them easily, which the user can also sign their names in 2 seconds and ... 2 mins later another letter arrives at the capitol.

    May I also say that I too vote against using google's captcha in a page where people may enter their address and google will obtain their ip. Perhaps a diy captcha? GD::SecurityImage::AC based on Authen::Captcha.

    Apropos checking on power: I like this site: http://www.therobingroom.com/ (for those who do not want to click it's a site with comments and ratings of US judges). Perhaps you can integrate their info so that the citizens also know who will be trying them when they do push that constitutional rights ring-bell too hard or too-much :)

    bw, bliako

Re: Who you gonna call? Google Civic Information client & website
by Bod (Parson) on Feb 07, 2021 at 19:24 UTC
    Google has an API called Civic Information from which one can obtain all the elected officials

    In the UK we have something similar in They Work For You. However, their API is chargeable 😕

    Edited to add that it's an awesome tool that 1nickt has created
    Unfortunately I cannot see it's full glory as I don't have a US address...although I guess I could find one :P

Re: Who you gonna call? Google Civic Information client & website
by jdporter (Paladin) on Feb 08, 2021 at 17:13 UTC

    This isn't working (for me). I've tried several addresses in Maryland and Virginia and never get any data.

    I wouldn't mind so much if it would give me some kind of message explaining why it couldn't fulfill my request, but it's not doing that either.

    Also, the "Contact" button in the upper right corner throws a 500.

    fwiw, I'm using Mozilla Firefox 85.0 64-bit on Windows 10.

    Update: It worked when I tried it in IE. :-(

      Thanks for the report. I develop in Firefox so it's surprising to hear this. I'll get right on some debugging.


      The way forward always starts with a minimal test.

        I use Firefox and had no trouble with my historic zips and tried a few random MA and VA zips too; including a Private window.

      Thanks again for the report. I fixed the error with the contact form, derp. I'm curious about what your "experience" was when you submitted the main search form. Did it show a table with a no data message? In the meantime I've removed the reCAPTCHA that was on the form and made the submit button a normal HTML button, so it should return some content at least if the browser doesn't have JS.


      The way forward always starts with a minimal test.
        when you submitted the main search form. Did it show a table with a no data message?

        Yes, I get the <table id="officials" table with just its header row.
        I also get the footer, and it looks oddly smashed into the header row of the preceding table, though I suspect that's just a visual artifact of the styling.

        I do not have js disabled, but I do have a few blockers running, so it's probably one of them. Don't spend too much time on it. ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://11127999]
Approved by Athanasius
Front-paged by Discipulus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-03-29 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found