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 🙏

© 2026 – Pkg Stats / Ryan Hefner

nz-privacy-auditor

v0.8.1

Published

Privacy Act 2020 compliance auditor for ML datasets — scans text and CSV data for NZ-specific PII (IRD, NHI, driver licence, phone, address, te reo Māori names). TypeScript port of the Python package. By QAPulse by SK.

Readme

nz-privacy-auditor

npm version npm downloads License: MIT Node.js Privacy Act 2020 QAPulse by SK

Privacy Act 2020 compliance auditor for ML datasets. Scans text for New-Zealand-specific PII — IRD, NHI, driver licence, phone, address, te reo Māori names. Zero dependencies. Works in Node, Deno, and browsers.


✨ Why nz-privacy-auditor?

NZ practitioners working with health records, government data, or customer corpora need to verify that datasets are free of regulated identifiers before they reach an ML pipeline or third-party service. Generic tools miss what actually matters under the Privacy Act 2020 and the Health Information Privacy Code 2020.

| Feature | nz-privacy-auditor | Generic PII tools | |---|---|---| | IRD number + mod-11 checksum | ✅ | ❌ | | NHI number (legacy + new format) | ✅ | ❌ | | NZ driver licence | ✅ | Regex only | | NZ phone (NSN validation) | ✅ | Partial | | NZ address (postcode + gazetteer) | ✅ | ❌ | | Te reo Māori names (macron-aware) | ✅ | ❌ | | Zero runtime dependencies | ✅ | Usually not | | TypeScript-native | ✅ | Varies |

The full Python package (pip install nz-privacy-auditor) has additional detectors, a CLI, Gemini LLM verification, HuggingFace loader, and a live demo. This TypeScript package is a port focused on the browser and Node ecosystems.


🚀 Install

npm install nz-privacy-auditor

Or with yarn / pnpm:

yarn add nz-privacy-auditor
pnpm add nz-privacy-auditor

Requires Node.js 18+.

CLI

A nz-privacy-auditor binary ships with the package:

npx nz-privacy-auditor scan path/to/data.csv
npx nz-privacy-auditor scan path/to/data.csv --format json --output report.json
npx nz-privacy-auditor scan data.csv --detector ird,nhi --min-confidence 0.7
npx nz-privacy-auditor scan data.csv --fail-on-finding   # exit 1 if any PII; CI gate
npx nz-privacy-auditor scan data.csv --verify-llm        # Gemini second-pass on low-confidence findings

For --verify-llm, set GOOGLE_API_KEY in your environment (get a free key at aistudio.google.com/apikey). Findings are cached at data/llm_cache/cache.json so repeat runs cost nothing.


📖 Usage

Scan a whole CSV file (programmatic)

import { readFileSync } from "fs";
import { Scanner, parseCsv, toJson } from "nz-privacy-auditor";

const text = readFileSync("patients.csv", "utf-8");
const rows = parseCsv(text);
const result = new Scanner().scanRows(rows);

console.log(`${result.totalFindings} findings across ${result.columnsScanned.length} columns`);
console.log(toJson(result));

Detect IRD numbers

import { IRDDetector } from "nz-privacy-auditor";

const detector = new IRDDetector();
const findings = detector.scan("Please reference IRD 49-091-850 on the form.");

console.log(findings);
// [{
//   detector: "ird",
//   severity: "high",
//   value: "49-091-850",
//   start: 17,
//   end: 27,
//   confidence: 1.0,
//   context: { normalised: "49091850" }
// }]

Only checksum-validated matches are emitted — no false positives on random 8-digit strings.

CommonJS

const { IRDDetector } = require("nz-privacy-auditor");

Standalone checksum helper

If you just need to validate an IRD without the detection pipeline:

import { irdChecksumOk } from "nz-privacy-auditor";

irdChecksumOk("49091850");   // true
irdChecksumOk("49091851");   // false (bad check digit)
irdChecksumOk("00000000");   // false (below MIN_IRD)

🗺️ Detector roadmap

| Detector | Approach | Status | |---|---|---| | IRD number | Regex + IR-published mod-11 (primary + secondary weights) | ✅ v0.1.0 | | NHI number | Regex + Health NZ mod-11 (legacy) / mod-23 (new format per HISO 10046:2024) | ✅ v0.2.0 | | Driver licence | [A-Z]{2}\d{6} + 300-char keyword proximity | ✅ v0.3.0 | | NZ phone | +64 / 0x patterns + NSN validation, E.164 output | ✅ v0.4.0 | | NZ address | Suffix + postcode + region / suburb gazetteer | ✅ v0.5.0 | | Te reo Māori names | Macron-aware curated gazetteer | ✅ v0.6.0 | | LLM verification | Gemini 2.5 Flash second-pass over low-confidence findings | ✅ v0.8.0 |

Test vectors are shared 1:1 with the Python implementation via fixtures/*.json — spec parity is enforced by construction, not by discipline.


🔗 See also


📄 License

MIT © 2026 QAPulse by SK.

The library reflects publicly available NZ government identifier specifications (Inland Revenue IRD checksum, Health NZ NHI standard HISO 10046:2024) but is not affiliated with or endorsed by any NZ government agency. Consult the Office of the Privacy Commissioner for compliance decisions on production systems.