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 🙏

© 2025 – Pkg Stats / Ryan Hefner

enzymeml

v1.5.0

Published

EnzymeML is a data model for describing enzymatic experiments. This package contains the TypeScript definitions for the EnzymeML data model based on the EnzymeML V2 specification and Zod.

Readme

EnzymeML-TS

npm version License: MIT

The official TypeScript library for EnzymeML, providing comprehensive type definitions and runtime validation for enzymatic experiment data.

Overview

EnzymeML is a standardized data exchange format that supports the comprehensive documentation of enzymatic data by describing reaction conditions, time courses of substrate and product concentrations, kinetic models, and estimated kinetic constants. This TypeScript library provides:

  • 🔒 Type-safe data structures based on EnzymeML v2 specification
  • Runtime validation using Zod
  • 📝 Complete type inference for excellent IDE support
  • 🌐 JSON-LD compatible for semantic web applications
  • 🔍 OpenAI streaming utilities for AI-powered data extraction from text and files using the OpenAI API

Installation

In order to use this library, you need to install it in your project. You can do this using NPM or Yarn.

# Using NPM
npm install enzymeml

# Using Yarn
yarn add enzymeml

Usage

There are two ways of using this library. First, you can use the EnzymeMLDocumentSchema or any of the sub-schemas to validate your dataset against the EnzymeML V2 specification through the usage of Zod. Second, you can use the EnzymeMLDocument or any of the sub-types in your web-application to provide a type-safe interface for your users.

Validation

The following example shows how to validate a dataset against the EnzymeML V2 specification using Zod.

import { EnzymeMLDocumentSchema } from 'enzymeml';

const data = {
    "version": "2.0.0",
    "description": "This is a test EnzymeML document",
    "name": "Test EnzymeML Document",
    "small_molecules": [
        {
            "id": "s1",
            "name": "Small Molecule 1",
            "canonical_smiles": "C1=CC=C(C=C1)C(=O)O"
        }
    ]
}

const result = EnzymeMLDocumentSchema.parse(data);

if (!result.success) {
    console.error(result.error);
}

Fetchers

The library provides both direct fetchers and search capabilities for the following sources:

import { fetchRhea, fetchPdb, fetchPubChem, searchChebi } from 'enzymeml';

const enzmldoc: EnzymeMLDocument = {
    ... // Your EnzymeML document
}

// Fetch specific entries by ID
const [reaction, smallMolecules] = await fetchRhea('RHEA:13065');
const protein = await fetchPdb('PDB:1LYZ');
const smallMolecule = await fetchPubChem('ethanol');

// Search for entries by name
const glucoseResults = await searchChebi('glucose', 10);

enzmldoc.reactions.push(reaction);
enzmldoc.small_molecules.push(...smallMolecules, ...glucoseResults);
enzmldoc.proteins.push(protein);

LLM Integration

The library includes OpenAI streaming utilities for AI-powered data generation and analysis:

import OpenAI from 'openai';
import { extractData, EnzymeMLDocumentSchema, UserQuery, PDFUpload, ImageUpload } from 'enzymeml';

// Create OpenAI client
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

// Upload files
const pdfUpload = new PDFUpload('./document.pdf');
await pdfUpload.upload();

const imageUpload = new ImageUpload('./image.png');
await imageUpload.upload();

// Generate structured EnzymeML documents with AI
const { chunks, final } = extractData({
  model: 'gpt-4o',
  input: [
    new SystemQuery('You are an expert at extracting structured data from scientific documents.'),
    new UserQuery('Extract the metadata from the following documents and images'),
    pdfUpload,
    imageUpload,
  ],
  schema: EnzymeMLDocumentSchema,
  schemaKey: 'enzymeml_document',
  client: client,
});

// Stream the response
for await (const chunk of chunks) {
  if (chunk.kind === 'text') {
    console.log(chunk.delta);
  }
}

// Get the final validated document
const document = await final.output_parsed;

Type-safe interface

The following example shows how to use the EnzymeMLDocument type to create a type-safe interface for your users.

import { EnzymeMLDocument, SmallMolecule } from 'enzymeml';

const myFunction = (data: EnzymeMLDocument): SmallMolecule => {
    const smallMolecule = data.small_molecules.find((smallMolecule) => smallMolecule.id === 's1');
    if (!smallMolecule) {
        throw new Error('Small molecule not found');
    }
    return smallMolecule;
}

Development

Code Quality

This project uses ESLint for code linting and formatting. The linting rules are automatically enforced through pre-commit hooks using Husky.

Available Scripts

# Run ESLint and automatically fix issues
npm run lint

# Check for ESLint issues without fixing
npm run lint:check

# Run tests
npm test

# Build the project
npm run build

Pre-commit Hooks

This project uses Husky to automatically run code quality checks before each commit:

  • ESLint: Automatically runs on all staged TypeScript files
  • Auto-fix: Attempts to automatically fix linting issues where possible
  • Commit blocking: Prevents commits if there are unfixable linting errors

The pre-commit hook will:

  1. Run eslint --fix on all staged .ts and .js files in the src/ directory
  2. Automatically stage any fixes made by ESLint
  3. Block the commit if there are remaining linting errors that cannot be auto-fixed

Setting up Development Environment

After cloning the repository, run:

npm install

This will:

  • Install all dependencies
  • Set up Husky git hooks automatically via the prepare script
  • Configure the pre-commit hook to run ESLint

Bypassing Pre-commit Hooks

In rare cases where you need to bypass the pre-commit hooks (not recommended), you can use:

git commit --no-verify -m "your commit message"

Contributing

Contributions are welcome! Please feel free to submit an issue or a pull request.

Before submitting a pull request:

  1. Ensure your code passes all ESLint checks (npm run lint:check)
  2. Run the test suite (npm test)
  3. Add tests for any new functionality