Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

Commit

Permalink
Fix/mapping (#60)
Browse files Browse the repository at this point in the history
* Fix mapping of the spreadsheet tables
* Added travis YAML
* Added coveralls and icon to readme file
* Added dependencies for coveralls
* Install ruby on travis
* Install sass on travis machine
* Install latest ruby version for sass
* Try to fix coveralls integration
* Added coverage badge to readme
* Fix review with jscs
* Set deployment process on successful build
  • Loading branch information
zhenyab authored and pwalsh committed Aug 16, 2016
1 parent 481b1cd commit 9c0aad8
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 133 deletions.
10 changes: 9 additions & 1 deletion .jscsrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"preset": "google",
"excludeFiles": ["app/public/**/*", "app/client//scripts/modernizr.min.js"]
"excludeFiles": [
"app/public/**/*",
"app/client//scripts/modernizr.min.js",
"app/client/scripts/jquery.mmenu.all.min.js"
],
"requireCamelCaseOrUpperCaseIdentifiers": {
"ignoreProperties": true
},
"requireMultipleVarDecl": false
}
45 changes: 45 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
sudo: false
language: node_js
node_js:
- '5'

addons:
ssh_known_hosts:
- heroku.com

before_install:
- rvm install 2.3.1
- gem update --system
- gem install sass
- gem install compass

install:
- mkdir -p coverage
- npm install

#before_script:
# - echo -e "Host heroku.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
# - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config

script:
- npm run build
- npm run review
- npm run test

after_script:
- "node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- tests --recursive --reporter=xunit-file && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"

#after_success:
# - rm app/public/.gitignore
# - git add . && git commit -a -m 'added public'
# - git push -f [email protected]:opentrials-ebola-tracker.git master

before_deploy:
- rm app/public/.gitignore

deploy:
provider: heroku
app: opentrials-ebola-tracker
api_key: 54632a2c-2498-4655-88af-19a0f233c4c7
skip_cleanup: true
on: master
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Ebola Tracker

[![Gitter](https://img.shields.io/gitter/room/opentrials/chat.svg)](https://gitter.im/opentrials/chat)
[![Shippable](https://img.shields.io/shippable/5604ab341895ca447417f6fe.svg)](https://app.shippable.com/projects/5604ab341895ca447417f6fe)
[![Travis Build Status](https://travis-ci.org/opentrials/tracker-ebola.svg?branch=fix%2Fmapping)](https://travis-ci.org/opentrials/tracker-ebola)
[![Coverage Status](https://coveralls.io/repos/github/opentrials/tracker-ebola/badge.svg?branch=fix%2Fmapping)](https://coveralls.io/github/opentrials/tracker-ebola?branch=fix%2Fmapping)

A mini app to track trials - [link](https://opentrials-tracker.herokuapp.com/).

Expand Down Expand Up @@ -74,5 +75,4 @@ Deployment to Heroku will be done only on master branch on green builds.
> More sofisticated CI/CD strategy with stage/production splitting
is planned for next stages of the project.

To tweak the process use `shippable.yml` ([reference](http://docs.shippable.com/yml_reference/))
file in the root of the project.
To tweak the process use `.travis.yml` file in the root of the project.
64 changes: 31 additions & 33 deletions app/client/scripts/plugins.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
;(function($, undefined) {

// scroll to achors
$(function() {
smoothScroll.init({
updateURL: false
});
});


// mobile menu
$(function() {
var $menu = $('nav#menu'),
$html = $('html, body');

$menu.mmenu({
extensions : [ "pageshadow" ],
offCanvas : {
position : "right",
zposition : "front"
}
});

var API = $menu.data( "mmenu" );
API.setSelected( $menu.find( "li" ).first() );

var closer = null;
var $menu = $('nav#menu');
var $html = $('html, body');
var closer = null;

$menu.mmenu({
extensions: ['pageshadow'], offCanvas: {
position: 'right', zposition: 'front'
}
});

$menu.find( 'a' ).on( 'click', function() {
closer = $(this).attr( "href" );
});
// var API = $menu.data( "mmenu" );
// API.setSelected( $menu.find( "li" ).first() );

API.bind( "closed", function() {
if ( closer ) {
setTimeout( function() {
$html.animate({
scrollTop: $(closer).offset().top
});
closer = null;
}, 25 );
}
});
});
$menu.find('a').on('click', function() {
closer = $(this).attr('href');
});

// API.bind( "closed", function() {
// if ( closer ) {
// setTimeout( function() {
// $html.animate({
// scrollTop: $(closer).offset().top
// });
// closer = null;
// }, 25 );
// }
// });
});

// cookie bar
window.cookieconsent_options = {"message":"This site uses cookies. For more information, see our ","dismiss":"OK, Got it","learnMore":"Cookie policy.","link":"https://okfn.org/cookie-policy/"};

window.cookieconsent_options = {
message: 'This site uses cookies. For more information, see our ',
dismiss: 'OK, Got it',
learnMore: 'Cookie policy.',
link: 'https://okfn.org/cookie-policy/'
};
})(jQuery);
2 changes: 1 addition & 1 deletion app/client/styles/app.min.css

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions app/public/scripts/app.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 17 additions & 17 deletions app/public/scripts/vendor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/public/styles/app.min.css

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions app/services/cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ function processData(trials) {
return new Promise(function(resolve, reject) {
var results = _.map(trials, function(trial) {
return {
year: trial.Year,
month: trial.Month,
cases: trial.Cases,
deaths: trial.Deaths,
dataPackage: trial.Datapackage
year: trial.year,
month: trial.month,
cases: trial.cases || 0,
deaths: trial.deaths || 0,
dataPackage: trial.datapackage
};
});
resolve(results);
Expand Down
49 changes: 25 additions & 24 deletions app/services/trials.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
var csv = require('csv');
var request = require('request');
var Promise = require('bluebird');
var config = require('../config');
var config = require('../config');
var _ = require('lodash');

/**
Expand Down Expand Up @@ -38,23 +38,24 @@ function processData(trials) {
var today = Math.round(currentDate.getTime() / daysDivider);
var results = _.map(trials, function(trial) {
var result = {
trialId: trial['Trial ID'],
title: trial.Title,
publicTitle: trial['Public title'],
participantCount: trial['Participant Count'],
startDate: !!trial['Start Date'] ? new Date(trial['Start Date']) : null,
completionDate: !!trial['Completion Date'] ?
new Date(trial['Completion Date']) : null,
investigator: trial['Principal Investigator'],
sponsors: trial['Sponsor/Collaborators'],
trialId: trial.trial_id,
title: trial.title,
publicTitle: trial.public_title,
participantCount: trial.participant_count,
startDate: !!trial.start_date ? new Date(trial.start_date) : null,
completionDate: (!!trial.completion_date ||
trial.completion_date !== '-') ?
new Date(trial.completion_date) : null,
investigator: trial.principal_investigator,
sponsors: trial.sponsor_collaborators,
isPublished: (
(('' + trial['Results Available?']).toUpperCase() == 'TRUE') &&
(('' + trial['Preliminary or full']).toUpperCase() == 'FULL')
(('' + trial.results_available).toUpperCase() == 'Yes') &&
(('' + trial.preliminary_or_full).toUpperCase() == 'FULL')

),
url: trial.URL,
funders: trial['Funded Bys'],
source: trial.Source
url: trial.url,
funders: trial.funded_by,
source: trial.source
};

if (!_.isArray(result.sponsors)) {
Expand All @@ -69,7 +70,7 @@ function processData(trials) {
var started = Math.round(result.startDate.getTime() / daysDivider);
if (result.completionDate) {
var completed = Math.round(result.completionDate.getTime() /
daysDivider);
daysDivider);
result.isCompleted = today >= completed;
result.daysAfterCompletion = today - completed;
if (result.daysAfterCompletion < 0) {
Expand Down Expand Up @@ -138,7 +139,7 @@ function loadData() {

function parseData(data) {
return new Promise(function(resolve, reject) {
var options = {columns: true, auto_parse: true}; // jscs:disable
var options = { columns: true, auto_parse: true }; // jscs:disable
csv.parse(data, options, function(err, data) {
if (!err) {
resolve(data);
Expand All @@ -152,7 +153,7 @@ function parseData(data) {
function cleanData(data) {
return new Promise(function(resolve, reject) {
data.forEach(function(item) {
Object.keys(item).forEach(function (key) {
Object.keys(item).forEach(function(key) {
item[key] = cleanNull(item[key]);
});
item['Conditions'] = cleanArray(item['Conditions']);
Expand All @@ -170,15 +171,15 @@ function cleanData(data) {
}

function cleanNull(value) {
if (value === 'Null') {
value = null;
}
return value;
if (value === 'Null') {
value = null;
}
return value;
}

function cleanArray(value) {
if (value === null) {
return value;
return value;
}
try {
value = value.split('|');
Expand All @@ -190,7 +191,7 @@ function cleanArray(value) {

function cleanDate(value) {
if (value === null) {
return value;
return value;
}
try {
// Join with "-" to make it ISO format with UTC
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"browser-sync": "^2.8.2",
"browserify": "^10.2.0",
"chai": "^2.3.0",
"coveralls": "^2.11.12",
"faker": "^3.0.1",
"gulp": "^3.8.11",
"gulp-autoprefixer": "^2.3.1",
Expand All @@ -45,6 +46,7 @@
"istanbul": "^0.3.21",
"jscs": "^2.1.1",
"mocha": "^2.3.3",
"mocha-lcov-reporter": "^1.2.0",
"resolve": "^1.1.6",
"uglify-js": "^2.4.21",
"vinyl-buffer": "^1.0.0",
Expand Down
36 changes: 0 additions & 36 deletions shippable.yml

This file was deleted.

0 comments on commit 9c0aad8

Please sign in to comment.