I'm trying to put together a custom search functionality which takes a geocoded address, runs it through the google civics API to grab the lower legislative branch open civic data code. In turn, I plan on having a page for each Congressional district -- which would have a custom field with the associated OCD data string that a geocoded search would return.
Here's a bit more of a data breakdown. For reference, here's the google civics API info:
Note the parameters:
includeOffices = true
levels = country
roles = legislatorLowerBody
You'll see the response which google Civic returns contains the following:
"name": "Virginia's 10th congressional district",
I have all this data ready to go. There is a custom field attached to each district (named "ocd)" which has the related OCD string (in the above example that would be ocd-division/country:us/state:va/cd:10)
I can build the geocoded form myself. What I need is the backend function which handles the request, gets the desired result from the google civic API, and then redirects you to the matching district page based on the returned OCD value from the google civics API.
Any help here would be appreciated ASAP.