Coder Social home page Coder Social logo

sambit2 / dataanalytics-web-based-education Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 163 KB

Contains the design of the tool in JS and the analysis of log files in R

HTML 0.46% JavaScript 9.34% R 90.21%
analysis asq classroom-environment data-analysis education enhanced learning learning-analytics logs modelling tecnology user

dataanalytics-web-based-education's People

Contributors

sambit2 avatar

Watchers

 avatar

dataanalytics-web-based-education's Issues

Feedback for existing code

  • It's better if you process per viewer, instead of all the events together

  • You could export the sessionevent.json from mongodb so
    that

    1. you don't get the weird $oid fields
    2. you don't get stringified JSON in some fields
  • You have inconsistent code indentation. Formatting is really important for readability

  • Instead of having an array for each indicator like so:

    var exercise = [];
    var connected = [];
    var focus = [];
    var idle = [];
    var input = [];
    var submitted = [];

    you could have one array with an object that has all indicators. Like this:

    var indicators = [];
    users.forEach(function(user){
      var iObj = {
        connected: undefined,
        focus: undefined,
        idle:undefined,
        input: undefined,
        submitted: undefined
      };
      indicators.push(iObj)
      })
  • Using line 48 to 57 is a waste of your time since step 4 of the munge scripts in the R repo (4_add_user_field_to_session_events.R) will create cache/sessionevents_with_user_<date>.csv which will have the normalized userid information

  • The loops in lines 67 and 71 can be merged into one.

  • You may also want to use the native JavaScript date objects to get seconds etc. [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date][https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date]

  • lines 85-147 are too complex.

  • This how I would get the events per user:

    var startTime = event[0].time;
    var endTime = event[0].time;
    var eventsPerUser = {};
    
    /**
    * This function is used to make sure each events has its
    * properties in our desired format
    */
    function preprocessEvent(evt){
      // make sure time is in a format we want
    
      // make sure userids are fine
    
      return evt
    }
    
    /**
      * The following loop will create an array for each user
      * in eventsPerUser and push the corresponding user events.
      * It will also find the min and max time the events take place
      */
    events.forEach(function(evt){
      evt = preprocessEvent(evt)
      // if we don't have an entry for this userid, create one
      if (eventsPerUser[evt.userid]){
        eventsPerUser[evt.userid] = []
      }
      eventsPerUser[evt.userid].push(eventsPerUser[evt.userid]);
      if (evt.time < startTime) {
        startTime = evt.time
      }
    
       if (evt.time > endTime) {
        endTime = evt.time
      }
    })
    • Now you can have the unique users like so:

        var users =  Object.keys(userEvents);
      
    • Now you can generate the state for each user like so:

      function generateState(timeMin, timeMax, userEvents){
        var duration = timeMax - timeMin
        // initialize state array
        for(var i=0; i<= duration, i++){
          var iObj = {
            connected: undefined,
            focus: undefined,
            idle:undefined,
            input: undefined,
            submitted: undefined
          };
          userState.push(iObj)
        }
      
        userEvents.forEach(function(){
            // user here something to EventstoIndicators
          })
      } 
      
      // map will return an array whose elements are the return values of all
      // the `mapFunction` calls
      allUsersState = users.map(function mapFunction(userid){
          var userState = generateState(timeMin, timeMax, eventsPerUser[userid] )
          return userState;
        })
  • don't use strings for binary (0/1, true/false) states. Use either true, false or integers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.