emc-interactions2 v0.0.8
Overview
Format interactions (combine meta and data.js file content), check for duplicates in our database, and finally upload to AWS database for later consumption by Bookshelf and the EMC Interactions Editor.
Prerequisites
The EMC-Insteractions command line tool requires serveral libraries to be installed on your machine, so let's get those setup first!
Install Node and NPM on your machine.
- Verify Node is installed by opening a Terminal window and running
node -v
- If your receive the message
command not found
, you'll need to download the Node installer package from the Node website (LTS version) - If you see a version number displayed,
v8.11.3
, that means Node is installed and you can proceed to the next step.
- If your receive the message
- When you install Node, NPM is usually installed along with it, but let's verify NPM is installed by running
npm -v
in your Terminal window.- You should see a version number for npm
5.6.0
, or something like that. - If you receive the message
command not found
, please reinstall Node by downloading the intaller from the Node website
- You should see a version number for npm
Install Python and PIP on your machine
Mac
Python should already be installed! Run
python --version
to find which version you have installed.Check for PIP (Python's package manager)
- run
pip --version
in a Terminal to determine if Python is installed on your machine. If you see something likepip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
, then we're all good. But if you receive acommand not found
message, that means PIP is not installed on your machine. Please continue to the next bullet point. - Download PIP by running
curl -O https://bootstrap.pypa.io/get-pip.py
in a Terminal. - Then run
python3 get-pip.py --user
orpython get-pip.py --user
, depending on your python version.
- run
Windows
- ...coming soon
Install AWS-CLI tool
Install AWS-CLI with one PIP command in your Terminal: pip3 install awscli --upgrade --user
Run aws --version
in a Terminal to determine if the AWS-CLI tool is installed correctly. If you'd like more detailed instructions, please reference the AWS Docs.
Trouble with PIP? Here's an alternative way to install the AWS-CLI tool:
Sequentially enter the following three commands into the Terminal.
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Setup
Decide which folder you will use for processing files. It should only contain the items that are processed or created by the emc-interactions tool.
You'll need the meta.csv file containing the meta data for the interactions you'd like to process.
You also need book folders, named the same as the book_Id you'd like to process so that all page #.js files are in their respective folders.
Configure
Run aws configure
in a terminal
>>AWS Access Key ID [********************]:
>>AWS Secret Access Key [********************]:
>>Default region name [us-east-1]:
>>Default output format [json]:
Install emc-interactions
Run npm install emc-interactions -g
in a Terminal to install the library globally.
How to use emc-interactions
Using Terminal, cd into the folder with your meta.csv and folders titled with
There are four commands available:
emc-interactions --help
Display the emc-interaction options below.
emc-interactions --format
Read the page #.js files in the current folder, combine it with the interaction meta data a .csv file named meta.csv.
emc-interactions --check
Check the database for duplicate extActivityIds. This command only checks the first and last extActivityId of each book. Must first run the format command.
emc-interactions --upload
Uploads the interactions in the AWSFILE.json Must first run the format command.