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

@vicentecalfo/jskew

v1.0.0

Published

Javascript interface to Kew data. Library for easy access to Kew’s nomenclatural and taxonomic services. Hides the intricacies of using the HTTP API.

Downloads

19

Readme

@vicentecalfo/jskew

Javascript interface to Kew data

Package for easy access to Kew’s nomenclatural and taxonomic services.

The official package is written in python and can be found here. However, this javascript version has the same functionality.

This is not an official package from the Kew team.

Installation

npm install @vicentecalfo/jskew --save

Usage

IPNI

https://www.ipni.org

To build complex queries, use the search terms available in Ipni terms. Query term are grouped into the modules Name, Author, and Publication.


import { Ipni } from '@vicentecalfo/jskew';

const ipni = new Ipni();

ipni.name(
	{
		genus:'poa',
		species: 'annua'
	}
).subscribe(
	(data) => console.log(data.body),
	(error) => console.log(error)
);

Name

Method

ipni.name(
    // Query parameters
    {
		genus:'poa',
		species: 'annua'
	}
    ).subscribe(
	(data) => console.log(data.body), //json data "data.body"
	(error) => console.log(error)
);

Terms (query parameters)

{
    added,
    author,
    basionym,
    basionym_author,
    bibliographic_reference,
    citation_type,
    collection_number,
    collectors,
    distribution,
    family,
    full_name,
    genus,
    in_powo,
    infrafamily,
    infragenus,
    infraspecies,
    modified,
    name_status,
    published,
    published_in,
    publishing_author,
    rank,
    scientific_name,
    species,
    species_author,
    version
}

Author

Method

ipni.author(
    // Query parameters
    {
		forename: 'Alison E. L.'
	}
    ).subscribe(
	(data) => console.log(data.body), //json data "data.body"
	(error) => console.log(error)
);

Terms (query parameters)

{
    forename,
    full_name,
    standard_form,
    surname
}

Publication

Method

ipni.pub(
    // Query parameters
    {
        title:'Contributions from the United States National Herbarium. Smithsonian Institution',
        lc_number:'QK1.U6755',
        bph_number:'BPH/S  p. 288'
    }
    ).subscribe(
	(data) => console.log(data.body), //json data "data.body"
	(error) => console.log(error)
);

Terms (query parameters)

{
    standard_form,
    bph_number,
    date,
    isbn,
    issn,
    lc_number,
    preceded_by,
    superceded_by,
    title,
    tl2_author,
    tl2_number
}

Filtering

You can filter a given result set by taxonomic rank.

ipni.name(
    // Query parameters
    {
		genus:'poa'
    },
    ['infraspecific']
    ).subscribe(
	(data) => console.log(data.body), //json data "data.body"
	(error) => console.log(error)
);

Avaiable filters

  • familial
  • infrafamilial
  • generic
  • infrageneric
  • specific
  • infraspecific

Using results

{
    page: number;
	perPage: number;
	results: array; // The search results are here.
	totalPages: number;
	totalResults: number;
}
ipni.name({genus:'poa'}).subscribe(
	(data) => {
        const results = data.body.results;
        // Do something with the result.
    },
	(error) => console.log(error)
);

// You can also use promises.
ipni
	.name({ genus: 'Poa'})
	.toPromise()
	.then((data) => {
		const results = data.body.results;
		console.log(results);
	})
	.catch((error) => console.log(error));

POWO

http://www.plantsoftheworldonline.org

Class for searching POWO data and looking up individual records. Taxonomic data is returned by default, but other associated such as distributions and descriptive text can also be retrieved.

To build complex queries, use the search terms available in powo terms. Query term are grouped into the modules Name, Characteristic, and Geography.

import { Powo } from '@vicentecalfo/jskew';
const powo = new Powo();

powo.name({
	genus:'Poa',
	species: 'annua'
})
.subscribe(
	(data) => console.log(data.body),
	(error) => console.log(error)
);

Name

powo.name(
     // Query parameters
    {
        genus,
        species
    }
).subscribe(
	(data) => console.log(data.body),
	(error) => console.log(error)
);

Terms (query parameters)

{
    full_name,
    common_name,
    kingdom,
    family,
    genus,
    species,
    author
}

Characteristic

powo.characteristic(
    // Query parameters
    {
	    flower,
	    leaf
    }
)
.subscribe(
	(data) => console.log(data.body),
	(error) => console.log(error)
);

Terms (query parameters)

{
    summary,
    appearance,
    characteristic,
    flower,
    fruit,
    leaf,
    inflorescence,
    seed,
    cloning,
    use
}

Geography

powo.geography(
    // Query parameters
	{
		distribution
	}
)
.subscribe(
	(data) => console.log(data.body),
	(error) => console.log(error)
);

Terms (query parameters)

{
    distribution
}

Filtering

You can filter a given result set by taxonomic rank.

powo.name(
    // Query parameters
    {
	    genus:'Poa'
    },
    ['accepted','species']
).subscribe(
	(data) => console.log(data.body), //json data "data.body"
	(error) => console.log(error)
);

Avaiable filters

  • accepted
  • has_images
  • families
  • genera
  • species
  • infraspecies

Individual record

    powo.lookup('urn:lsid:ipni.org:names:320035-2')
        .subscribe(
            (data) => console.log(data.body),
            (error) => console.log(error)
        );

Extra data

The standard data returned by the POWO api includes taxonomic and nomenclatural information, but there are other data you can request.

Currently you can only retrieve distribution data, but other data should be exposed in the future.

    powo
        .lookup(
            'urn:lsid:ipni.org:names:320035-2',
            { include: ['distribution'] }
        )
        .subscribe(
            (data) => console.log(data.body),
            (error) => console.log(error)
        );

API error handling

You can access the status code. Sample

// Inpi or Powo classes
ipni
	.name({ genus: 'Poa', species: 'annua' })
	.toPromise()
	.then((data) => {
        const statusCode = data.response.statusCode; 
        // example: 249 > too many requests, now you can retry after X seconds
        // Do something with the status code result.
	})
	.catch((error) => console.log(error));

Additional information

  • This package is not official form the Royal Botanic Gardens, Kew.
  • The documentation for this package is very similar to the official package written in python (pykew), due to the similarity of features.