Code Monkey home page Code Monkey logo

pedestrian-and-bike-crashes's Introduction

A Twitter bot that tweets Bicyclist and Pedestrian related crashes, using Citizen data.

Tweet screenshot

Run

npm install to fetch and install dependencies.

To run: node index.js --location cityNameOne, where cityNameOne is the name of the city you want to fetch and tweet data for (see keys section for more information).

Keys file

To use, create a keys.file with the following format for each city you want to fetch and tweet data for:

module.exports = {
    cityNameOne: {
        consumer_key: 'consumer_key',
        consumer_secret: 'consumer_secret',
        access_token: 'access_token',
        access_token_secret: 'access_token_secret',
        lowerLatitude: 'lowerLatitude',
        lowerLongitude: 'lowerLongitude',
        upperLatitude: 'upperLatitude',
        upperLongitude: 'upperLongitude',
        timeZone: 'America/New_York',
    },
    cityNameTwo: {
        consumer_key: 'consumer_key',
        consumer_secret: 'consumer_secret',
        access_token: 'access_token',
        access_token_secret: 'access_token_secret',
        lowerLatitude: 'lowerLatitude',
        lowerLongitude: 'lowerLongitude',
        upperLatitude: 'upperLatitude',
        upperLongitude: 'upperLongitude',
        timeZone: 'America/Los_Angeles',
    },
    ...
};

To get the consumer_key, consumer_secret, access_token, and access_token_secret values, you'll need to sign up for a Twitter Developer account.

To get the lowerLatitude, lowerLongitude, upperLatitude, and upperLongitude values, you'll need to go to the Citizen explore page. Open up the developer tools in your browser, go to the network tab, and select the city you want to see incidents for. Select the trending API call and the latitude and longitude values are the parameters in the URL.

The timeZone value is used for converting incident times (Citizen stores them in UTC) to the city's local time. The timeZone value for your city can be found here - use the value in the TZ database name column. If your city isn't listed just use the closest major city (ex. for Philadelphia use America/New_York).

pedestrian-and-bike-crashes's People

Contributors

cailinpitt avatar

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.