Set the name ordering & small fixes

This commit is contained in:
Konstantin Mamalakis 2018-02-22 20:37:33 +02:00 committed by Josh Harvey
parent 402f75f50c
commit 910d7e200f
4 changed files with 74 additions and 44 deletions

View file

@ -7,7 +7,7 @@ const options = require('../options')
const logger = require('../logger')
const _ = require('lodash/fp')
const debug_log = require('./debug') // KOSTIS TODO: remove
const debug_log = require('../pp')(__filename) // KOSTIS TODO: remove
const OFAC_DATA_DIR = options.ofacDataDir
@ -71,12 +71,12 @@ const processAlias = _.curry((groupTypes, aliasNode) => {
const nameParts = _.map(getNamePart, namePartNodes)
const parts = _.assignAll(nameParts)
const fullName = nameUtils.fullNameFromParts(parts)
const fullNames = nameUtils.makeFullNames(parts)
const phoneticParts = _.mapValues(nameUtils.phonetic, parts)
const phoneticFullName = nameUtils.phonetic(fullName)
const phoneticFullNames = _.map(nameUtils.phonetic, fullNames)
return {parts, fullName, phoneticParts, phoneticFullName}
return {parts, fullNames, phoneticParts, phoneticFullNames}
})
// birth date
@ -116,7 +116,7 @@ function processProfile (profileNode) {
const groupTypesEntries = _.map(processMasterNamePartGroup, identityNode.NamePartGroups.MasterNamePartGroup)
const groupTypes = new Map(groupTypesEntries)
const mapCompact = _.flow(_.compact, _.map)
const mapCompact = _.flow(_.map, _.compact)
const getNameParts = processAlias(groupTypes)
const aliases = mapCompact(getNameParts, identityNode.Alias)