Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

I published this data as an online JSON API #32

@simonw

Description

@simonw

I've been building a suite of tools for publishing CSV files as online databases - https://github.com/simonw/datasette

Since this data is a set of CSV files and is openly (MIT) licensed, I've used my tools to publish it as an API here: https://election-calendar-2018.now.sh/

Here's the exact sequence of commands I used to do this (having previously installed both datasette and csvs-to-sqlite):

cd /tmp
git clone https://github.com/democrats/election-calendar
cd election-calendar/
csvs-to-sqlite . election-calendar.db
datasette publish now election-calendar.db \
  --source="democrats/election-calendar" \
  --source_url=https://github.com/democrats/election-calendar \
  --license=MIT \
  --license_url="https://github.com/democrats/election-calendar/blob/master/LICENSE" \
  --title="2018 Election Calendar"

The datasette publish now command output looked like this (truncated):

> Deploying /private/var/folders/...b2xns/datasette
> Ready! https://datasette-flwjwsfdvo.now.sh (copied to clipboard) [5s]
> Synced 3 files (48.56KB) [0ms] 
> Initializing…
> Building
...

I than run this command to give it a nicer URL:

now alias https://datasette-flwjwsfdvo.now.sh election-calendar-2018.now.sh

As an example of what you can now do with this... here's a query showing all states with early vote by mail: https://election-calendar-2018.now.sh/election-calendar-351139d/2018%2Fstate_reference?early_vote_by_mail__exact=yes&is_state__exact=yes

And here's that same data as JSON: https://election-calendar-2018.now.sh/election-calendar-351139d/2018%2Fstate_reference.jsono?early_vote_by_mail__exact=yes&is_state__exact=yes

I've written a bunch about the other kinds of tricks you can do with Datasette on my blog: https://simonwillison.net/tags/datasette/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions