move-coop / parsons

A python library of connectors for the progressive community.
https://www.parsonsproject.org/
Other
259 stars 131 forks source link

[Feature/Addition] AP Elections Class #774

Open elyse-weiss opened 1 year ago

elyse-weiss commented 1 year ago

Proposed new AP Elections class for use with Associated Press API.

Detailed Description

TMC purchased the Associated Press API in both 2020 and 2022. The code is in this Github gist: https://gist.github.com/elyse-weiss/77385e02430df8b3d2f135c6f9ff470b

I do not have time at this moment to formalize into a Parsons class, but figured someone else might. There are two scripts included:

ap_election.py

During a new calendar year, the following updates need to be made to apelection.py:

update_election_data.py

https://api.ap.org/v3/elections/{election_date}?format=json&level={level}&resultstype={test}&statepostal=%{stateid}&minDateTime={timestamp}

Context

At TMC, we chose to push the data to Postgres since we were running the job to hit against the API every 5 minutes.

Possible Implementation

Priority

low priority

shaunagm commented 4 months ago

@elyse-weiss - I have a contributor potentially interested in working on this. Do you know if TMC still has access to the AP API that we could use to test out a new connector?

elyse-weiss commented 4 months ago

TMC is very likely getting the API again this year, but I feel fairly certain they do not have it yet.