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

q247-models-core

v0.0.3

Published

Models for effort/calories in q247 plugin

Downloads

21

Readme

Q247 Models

Model and reference implementation of developer effort models for Q247 plugin

Key features

  • Pluggable model architecture
  • Easy to provide custom made models
  • 2 sample models to start with are provided

Provided models

As of today model based on Shanon's entropy model is provided in two versions. You can read more about Shanon's entropy at this link

Installation

$ npm install q247-models-core

Usage

const {ShanonEntropyScoreModelV2} = require("q247-my-custom-models")

const q247Event = {
  gitlog: "commit 5fc617ef5ede5d7ff6ffef0ba3205afe3e2a337e\nAuthor: xxxxx xxxxx <[email protected]>\nDate:   Sat Jun 8 18:44:46 2024 +0200\n\n    PWR-01 cleaning\n\n index.js | 5 +----\n 1 file changed, 1 insertion(+), 4 deletions(-)\n",
  oper: "commit",
  remote: "/Users/xxxxx/Documents/Projekty/gitspace/private/grm-microservices/process",
  diff: "commit 5fc617ef5ede5d7ff6ffef0ba3205afe3e2a337e\nAuthor: xxxxx xxxxx <[email protected]>\nDate:   Sat Jun 8 18:44:46 2024 +0200\n\n    PWR-01 cleaning\n\ndiff --git a/index.js b/index.js\nindex d7c4190..d232a53 100644\n--- a/index.js\n+++ b/index.js\n@@ -101,11 +101,8 @@ function attachNewPostOperation(appHandler, version, path, context, operationHan\n attachNewGetOperation(app, version, path, \"/transition/available/:typeId/:entityId\", manager.availableTransitions.bind(manager));\n attachNewPostOperation(app, version, path, \"/transition/execute/:typeId/:entityId/:transitionCode\", manager.transitionExecute.bind(manager));\n attachNewPostOperation(app, version, path, \"/instance/:typeId/:entityId\", manager.postProcessInstance.bind(manager));\n-\n attachNewGetOperation(app, version, path, \"/instance/:typeId/:entityId\", manager.getProcessInstance.bind(manager));\n-\n attachNewGetOperation(app, version, path, \"/definition/:typeId\", manager.getProcessDefinition.bind(manager));\n attachNewPostOperation(app, version, path, \"/definition/:typeId\", manager.postProcessDefinition.bind(manager));\n \n-attachNewGetOperation(app, version, path, \"/instance/:typeId/:entityId/history\", manager.getProcessInstanceHistory.bind(manager));\n-\n+attachNewGetOperation(app, version, path, \"/instance/:typeId/:entityId/history\", manager.getProcessInstanceHistory.bind(manager));\n\\ No newline at end of file\n",
  account: "a_somecompany",
  user: "[email protected]",
  project: "4r3t7x7fj6",
  id: "xj8d6c840o",
  ct: 1718393469569,
  decoded: {
    ticket: "PWR-01",
    ticketPrefix: "PWR",
    commit: "commit 5fc617ef5ede5d7ff6ffef0ba3205afe3e2a337e",
    author: {
      name: "xxxxx xxxxx",
      email: "[email protected]",
    },
    date: "Date:   Sat Jun 8 18:44:46 2024 +0200",
    message: "PWR-01 cleaning",
    changes: [
      " index.js | 5 +----",
    ],
    changeSummary: {
      raw: " 1 file changed, 1 insertion(+), 4 deletions(-)",
      files: 1,
      inserts: 1,
      deletions: 4,
    },
  }
}

const model = new ShanonEntropyScoreModelV2();
const score = await model.score(q247Event);
        

async score(gitEvent)

Calculates effort scoring for provided gitEvent. Returns a Promise that resolves to a Score object.

| Parameter | Type | Description | | --- | --- | --- | | gitEvent | object | Git event object from q247 plugin |

Score

Result of score calculation.

export interface ScoreModelCard {
    name: string;
    version: string;
}
export interface Score {
    id: string; // score unique id
    model: ScoreModelCard;
    event: Event; // source event that was scored
}
export interface ScalarScore extends Score{    
    score: number
}

| Name | Description | Example | | --- | --- | --- | | "id" | Unique score id | a8sjk800js71ja | | "name" | Name of the model used to calculate this score | ShanonEntropyScoreModelV2 | | "version" | Version number of the model used to calculate score | w$Tsu4G | | "event" | Source git event for which score was calculated | See Usage section for event example | | "score" | Estimated effort required to produce source git event | 1.23 |

Writing custom models

Q247 models are fully extendable. In order to create custom model one should provide an implementation of a ScoreModel class/interface

import { ScalarScore, ScoreModel, Event } from "q247-models-core";

export class ShanonEntropyScoreModelV1 implements ScoreModel {
    
    name = "ShanonEntropyScoreModel";
    version = "1.0";

    score(event: Event): Promise<ScalarScore> {
      /* here goes your custom model implementation */
    }
}