1.0.2 • Published 2 years ago

growth-kpi v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

growth-kpi

This JS library is a KPI (key performance indicator) engine for various KPI types (i.e - NPS, Favorability, etc..)

Workflow

The idea is as follows: The client of this library provides a set of json-formatted data. This dataset has keys that indicate a numeric value upon which growth-kpi will do calculations.

Install

npm i growth-kpi

Usage

const growthKpi = require('growth-kpi');

let product = growthKpi.produceReport({
    "data-blends":
        [{
            "group-by-key": <GROUP_BY_KEY>,
            "dl-key": <DL_KEY>,
            "filters-group-by-key": <FILTERS_GROUP_BY_KEY>,
            "blend-id": <BLEND_ID>,
            "timing-key": <TIMING_KEY>,
            "ds":
                [{
                    "KEY1": <VALUE1>,
                    "KEY2": <VALUE2>,
                }],
            "ds-key": <DS_KEY>,
            "conditions":
                [{
                    "type": <TYPE>,
                    "ds-key": <DS_KEY>,
                    "ds-value": DS_VALUE,
                    "scoring-key": <SCORING>,
                    "given-value": <VALUE>
                }],
            "dl": [{
                    "KEY1": <VALUE1>,
                    "KEY2": <VALUE2>,
                }]
        }],
    "product-definition":
    {
        "report-type": <REPORT_TYPE>,
        "start-of-week": <START_OF_WEEK>,
        "period-count": <PERIOD_COUNT>,
        "view-as-key": <VIEW_AS_KEY>,
        "location": <LOCATION>,
        "year": <YEAR>,
        "month": <MONTH>,
        "day": <DAY>
    },
    "snippet-definitions":
        [{
            "scale": <SCALE>,
            "min-target": <MIN_TARGET>,
            "blend-id": <BLEND_ID>,
            "max-target": <MAX_TARGET>,
            "calc-type": <CALC_TYPE>,
            "scoring-key": <SCORING_KEY>,
            "snippet-type": <SNIPPET_TYPE>,
            "title": <TITLE>,
            "text-key": <TEST_KEY>,
            "filter-value": <FILTER_VALUE>,
            "filter-key": <FILTER_KEY>,
            "location-append": <LOCATION_APPEND>,
            "overall-points": <OVERALL_POINTS>
        }]
});