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

ops.js

v7.0.0

Published

Javascript based library to access the Open PHACTS API and discover bio-chemical and life sciences data

Downloads

59

Readme

OPS.js Build Status DOI

Open PHACTS API Version

2.1

About

OPS.js is a javascript NodeJS based library, available via NPM, for accessing the Open PHACTS Linked Data API (LDA). It uses nets to handle the asynchronous network calls. OPS.js can also be used to parse responses from the LDA. Please read the API documentation. The API documentation is also available locally within the docs folder. To view them open the docs/index.html file in a browser.

Dependencies & requirements

NodeJS, NPM, nets, JSDoc & browserify Get your Open PHACTS API application ID and key by registering at https://dev.openphacts.org

Licence

The OPS.js source code is released under the MIT License, http://opensource.org/licenses/MIT. See licence.txt for more details.

Contributing

We love receiving patches for bug fixes and new features. Please follow these simple steps to make our lives easier.

  1. Fork the project.
  2. Checkout develop branch.
  3. Create a new branch based on develop and change the code.
  4. Write some tests.
  5. Submit patch.

Citations

To cite OPS.js in publications please see the zenodo record.

Ian Dunlop et al. (2015). ops.js: OPS.js 6.1.3 for Open PHACTS 1.5 API. Zenodo. 10.5281/zenodo.29418

For Bibtex use:

@misc{ian_dunlop_2015_29418,
  author       = {Ian Dunlop and
                  Egon Willighagen and
                  Elblood and
                  andrawaag and
                  Stian Soiland-Reyes and
                  PANDORINO},
  title        = {ops.js: OPS.js 6.1.3 for Open PHACTS 1.5 API},
  month        = aug,
  year         = 2015,
  doi          = {10.5281/zenodo.29418},  
  url          = {http://dx.doi.org/10.5281/zenodo.29418}
}

You can get version information by using an OPS.js method in a browser or Node:

    new Version().information()

Using the library

If running in a browser based application use src/combined.js. With NodeJS use npm install ops.js.
See the API documentation

Each API call generally has 1 method to fetch the results using an asynchronous call with a callback and then another method to parse these results. Look at https://dev.openphacts.org for more information about the source methods that the API calls use.

Testing the library

Jasmine is used to test the ops.js api. The specs for the tests are in the 'test/spec' directory. To run them use jasmine-node like this:

jasmine-node --config app_id your_app_id --config app_key your_app_key --config app_url https://beta.openphacts.org/2.1 test/spec/integration/

In case the test run does not finish with some statistics on the number of tests run, assertions made, and skipped and failed tests, then it like failed on one of the tests. To see the exception that was thrown, run Jasmine with the --captureExceptions option:

jasmine-node --captureExceptions --config app_id your_app_id --config app_key your_app_key --config app_url https://beta.openphacts.org/1.5 test/spec/integration/

To enable console logging of URIs tested, add the parameter --config debug true

Testing with Docker

If you use Docker, you can run the openphacts/ops-api-test image to run the tests, without needing to install NodeJS.

Run with the -it parameter to get colour output. You might want to override environment variables like app_url, app_id and app_key. Example:

docker run -it -e app_url=http://heater.cs.man.ac.uk:3002 openphacts/ops-api-test

API call examples:

More examples can be found in the integration tests and in the API docs.

Concept Wiki free text search

var searcher = new ConceptWikiSearch("https://beta.openphacts.org/2.1", appID, appKey);  
var callback=function(success, status, response){  
    searcher.parseResponse(response);
};  
// success is 'true' or 'false', status is the http status code, response is the raw result which the parser function accepts  
// response will be null in the case of errors  
// limit to 20 results, species human (branch 4), with type set to compounds (uuid 07a800....)  
searcher.byTag('Aspirin', '20', '4', '07a84994-e464-4bbf-812a-a4b96fa3d197', callback);

Compound information

var searcher = new CompoundSearch("https://beta.openphacts.org/2.1", appID, appKey);  
var callback=function(success, status, response){  
    var compoundResult = searcher.parseCompoundResponse(response);  
};  
// success is 'true' or 'false', status is the http status code, response is the raw result which the parser function accepts  
// response will be null in the case of errors  
// compound uri is for Aspirin  
searcher.fetchCompound('http://www.conceptwiki.org/concept/38932552-111f-4a4e-a46a-4ed1d7bdf9d5', null, callback);

Core Developers

Ian Dunlop

Contributors

Rishi Ramgolam
Elblood
Andra Waagmeester
Egon Willighagen
PANDORINO
Stian Soiland-Reyes Morton Fox