Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement : dict of Record to support quick references #37

Open
ukgenes opened this issue Apr 25, 2021 · 2 comments
Open

Enhancement : dict of Record to support quick references #37

ukgenes opened this issue Apr 25, 2021 · 2 comments

Comments

@ukgenes
Copy link

ukgenes commented Apr 25, 2021

  • GEDCOM parser for Python version:
  • Python version:
  • Operating System:

Description

Enhancement: produce a dict of Records to support single record reference and pointer decoding

Could also make some minor rework to final refresh to allow pointer references to resolve using this dict

Would like to add records thru a UI ... preferably would auto connect xref_id independent of which is added first
i.e. source or target

What I Did

class Record
pointer = {}

def make_record( ...
...
if rec.xref_id != None:
Record.pointer(rec.xref_id) = rec


can then reference any Record as Record.pointer[xref_id] ...

@ukgenes ukgenes changed the title Enhancement Enhancement : dict of Record to support quick references Apr 25, 2021
@ukgenes
Copy link
Author

ukgenes commented May 2, 2021

Andy ... thx for the other changes ...
the code you didn't understand was my experimenting and is more properly

Record.pointer['@i293@'].subtag("CENS/DATE")

allowing direct access to both a record and any pointers that refer to it

....

The other idea would be to have a root Record that has the other records as sub_tags using a dict instead of a list? sounds a bit messy ...

@andy-z
Copy link
Owner

andy-z commented May 2, 2021

@ukgenes, I am not quite sure what do you want to achieve here. ged4py relies heavily on an assumption that all records come from a single GEDCOM file. "Adding" the records that are not from the same file or just were created by yourself is not supported, and it would require significant change in infrastructure to support it (but I have not heard of any request yet to support it). ged4py is not a generic editing tool for GEDCOM data, it's only a parser, For editing and saving data you probably need something more advanced.

If what you are doing works for you you can continue doing it, and you do not really need pointer dictionary to be a member of Record - it can be any global variable. Or if I am misunderstanding what you want please explain it with more specific examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants