https://github.com/nakamura196/jps-entity-lookup
jps-entity-lookup
https://github.com/nakamura196/jps-entity-lookup
jps
Last synced: 4 months ago
JSON representation
jps-entity-lookup
- Host: GitHub
- URL: https://github.com/nakamura196/jps-entity-lookup
- Owner: nakamura196
- License: gpl-3.0
- Created: 2024-05-17T00:03:16.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-17T00:38:00.000Z (over 1 year ago)
- Last Synced: 2025-02-15T06:30:10.816Z (8 months ago)
- Topics: jps
- Language: JavaScript
- Homepage:
- Size: 95.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.config.js
- License: LICENSE
Awesome Lists containing this project
README
# jps-entity-lookup

[](https://travis-ci.org/cwrc/jps-entity-lookup)
[](https://codecov.io/gh/cwrc/jps-entity-lookup)
[](http://npm.im/jps-entity-lookup)
[](http://npm-stat.com/charts.html?package=jps-entity-lookup&from=2015-08-01)
[](http://opensource.org/licenses/GPL-3.0)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)
[](http://github.com/badges/stability-badges)1. [Overview](#overview)
1. [Installation](#installation)
1. [Use](#use)
1. [API](#api)
1. [Development](#development)## Overview
Finds entities (people, places, organizations, titles) in jps. Meant to be used with [cwrc-public-entity-dialogs](https://github.com/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](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) for http requests, and so could likely therefore use a browser/node.js compatible fetch implementation like: [isomorphic-fetch](https://www.npmjs.com/package/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:
```js
{
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:
```json
{
"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](https://github.com/cwrc/CWRC-Writer-Dev-Docs) describes general development practices for CWRC-Writer GitHub repositories, including this one.
### Mocking
We use [fetch-mock](https://github.com/wheresrhys/fetch-mock) to mock http calls (which we make using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) rather than XMLHttpRequest).
### Continuous Integration
We use [Travis](https://travis-ci.org).
### Release
We follow [SemVer](http://semver.org), which [Semantic Release](https://github.com/semantic-release/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.