Noodles Practicing Medicine
Miss any of our Open RFC calls?Watch the recordings here! »

viaf-entity-lookup

2.0.0 • Public • Published

viaf-entity-lookup

Picture

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

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

Overview

Finds entities (people, places, organizations, titles) in VIAF. 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 viaf-entity-lookup -S

Use

import viafLookup from 'viaf-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://viaf.org/viaf/9447148209321300460003/",
  "name": "Fay Jones School of Architecture and Design",
  "nameType": "Corporate",
  "originalQueryString": "jones",
  "repository": "VIAF",
  "uri": "http://viaf.org/viaf/9447148209321300460003/",
  "uriForDisplay": "https://viaf.org/viaf/9447148209321300460003/"
}

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

getPersonLookupURI(query)

getPlaceLookupURI(query)

getOrganizationLookupURI(query)

getTitleLookupURI(query)

where the 'query' argument is the entity name to find and the methods return the VIAF 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.

Install

npm i viaf-entity-lookup

DownloadsWeekly Downloads

34

Version

2.0.0

License

GPL-3.0

Unpacked Size

183 kB

Total Files

16

Last publish

Collaborators

  • avatar
  • avatar