Week 4 plan

This week we are going to do the following

  • Frontend Boilerplate
    • This week we will start doing scaffolding in the homepage, and maybe in one or two more views. (Samuel)
  • Define Backend models/entities
    • There are about 3 to 4 entities, we will define each one with their respective properties this week. (Victor and Estefany)
  • Define Web HTTP frameworks for Go backend service
    • We are considering to use Gorilla, Gin, Revel or whatever framework which fits better for our project. (Julia)
  • Create A Multinomial Logisitic Regression model
    • This will be a rebalanced model, which will be developed together with the team from Bosch. (Victor)
  • Do a presentation of our currently deliverables in Bosch. (Victor)

Unit Testing in Node

Writing unit tests in Node is very easy, we are going to use 2 tools for doing that: Mocha and Chai.

Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun

https://mochajs.org/

Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework.

https://www.chaijs.com/

First of all, make sure you have installed Node in your computer, you can get it here: https://nodejs.org

In your workspace folder, run the next command to init a node package, and complete the requested parameters.

npm init

Run the following command to install Mocha and Chai as a dev dependency

npm install --save-dev mocha chai

Let’s write a simple function that adds 2 numbers

const add2Numbers = (x, y) => {
return x + y;
};

Let’s write the test for that function

// First we have to require chai
const chai = require("chai");


describe("add2Numbers()", () => {
// Description of the test
it("should add 2 numbers", () => {
const x = 1;
const y = 2;

const sum = x + y;

const sumByFunction = add2Numbers(x, y);

// Our assert function
chai.expect(sumByFunction).to.be.equal(sum);
});
});

Next step is to run our tests, go to package.json, and add the «directories» property if not set already. Inside directories, we add another key named «test» that will have the value of the directory where we are saving our test files. Also, we need to add our test script, that will be just «mocha».

package.json
{
.
.
.
"directories": {
"test": "test"
},
"scripts": {
"test" : "mocha"
}
.
.
.
}

So far, our project structure should look like this.

src
- package-lock.json
- package.json
- tests
- - example.test.js

We do the tests running the next command

npm test

The output should look like this

   mocha 
add2Numbers()
✓ should add 2 numbers
1 passing (11ms)

So far so good! Now you know how to write tests in Node.

You can find the code here https://github.com/samosunaz/node-tests

Week 3 review

  • Machine Learning Model
    • To solve the inital problem (which is to predict a range of bikes available or unavailable per station), we are planning to use a Multinomial Logistic Regression Model.
    • We have defined that there are 4 important variables:
      • Initial date of trip (which can be split into year, month, day and hour)
      • Final date of trip (which can be split into year, month, day and hour)
      • Departure (id).
      • Arrival (id).
  • Matlab – We did a PoC using Matlab about comparing the initial time and final time of each user’s trip.
    • Screen Shot 2019-02-02 at 17.31.20.png
  • Domain requirements
    • Currently in progress.
  • Proposal Technologies
    • Go
    • React/Redux.
    • Google Cloud/App Engine
    • Docker
    • Matlab
    • Python/SUMO
  • Bakckend architecture
    • Currently in progress
  • MockupsScreen Shot 2019-02-02 at 17.38.40.png
  • Project Charter
  • PROJECT CHARTER
    GENERAL PROJECT INFORMATION
    PROJECT NAME MiBici Battery Swap
    PROJECT SPONSOR Bosch
    PROJECT MANAGER Alberto Briseno
    EMAIL ADDRESS Jose.Briseno@mx.bosch.com
    PHONE NUMBER 52 33 1579-1263
    ORGANIZATIONAL UNIT Bosch ML Team
    PROCESS IMPACTED public transport
    EXPECTED START DATE January 31, 2019
    EXPECTED COMPLETION DATE May 1, 2019
    EXPECTED SAVINGS $0
    ESTIMATED COSTS $0
    GREEN BELTS ASSIGNED NA
    BLACK BELTS ASSIGNED NA
    DESCRIBE THE PROBLEM OR ISSUE, GOALS, OBJECTIVES, AND DELIVERABLES OF THIS PROJECT
    PROBLEM OR ISSUE MiBici is a project in where you pay a membership to use one bike from the different stations around the city, after you pick one, the bike must be returned to one of the stations already mentioned. The project is about predicting the times and in which zones are used the bikes, in order to deliver a simulation associated with the data analyzed.
    PROJECT GOAL The bikes are intended to be replaced in a short period of time for electric ones. The team involved in this project required to know the information that we must deliver, in order for swapping the batteries.
    BUSINESS CASE Public transport/ Encourage a healthy and better lifestyle.
    GOALS / METRICS Machine Learning Predictive Model/ Bikes simulator in a real time traffic approach.
    EXPECTED DELIVERABLES Web platform with the stations, the number of bikes in each station and in estimated range of time.
    DEFINE THE PROJECT SCOPE AND SCHEDULE
    WITHIN SCOPE Machine Learning Predictive Model/ Bikes simulator
    OUTSIDE OF SCOPE Web platform
    TENTATIVE SCHEDULE KEY MILESTONE START COMPLETE
    Form Project Team / Preliminary Review / Scope 01/25/19 01/31/19
    Finalize Project Plan / Charter / Kick Off 02/05/19 11/02/19
    Development Phase 02/12/19 04/09/19
    Measurement Phase 02/26/19 04/09/19
    Analysis Phase 03/05/19 04/16/19
    Improvement Phase 03/08/19 04/20/19
    Control Phase 03/19/19 04/25/19
    Project Summary Report and Close Out 04/30/19 05/03/19
    DEFINE THE PROJECT RESOURCES AND COSTS
    PROJECT PARTICIPANTS Cesar, Constanza, Katia, Mario, Victor, Mark, Montserrat, Gabriel, Alberto, Julia, Samuel, David, Estefania and team from Bosch
    SUPPORT RESOURCES
    Matlab, SUMO, accesability to MiBici data and web frameworks.
    SPECIAL NEEDS
    Computers that can support the simulations.
    COST TYPE VENDOR / LABOR NAMES RATE QTY AMOUNT
    LABOR Planning 2 wk $0
    LABOR Developing 2 wk $0
    LABOR Testing 3 wk $0
    LABOR Developing 2 wk $0
    LABOR Testing 3 wk $0
    LABOR Deployment 2 wk $0
    TOTAL COSTS $0
    DEFINE THE PROJECT BENEFITS AND CUSTOMERS
    PROCESS OWNER Alberto Briseno
    KEY STAKEHOLDERS Cesar, Constanza, Katia, Mario, Victor, Mark, Montserrat, Gabriel, Alberto, Julia, Samuel, Estefania, Ismael, David, team from Bosch and people who use public bikes.
    FINAL CUSTOMER
    People which has the control management over MiBici logistic.
    EXPECTED BENEFITS People will be able to have bikes available at all stations with charged batteries (the bikes are ment to be electric).
    TYPE OF BENEFIT DESCRIBE BASIS OF ESTIMATE EST BENEFIT
    SPECIFIC COST SAVINGS NA $0
    ENHANCED REVENUES NA $0
    HIGHER PRODUCTIVITY (SOFT) NA $0
    IMPROVED COMPLIANCE NA $0
    BETTER DECISION MAKING NA $0
    LESS MAINTENANCE NA $0
    OTHER COSTS AVOIDED NA $0
    $0
    DESCRIBE PROJECT RISKS, CONSTRAINTS, AND ASSUMPTIONS
    RISKS We are expecting to learn technolgies which we haven’t used and deliver the best as we can the Machine Learning and simulation part.
    CONSTRAINTS Time, project meetings
    ASSUMPTIONS The stakeholders will participate actively and the user stories, engineering tasks and requirements may be well stablished and may not change very constantly.
    Prepared by: Kassem’s Team Date: January 29, 2019

Week 3 plan

The plan for this week is the follwoing:

  • Definition of variables
    • Define variables that will be the output from the Machine Learning Predictive Model (we have identified 6 variables) for the microservice. (Victor)
  • Matlab – data analyzed
    • Make a PoC about using matlab to retrieve and process the data. (Victor)
  • Domain requirements
    • Identify the required modules, entities and domains. (Victor and Julia)
  • Proposal Technologies
    • List the technologies that we will use. (Samuel and Julia)
  • Bakckend architecture
    • Identify the backend architecture needed for the real scope which we want to achieve. (Estefy and Samuel)
  • Mockups
    • Create some mockups for the frontend. (Samuel and Julia)

Review Week 2

According to this week plan…

  • Also, we have a first approach for the system architecture. We will discuss it more into detail the next session:architecture

 

  • And this is the list of requirements we have so far:
    • ML algorithms implemented (Matlab/ python).
    • Data with useful information.
    • Display data by time/ location.
    • Data persistence.
    • Use of sockets for real time updates.
    • Usage trends.
    • Devops environment.
    • Software testing.
    • Software simulation using python and SUMO.
  • In order to do this project we have been authorized (from Bosch) to include other classmates from different subjects.