npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

data-dot-gov

v0.1.0

Published

JavaScript SDK for accessing Singapore government data from data.gov.sg

Downloads

4

Readme

data-dot-gov

This package exposes APIs from https://data.gov.sg for usage from JavaScript.

Installation

Install it via npm:

# npm install data-dot-gov --save-dev

Usage

Obtain an API Consumer Key

In your main index.js/server.js file, import the package and set the consumer key. You can obtain a consumer key by creating an account at https://developers.data.gov.sg.

After setting up, go to your APIs and create a new app. A Consumer Key should have been made available to you.

Available APIs

✅ indicates it's ready. ❌ indicates it's not ready.

Real-Time APIs

Source: https://developers.data.gov.sg/

✅ taxi-availability

Available at: dataDotGov.RealTime.Transport.getTaxiAvailability()

❌ traffic-images

Not available yet.

❌ 2-hour-weather-forecast

Not available yet.

❌ 24-hour-weather-forecast

Not available yet.

❌ 4-day-weather-forecast

Not available yet.

❌ air-temperature

Not available yet.

❌ pm25

Not available yet.

❌ psi

Not available yet.

❌ rainfall

Not available yet.

❌ relative-humidity

Not available yet.

❌ uv-index

Not available yet.

❌ wind-direction

Not available yet.

❌ wind-speed

Not available yet.

Data-Store APIs

Source: https://data.gov.sg/developer

Meta Data
✅ package_metadata

Available at: dataDotGov.DataStore.getPackageInfo(:package_name)

:package_name - name of package according to package on https://data.gpv.sg.

✅ resource_metadata

Available at: dataDotGov.DataStore.getResourceInfo(:resource_id)

:resource_id - UUID of resource from .getPackageInfo().

CKAN APIs
✅ datastore_query

Available at: dataDotGov.DataStore.query(:resource_id, :query)

:resource_id - UUID of CKAN API resource, note that this is not the same as the :resource_id from resource_metadata.

:query - additional search parameters for querying the resource identified by :resource_id.

Others

Add on to this if you've created a function endpoint for this!

Development & Contribution

Setting up

Fork and Install Dependencies

Fork this project and clone it locally.

Install dependencies with:

# npm install
#
# OR
#
# yarn install

Obtain an API Consumer Key

See the above section in Usage on obtaining an API Consumer Key

Create .env File

Create an .env file in the project root with the following content:

PORT=<port for hosting>
DATAGOVSG_CONSUMER_KEY=<consumer key from above>

Development

The ./index.js file contains the main file which is included upon require('data-dot-gov').

The ./lib folder contains the code in a single-layer organisation manner. Files within ./lib should be named in lowercase according to the variables they expose.

Testing

Tests are stored in ./test and are run using the Mocha runner. Test coverage is provided by Istanbul and is made available in ./coverage.

To run the tests, use npm test.

To run the tests with watching, use npm run test-watch

View Coverage Reports

Run the development server using npm run dev and you should be able to access the coverage reports at http://localhost:PORT where PORT is a defined key in your ./.env file.

Cheers!