artoonie / rcvis

Easy-to-understand visualizations for Ranked-Choice Voting elections: sankey, bargraphs, and tables. Interactive and print-friendly options available. Supports most common tabulators.
https://www.rcvis.com
GNU General Public License v3.0
29 stars 8 forks source link

URL based API for visualizations #485

Open dsernst opened 9 months ago

dsernst commented 9 months ago

Hi @artoonie, really great stuff.

Are you open to this additional new proposed interface to create a RCV visualization?

Currently:

  1. Create account
  2. Email for API key
  3. POST election data to create new visualization
  4. Share URL to new visualization [on load the front end downloads the stored data from the DB]

Proposed:

  1. Stick all the election data into URL parameters and just directly link to that. [on load the front end grabs the election data from the URL params]

That's it.

Pros:

  1. Much quicker for others to start using. Eliminates current steps 1 and 2, and merges 3 and 4.
  2. Potentially less DB/infra costs for you, because the data no longer needs to be stored / retrieved from DB.

Similar Examples:

artoonie commented 9 months ago

Interesting idea --

It would take a lot more work than it seems on the surface because a ton of preprocessing is done on the server. We have several layers of caching, some of it in this repo, some of it not, with the goal of getting good marks on page rendering benchmarks.

To make this work, we'd have to:

  1. Port all backend python to Javascript
  2. Optimize the javascript to still have fast page loads
  3. Figure out the consequences of extremely large GET payloads

My initial hunch is that it's not worth the effort, as the common use case isn't like a QR code or notepad (where only one person accesses in general), but rather, something that's frequently shared via URLs. I could be convinced to accept a pull request.

If there's a way I can help speed up your integration with our current API, I'm happy to do that. The demo code should make it somewhat quick to create your first vis.

dsernst commented 9 months ago

I see. Thanks for the thoughtful reply