gedcom-x 0.5.6__tar.gz → 0.5.8__tar.gz
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.
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/PKG-INFO +1 -1
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/gedcom_x.egg-info/PKG-INFO +1 -1
- gedcom_x-0.5.8/gedcom_x.egg-info/SOURCES.txt +88 -0
- gedcom_x-0.5.8/gedcomx/Extensions/__init__.py +1 -0
- gedcom_x-0.5.8/gedcomx/Extensions/rs10/__init__.py +1 -0
- gedcom_x-0.5.8/gedcomx/Extensions/rs10/rsLink.py +116 -0
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/gedcomx/TopLevelTypeCollection.py +1 -1
- gedcom_x-0.5.8/gedcomx/__init__.py +50 -0
- gedcom_x-0.5.6/gedcomx/Address.py → gedcom_x-0.5.8/gedcomx/address.py +13 -13
- gedcom_x-0.5.6/gedcomx/Agent.py → gedcom_x-0.5.8/gedcomx/agent.py +52 -24
- gedcom_x-0.5.6/gedcomx/Attribution.py → gedcom_x-0.5.8/gedcomx/attribution.py +36 -9
- gedcom_x-0.5.6/gedcomx/Conclusion.py → gedcom_x-0.5.8/gedcomx/conclusion.py +49 -21
- gedcom_x-0.5.8/gedcomx/converter.py +1049 -0
- gedcom_x-0.5.8/gedcomx/coverage.py +55 -0
- gedcom_x-0.5.6/gedcomx/Date.py → gedcom_x-0.5.8/gedcomx/date.py +11 -4
- gedcom_x-0.5.6/gedcomx/Document.py → gedcom_x-0.5.8/gedcomx/document.py +27 -8
- gedcom_x-0.5.6/gedcomx/Event.py → gedcom_x-0.5.8/gedcomx/event.py +102 -27
- gedcom_x-0.5.6/gedcomx/EvidenceReference.py → gedcom_x-0.5.8/gedcomx/evidence_reference.py +2 -2
- gedcom_x-0.5.6/gedcomx/Fact.py → gedcom_x-0.5.8/gedcomx/fact.py +45 -34
- gedcom_x-0.5.6/gedcomx/Gedcom5x.py → gedcom_x-0.5.8/gedcomx/gedcom5x.py +78 -61
- gedcom_x-0.5.8/gedcomx/gedcom7/Exceptions.py +9 -0
- gedcom_x-0.5.8/gedcomx/gedcom7/Gedcom7.py +160 -0
- gedcom_x-0.5.8/gedcomx/gedcom7/GedcomStructure.py +94 -0
- gedcom_x-0.5.8/gedcomx/gedcom7/Specification.py +347 -0
- gedcom_x-0.5.8/gedcomx/gedcom7/__init__.py +26 -0
- gedcom_x-0.5.8/gedcomx/gedcom7/g7interop.py +205 -0
- gedcom_x-0.5.8/gedcomx/gedcom7/logger.py +19 -0
- gedcom_x-0.5.8/gedcomx/gedcomx.py +501 -0
- gedcom_x-0.5.6/gedcomx/Gender.py → gedcom_x-0.5.8/gedcomx/gender.py +29 -17
- gedcom_x-0.5.8/gedcomx/group.py +63 -0
- gedcom_x-0.5.6/gedcomx/Identifier.py → gedcom_x-0.5.8/gedcomx/identifier.py +13 -16
- gedcom_x-0.5.6/gedcomx/LoggingHub.py → gedcom_x-0.5.8/gedcomx/logging_hub.py +21 -0
- gedcom_x-0.5.6/gedcomx/Mutations.py → gedcom_x-0.5.8/gedcomx/mutations.py +50 -26
- gedcom_x-0.5.8/gedcomx/name.py +396 -0
- gedcom_x-0.5.6/gedcomx/Note.py → gedcom_x-0.5.8/gedcomx/note.py +17 -10
- gedcom_x-0.5.6/gedcomx/OnlineAccount.py → gedcom_x-0.5.8/gedcomx/online_account.py +1 -1
- gedcom_x-0.5.6/gedcomx/Person.py → gedcom_x-0.5.8/gedcomx/person.py +52 -29
- gedcom_x-0.5.8/gedcomx/place_description.py +123 -0
- gedcom_x-0.5.8/gedcomx/place_reference.py +62 -0
- gedcom_x-0.5.8/gedcomx/qualifier.py +54 -0
- gedcom_x-0.5.6/gedcomx/Relationship.py → gedcom_x-0.5.8/gedcomx/relationship.py +33 -13
- gedcom_x-0.5.8/gedcomx/resource.py +85 -0
- gedcom_x-0.5.8/gedcomx/serialization.py +815 -0
- gedcom_x-0.5.6/gedcomx/SourceDescription.py → gedcom_x-0.5.8/gedcomx/source_description.py +144 -85
- gedcom_x-0.5.6/gedcomx/SourceReference.py → gedcom_x-0.5.8/gedcomx/source_reference.py +15 -14
- gedcom_x-0.5.6/gedcomx/Subject.py → gedcom_x-0.5.8/gedcomx/subject.py +30 -28
- gedcom_x-0.5.6/gedcomx/GedcomX.py → gedcom_x-0.5.8/gedcomx/translation.py +283 -446
- gedcom_x-0.5.6/gedcomx/URI.py → gedcom_x-0.5.8/gedcomx/uri.py +42 -26
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/pyproject.toml +4 -2
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/setup.py +1 -1
- gedcom_x-0.5.6/gedcom_x.egg-info/SOURCES.txt +0 -48
- gedcom_x-0.5.6/gedcomx/Coverage.py +0 -36
- gedcom_x-0.5.6/gedcomx/Group.py +0 -37
- gedcom_x-0.5.6/gedcomx/Name.py +0 -276
- gedcom_x-0.5.6/gedcomx/PlaceDescription.py +0 -70
- gedcom_x-0.5.6/gedcomx/PlaceReference.py +0 -30
- gedcom_x-0.5.6/gedcomx/Qualifier.py +0 -27
- gedcom_x-0.5.6/gedcomx/Resource.py +0 -75
- gedcom_x-0.5.6/gedcomx/Serialization.py +0 -401
- gedcom_x-0.5.6/gedcomx/Translation.py +0 -219
- gedcom_x-0.5.6/gedcomx/__init__.py +0 -48
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/README.md +0 -0
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/gedcom_x.egg-info/dependency_links.txt +0 -0
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/gedcom_x.egg-info/top_level.txt +0 -0
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/gedcomx/Logging.py +0 -0
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/gedcomx/Zip.py +0 -0
- /gedcom_x-0.5.6/gedcomx/Exceptions.py → /gedcom_x-0.5.8/gedcomx/exceptions.py +0 -0
- /gedcom_x-0.5.6/gedcomx/ExtensibleEnum.py → /gedcom_x-0.5.8/gedcomx/extensible_enum.py +0 -0
- /gedcom_x-0.5.6/gedcomx/Gedcom.py → /gedcom_x-0.5.8/gedcomx/gedcom.py +0 -0
- /gedcom_x-0.5.6/gedcomx/SourceCitation.py → /gedcom_x-0.5.8/gedcomx/source_citation.py +0 -0
- /gedcom_x-0.5.6/gedcomx/TextValue.py → /gedcom_x-0.5.8/gedcomx/textvalue.py +0 -0
- {gedcom_x-0.5.6 → gedcom_x-0.5.8}/setup.cfg +0 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
README.md
|
2
|
+
pyproject.toml
|
3
|
+
setup.py
|
4
|
+
gedcom_x.egg-info/PKG-INFO
|
5
|
+
gedcom_x.egg-info/SOURCES.txt
|
6
|
+
gedcom_x.egg-info/dependency_links.txt
|
7
|
+
gedcom_x.egg-info/top_level.txt
|
8
|
+
gedcomx/Address.py
|
9
|
+
gedcomx/Agent.py
|
10
|
+
gedcomx/Attribution.py
|
11
|
+
gedcomx/Conclusion.py
|
12
|
+
gedcomx/Converter.py
|
13
|
+
gedcomx/Coverage.py
|
14
|
+
gedcomx/Date.py
|
15
|
+
gedcomx/Document.py
|
16
|
+
gedcomx/Event.py
|
17
|
+
gedcomx/Exceptions.py
|
18
|
+
gedcomx/Fact.py
|
19
|
+
gedcomx/Gedcom.py
|
20
|
+
gedcomx/Gedcom5x.py
|
21
|
+
gedcomx/GedcomX.py
|
22
|
+
gedcomx/Gender.py
|
23
|
+
gedcomx/Group.py
|
24
|
+
gedcomx/Identifier.py
|
25
|
+
gedcomx/Logging.py
|
26
|
+
gedcomx/Mutations.py
|
27
|
+
gedcomx/Name.py
|
28
|
+
gedcomx/Note.py
|
29
|
+
gedcomx/Person.py
|
30
|
+
gedcomx/Qualifier.py
|
31
|
+
gedcomx/Relationship.py
|
32
|
+
gedcomx/Resource.py
|
33
|
+
gedcomx/Serialization.py
|
34
|
+
gedcomx/Subject.py
|
35
|
+
gedcomx/TextValue.py
|
36
|
+
gedcomx/TopLevelTypeCollection.py
|
37
|
+
gedcomx/Translation.py
|
38
|
+
gedcomx/URI.py
|
39
|
+
gedcomx/Zip.py
|
40
|
+
gedcomx/__init__.py
|
41
|
+
gedcomx/address.py
|
42
|
+
gedcomx/agent.py
|
43
|
+
gedcomx/attribution.py
|
44
|
+
gedcomx/conclusion.py
|
45
|
+
gedcomx/converter.py
|
46
|
+
gedcomx/coverage.py
|
47
|
+
gedcomx/date.py
|
48
|
+
gedcomx/document.py
|
49
|
+
gedcomx/event.py
|
50
|
+
gedcomx/evidence_reference.py
|
51
|
+
gedcomx/exceptions.py
|
52
|
+
gedcomx/extensible_enum.py
|
53
|
+
gedcomx/fact.py
|
54
|
+
gedcomx/gedcom.py
|
55
|
+
gedcomx/gedcom5x.py
|
56
|
+
gedcomx/gedcomx.py
|
57
|
+
gedcomx/gender.py
|
58
|
+
gedcomx/group.py
|
59
|
+
gedcomx/identifier.py
|
60
|
+
gedcomx/logging_hub.py
|
61
|
+
gedcomx/mutations.py
|
62
|
+
gedcomx/name.py
|
63
|
+
gedcomx/note.py
|
64
|
+
gedcomx/online_account.py
|
65
|
+
gedcomx/person.py
|
66
|
+
gedcomx/place_description.py
|
67
|
+
gedcomx/place_reference.py
|
68
|
+
gedcomx/qualifier.py
|
69
|
+
gedcomx/relationship.py
|
70
|
+
gedcomx/resource.py
|
71
|
+
gedcomx/serialization.py
|
72
|
+
gedcomx/source_citation.py
|
73
|
+
gedcomx/source_description.py
|
74
|
+
gedcomx/source_reference.py
|
75
|
+
gedcomx/subject.py
|
76
|
+
gedcomx/textvalue.py
|
77
|
+
gedcomx/translation.py
|
78
|
+
gedcomx/uri.py
|
79
|
+
gedcomx/Extensions/__init__.py
|
80
|
+
gedcomx/Extensions/rs10/__init__.py
|
81
|
+
gedcomx/Extensions/rs10/rsLink.py
|
82
|
+
gedcomx/gedcom7/Exceptions.py
|
83
|
+
gedcomx/gedcom7/Gedcom7.py
|
84
|
+
gedcomx/gedcom7/GedcomStructure.py
|
85
|
+
gedcomx/gedcom7/Specification.py
|
86
|
+
gedcomx/gedcom7/__init__.py
|
87
|
+
gedcomx/gedcom7/g7interop.py
|
88
|
+
gedcomx/gedcom7/logger.py
|
@@ -0,0 +1 @@
|
|
1
|
+
from .rs10 import rsLink
|
@@ -0,0 +1 @@
|
|
1
|
+
from .rsLink import rsLink
|
@@ -0,0 +1,116 @@
|
|
1
|
+
'''
|
2
|
+
The "Link" Data Type
|
3
|
+
The Link data type defines a representation of an available transition from one application state to another.
|
4
|
+
The base definition of a link is provided by RFC 5988.
|
5
|
+
|
6
|
+
Instances of Link can be reasonably expected as extension elements to any GEDCOM X data type,
|
7
|
+
except data types that are defined by the GEDCOM X Conceptual Model to explicitly restrict extension properties.
|
8
|
+
'''
|
9
|
+
|
10
|
+
'''
|
11
|
+
8/25/25, 0.5.5, built serialization, type checking in init for href
|
12
|
+
'''
|
13
|
+
|
14
|
+
from typing import List, Optional
|
15
|
+
from ...uri import URI
|
16
|
+
from ...exceptions import GedcomClassAttributeError
|
17
|
+
|
18
|
+
|
19
|
+
class rsLink():
|
20
|
+
"""A link description object. RS Extension to GedcomX by FamilySearch.
|
21
|
+
|
22
|
+
Args:
|
23
|
+
rel (str): Link relation identifier. Required.
|
24
|
+
href (str, optional): Link target URI. If omitted, provide `template`.
|
25
|
+
template (str, optional): URI Template (see RFC 6570). If omitted, provide `href`.
|
26
|
+
type (str, optional): Media type(s) of the linked resource (RFC 2616 §3.7).
|
27
|
+
accept (str, optional): Acceptable media type(s) for updating the linked resource (RFC 2616 §3.7).
|
28
|
+
allow (str, optional): Allowable HTTP methods to transition to the linked resource (RFC 2616 §14.7).
|
29
|
+
hreflang (str, optional): Language of the linked resource (e.g., BCP-47 tag).
|
30
|
+
title (str, optional): Human-readable label for the link.
|
31
|
+
|
32
|
+
Raises:
|
33
|
+
ValueError: If neither `href` nor `template` is provided.
|
34
|
+
"""
|
35
|
+
|
36
|
+
"""Attribution Information for a Genealogy, Conclusion, Subject and child classes
|
37
|
+
|
38
|
+
Args:
|
39
|
+
contributor (Agent, optional): Contributor to object being attributed.
|
40
|
+
modified (timestamp, optional): timestamp for when this record was modified.
|
41
|
+
changeMessage (str, optional): Birth date (YYYY-MM-DD).
|
42
|
+
creator (Agent, optional): Creator of object being attributed.
|
43
|
+
created (timestamp, optional): timestamp for when this record was created
|
44
|
+
|
45
|
+
Raises:
|
46
|
+
|
47
|
+
"""
|
48
|
+
identifier = "http://gedcomx.org/v1/Link"
|
49
|
+
|
50
|
+
def __init__(self,rel: Optional[URI] = None,
|
51
|
+
href: Optional[URI] = None,
|
52
|
+
template: Optional[str] = None,
|
53
|
+
type: Optional[str] = None,
|
54
|
+
accept: Optional[str] = None,
|
55
|
+
allow: Optional[str] = None,
|
56
|
+
hreflang: Optional[str] = None,
|
57
|
+
title: Optional[str] = None) -> None:
|
58
|
+
|
59
|
+
self.rel = rel
|
60
|
+
self.href = href if isinstance(href,URI) else URI.from_url(href) if isinstance(href,str) else None
|
61
|
+
self.template = template
|
62
|
+
self.type = type
|
63
|
+
self.accept = accept
|
64
|
+
self.allow = allow
|
65
|
+
self.hreflang = hreflang
|
66
|
+
self.title = title
|
67
|
+
|
68
|
+
if self.href is None and self.template is None:
|
69
|
+
raise GedcomClassAttributeError("href or template are required")
|
70
|
+
|
71
|
+
@property
|
72
|
+
def _as_dict_(self):
|
73
|
+
from ...serialization import Serialization
|
74
|
+
type_as_dict = {
|
75
|
+
"rel": self.rel._as_dict_ if self.rel else None,
|
76
|
+
"href": self.href._as_dict_ if self.href else None,
|
77
|
+
"template": self.template, # RFC 6570 template if used
|
78
|
+
"type": self.type, # media type (note: shadows built-in 'type')
|
79
|
+
"accept": self.accept,
|
80
|
+
"allow": self.allow,
|
81
|
+
"hreflang": self.hreflang,
|
82
|
+
"title": self.title,
|
83
|
+
}
|
84
|
+
return Serialization.serialize_dict(type_as_dict)
|
85
|
+
|
86
|
+
@property
|
87
|
+
def json(self):
|
88
|
+
import json
|
89
|
+
return json.dumps(self._as_dict_)
|
90
|
+
|
91
|
+
class _rsLinkList():
|
92
|
+
def __init__(self) -> None:
|
93
|
+
self.links = {}
|
94
|
+
|
95
|
+
def add(self,link: rsLink):
|
96
|
+
if link and isinstance(link,rsLink):
|
97
|
+
if link.rel in self.links.keys():
|
98
|
+
self.links[link.rel].append(link.href)
|
99
|
+
else:
|
100
|
+
self.links[link.rel] = [link.href]
|
101
|
+
|
102
|
+
|
103
|
+
@classmethod
|
104
|
+
def _from_json_(cls,data: dict):
|
105
|
+
|
106
|
+
link_list = _rsLinkList()
|
107
|
+
for rel in data.keys():
|
108
|
+
link_list.add(rsLink(rel,data[rel]))
|
109
|
+
return link_list
|
110
|
+
|
111
|
+
@property
|
112
|
+
def _as_dict_(self) -> dict:
|
113
|
+
return self.links
|
114
|
+
|
115
|
+
|
116
|
+
|
@@ -0,0 +1,50 @@
|
|
1
|
+
from .agent import Agent
|
2
|
+
from .address import Address
|
3
|
+
from .attribution import Attribution
|
4
|
+
from .conclusion import Conclusion
|
5
|
+
from .converter import GedcomConverter
|
6
|
+
from .coverage import Coverage
|
7
|
+
from .date import Date
|
8
|
+
from .document import Document
|
9
|
+
from .document import DocumentType
|
10
|
+
from .evidence_reference import EvidenceReference
|
11
|
+
from .extensible_enum import ExtensibleEnum
|
12
|
+
from .event import Event
|
13
|
+
from .event import EventType
|
14
|
+
from .event import EventRole
|
15
|
+
from .fact import Fact
|
16
|
+
from .fact import FactQualifier
|
17
|
+
from .fact import FactType
|
18
|
+
from .gedcom import Gedcom
|
19
|
+
from .gedcom5x import Gedcom5x, Gedcom5xRecord
|
20
|
+
from .gedcomx import GedcomX
|
21
|
+
from .gender import Gender, GenderType
|
22
|
+
from .group import Group, GroupRole
|
23
|
+
from .identifier import Identifier, IdentifierType, IdentifierList
|
24
|
+
from .Logging import get_logger
|
25
|
+
from .name import Name, NameForm, NamePart, NamePartType, NameType, NamePartQualifier
|
26
|
+
from .note import Note
|
27
|
+
from .online_account import OnlineAccount
|
28
|
+
from .person import Person, QuickPerson
|
29
|
+
from .place_description import PlaceDescription
|
30
|
+
from .place_reference import PlaceReference
|
31
|
+
from .qualifier import Qualifier
|
32
|
+
from .relationship import Relationship, RelationshipType
|
33
|
+
from .serialization import Serialization
|
34
|
+
from .source_citation import SourceCitation
|
35
|
+
from .source_description import SourceDescription
|
36
|
+
from .source_description import ResourceType
|
37
|
+
from .source_reference import SourceReference
|
38
|
+
from .subject import Subject
|
39
|
+
from .textvalue import TextValue
|
40
|
+
from .resource import Resource
|
41
|
+
from .uri import URI
|
42
|
+
|
43
|
+
|
44
|
+
from .Extensions.rs10.rsLink import rsLink
|
45
|
+
|
46
|
+
from .gedcom7.Gedcom7 import Gedcom7, GedcomStructure
|
47
|
+
from .translation import g7toXtable
|
48
|
+
|
49
|
+
|
50
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import Optional
|
2
2
|
import json
|
3
3
|
|
4
|
-
|
4
|
+
|
5
5
|
|
6
6
|
class Address:
|
7
7
|
"""A GedcomX Address Data Type
|
@@ -113,18 +113,18 @@ class Address:
|
|
113
113
|
|
114
114
|
@property
|
115
115
|
def _as_dict_(self):
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
116
|
+
from .serialization import Serialization
|
117
|
+
type_as_dict = {}
|
118
|
+
if self.city: type_as_dict["city"] = self.city
|
119
|
+
if self.country: type_as_dict["country"] = self.country
|
120
|
+
if self.postalCode: type_as_dict["postalCode"] = self.postalCode
|
121
|
+
if self.stateOrProvince: type_as_dict["stateOrProvince"] = self.stateOrProvince
|
122
|
+
if self.street: type_as_dict["street"] = self.street
|
123
|
+
if self.street2: type_as_dict["street2"] = self.street2
|
124
|
+
if self.street3: type_as_dict["street3"] = self.street3
|
125
|
+
if self.street4: type_as_dict["street4"] = self.street4
|
126
|
+
if self.street5: type_as_dict["street5"] = self.street5
|
127
|
+
if self.street6: type_as_dict["street6"] = self.street6
|
128
128
|
|
129
129
|
return Serialization.serialize_dict(type_as_dict)
|
130
130
|
|
@@ -2,16 +2,31 @@ import base64
|
|
2
2
|
import uuid
|
3
3
|
|
4
4
|
from typing import List, Optional
|
5
|
+
"""
|
6
|
+
======================================================================
|
7
|
+
Project: Gedcom-X
|
8
|
+
File: agent.py
|
9
|
+
Author: David J. Cartwright
|
10
|
+
Purpose:
|
5
11
|
|
6
|
-
|
7
|
-
|
8
|
-
|
12
|
+
Created: 2025-08-25
|
13
|
+
Updated:
|
14
|
+
-
|
15
|
+
|
16
|
+
======================================================================
|
17
|
+
"""
|
9
18
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
19
|
+
"""
|
20
|
+
======================================================================
|
21
|
+
GEDCOM Module Type Imports
|
22
|
+
======================================================================
|
23
|
+
"""
|
24
|
+
from .address import Address
|
25
|
+
from .identifier import Identifier, IdentifierList
|
26
|
+
from .online_account import OnlineAccount
|
27
|
+
from .resource import Resource
|
28
|
+
from .textvalue import TextValue
|
29
|
+
from .uri import URI
|
15
30
|
|
16
31
|
|
17
32
|
class Agent:
|
@@ -82,9 +97,10 @@ class Agent:
|
|
82
97
|
self.emails = emails or []
|
83
98
|
self.phones = phones or []
|
84
99
|
self.addresses = addresses if addresses else []
|
100
|
+
self.person = person
|
85
101
|
self.xnotes = []
|
86
102
|
self.attribution = attribution or None
|
87
|
-
self.uri = URI(fragment=self.id)
|
103
|
+
self.uri = URI(fragment=self.id) if self.id else None
|
88
104
|
|
89
105
|
def _append_to_name(self, text_to_append: str):
|
90
106
|
if self.names and self.names[0] and self.names[0].value:
|
@@ -113,8 +129,8 @@ class Agent:
|
|
113
129
|
else:
|
114
130
|
raise ValueError(f'name must be of type str or TextValue, recived {type(name_to_add)}')
|
115
131
|
|
116
|
-
def add_note(self, note_to_add
|
117
|
-
from .
|
132
|
+
def add_note(self, note_to_add):
|
133
|
+
from .note import Note
|
118
134
|
if note_to_add and isinstance(note_to_add,Note):
|
119
135
|
self.xnotes.append(note_to_add)
|
120
136
|
else:
|
@@ -125,18 +141,29 @@ class Agent:
|
|
125
141
|
|
126
142
|
@property
|
127
143
|
def _as_dict_(self):
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
"
|
133
|
-
|
134
|
-
"
|
135
|
-
|
136
|
-
"
|
137
|
-
|
138
|
-
"
|
139
|
-
|
144
|
+
from .serialization import Serialization
|
145
|
+
type_as_dict = {}
|
146
|
+
|
147
|
+
if self.id:
|
148
|
+
type_as_dict["id"] = self.id
|
149
|
+
if self.identifiers:
|
150
|
+
type_as_dict["identifiers"] = self.identifiers._as_dict_
|
151
|
+
if self.names:
|
152
|
+
type_as_dict["names"] = [name._as_dict_ for name in self.names if name]
|
153
|
+
if self.homepage:
|
154
|
+
type_as_dict["homepage"] = self.homepage
|
155
|
+
if self.openid:
|
156
|
+
type_as_dict["openid"] = self.openid
|
157
|
+
if self.accounts:
|
158
|
+
type_as_dict["accounts"] = self.accounts
|
159
|
+
if self.emails:
|
160
|
+
type_as_dict["emails"] = self.emails
|
161
|
+
if self.phones:
|
162
|
+
type_as_dict["phones"] = self.phones
|
163
|
+
if self.addresses:
|
164
|
+
type_as_dict["addresses"] = [address._as_dict_ for address in self.addresses if address]
|
165
|
+
if self.xnotes:
|
166
|
+
type_as_dict["notes"] = [note._as_dict_() for note in self.xnotes if note]
|
140
167
|
return Serialization.serialize_dict(type_as_dict)
|
141
168
|
|
142
169
|
@classmethod
|
@@ -144,8 +171,9 @@ class Agent:
|
|
144
171
|
"""
|
145
172
|
Create a Person instance from a JSON-dict (already parsed).
|
146
173
|
"""
|
174
|
+
from .serialization import Serialization
|
147
175
|
type_as_dict = Serialization.get_class_fields('Agent')
|
148
|
-
return Serialization.deserialize(
|
176
|
+
return Serialization.deserialize(type_as_dict,Agent)
|
149
177
|
|
150
178
|
def __str__(self):
|
151
179
|
"""
|
@@ -2,9 +2,30 @@
|
|
2
2
|
from datetime import datetime
|
3
3
|
from typing import Optional, Dict, Any
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
"""
|
6
|
+
======================================================================
|
7
|
+
Project: Gedcom-X
|
8
|
+
File: Attribution.py
|
9
|
+
Author: David J. Cartwright
|
10
|
+
Purpose:
|
11
|
+
|
12
|
+
Created: 2025-08-25
|
13
|
+
Updated:
|
14
|
+
- 2025-08-31: fixed _as_dict_ to deal with Resources and ignore empty fields
|
15
|
+
|
16
|
+
======================================================================
|
17
|
+
"""
|
18
|
+
|
19
|
+
"""
|
20
|
+
======================================================================
|
21
|
+
GEDCOM Module Types
|
22
|
+
======================================================================
|
23
|
+
"""
|
24
|
+
|
25
|
+
from .agent import Agent
|
26
|
+
from .resource import Resource
|
27
|
+
#=====================================================================
|
28
|
+
|
8
29
|
|
9
30
|
class Attribution:
|
10
31
|
"""Attribution Information for a Genealogy, Conclusion, Subject and child classes
|
@@ -39,12 +60,18 @@ class Attribution:
|
|
39
60
|
"""
|
40
61
|
Serialize Attribution to a JSON-ready dict, skipping None values.
|
41
62
|
"""
|
63
|
+
from Serialization import Serialization
|
42
64
|
type_as_dict: Dict[str, Any] = {}
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
65
|
+
if self.contributor:
|
66
|
+
type_as_dict['contributor'] = Resource(target=self.contributor)._as_dict_
|
67
|
+
if self.modified:
|
68
|
+
type_as_dict['modified'] = self.modified if self.modified else None
|
69
|
+
if self.changeMessage:
|
70
|
+
type_as_dict['changeMessage'] = self.changeMessage if self.changeMessage else None
|
71
|
+
if self.creator:
|
72
|
+
type_as_dict['creator'] = Resource(target=self.creator)._as_dict_
|
73
|
+
if self.created:
|
74
|
+
type_as_dict['created'] = self.created if self.created else None
|
48
75
|
|
49
76
|
return Serialization.serialize_dict(type_as_dict)
|
50
77
|
|
@@ -59,6 +86,6 @@ class Attribution:
|
|
59
86
|
"""
|
60
87
|
Create a Person instance from a JSON-dict (already parsed).
|
61
88
|
"""
|
62
|
-
from .
|
89
|
+
from .serialization import Serialization
|
63
90
|
|
64
91
|
return Serialization.deserialize(data, Attribution)
|
@@ -3,17 +3,34 @@ import uuid
|
|
3
3
|
import warnings
|
4
4
|
|
5
5
|
from typing import List, Optional
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
"""
|
7
|
+
======================================================================
|
8
|
+
Project: Gedcom-X
|
9
|
+
File: conclusion.py
|
10
|
+
Author: David J. Cartwright
|
11
|
+
Purpose:
|
12
|
+
|
13
|
+
Created: 2025-08-25
|
14
|
+
Updated:
|
15
|
+
-
|
16
|
+
|
17
|
+
======================================================================
|
18
|
+
"""
|
19
|
+
|
20
|
+
"""
|
21
|
+
======================================================================
|
22
|
+
GEDCOM Module Type Imports
|
23
|
+
======================================================================
|
24
|
+
"""
|
25
|
+
from .attribution import Attribution
|
14
26
|
from .Extensions.rs10.rsLink import _rsLinkList, rsLink
|
27
|
+
from .note import Note
|
28
|
+
from .qualifier import Qualifier
|
29
|
+
from .resource import Resource, URI
|
30
|
+
from .source_reference import SourceReference
|
31
|
+
|
32
|
+
|
15
33
|
|
16
|
-
from collections.abc import Sized
|
17
34
|
|
18
35
|
class ConfidenceLevel(Qualifier):
|
19
36
|
High = "http://gedcomx.org/High"
|
@@ -96,7 +113,7 @@ class Conclusion:
|
|
96
113
|
Args:
|
97
114
|
id (str, optional): A unique identifier for the conclusion. If not provided,
|
98
115
|
a UUID-based identifier will be automatically generated.
|
99
|
-
lang (str, optional): The language code of the conclusion.
|
116
|
+
lang (str, optional): The language code of the conclusion.
|
100
117
|
sources (list[SourceReference], optional): A list of source references that
|
101
118
|
support the conclusion.
|
102
119
|
analysis (Document | Resource, optional): A reference to an analysis document
|
@@ -127,7 +144,7 @@ class Conclusion:
|
|
127
144
|
|
128
145
|
def __init__(self,
|
129
146
|
id: Optional[str] = None,
|
130
|
-
lang: Optional[str] =
|
147
|
+
lang: Optional[str] = None,
|
131
148
|
sources: Optional[List[SourceReference]] = None,
|
132
149
|
analysis: Optional[object | Resource] = None,
|
133
150
|
notes: Optional[List[Note]] = None,
|
@@ -188,16 +205,27 @@ class Conclusion:
|
|
188
205
|
|
189
206
|
@property
|
190
207
|
def _as_dict_(self):
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
'
|
196
|
-
|
197
|
-
'
|
198
|
-
|
199
|
-
'
|
200
|
-
|
208
|
+
from .serialization import Serialization
|
209
|
+
type_as_dict = {}
|
210
|
+
|
211
|
+
if self.id:
|
212
|
+
type_as_dict['id'] = self.id
|
213
|
+
if self.lang:
|
214
|
+
type_as_dict['lang'] = self.lang
|
215
|
+
if self.sources:
|
216
|
+
type_as_dict['sources'] = [s._as_dict_ for s in self.sources if s]
|
217
|
+
if self.analysis:
|
218
|
+
type_as_dict['analysis'] = getattr(self.analysis, '_as_dict_', self.analysis)
|
219
|
+
if self.notes:
|
220
|
+
type_as_dict['notes'] = [
|
221
|
+
(n._as_dict_ if hasattr(n, '_as_dict_') else n) for n in self.notes if n
|
222
|
+
]
|
223
|
+
if self.confidence is not None:
|
224
|
+
type_as_dict['confidence'] = self.confidence
|
225
|
+
if self.attribution:
|
226
|
+
type_as_dict['attribution'] = getattr(self.attribution, '_as_dict_', self.attribution)
|
227
|
+
if self.links:
|
228
|
+
type_as_dict['links'] = self.links._as_dict_
|
201
229
|
|
202
230
|
return Serialization.serialize_dict(type_as_dict)
|
203
231
|
|