Scraper built in NodeJS for SAMHSA's Restricted-use Data Analysis System. Created as an easier method of obtaining data opposed to running a crosstab.
-
Clone or download this repo
-
Extract the files to a location of your choice
-
Install the latest version of node
-
In Windows, search for 'cmd' to find command prompt, if in Mac OS, search for your terminal
-
In command prompt type
cd <FILEPATH OF EXTRACTED FILES HERE>
, and press enter -
After the correct filepath is selected, type
npm install
and press enter to install all dependencies
The in.csv file should contain the input variables for each call to the API
- Data Years: The 2-Year data set you're targeting
- Row Variable: The key row variable
- Column Variable: The key column variable (optional)
- Control Variable: The key control variable (optional)
- Row, Column, and Control Filters: Filters for their respective variable. (must be a number, optional)
To execute the program run node main.js
in command prompt / terminal or with npm npm start
You can also create a .bat file <FILENAME HERE>.bat
and paste either of those commands as an easier single-click method of executing the code
For help understanding console commands in Windows: https://www.digitaltrends.com/computing/how-to-use-command-prompt/
For help completing these steps in a macOS: https://macpaw.com/how-to/use-terminal-on-mac
For help troubleshooting issues with NodeJS: https://nodejs.dev/learn/run-nodejs-scripts-from-the-command-line