lrs-xml-parser
Version:
TCO 16 Megahack - XML Parser
47 lines (29 loc) • 1.78 kB
Markdown
## TCO Megahack - XML Parser
### Requirements
* Node.js 6.9.1
* mongodb
<br />
### Configuration
Edit `config/config.js` and change `mongo_uri` to the value for your environment.
<br />
### Using the module
The module exposes three methods:
* getNaicsCodes
* getPrograms
* getCleanAirActRules
<br />
#### getNaicsCodes
This method accepts two parameters: `xmlFilename` and `callback` and stores the NAICS codes in the Naics collection.
`xmlFilename` represents the full path to the XML file containing the NAICS codes.
`callback` represents the callack to be called after the NAICS codes have been retrieved and stored in MongoDB
<br />
#### getPrograms
This method accepts three parameters: `xmlFilename`, `baseFolder` and `callback` and stores the retrieved programs and their corresponding rules / regulation IDs in the Program collection. This method may take a while to complete depending on the number of CFR files that need to be parsed and their respective file sizes.
`xmlFilename` represents the full path to the XML file containing the programs.
`baseFolder` represents the path to the folder containing the `CFR2015Title40XXX` files.
`callback` represents the callack to be called after the programs have been retrieved and stored in MongoDB.
<br />
#### getCleanAirActRules
This method accepts two parameters: `baseFolder` and `callback` and stores the retrieved rules with their regulation IDs in the Rule collection. This method may take a while to complete depending on the number of CFR files that need to be parsed and their respective file sizes.
`baseFolder` represents the path to the folder containing the `CFR2015Title40XXX` files.
`callback` represents the callack to be called after the programs have been retrieved and stored in MongoDB.