Skip to content

Instantly share code, notes, and snippets.

@max-mapper
Last active August 29, 2015 14:04
Show Gist options
  • Save max-mapper/80de2ba6a6f52ff382e3 to your computer and use it in GitHub Desktop.
Save max-mapper/80de2ba6a6f52ff382e3 to your computer and use it in GitHub Desktop.
fcc-ecfs to dat importer
1. install dat@master

git clone https://github.com/maxogden/dat.git
cd dat
npm install
npm link

2. make a new empty dat repo in some folder
cd some_folder
dat init

3. put package.json from this gist into some folder, then
npm install
npm start
{
"name": "fcc-ecfs",
"version": "1.0.0",
"gasket": {
"main": [
"gasket run import -- http://www.fcc.gov/files/ecfs/14-28/14-28-RAW-Solr-1.xml",
null,
"gasket run import -- http://www.fcc.gov/files/ecfs/14-28/14-28-RAW-Solr-2.xml",
null,
"gasket run import -- http://www.fcc.gov/files/ecfs/14-28/14-28-RAW-Solr-3a.xml",
null,
"gasket run import -- http://www.fcc.gov/files/ecfs/14-28/14-28-RAW-Solr-3b.xml",
null,
"gasket run import -- http://www.fcc.gov/files/ecfs/14-28/14-28-RAW-Solr-4.xml",
null,
"gasket run import -- http://www.fcc.gov/files/ecfs/14-28/14-28-RAW-Solr-5.xml"
],
"import": [
"curl $1",
"xml-json doc",
"jsonmap \"var self = this; this.arr.map(function(a){ self[a.name] = a; delete self[a.name].name; }); delete this.arr; this.score = this.float._; delete this.float; Object.keys(this).map(function(k) { if (typeof self[k] === 'string') return; var type = Object.keys(self[k])[0]; self[k] = self[k][type] })\"",
"dat import --json --primary=id"
]
},
"scripts": {
"start": "gasket run"
},
"dependencies": {
"gasket": "^1.2.2",
"jsonmap": "^1.1.1",
"xml-json": "^2.0.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment