A (real) JavaScript program written to parse and insert JSON data from a (fake) social media platform into a (fake) targeted marketing database.
The Script will also parse the .json
into a human-readable .html
document:
This script requires both node
and npm
installed to run.
- Install the dependencies with
npm i
. - Run the script with
node tmdp.js
.
The command prompt will display a short list of options - further info can be viewed by inputting "h" for the help menu.
The basic functionality of the program will write out the generated SQL queries into a .sql
script file. The JSON data can assembled as an HTML page for easier viewing of the managed dataset.
./tmdp.js
- The program script../post_data.json
- A snippet of a social media data feed represented as JSON../credentials.json
- A file to store the credentials for your MySQL database.- Not yet implemented
./schema/targeted_marketing.sql
- The schema script for the database- Also creates 5 sample Users and SocialAccounts
./templates/html_template.html
- The document template that is used for HTML output
Group
,Event
, and all derived tables needed to be renamed toSocialGroup
andSocialEvent
to avoid conflicts with MySQL keywords.- Should
Post
,Comment
, etc, have adatetime
field rather thandate
?
All new tables have to be recreated using the tmdb
database rather than mydb
.
- Use
mysql2
to allow direct insertion into database without the middle step of generating a script - Read in other .json files such as
group_data.json
and create functions for generating the properINSERT
statements