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

aqi-calculator

v1.1.3

Published

aqi-calculator is an NPM package that allows you to calculate Air Quality Index (AQI) with the help of pollutant concentrations ranging from PM 2.5, PM 10, SO2, NOX, O3 and CO.

Downloads

30

Readme

Air Quality Index (AQI) Calculator

The package calculates AQI according to the Indian National AQI Standards. This can change in the future as per standards. This is just first version of AQI calculation and we are still awaiting a very standard and clear way of calculating AQI.

aqi-calculator is an NPM package that allows you to calculate Air Quality Index (AQI) with the help of pollutant concentrations ranging from PM2.5 PM10 SO2 NOX O3 CO.

Why aqi-calculator?

We make use of AQI calculations to power our air quality application (BreeZo) and its API. Therefore, we are making this independent calculator to set the same standard of calculation across all our applications.

Installation

Using Browser

<script src="https://unpkg.com/[email protected]/dist/aqi-calculator.min.js"></script>

Using NPM

npm install aqi-calculator

Client-Side Example - Browser

<!DOCTYPE html>
<html>
  <head>
    <title>Example AQI Calculator</title>
  </head>
  <body>
    <script src="https://unpkg.com/[email protected]/dist/aqi-calculator.min.js"></script>
    <script>
      var DATA = [
        {
          datetime: "2020-03-27T13:00:00.000Z", //Taking the 24-hour average concentration  - change when you use this example
          pm25: null,
          pm10: null,
          so2: null,
          no: null,
          nox: null,
          no2: null,
          o3: null,
          co: null,
        },
        {
          datetime: "2020-03-27T14:00:00.000Z", //Taking the 24-hour average concentration  - change when you use this example
          pm25: 294,
          pm10: 297,
          so2: 3,
          no: 32,
          nox: 41,
          no2: 18,
          o3: 63,
          co: null,
        },
        {
          datetime: "2020-03-27T15:00:00.000Z", //Taking the 24-hour average concentration  - change when you use this example
          pm25: 213,
          pm10: 275,
          so2: 5,
          no: 33,
          nox: 43,
          no2: 19,
          o3: 59,
          co: null,
        },
      ];

      var AQI = aqiCalculator(DATA);
      document.write(AQI);
    </script>
  </body>
</html>

Client-Side Example - React

import React from "react";
import aqiCalculator from "aqi-calculator";

const DATA = [
  {
    datetime: "2020-03-27T13:00:00.000Z", //Taking the 24-hour average concentration  - change when you use this example
    pm25: null,
    pm10: null,
    so2: null,
    no: null,
    nox: null,
    no2: null,
    o3: null,
    co: null,
  },
  {
    datetime: "2020-03-27T14:00:00.000Z", //Taking the 24-hour average concentration  - change when you use this example
    pm25: 294,
    pm10: 297,
    so2: 3,
    no: 32,
    nox: 41,
    no2: 18,
    o3: 63,
    co: null,
  },
  {
    datetime: "2020-03-27T15:00:00.000Z", //Taking the 24-hour average concentration  - change when you use this example
    pm25: 213,
    pm10: 275,
    so2: 5,
    no: 33,
    nox: 43,
    no2: 19,
    o3: 59,
    co: null,
  },
];

const AQIComponent = () => {
  const AQI = aqiCalculator(DATA);
  return AQI;
};

export default AQIComponent;

Server-Side Example - NodeJs

const aqiCalculator = require("aqi-calculator");

const DATA = [
  {
    datetime: "2020-03-27T13:00:00.000Z", //Taking the 24-hour average concentration  - change when you use this example
    pm25: null,
    pm10: null,
    so2: null,
    no: null,
    nox: null,
    no2: null,
    o3: null,
    co: null,
  },
  {
    datetime: "2020-03-27T14:00:00.000Z", //Taking the 24-hour average concentration  - change when you use this example
    pm25: 294,
    pm10: 297,
    so2: 3,
    no: 32,
    nox: 41,
    no2: 18,
    o3: 63,
    co: null,
  },
  {
    datetime: "2020-03-27T15:00:00.000Z", //Taking the 24-hour average concentration  - change when you use this example
    pm25: 213,
    pm10: 275,
    so2: 5,
    no: 33,
    nox: 43,
    no2: 19,
    o3: 59,
    co: null,
  },
];

const AQI = aqiCalculator(DATA);
console.log(AQI);