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

haztrak

v2.0.2

Published

Easily integrate web applications with the EPA e-Manifest system and RCRAInfo

Downloads

16

Readme

MIT License Build

Table of Contents

Intro

e-Manifest was established by the EPA as a national IT system that enables the Agency and the RCRA community to electronically track hazardous waste shipments. It was built as a modular component of RCRAInfo.

haztrak simplifies the process of integrating with the RCRAInfo/e-Manifest system, and transitioning to electronic manifests by abstracting the implementation and letting you get back to what's important.

For additional information about e-Manifest, check out the below links

One of the best sources of documentation for this project, is the e-Manifest Swagger page

For a python alternative see the emanifest pip package

Installation

  $ npm install haztrak
  or
  $ yarn add haztrak

haztrak uses ES6 module syntax, see Node's documentation for more info.

Environment Variables

To use haztrak, you'll need Site Maanger access to a site with an API ID and key. You will need to add the following environment variables. hazTrak will load any Variables you have in your .env file see the [dotenv] (https://www.npmjs.com/package/dotenv) for more details

BASE_URL RCRAInfo or PreProd baseURL

RCRAINFO_API_ID

RCRAINFO_API_KEY

Examples

Site Services

import haztrak from 'haztrak'

const  checkSites = async () => {
  // To get site details, set details field to True
  const detailObject = {
      siteId: 'VATEST000001',
      detail: 'True'
  }
  // To check if site exist, set exist field to True
  const existObject = {
      siteId: 'VATEST000001',
      exist: 'True'
  }
  // Pass search criteria in the obect to search for sites
  const searchCriteria = {
      state: 'VA',
      siteType: 'Transporter',
      name: 'test transporter'
  }
  const siteInfo = await haztrak.site(detailObject)
  const siteExist = await haztrak.site(existObject)
  const searchRes = await haztrak.site(searchCriteria)
}
checkSites()

manifests UI link

Returns a hyperlink to view or sign manifest(s) in RCRAinfo as the specified facility

import haztrak from 'haztrak'

const foobar = async () => {
  linkObject = {
     page: <BulkSign | Dashboard | BulkQuickSign | Edit | View | Sign> 
     epaSiteId: <EPA ID Number viewing manifests as>
     mtn: <array of manifest tracking numbers>
   }
  const eManLink = await haztrak.eManLink(linkObject)
}

Edit, View and Sign only accept 1 MTN

RCRAInfo Lookup

import haztrak from 'haztrak'

const foo = async () => {
  const densityCodes = await haztrak.lookup('den')
}

haztrak.lookup accepts one of the below string

  • den → Density code
  • form → Form Codes
  • source → Source Code
  • state → State waste codes
  • fed → Federal Waste Codes
  • min → Waste minimization codes
  • ports → Ports of entry

e-Manifest Lookup

haztrak.eMaLlookup accepts one of the below strings. Parameters with filt require additional arguements

import haztrak from 'haztrak'

const foo = async () => {
  // shippingName and idNumber are only required for codes with filt suffix
  eLookupObject = {
    codes: <name | id | haz | pack | num-suffix | num-siffix-all | cont | uom | load | haz-filt | pack-filt | name-filt | id-filt>
    shippingName: <possibles values from codes='dot'>
    idNumber: <possibles values from codes='id'>
  }
  const shippingNames = await haztrak.eManLookup(eLookupObject) 
}

e-Manifest Examples

Now the good stuff, electronic manifesting in version 2.0, downloading zip atachments is unsupported.

eMan provides the following methods

  1. billHistory
  2. bill
  3. search
  4. correctionDetail
  5. correction
  6. siteMtn
  7. get
  8. sites
  9. correct
  10. revert
  11. exists
  12. update
  13. del
  14. save

Get

eMan.get takes the manifest tracking number (MTN) and returns an object of the curent version in the e-Manifest system.

  import haztrak from 'haztrak'

  const exampleGet = async () => {
    const mtn = '012345678ELC'
    const res = await haztrak.eMan.get(mtn)
  }
  examplesGet()

Save

eMan.save takes a stringified JSON and returns the e-Manifest response oulined in the USEPA/e-Manifest documentation.

For this example, the manifest we'd like to save is stored in a JSON file

import haztrak from 'haztrak'
import fs from 'fs'
const exampleSave = async () => {
  fs.readFile('./exampleMan.json', 'utf8', async (err, data) => {
    if (err) {
      console.log(`Error reading file: ${err}`)
    } else {
      let manifest = JSON.parse(data)
      manifest = JSON.stringify(manifest)
      const res = await haztrak.eMan.save(manifest)
    }
  })
}
exampleSave()

Delete

eMan.delete accepts an mtn and returns the e-Manifest response outlined in the e-Manifest documentation.

const testDel = async () => {
  const mtn = '100032099ELC'
  const res = await haztrak.eMan.delete(mtn)
}
testDel()

Contributing

If you have an idea for something you'd like to see in haztrak, please do not be afraid to contribute! I have some general guidelines in docs/Contributing but if you see something you don't like, I'll probably change it for you.

The general process for contributing code features/improvements is...

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Make sure your changes are tested either with unit or UI tests. (npm test)
  4. Commit your Changes (git commit -m 'Add some AmazingFeature')
  5. Push to the Branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request!

If you'd like to propose something, just go right for the pull request.

There's more ways to contribute than JavaScript, for more details see docs/Contributing :)

License

haztrak is licensed under the terms of the MIT license