Commit 70935764 authored by Severine Duvaud's avatar Severine Duvaud
Browse files

Beacon v0.4

parent 9c2df180
......@@ -40,7 +40,7 @@ arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope
var conf = $scope.config;
return $location.absUrl() + "v0.3/query?" +
return $location.absUrl() + "v0.4/query?" +
"referenceName=" + conf.referenceName +
"&start=" + conf.start +
"&assemblyId=" + conf.assemblyId +
......@@ -61,7 +61,7 @@ arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope
$scope.getDatasetUrl = function () {
var conf = $scope.datasetConfig;
return $location.absUrl() + "v0.3/dataset?" +
return $location.absUrl() + "v0.4/dataset?" +
"id=" + conf.id;
};
......
......@@ -2,7 +2,7 @@
<div class="jumbotron">
<h1>Beacon ArrayMap</h1>
<p><a target="_blank" href="https://genomicsandhealth.org/work-products-demonstration-projects/beacon-project-0">Beacon</a>
<a target="_blank" href="https://docs.google.com/document/d/1n7qtCBFwsExP_k2GPfWS_PN53Xeh8YxeCBOgyZ5itOw/edit#"> v0.3</a> implementation for <a target="_blank" href="http://arraymap.org/">ArrayMap</a>.</p>
<a target="_blank" href="https://docs.google.com/document/d/1n7qtCBFwsExP_k2GPfWS_PN53Xeh8YxeCBOgyZ5itOw/edit#"> v0.4</a> implementation for <a target="_blank" href="http://arraymap.org/">ArrayMap</a>.</p>
</div>
<form class="form-horizontal">
<div class="form-group">
......
var express = require('express');
var router = express.Router();
var _ = require('underscore')
var beacon = require('../arraymap-beacon/v0.3/arraymap-beacon.js');
var beacon = require('../arraymap-beacon/v0.4/arraymap-beacon.js');
/* GET home page. */
router.get('/', function (req, res, next) {
......@@ -83,7 +83,7 @@ router.get('/v0.3/query/', function (req, res) {
});
});
router.get('/v0.3/dataset', function (req, res) {
router.get('/v0.4/dataset', function (req, res) {
var preconditions = beacon.checkDatasetIdentifier(req.query);
......@@ -105,4 +105,23 @@ router.get('/v0.3/dataset', function (req, res) {
});
});
/* Returns response for API v 0.4 */
router.get('/v0.4/query/', function (req, res) {
var preconditions = beacon.checkPreconditions(req.query);
if (preconditions.hasError) {
res.json(preconditions.msg); //Gets error messages
return;
}
var mongoQuery = beacon.buildMongoQuery(req.query);
console.log("Building MongoDB query params: " + JSON.stringify(mongoQuery));
req.db.samples.aggregate(mongoQuery, function(err, docs) {
var response = beacon.checkResultAndGetResponse(req.query, docs);
res.json(response);
});
});
module.exports = router;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment