haztrak
v2.0.2
Published
Easily integrate web applications with the EPA e-Manifest system and RCRAInfo
Downloads
16
Maintainers
Readme
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 codeform
→ Form Codessource
→ Source Codestate
→ State waste codesfed
→ Federal Waste Codesmin
→ Waste minimization codesports
→ 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
- billHistory
- bill
- search
- correctionDetail
- correction
- siteMtn
- get
- sites
- correct
- revert
- exists
- update
- del
- 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...
- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Make sure your changes are tested either with unit or UI tests. (npm test)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- 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