Node.js project to parse a gedcom file and generate a graph database with the contents. Currently targeting neo4j only.
This script must be run on the machine that hosts both the neo4j database and the gedcom file you want to import. It does bulk local import because importing records over the network to neo4j is excruciatingly slow. The import time dropped from crashing after 15 minutes to taking around 6 seconds on a rather large gedcom file (~145MB).
-s --src - path to the gedcom file to be parsed (default: read from STDIN)
-d --dest - path to neo4j's data folder (i.e. /var/lib/neo4j/data/graph.db)
-b --bindir - path to neo4j's bin folder (i.e. /usr/local/bin)
-v --verbose - show debug level output
-t --tmpdir - temporary location for intermediate CSV files (default: /tmp/ged2neo-csvs)
-q --quiet - suppress all output apart from error messages
Specify everything:
node index.js -s gedcom.ged -d /path/to/neo4j/data/graph.db -b /path/to/neo4j/bin
Or read the gedcom file from STDIN:
node index.js -d /path/to/neo4j/data/graph.db -b /path/to/neo4j/bin < gedcom.ged
Use default system paths for neo4j binaries:
node index.js -s gedcom.ged -d /path/to/neo4j/data/graph.db
Use default system path for neo4j's data folder:
node index.js -s gedcom.ged -b /path/to/neo4j/bin
- Reads the gedcom file into a ReadStream
- Pipes that through gedcom-stream (https://github.com/connrs/gedcom-stream)
- Pipes that gedcom-stream into a WriteStream that then pipes to multiple fast-csv streams (https://github.com/)
- one stream per record type (INDI, FAM, etc)
- Uses neo4j-import to bulk import those generated CSV files into a temporary folder
- Stops neo4j
- Backs up the old neo4j database.
- Moves the temp folder into the neo4j database.
- Starts neo4j again
If something fails between steps 5 and 8, the backup is moved back into place, so it's as if nothing happened.
- Profile the CVS writer and figure out why it takes the bulk of the time.
- Add tests
- Automatically run tests in Travis CI on PR
- Add indexes to generated nodes
- Convert dates to more useful format