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

dailypulse

v1.0.6

Published

Celpax DailyPulse NodeJS API Client

Downloads

18

Readme

DailyPulse Client API

This is the Celpax's NodeJS DailyPulse Client API. Note that:

  • All API calls are asynchronous, you need to pass a callBack function as is typical in NodeJS.
  • CallBacks forllow the standard signature of callBack(error,object).

Install the client

In order to install simply call npm install dailypulse or include it in your package.json file as a dependency.

create a dailypulse instance

In order to instanciate the dailypulse client and start making request you need to do:

const access_key_id="your-access-key-here";
const secret_access_key="your-secret-access-key-here";

var DailyPulse=require("dailypulse");
var dailyPulseClient=new DailyPulse(access_key_id,secret_access_key);

You can download your access and secret api keys from DailyPulse dashboard.

Get your sites

DailyPulse can be deployed on one or more company sites. In either case you will need to know the Site ID before you can download metrics related to it.

You can get your sites as follows:

    dailyPulseClient.getSites(function(err,sites){
        // err should be null if everthing went OK!
        // sites will be an arry of objects with id and description
        var mySite=sites[0];
    });

Mood KPI

You can retrieve the latest calculated Mood KPI for a given site as follows:

    dailyPulseClient.getMoodKPI(mySite.id, function(err,mood){
        // err should be null if everthing went OK!
        if(mood.green > 70) Console.log("We are going very well!!");
    });

Note that in some cases the Mood KPI cannot be calculated (for example during rollout) and will be returned as null. A date member will also be included indicating when the Mood KPI was last updated.

Alternatively, you can retrieve the latest calculated global Mood KPI of all the sites of the account as follows:

    dailyPulseClient.getGlobalMoodKPI(function(err,mood){
        // err should be null if everthing went OK!
        if(mood.green > 70) Console.log("We are going very well!!");
    });

Historical Mood KPI

You can retrieve the historical calculated Mood KPI for a given site and the number of days to fetch since today as follows:

   dailyPulseClient.getHistoricalMoodKPI(mySite.id,numberOfDaysToFetch,function(err,moodArray){ 
        // err should be null if everthing went OK!
        if(moodArray[0].green > 70) Console.log("We are going very well!!");
    });

The maximum number of allowed days to be fetched can be configured in the Celpax Dashboard console. You need administrator privileges for accessing to the configuration section.

Alternatively you can retrieve the historical calculated global mood KPI of all the sites of the account as follows:

    dailyPulseClient.getHistoricalGlobalMoodKPI(numberOfDaysToFetch,function(err,moodArray){ 
        // err should be null if everthing went OK!
        if(moodArray[0].green > 70) Console.log("We are going very well!!");
    });

Pulses in a Typical Day

Dailypulse will track how many pulses are registered in a typical day. DailyPulse will detect and exclude from this statist days such as weekends in which a couple of people turn up to work, or company parties when there might be an unusual number of pulses.

Again, pulses per typical day might not be callculated for a given site yet, in which case null can be returned.

You can get it in a similar way by doing:

dailyPulseClient.getPulsesPerTypicalDay(site.id,function(err,typicalday){
    // Some dates may not have a PulsesPerTypicalDay calculated,
    console.log("Normally there are:"+typicalday.pulses + "pulses in a typical day");
});

A date member will also be returned indicating when the pulses per typical day was last updated.

Alternatively, you can retrieve the global pulses in a typical day of all the sites of the account as follows:

dailyPulseClient.getGlobalPulsesPerTypicalDay(function(err,typicalday){
    // Some dates may not have a PulsesPerTypicalDay calculated,
    console.log("Normally there are:"+typicalday.pulses + "pulses in a typical day");
});

Historical Pulses in a Typical Day

You can retrieve the historical Pulses in a Typical day for a given site and the number of days to fetch since today as follows:

dailyPulseClient.getHistoricalPulsesPerTypicalDay(mySite.id,numberOfDaysToFetch,function(err,typicaldayArray){
    // Some dates may not have a PulsesPerTypicalDay calculated,
    console.log("Normally there are:"+typicaldayArray[0].pulses + "pulses in a typical day");
});

The maximum number of allowed days to be fetched can be configured in the Celpax Dashboard console. You need administrator privileges for accessing to the configuration section.

Alternatively, you can retrieve the historical global pulses per typical day of all the sites of the account as follows:

dailyPulseClient.getHistoricalGlobalPulsesPerTypicalDay(numberOfDaysToFetch,function(err,typicaldayArray){
    // Some dates may not have a PulsesPerTypicalDay calculated,
    console.log("Normally there are:"+typicaldayArray[0].pulses + "pulses in a typical day");
});

User Interface Design

We have released user interface elements, such as: colours, fonts, widgets available in the github project: DailyPulse-Resources

The resources provided match the User Interface of the DailyPulse Dashboard.

Testing

An echo test method has also been include so that you can test your setup as much as you want before pulling real data.

You can use it as follows, for example in one of your unit tests:

dailyPulseClient.echo("helloworld",function(err,obj){
    expect(err).to.be.null;
    expect(obj.msg).to.equal("helloworld");
    console.log("Echo Result:"+JSON.stringify(obj));
    done();
});