Whilst small files can be uploaded to forum posts, if you have a custom theme or module to contribute please add it on the "Add-ons" page.

TOPIC: Integrating with webtrees

Integrating with webtrees 7 months 1 week ago #1

  • PeWu
  • PeWu's Avatar
  • Offline
  • New
  • Posts: 12
Hi,

I created a small app that shows an interactive family tree similar to webtrees' interactive tree: pewu.github.io/topola-viewer

I'm wondering how I could integrate it with webtrees so that I could view the contents of a webtrees database through my app. The app loads a GEDCOM file to memory in the browser (without sending anything to the server) to show the family tree.

In general, I see 2 approaches to integration:
1. Create a webtrees module that embeds my app inside a webtrees page just like the existing interactive tree.
2. Make it possible to load the database from webtrees into my app which is currently hosted on GitHub pages.

I don't have any experience yet with developing modules for webtrees. I would guess that option (1) is easier because everything stays in the scope of webtrees and might be more appealing to users because they wouldn't leave the webtrees site.

Option (2), on the other hand, has the advantage that the Topola Viewer can be updated independently and users will get new features without having to update their webtrees installation.

In my app, I can pass a URL to a GEDCOM file to view the chart. However, I didn't find any URL that I could use as an API to get data from webtrees. There is this download link: http://.../admin_trees_download.php?action=download&ged=tree&privatize_export=none but I need to be authenticated as admin to call it. I could scrape the contents of the webtrees database by visiting individual pages one by one but it wouldn't be very efficient.

My question to the developer community here is: what do you think would be the best way to integrate?

Thank you for your help,
Przemek
The administrator has disabled public write access.

Integrating with webtrees 7 months 1 week ago #2

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Posts: 11536
A few quick thoughts.

Privacy calculations can be slow. Options such as "relationship privacy" also require a lot of memory.
On a large tree, it is just not possible to export the entire tree while using the privacy filters.
A more practical option might be to select just the ancestors and/or descendants of an individual.
Or maybe everyone within N relationship steps.

webtrees will have already parsed the GEDCOM data into a structured format.

Converting back to GEDCOM so that your app can parse it again seems very inefficient.
Perhaps it would be better to have webtrees convert the data to JSON?

Creating a module to add a chart like this should be pretty simple.

Presumbaly, your app just needs an HTML template, some CSS, JS and can run
from some JSON data.

Perhaps as you scroll around the tree, you can reload the JSON data for different
indivdiuals?
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net
The administrator has disabled public write access.

Integrating with webtrees 7 months 1 week ago #3

  • PeWu
  • PeWu's Avatar
  • Offline
  • New
  • Posts: 12
Thanks for the quick reply. This is very helpful.

You are right that I don't need the whole database at once. I could load just the visible part and load more on demand.

JSON is definitely more efficient than going through the GEDCOM format that I would need to parse anyway.

I'll try to make something work and I'll come back if I have more questions.
The administrator has disabled public write access.

Integrating with webtrees 6 months 3 weeks ago #4

  • PeWu
  • PeWu's Avatar
  • Offline
  • New
  • Posts: 12
Hi,

I started with what I found easiest to do. I am using FunctionsExport::exportGedcom() to produce the whole GEDCOM file. This is not optimal but was easiest to code.
You mentioned "relationship privacy" but I couldn't find in the code how it works. I only implemented this set of privacy options: {PRIV_PRIVATE (visitor), PRIV_USER (user), PRIV_NONE (gedadmin)}.

Here is the code: github.com/PeWu/topola-webtrees
The administrator has disabled public write access.

Integrating with webtrees 6 months 3 weeks ago #5

  • UksusoFF
  • UksusoFF's Avatar
  • Offline
  • Junior
  • Posts: 118
PeWu wrote:
You mentioned "relationship privacy" but I couldn't find in the code how it works. I only implemented this set of privacy options: {PRIV_PRIVATE (visitor), PRIV_USER (user), PRIV_NONE (gedadmin)}.
You can see privacy settings here: admin_trees_config.php?action=privacy&ged=tree1

Tested your module. It's work :)

Can it help with whole tree view?

www.webtrees.net/index.php/en/forum/2-op...nteractive-tree-view
www.webtrees.net/index.php/en/forum/9-re...f-tree-view-possible
The administrator has disabled public write access.

Integrating with webtrees 6 months 3 weeks ago #6

  • PeWu
  • PeWu's Avatar
  • Offline
  • New
  • Posts: 12
I'm happy it worked for you.

Regarding the whole tree view, I looked at the threads you linked and there are 2 themes:

1. Navigating between individuals – in my interactive tree you can click on individuals and navigate to any other individual as long as they are connected. You can also use the search box to navigate to an individual by name.

2. Showing a chart with all individuals in the database – there is no straightforward way of doing it. See this discussion for an idea how to show a chart of all relatives.
The administrator has disabled public write access.
Powered by Kunena Forum