gedcom-d3 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -7
- package/d3ize.js +553 -556
- package/package.json +35 -35
package/README.md
CHANGED
|
@@ -1,19 +1,141 @@
|
|
|
1
1
|
# gedcom-d3
|
|
2
|
-
Based on [tmcw/parse-gedcom](https://github.com/tmcw/parse-gedcom), this project seeks to improve d3ize functionality to make Gedom data in more fully-functional d3 capable JSON, specifically for use in plotting with [vasturiano/3d-force-graph](https://github.com/vasturiano/3d-force-graph).
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
A parser and converter for GEDCOM (.ged) files, producing D3-capable JSON for genealogy visualization, especially with [3d-force-graph](https://github.com/vasturiano/3d-force-graph).
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
- **Based on:** [tmcw/parse-gedcom](https://github.com/tmcw/parse-gedcom)
|
|
6
|
+
- **See it in action:** [oh-kay-blanket/blood-lines](https://github.com/oh-kay-blanket/blood-lines)
|
|
7
7
|
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```sh
|
|
8
13
|
npm install --save gedcom-d3
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
9
17
|
|
|
10
18
|
## API
|
|
11
19
|
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
### `parse(gedcomString)`
|
|
21
|
+
|
|
22
|
+
- **Input:** A string containing GEDCOM data.
|
|
23
|
+
- **Output:** An array of parsed GEDCOM objects (tree structure).
|
|
24
|
+
|
|
25
|
+
### `d3ize(tree)`
|
|
26
|
+
|
|
27
|
+
- **Input:** The output of `parse()` (GEDCOM tree array).
|
|
28
|
+
- **Output:** An object with the following structure:
|
|
29
|
+
- `nodes`: Array of person nodes, each with properties like `id`, `name`, `surname`, `gender`, `dob`, `yob`, `color`, `bio`, etc.
|
|
30
|
+
- `links`: Array of relationship links (parent/child, spouse, etc.), with `source`, `target`, and relationship type.
|
|
31
|
+
- `families`: Array of family groupings from the GEDCOM data.
|
|
32
|
+
- `surnameList`: Array of unique surnames with color assignments.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Usage Example
|
|
14
37
|
|
|
15
38
|
```javascript
|
|
16
|
-
import
|
|
39
|
+
import { parse, d3ize } from 'gedcom-d3'
|
|
40
|
+
import gedcomFile from './gedcoms/sample_ancestors.ged'
|
|
17
41
|
|
|
18
|
-
const
|
|
42
|
+
const tree = parse(gedcomFile)
|
|
43
|
+
const d3Data = d3ize(tree)
|
|
44
|
+
// d3Data.nodes and d3Data.links can be fed into 3d-force-graph or similar D3 visualizations
|
|
19
45
|
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Node & Link Structure
|
|
50
|
+
|
|
51
|
+
### Node (Person)
|
|
52
|
+
|
|
53
|
+
- `id`: Unique identifier (GEDCOM pointer)
|
|
54
|
+
- `name`: Full name
|
|
55
|
+
- `firstName`, `surname`: Parsed name parts
|
|
56
|
+
- `gender`: 'M' or 'F'
|
|
57
|
+
- `dob`, `yob`: Date/year of birth
|
|
58
|
+
- `dod`, `yod`: Date/year of death
|
|
59
|
+
- `pob`, `pod`: Place of birth/death
|
|
60
|
+
- `families`: Array of family objects
|
|
61
|
+
- `color`: Assigned color for surname
|
|
62
|
+
- `bio`: Biographical notes (if present)
|
|
63
|
+
- ...and more, depending on GEDCOM tags
|
|
64
|
+
|
|
65
|
+
### Link (Relationship)
|
|
66
|
+
|
|
67
|
+
- `source`: Source person `id`
|
|
68
|
+
- `target`: Target person `id`
|
|
69
|
+
- `sourceType`, `targetType`: Relationship roles (e.g., 'HUSB', 'WIFE', 'CHIL')
|
|
70
|
+
- `type`: Relationship type (e.g., 'MARR', 'DIV', or parentage)
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Updating & Publishing the NPM Package
|
|
75
|
+
|
|
76
|
+
### 1. Make your changes
|
|
77
|
+
|
|
78
|
+
- Edit code, update version in `package.json` (see [semver](https://semver.org/)).
|
|
79
|
+
|
|
80
|
+
### 2. Test locally (optional but recommended)
|
|
81
|
+
|
|
82
|
+
- In another project, run:
|
|
83
|
+
```sh
|
|
84
|
+
npm install /path/to/gedcom-d3
|
|
85
|
+
```
|
|
86
|
+
- Or use `npm link` for local development.
|
|
87
|
+
|
|
88
|
+
### 3. Commit and push your changes
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
git add .
|
|
92
|
+
git commit -m "Describe your changes"
|
|
93
|
+
git push
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 4. Bump the version
|
|
97
|
+
|
|
98
|
+
- For a patch, minor, or major update:
|
|
99
|
+
```sh
|
|
100
|
+
npm version patch # or 'minor' or 'major'
|
|
101
|
+
git push && git push --tags
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 5. Publish to NPM
|
|
105
|
+
|
|
106
|
+
- Log in if you haven't:
|
|
107
|
+
```sh
|
|
108
|
+
npm login
|
|
109
|
+
```
|
|
110
|
+
- Publish:
|
|
111
|
+
```sh
|
|
112
|
+
npm publish
|
|
113
|
+
```
|
|
114
|
+
- For scoped packages (not needed here):
|
|
115
|
+
```sh
|
|
116
|
+
npm publish --access public
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 6. Verify
|
|
120
|
+
|
|
121
|
+
- Check your package at [npmjs.com/package/gedcom-d3](https://www.npmjs.com/package/gedcom-d3)
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
ISC
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Contributing
|
|
132
|
+
|
|
133
|
+
Pull requests and issues welcome! See [oh-kay-blanket/gedcom-d3](https://github.com/oh-kay-blanket/gedcom-d3).
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Credits
|
|
138
|
+
|
|
139
|
+
- [tmcw/parse-gedcom](https://github.com/tmcw/parse-gedcom) for the original parser
|
|
140
|
+
- [vasturiano/3d-force-graph](https://github.com/vasturiano/3d-force-graph) for visualization inspiration
|
|
141
|
+
- [oh-kay-blanket/blood-lines](https://github.com/oh-kay-blanket/blood-lines) for implementation example
|