in javascript

A Test for Developer Candidates

This was developed for testing out candidates for a junior developer position with MEAN stack like skills.  


Much of what we do is take lots of information and display it in some meaningful way.  Sometimes that information will be from different sources and needs to be filtered, transformed, combined, and so on.  


For this exercise, we’ll look at your ability to consume information from web services, process it, and display it to a user.

The Domain

The NIH and the National Library of Medicine provide a web service called PUG that we can use for free to pull information about millions of different chemical compounds and substances.  The tutorial for it can be found at the following URL:

In short, you can construct a URL to retrieve data about a chemical like this:

For example, if we want to get a list of synonyms for the compound identified by 12345 in JSON format:

All sorts of information can be fetched from this resource including molecular information and structure, image files (PNG format), and so on.

A key feature is the ability to pull multiple records together.  For example:,2,3,4,5/property/MolecularFormula,MolecularWeight,CanonicalSMILES/JSON

This will pull the data for id’s 1, 2, 3, 4, and 5 giving back an array.  Processing arrays and objects is a key operation.

The Problem

Customer needs a web-based search tool to get and display information about different chemicals.  Your solution should accept an input from the user, get the necessary information from PubChem through PUG, and display it back to the user according to the following specifications:

  1. User can specify one or more chemicals as the input
  2. User should get back the following information for each compound:
    1. The input given
    2. The first and last synonyms
    3. The molecular formula
    4. The molecular weight
    5. An image (PNG) of the compound

Required Elements

In solving this problem, you will need to demonstrate the use of retrieving data from web services, and the ability to accept input from and give output to the user.  You generally have free reign in architecture and implementation choices.  However, here are a few things we’d want to see:

  • The use of JavaScript only, but any modules you can find on,, or the web are fair game.
  • Well-packaged so that I can install it on my laptop through “npm install”.
  • A good understanding of how things work so we can discuss them.


In addition to accomplishing the customer requirements, demonstrate the use of two or more of the following:

  1. The use of a CSS framework such as Material Design, Materialize, Bootstrap, etc. to create a responsive design.
  2. The use of a JS front-end framework to accomplish a Single-Page Application
  3. The use of the map function (on an array) to transform items in an array
  4. The use of reduce to calculate the total molecular weight
  5. Display the data in a quality format without using a table (e.g. by using a grid, a ‘card’, or something similar)
  6. For big fat bonus points, also retrieve a list of active AIDs for each compound and display the count of them.

Time permitting, complete as many as you can.

Feel free to ask questions or for help.  You can reach me @