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

@randomredltd/mm-homomorphic

v1.2.2

Published

MorphMetro Homomorphic library

Downloads

2

Readme

MorphMetro - Homomorphic calculations library

About

Homomorphic-lib is used to calculate two metrics (z-score and E_n number) that are used during ILC (Inter Laboratory Comparison) and PT (Proficiency Testing). All accredited measuring laboratories are required to periodically conduct ILC/PT. They do so by comparing their measurements with referent data provided by the referent laboratory.

To use homomorphic-lib, two data sets are needed. First is the referent data which consists of 3 to 10 referent values (X_RD) and one value representing measuring uncertainty of the referent laboratory (U_RD). Second data set is the data from the accredited measuring laboratory. It consists of 3 to 10 measured values (X_MD) and one value representing the uncertainty of the measuring laboratory (U_MD).

To calculate two metrics (z-score and E_n number) the following equations are used:

$z=(X_{MD}-X_{RD})/S_{MD}$

$E_n=(X_{MD}-X_{RD})/\sqrt{U_{MD}2+U_{RD}2}$

,where

$X_{MD}$ – average value of measured data

$X_{RD}$ – average value of referent data

$S_{MD}$ – standard deviation of measured data

$U_{MD}$ – expanded measurement uncertainty of measured data

$U_{RD}$ – expanded measurement uncertainty of referent data

From equations it can be seen that for calculation of z-score and E_n number, both referent and measured data are required. To preserve data privacy, homomorphic-lib encrypts both data sets and performs the calculations in encrypted form by using homomorphic encryption (Microsoft SEAL library).

Install

Install all packages

npm i

Test

Run tests

npm run test

Build

Build and bundle with webpack

npm run build:prod

Publish to NPM

Publish to RandomRed internal NPM

npm run co:login
npm run publish

Example usage

Example usage of the library

    const {generateKeys, referenceLabCalculation, measuringLabCalculation, referenceLabFinalCalculation} = require('mm-homomorphic')
    
   //******************************************
   // REFERENCE LABORATORY
    const referenceData = [3.65, 3.72, 3.77, 3.68, 3.73, 3.72, 3.70, 3.71];
    const uBRD = 0.02;
    const {secretKey, publicKey, relin_keys, galKeys} = await generateKeys();
    const {cipher_average_RD, cipher_u_RD_square} = await referenceLabCalculation(publicKey, secretKey, referenceData,  uBRD )
   //******************************************

   //******************************************
   // MEASURING LABORATORY
    // measured data input
    const measured_data = [3.45, 3.74, 3.854, 3.54, 3.71];
    const uB_MD = 0.05;
    const {cipher_z_score, cipher_En} = await measuringLabCalculation(cipher_average_RD, publicKey, relin_keys,  cipher_u_RD_square, measured_data, uB_MD);
   //******************************************

   //******************************************
   // REFERENCE LABORATORY
    const results = await referenceLabFinalCalculation(cipher_z_score, publicKey, cipher_En, secretKey)
   //******************************************

Acknowledgments

This package was developed under MorphMetro project, funded by the EU in the framework of the NGI TRUSTCHAIN project, grant No. 101093274.