Skip to content

Instantly share code, notes, and snippets.

@tyage
Last active August 29, 2015 14:08
Show Gist options
  • Save tyage/a018f17218ae00369c2f to your computer and use it in GitHub Desktop.
Save tyage/a018f17218ae00369c2f to your computer and use it in GitHub Desktop.
str = ""
fields.forEach(function(f) {
str += '{ "title": { "ja": ' + JSON.stringify(f.title.ja) + ', "en": ' + JSON.stringify(f.title.en) + ' }' +
',\n "breakedTitles": { "ja": ' + JSON.stringify(f.breakedTitles.ja).split('","').join('", "') + ', "en": ' + JSON.stringify(f.breakedTitles.en).split('","').join('", "') + ' }' +
',\n "x": ' + f.x + ', "y": ' + f.y + ', "r": ' + f.r + ', "people": ' + JSON.stringify(f.people) + ', "type": ' + JSON.stringify(f.type) + ' }' + ',\n'
})
copy(str)
b = a.map(function(f) {
var belongsTo = f["マップ内の所属"].split(' ');
belongsTo.shift();
return [ f['研究者ID'], belongsTo.length > 0 ? belongsTo.join(' ') : null ]
})
// Social infrastrcture -> Social infrastructure
// Sensing device -> Sensing devices
// ICT -> ICT Smart city Energy control
// Screening -> Screening, Model animal
// Genetic modifiction -> Genetic modification
// Bio engineering -> Bioengineering
// Bio eingineering -> Bioengineering
// Model animal -> Screening, Model animal
// Tissue engineering -> Tissue engineering material
// Sensor molecule -> Senser molecule, imaging material
// Memblem -> Membrane
b.forEach(function(c) {
var exists = false
fields.forEach(function(f) {
var title = c[1]
switch (title) {
case 'Social infrastrcture':
title = 'Social infrastructure'
break
case 'Sensing device':
title = 'Sensing devices'
break
case 'ICT':
title = 'ICT Smart city Energy control'
break
case 'Screening':
title = 'Screening, Model animal'
break
case 'Genetic modifiction':
title = 'Genetic modification'
break
case 'Bio engineering':
title = 'Bioengineering'
break
case 'Bio eingineering':
title = 'Bioengineering'
break
case 'Model animal':
title = 'Screening, Model animal'
break
case 'Tissue engineering':
title = 'Tissue engineering material'
break
case 'Sensor molecule':
title = 'Senser molecule, imaging material'
break
case 'Memblem':
title = 'Membrane'
break
}
if (title && c[0] !== '' && f.title.en.toLowerCase() === title.toLowerCase()) {
exists = true
f.people.push(c[0])
f.people = _.uniq(f.people)
}
})
if (!exists) {
console.log(c)
}
})
fields.forEach(function(f) {
if(a[f.title.ja]) {
a[f.title.ja].forEach(function(id) {
f.people.push(id)
})
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment