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 🙏

© 2025 – Pkg Stats / Ryan Hefner

data-gov-uk-graphql

v0.0.4

Published

GraphQL Wraparound data.uk.gov api data

Readme

GraphQL implementation of data.gov.uk API

data source: https://data.gov.uk/data/api/.

Overview

A wraparound of various datasets provided by data.gov.uk ranging from crime data, scheduled roadwork's, to hospital information. Associated responses follow close to the raw data and are mapped into the graphql type system.

All requests are generated by relevant query parameters to the data sets such as; post code, longitude / latitude etc.

All queries are modular GraphQLObjectType’s and can be simply bolted on to any existing GraphQL Schema. Resolve data fetching functions are self contained within the modules.

Available Data Sets
  • Crime Data (monthly location based street crime stats)
  • Hospital Information (location based hospital services)
  • Pharmacy Information (local pharmacies info)
  • RoadWorks Information (existing and scheduled roadworks based on road)
  • Ferry Port Information (information on ferry ports within n miles of location)
  • Airports Information (list of airport's and codes)
Caveats

Requests are made to the data source api at data.gov.uk/api response's for some of the data sets can be slow.

Install

npm install data-gov-uk-graphql

Demo Playground

Usage

import specific required data types

import {
    CrimesType,
    HospitalsType,
    PharmacysType,
    RoadWorksType,
    FerrysType,
    AirportsType
} from 'data-gov-uk-graphql'

Add type's to the schema

const QueryType = new GraphQLObjectType({
  name: 'Query',
  description: 'The root query..',
  fields: () => ({
    crimes: CrimesType,
    hospitals: HospitalsType,
    pharmacys: PharmacysType,
    roadworks: RoadWorksType,
    airports: AirportsType,
    ferrys: FerrysType,
  }),
});

export const Schema = new GraphQLSchema({
  query: QueryType,
});

Basic Example Query

Get local pharmacy information based on a partial post code

Demo

{
  pharmacys(partial_postcode:"m21"){
    name,
    address1,
    city,
    postcode
  }
}

.

API Documentation

Crime Data

Required Request Variables

| Variable | Type | Description | | :------| :-----------| :-----------| | month | String | Shorthand month jan, feb | | lat | Float | latitude | | lng | Float | longitude | | year | Int | year |

Demo

{
  crimes(
    lng:-1.131592,
    lat:52.629729,
    year:2015,
    month:"jun",
  ){
    id,
    category,
    outcome_status{
      category,
      date
    },
    month,
    persistent_id,
    location_type,
    location{
      latitude,
      longitude,
      street{
        id,
        name
      }
    }
  }
}

Hospital Information

location based hospital services

Required Request Variables

| Variable | Type | Description | | :------| :-----------| :-----------| | lat | Float | latitude | | lng | Float | longitude |

Demo

{
	hospitals(lat:53.1, lon:3.0){
        postcode,
        name,
        phone,
        organisation_code,
        website
    }
}

Pharmacy Information

local pharmacies info

Required Request Variables

| Variable | Type | Description | | :------| :-----------| :-----------| | partial_postcode | String | partial postcode first half |

Demo

{
  pharmacys(partial_postcode:"m1"){
    name,
    address1,
    city,
    postcode,
  }
}

RoadWorks Information

existing and scheduled roadworks based on road

Required Request Variables

| Variable | Type | Description | | :------| :-----------| :-----------| | road | String | road / motorway |

Demo

{
  roadworks(road:"M1"){
    traffic_management,
    status,
    start_date,
    road,
    location,
    local_authority,
    expected_delay,
    end_date,
    description
  }
}

Ferry Port Information

information on ferry ports within n miles of location

Required Request Variables

| Variable | Type | Description | | :------| :-----------| :-----------| | postcode | String | full postcode | | distance | Int | within n miles from postcode location |

Demo

{
  ferrys(postcode: "L1 0AA", distance:10){
    name,
    ospoint {
      type
      coordinates
    }
    latlong {
      type
      coordinates
    },
    distance,
    ferrycode,
    atcocode
  }
}

Airports Information

list of airport's and codes

Demo

{
  airports{
    name,
    iatacode,
    atcocode
  }
}