open-index/open-npm huggingface dataset:
npm package: @metriport/api-sdk
Description: Metriport helps you access and manage health and medical data, through a single open source API.
Author: Metriport Inc.
Latest version: 18.9.0

# Metriport API SDK Package

A package to get started using [Metriport](https://metriport.com/) - universal and open-source API for healthcare data.
It’s currently only available for Node-based applications.

## Usage

Check out the documentation at https://docs.metriport.com

### Installation

```
npm install --save @metriport/api-sdk
```

### Setup

#### Medical API

To use the Medical API, create a new instance of the `MetriportMedicalApi` class:

```ts
import { MetriportMedicalApi } from "@metriport/api-sdk";

const metriportClient = new MetriportMedicalApi("YOUR_API_KEY");
```

To connect to the sandbox:

```ts
new MetriportMedicalApi("YOUR_API_KEY", { sandbox: true });
```

```
            ,▄,
          ▄▓███▌
      ▄▀╙   ▀▓▀    ²▄
    ▄└               ╙▌
  ,▀                   ╨▄
  ▌                     ║
                         ▌
                         ▌
,▓██▄                 ╔███▄
╙███▌                 ▀███▀
    ▀▄
      ▀╗▄         ,▄
         '╙▀▀▀▀▀╙''


      by Metriport Inc.

```
npm package: @metriport/carequality-cert-runner
Description: Tool to run through Carequality certification test cases - by Metriport Inc.
Author: Metriport Inc.
Latest version: 1.27.0

# `carequality-cert-runner`

Carequality Certification Runner by Metriport Inc.

Tool to run through Carequality certification test cases.

## Install

To install the program, execute the following command on your terminal:

`npm i -g @metriport/carequality-cert-runner`

Note: you may have to run the command with `sudo`.

## Usage

<!-- TODO: WILL UPDATE THIS WHEN RUNNER IS COMPLETE -->

## Options

## Development

`npm run build`: builds the package

`npm start`: runs the local code pointing to `./.env`

(optionally) `npm run install-local`: installs the package globally from the local source

```
            ,▄,
          ▄▓███▌
      ▄▀╙   ▀▓▀    ²▄
    ▄└               ╙▌
  ,▀                   ╨▄
  ▌                     ║
                         ▌
                         ▌
,▓██▄                 ╔███▄
╙███▌                 ▀███▀
    ▀▄
      ▀╗▄         ,▄
         '╙▀▀▀▀▀╙''


      by Metriport Inc.

```
npm package: @metriport/carequality-sdk
Description: SDK to interact with the Carequality directory - by Metriport Inc.
Author: Metriport Inc.
Latest version: 1.12.0

# `carequality-sdk`

SDK to interact with the
[Carequality FHIR R4 directory](https://sequoiaproject.org/SequoiaProjectHealthcareDirectoryImplementationGuide/output/index.html) - by Metriport Inc.

## Usage

```
import {
  APIMode,
  CarequalityManagementApiFhir
} from "@metriport/carequality-sdk";

const api = new CarequalityManagementApiFhir({
    apiKey: "API_KEY",
    apiMode: APIMode.dev,
});
```

```
            ,▄,
          ▄▓███▌
      ▄▀╙   ▀▓▀    ²▄
    ▄└               ╙▌
  ,▀                   ╨▄
  ▌                     ║
                         ▌
                         ▌
,▓██▄                 ╔███▄
╙███▌                 ▀███▀
    ▀▄
      ▀╗▄         ,▄
         '╙▀▀▀▀▀╙''


      by Metriport Inc.

```
npm package: @metriport/commonwell-jwt-maker
Description: CLI to create a JWT for use in CommonWell queries - by Metriport Inc.
Author: Metriport Inc.
Latest version: 1.30.0

# `commonwell-jwt-maker`

CommonWell JWT Maker by Metriport Inc.

CLI to create a JWT for use in CommonWell queries.

## Install

To install the program, execute the following command on your terminal:

`npm i -g @metriport/commonwell-jwt-maker axios`

Note: you may have to run these commands with `sudo`.

## Usage

After installation, you can run execute following command on your terminal to run the program:

`cw-jwt-maker [options]`

Example invovation:

`cw-jwt-maker --rsa-key "/path/to/private/key/privkey.pem"  --role "ict" --subject-id "John Doe" --org-name "Health Organization" --oid "2.16.840.1.472849.4.2716" --pou "TREATMENT" --npi "5837288472"`

Your JWT will be the output of the program.

## Options

`--rsa-key <file-path>`

Absolute path to the RSA256 private key file corresponding to the specified organization's public key (certificate) - used for signing the JWT.

`--role <practitioner-role>`

The practitioner role of the entity making this request. Valid role values: https://hl7.org/fhir/R4/valueset-practitioner-role.html

`--subject-id <subject-id>`

Free text field used for audit purposes. The value should be user ID or user name of staff using the CommonWell enabled system. Can be a system user if the API call is generated from an automated process instead of an actual user.

`--org-name <organization-name>`

The organization name for the request correspondint to the specified OID.

`--oid <organization-id>`

OID of the org making the request. CW uses this ID to certificate in order to validate the signature on the token.

`--pou <purpose-of-use>`

The purpose of use (POU) for this request. (choices: "TREATMENT","PAYMENT", "OPERATIONS", "SYSADMIN", "FRAUD", "PSYCHOTHERAPY","TRAINING", "LEGAL", "MARKETING", "DIRECTORY", "FAMILY", "PRESENT","EMERGENCY", "DISASTER", "PUBLICHEALTH", "ABUSE", "OVERSIGHT","JUDICIAL", "LAW", "DECEASED", "DONATION", "RESEARCH", "THREAT", "GOVERNMENT", "WORKERSCOMP", "COVERAGE", "REQUEST")

`--npi [npi-number]`

Ten digit National Provider Identifier (optional).

`--payload-hash [payload-hash]`

Only required for Patient IDLink - MurmurHash2 calculation of HTTP POST body (optional).

`-V, --version`

Output the version number.

`-h, --help`

Display help for command.

## Development

`npm run build`: builds the package

`npm run local`: installs the package globally and runs it

```
            ,▄,
          ▄▓███▌
      ▄▀╙   ▀▓▀    ²▄
    ▄└               ╙▌
  ,▀                   ╨▄
  ▌                     ║
                         ▌
                         ▌
,▓██▄                 ╔███▄
╙███▌                 ▀███▀
    ▀▄
      ▀╗▄         ,▄
         '╙▀▀▀▀▀╙''


      by Metriport Inc.

```
npm package: @metriport/commonwell-sdk
Description: SDK to simplify CommonWell API integration - by Metriport Inc.
Author: Metriport Inc.
Latest version: 8.11.0

# `commonwell-sdk`

SDK to simplify CommonWell API integration - by Metriport Inc.

## Usage

To connect to the CommonWell API, you can use the one of the options below:

- `CommonWellMember` class:
  - This class is used to connect to the CommonWell API as a member organization.
  - It is used to create, update, and delete organizations, certificates, and other resources.
- `CommonWell` class:
  - This class is used to connect to the CommonWell API as a contributor organization.
  - It is used to create, update, link, and delete patients, query documents, and other resources.

### CommonWellMember

```typescript
import { APIMode, CommonWellMember } from "@metriport/commonwell-sdk";

const commonWellMember = new CommonWellMember({
  orgCert: "<member-certificate-string>",
  rsaPrivateKey: "<member-private-key-string>",
  memberName: "<member-name>",
  memberId: "<member-id>",
  apiMode: APIMode.integration, // or APIMode.production
});
```

### CommonWell

```typescript
import { APIMode, CommonWell } from "@metriport/commonwell-sdk";

const commonWell = new CommonWell({
  orgCert: "<contributor-certificate-string>",
  rsaPrivateKey: "<contributor-private-key-string>",
  orgName: "<contributor-name>",
  oid: "<contributor-id>",
  homeCommunityId: "<contributor-home-community-id>",
  npi: "<contributor-npi>",
  apiMode: APIMode.integration, // or APIMode.production
});
```

```
            ,▄,
          ▄▓███▌
      ▄▀╙   ▀▓▀    ²▄
    ▄└               ╙▌
  ,▀                   ╨▄
  ▌                     ║
                         ▌
                         ▌
,▓██▄                 ╔███▄
╙███▌                 ▀███▀
    ▀▄
      ▀╗▄         ,▄
         '╙▀▀▀▀▀╙''


      by Metriport Inc.

```
npm package: @metriport/core
Description: Metriport helps you access and manage health and medical data, through a single open source API. Common code shared across packages.
Author: Metriport Inc.
Latest version: 1.6.7
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Metriport Core package

A package to share common code across other [Metriport](https://metriport.com/) packages.

If you're looking for Metriport's API SDK, check this one out: https://www.npmjs.com/package/@metriport/api-sdk

[Metriport](https://metriport.com/) is a universal and open-source API for healthcare data.

```
            ,▄,
          ▄▓███▌
      ▄▀╙   ▀▓▀    ²▄
    ▄└               ╙▌
  ,▀                   ╨▄
  ▌                     ║
                         ▌
                         ▌
,▓██▄                 ╔███▄
╙███▌                 ▀███▀
    ▀▄
      ▀╗▄         ,▄
         '╙▀▀▀▀▀╙''


      by Metriport Inc.

```
npm package: @metriport/ehex-sdk
Description: SDK to interact with the Ehex directory - by Metriport Inc.
Author: Metriport Inc.
Latest version: 0.5.0

# `ehex-sdk`

SDK to interact with the
[Ehex FHIR R4 directory](https://ehealthexchange.org/fhir-r4-directory-rollout/) - by Metriport Inc.

## Usage

```
import {
  APIMode,
  EhexManagementApiFhir
} from "@metriport/ehex-sdk";

const api = new EhexManagementApiFhir({
    apiKey: "API_KEY",
    apiMode: APIMode.dev,
});
```

```
            ,▄,
          ▄▓███▌
      ▄▀╙   ▀▓▀    ²▄
    ▄└               ╙▌
  ,▀                   ╨▄
  ▌                     ║
                         ▌
                         ▌
,▓██▄                 ╔███▄
╙███▌                 ▀███▀
    ▀▄
      ▀╗▄         ,▄
         '╙▀▀▀▀▀╙''


      by Metriport Inc.

```
npm package: @metriport/ihe-gateway-sdk
Description: SDK to interact with other IHE Gateways - by Metriport Inc.
Author: Metriport Inc.
Latest version: 0.28.0

# `ihe-gateway-sdk`

SDK to connect to the Metriport IHE Gateway - by Metriport Inc.

## Usage

```
import {
  IHEGateway
} from "@metriport/ihe-gateway-sdk";

const iheGateway = new IHEGateway({ url });
```

```
            ,▄,
          ▄▓███▌
      ▄▀╙   ▀▓▀    ²▄
    ▄└               ╙▌
  ,▀                   ╨▄
  ▌                     ║
                         ▌
                         ▌
,▓██▄                 ╔███▄
╙███▌                 ▀███▀
    ▀▄
      ▀╗▄         ,▄
         '╙▀▀▀▀▀╙''


      by Metriport Inc.

```
npm package: @metriport/shared
Description: Common code shared across packages - by Metriport Inc.
Author: Metriport Inc.
Latest version: 0.33.0

# `shared`

Common code shared across packages - by Metriport Inc.

```
            ,▄,
          ▄▓███▌
      ▄▀╙   ▀▓▀    ²▄
    ▄└               ╙▌
  ,▀                   ╨▄
  ▌                     ║
                         ▌
                         ▌
,▓██▄                 ╔███▄
╙███▌                 ▀███▀
    ▀▄
      ▀╗▄         ,▄
         '╙▀▀▀▀▀╙''


      by Metriport Inc.

```
npm package: @metriq/express
Description: Express middleware adapter for Metriq - high-performance TypeScript metrics collection library
Author: Daniel Katz
Latest version: 0.5.0

# @metriq/express

[![npm version](https://img.shields.io/npm/v/@metriq/express.svg)](https://www.npmjs.com/package/@metriq/express)
[![License](https://img.shields.io/npm/l/@metriq/express.svg)](https://www.npmjs.com/package/@metriq/express)

Express middleware adapter for Metriq metrics library.

## 📦 Installation

```bash
npm install @metriq/express
```

## 🚀 Quick Start

```typescript
import express from "express";
import { metriq } from "metriq";
import { prometheus } from "@metriq/express";

// Initialize metrics
const metrics = metriq();

// Create a counter
metrics.createCounter("http_requests_total", "Total HTTP requests");

// Create Express app
const app = express();

// Add metrics endpoint
app.get("/metrics", prometheus(metrics));

app.listen(3000);
```

## 🔧 Request Monitoring Example

```typescript
import express from "express";
import { metriq } from "metriq";
import { prometheus } from "@metriq/express";

const app = express();
const metrics = metriq();

// Create metrics
const requests = metrics.createCounter<{
    method: string;
    path: string;
    status: string;
}>("http_requests_total", "Total HTTP requests");

const latency = metrics.createHistogram<{
    method: string;
    path: string;
}>("http_request_duration_seconds", "Request duration in seconds", {
    buckets: [0.1, 0.5, 1, 2, 5],
});

// Middleware to track requests
app.use((req, res, next) => {
    const start = process.hrtime();

    res.on("finish", () => {
        const [seconds, nanoseconds] = process.hrtime(start);
        const duration = seconds + nanoseconds / 1e9;

        const labels = {
            method: req.method,
            path: req.route?.path ?? "unknown",
            status: res.statusCode.toString(),
        };

        requests.increment(labels);
        latency.observe(
            {
                method: labels.method,
                path: labels.path,
            },
            duration,
        );
    });

    next();
});

// Metrics endpoint
app.get("/metrics", prometheus(metrics));

app.listen(3000);
```
npm package: @metriq/fastify
Description: Fastify adapter for Metriq - high-performance TypeScript metrics collection library
Author: Daniel Katz
Latest version: 0.5.0

# @metriq/fastify

[![npm version](https://img.shields.io/npm/v/@metriq/fastify.svg)](https://www.npmjs.com/package/@metriq/fastify)
[![License](https://img.shields.io/npm/l/@metriq/fastify.svg)](https://www.npmjs.com/package/@metriq/fastify)

Fastify adapter for Metriq metrics library.

## 📦 Installation

```bash
npm install @metriq/fastify
```

## 🚀 Quick Start

```typescript
import Fastify from "fastify";
import { metriq } from "metriq";
import { prometheus } from "@metriq/fastify";

// Extend FastifyRequest to store the start time
declare module "fastify" {
    interface FastifyRequest {
        requestTime?: [number, number];
    }
}

const app = Fastify();
const metrics = metriq();

// Create metrics
const requests = metrics.createCounter<{
    method: string;
    path: string;
    status: string;
}>("http_requests_total", "Total HTTP requests");

const latency = metrics.createHistogram<{
    method: string;
    path: string;
}>("http_request_duration_seconds", "Request duration in seconds", {
    buckets: [0.1, 0.5, 1, 2, 5],
});

// Hooks to track requests
app.addHook("onRequest", (request, reply, done) => {
    const start = process.hrtime();
    request.requestTime = start;
    done();
});

app.addHook("onResponse", (request, reply, done) => {
    const [seconds, nanoseconds] = process.hrtime(request.requestTime);
    const duration = seconds + nanoseconds / 1e9;
    const labels = {
        method: request.method,
        path: request.routeOptions.url ?? "unknown",
        status: reply.statusCode.toString(),
    };
    requests.increment(labels);
    latency.observe(
        {
            method: labels.method,
            path: labels.path,
        },
        duration,
    );
    done();
});

// Metrics endpoint
app.get("/metrics", prometheus(metrics));

await app.listen({ port: 3000 });
```