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

ti-cpi

v2025.0.0

Published

This library wraps up the data collected by Transparency International in their Corruption Perception Index

Readme

Transparency International - Corruption Perception Index

From the makers of .LOUPE — the compliance workspace. Need to screen your business partners against corruption risk? Check out our Business Partner Compliance tool.

This small library wraps up the data collected by Transparency International in their Corruption Perception Index. The data is available in CSV/Excel format on their website. This library provides a simple interface to the data. The original data is licensed under the Attribution-NoDerivatives 4.0 International (CC BY-ND 4.0) license. The data converted from Excel to CSV is hosted in this repository in the docs/ti directory and is licensed under the same license. The code itself is licensed under the MIT License.

npm version license CI codecov

How to use

You can install this library using NPM:

npm i --save ti-cpi

Then you can use it in your (TypeScript) code like this:

import {tiCpi, tiCpiForYear, tiCpiUrl} from "ti-cpi";

const iso2CountryCode = "AT";

// Fetch all the data for a specific country
const austria = tiCpi({iso2CountryCode})

const austria2020 = tiCpiForYear({iso2CountryCode}, 2020);

// Fetch the URL of a countries CPI page
const url = tiCpiUrl({iso2CountryCode});

Data updates

Transparency international releases the update data annually in January. We are on relevant news-letters and update this library as soon as possible after receiving the update information.

Developers

Updating

To update the data do the following:

  • Run npm install to install the required dependencies
  • Change the const MOST_CURRENT_YEAR in const.ts the the year with the most recent data (the last year)
  • Download the latest data from the Transparency International website (Excel format, Results and Trends)
  • Export the Excel tab "Results and trends" to CSV
  • Open CSV file and replace , with ; (semicolon) in the whole file
  • Move the CSV file to the root of this repository and rename it to CPI<year>_GlobalResultsTrends.csv
  • Run npm run convert to convert the CSV file to JSON (this will create a new file src/data<year>.json)
  • Ensure that the new files are added to GIT
  • Run the tests and follow the instructions below to publish the new version

Building

To build this library you can run:

npm run build

A version published to NPM can be created by following the following checklist:

  • Bump the version in package.json
  • Run npm run build locally to verify the build is working
  • Run npm run test locally to verify none of the tests are failing
  • Commit and push the changes to the main branch
  • Create a new release on GitHub with the version number as the tag
  • The CI configuration in .github/workflows/release.yml will automatically publish the new version to NPM