This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (function() { | |
"use strict"; | |
/** | |
* Databot input requirements: | |
* { | |
* queueId: "<dataset id to be monitored>", | |
* tdxServer: "e.g. http://tdx.nqm-1.com", | |
* ddpServer: "e.g. http://ddp.nqm-1.com" | |
* } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
const useDataSubscription = (tdx, datasetId, selector, options) => { | |
const [data, setData] = React.useState([]); | |
React.useEffect( | |
() => { | |
let subscription; | |
let observer; | |
if (tdx) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST https://tdx.nqminds.com/token -H 'authorization: Basic <app-id>:<app-secret>' -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{"grant_type":"client_credentials", "ttl": 31536000}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (function() { | |
"use strict"; | |
const Promise = require("bluebird"); | |
function databot(input, output, context) { | |
const tdxApi = context.tdxApi; | |
const mappingId = input.mappingId; | |
// filter boundary dataset with a list of all ccgs | |
const filter = { | |
mappingType: "ons-mapping", | |
parentType: "CCG15CD", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const databot = function(input, output, context) { | |
const api = context.tdxApi; | |
let x = 0; | |
const readStream = api.getNDDatasetData( | |
"HygXQFrwx-", // This contains nearly 6 million documents | |
null, | |
null, | |
{limit: 0} | |
); | |
const writeStream = split(JSON.parse, null, {trailing: true}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mapData(populationData, ratioData, serviceArray, areaServiceId, deststream) { | |
// re-format the ratioData from an array to a dictionary lookup object | |
// in order to do the multiplications with poplet data | |
const ratioObject = dicLookup(ratioData, serviceArray); | |
const writePromises = []; | |
_.forEach(populationData, (populationObj) => { | |
const key = `${populationObj.area_id}${populationObj.gender}${populationObj.age_band}`; | |
if (ratioObject[key]) { | |
const rObj = { | |
areaServiceId: areaServiceId, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function blob(xIn, yIn) { | |
const x = xIn; | |
const y = yIn; | |
this.setY = (yIn) => { | |
y = y; | |
}; | |
this.getY = () => { | |
return y; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {dataLoader, optionsWithError} from "../../../configs/app-data-loader"; | |
import Home from "../components/home"; | |
import {Meteor} from "meteor/meteor"; | |
function dataMapper({ | |
connectionManager, | |
setRegionId, | |
setUserName, | |
setGeoCentre, | |
setProjectionListId, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let total = 0; | |
const processChunk = function(chunkList, chunkIndex) { | |
const chunk = chunkList[chunkIndex]; | |
// do stuff with chunk asynchronously | |
return doStuff(chunk) | |
.then((result) => { | |
if (chunkIndex < chunkList.length) { | |
total += result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// estimator.js | |
module.exports = (function() { | |
var getData = function(id, cb) { | |
return api.getDataAsync(id, this.state.filter); | |
} | |
function estimator(initial) { | |
this.state = initial; |
NewerOlder