Code Monkey home page Code Monkey logo

scrape-open-data's Introduction

scrape-open-data

Scrape latest data

Scrapes every available dataset from Socrata and stores them as newline-delimited JSON in this repository, to track changes over time through Git scraping.

  • socrata/data.delaware.gov.jsonl contains the latest datasets for a specific domain. This is updated twice a day.
  • socrata/data.delaware.gov.stats.jsonl contains information on page views and download numbers. This is updated once a week to avoid every single fetch including updated counts for many different datasets.

The resulting database is deployed to https://open-data.datasette.io/

scrape_socrata.py

Run python scrape_socrata.py socrata/ to scrape the data from Socrata and save it in the socrata/ directory.

Add --stats to include page view and download statistics in separate files.

Add --verbose for verbose output.

build_socrata_db.py`

Run this command to build a SQLite database from the .jsonl files in socrata/:

python build_socrata_db.py socrata.db socrata

scrape-open-data's People

Contributors

simonw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scrape-open-data's Issues

Build and publish SQLite database of open data

I tried this initially using sqlite-utils insert --flatten against the .jsonl files, but ended up with a table with hundreds of columns.

I'm going to be selective about which columns I include in the database instead.

Run scraper with --stats once per week

This is so I don't get lots of tiny diffs because of page view and download counts incrementing all the time.

I built the script with this in mind - it only writes the stats information out - as separate files - if you include --stats:

if save_stats:
if domain not in stats_files:
stats_files[domain] = (root / "{}.stats.json".format(domain)).open("w")
stats_files[domain].write(json.dumps(stats) + "\n")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.