export function process_twgovdata_7437(acc, path, done)
content = fs.readFileSync path, 'utf-8'
content = content.replace /orgName/g, 'orgname'
$ = cheerio.load content, {+xmlMode}
orgs = $ 'orgs' .find 'org'
get = (o, q) -> o.find q .text!
orgs.each ->
obj = do
name: normalized-name(get @, 'orgname')
address: get @, 'address'
other_names: []
contact_details: [
{label: '機關電話', 'type': 'voice', 'value': get @, 'tel'}
{label: '機關電郵', 'type': 'email', 'value': get @, 'email'}
{label: '機關傳真', 'type': 'fax', 'value': get @, 'fax'}
]
note: get @, 'description'
links: [
* url: get @, 'website'
]
unless acc.data[obj.name]?
acc.data[obj.name] = obj
else
acc.data[obj.name] <<< obj
acc.count += 1
done acc
Organization Processor