Starting from:

$30

CSE270E- Assignment 13 Solved

In this assignment you will work with loading data from a csv file into a mongodb and then building a web application that will let the user make queries of the data set. The data is an open data set measuring student test performance.

Skeleton
The skeleton for this project is in my public git file at https://gitlab.csi.miamioh.edu/campbest/cse270ecampbest-public (https://gitlab.csi.miamioh.edu/campbest/cse270e-campbest-public) . I suggest you clone this to your ubuntu instance (not in your working directory but under /home/ubuntu) and the copy the files to your own repository working copy.

Load the data
Create a new mongodb called StudentPerformanceData using the mongo cli.

1.  Copy over the skeleton Assignment-13 directory to your working copy.

2.  In Assignment-13 the data is in a folder called data.

3.  Inside this directory download the file StudentPerformanceData.csv

4.  Using the mongoose schema module, create a nodejs program called loadData.js that will read in the StudentPerformanceData.csv and populate the mongodb. Here is the schema that I used: var studentDataSchema = new mongoose.Schema({             gender: String,             race: String,             parentEducation: String,             lunch: String,             testPrep: String,             math: String,             reading: String,             writing: String });

 

5.  FYI: You will need to read in the file using the npm module file and I also used the npm module csv to parse the csv record.

Complete the Data Model for the express applica on
1.  Look over the express code and see how the data model is used. The name of the exported functions

(which all return promises) are at the end of the file data/StudentDataModel.js

2.  A data model is simply a js program that handles all interactions with the data. The functions in this program will be called by express to get and populate the various data elements for the Express application.

1.  You will be building a node module, so all functions you want to make available to world will need to be exported via the exports (https://www.sitepoint.com/understanding-module-exports-exportsnode-js/) method.

2.  All mongodb calls should be via the mongoose module

3.  Functions that you will need to create are: Remember these functions will use  a callback to return the actual data.

1. addStudent(record)

1.  this method will add a record to the mongodb

2.  close

1. close the mongodb connection

3.  clear

1. Calls the mongodb drop function to clear out existing records

4.  getStats

1.  This method will return a datastructure will all the statistics the view is looking to display. I used a whole series of awaits to get each statistic. This method takes in 3 parameters, math, reading and writing and uses the query to select only those records whose scores are greater than the input values.

2.  Use the mongo query logic (https://docs.mongodb.com/manual/reference/operator/query/) :

When done the existing express code should work with your datamodel. I don't believe you should have to modify any of the app.js or view code.

Video Discussing Solu on
Submit:

Run this application on port 3013 submit links to the running application and to your git repository.

Some Rubric (14)
 

Criteria
 
Ratings
 
Pts
loadJS works
5.0 pts Full Marks
 
0.0 pts

No Marks
 
5.0 pts
loadJS reports errors
5.0 pts Full Marks
 
0.0 pts

No Marks
 
5.0 pts
addStudent stores records
5.0 pts Full Marks
 
0.0 pts

No Marks
 
5.0 pts
addRecord error handling
5.0 pts Full Marks
3.0 pts

Some but not complete
0.0 pts

No Marks
5.0 pts
get Stats - quality
5.0 pts Full Marks
 
0.0 pts

No Marks
 
5.0 pts
 
 
Total Points: 25.0
 

More products