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
module.exports = (function() { | |
"use strict"; | |
return { | |
tdxHost: "https://q.nqminds.com", | |
shareKeyId: "BJxDTAMqW", | |
shareKeySecret: "1234554321", | |
commandHost: "https://cmd.nqminds.com", | |
queryHost: "https://q.nqminds.com", | |
accessTokenTTL: 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 _ = require("lodash"); | |
const safeBands = require("./safe-age"); | |
const Promise = require("bluebird"); | |
const split = require("split"); | |
let tdxApi; | |
/** | |
* | |
* @param {*} serviceRatioId - datasetId refers to serviceRatio |
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
export const dataMapper = ({connectionManager, userInfo}, onData) => { | |
const baseYear = new Date().getFullYear(); | |
const comparisonYear = _.last(Meteor.settings.public.years); | |
const data = {}; | |
const tdxApi = connectionManager.tdxApi; | |
// changed filter for school-demo | |
const filter = { | |
parentId: userInfo.regionId, |
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 databot(input, output, context) { | |
const split = require("split"); | |
if (!input.datasetId) { | |
output.error("invalid args - supply datasetId"); | |
process.exit(1); | |
} | |
var dataCount = 0; | |
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 normalizeByJobRole(ageRatio, practiceAgeObj, practiceJobObj, ageBands, destStream) { | |
const normalizedObj = {}; | |
// sum of normalizedObj by jobRole, key is [gender, practiceId] | |
const normalizedSum = {}; | |
// practiceJobObj key is ${gender}${jobRole}${practiceId} | |
// individualObj key is ${gender}${jobRole}${ageBand}, MALEGP_REG_JUN_DOC30TO34 | |
// forEach [gender, jobRole] | |
_.forEach(practiceJobObj, (item, jobKey) => { | |
// practiceJobObj length is about 677,000 | |
const jobKey = jobKeyArray[i]; |