Skip to content

nakamura196/jps-entity-lookup

Repository files navigation

jps-entity-lookup

Picture

Travis Codecov version downloads GPL-3.0 semantic-release Commitizen friendly experimental

  1. Overview
  2. Installation
  3. Use
  4. API
  5. Development

Overview

Finds entities (people, places, organizations, titles) in jps. Meant to be used with cwrc-public-entity-dialogs where it runs in the browser.

Although it will not work in node.js as-is, it does use the Fetch API for http requests, and so could likely therefore use a browser/node.js compatible fetch implementation like: isomorphic-fetch.

Installation

npm i jps-entity-lookup

Use

import jpsLookup from 'jps-entity-lookup';

API

findPerson(query)

findPlace(query)

findOrganization(query)

findTitle(query)

where the 'query' argument is an object:

{
    entity: "The name of the thing the user wants to find.",
    options: "TBD"
}

and all find* methods return promises that resolve to an object like the following:

{
    "id": "http://jps.org/jps/9447148209321300460003/",
    "name": "Fay Jones School of Architecture and Design",
    "nameType": "Corporate",
    "originalQueryString": "jones",
    "repository": "jps",
    "uri": "http://jps.org/9447148209321300460003/",
    "uriForDisplay": "https://jps.org/9447148209321300460003/"

}

There are a further four methods that are mainly made available to facilitate testing (to make it easier to mock calls to the jps service):

getPersonLookupURI(query)

getPlaceLookupURI(query)

getOrganizationLookupURI(query)

getTitleLookupURI(query)

where the 'query' argument is the entity name to find and the methods return the jps URL that in turn returns results for the query.

Development

CWRC-Writer-Dev-Docs describes general development practices for CWRC-Writer GitHub repositories, including this one.

Mocking

We use fetch-mock to mock http calls (which we make using the Fetch API rather than XMLHttpRequest).

Continuous Integration

We use Travis.

Release

We follow SemVer, which Semantic Release makes easy. Semantic Release also writes our commit messages, sets the version number, publishes to NPM, and finally generates a changelog and a release (including a git tag) on GitHub.

About

jps-entity-lookup

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published