M My Own Project — Unofficial Gramps tools and ideas.

Statistics project

Family Statistics

Family Statistics turns selected Gramps data into a clean web report that can be viewed locally or published alongside a family history website.

How it works

Family Statistics uses four HTML reports exported from Gramps:

  1. Complete Individual Report complete.html
  2. Tag Report tag.html
  3. Records Report records.html
  4. Birthday and Anniversary Report birthdays.html

Save all four files in the same folder as statistics.py .

1. Complete Individual Report

Open Reports → Text Reports → Complete Individual Report... and use your own filter.

  • In Report Options (2) , select YYYY-MM-DD (ISO) .
  • Under Include , leave all options unselected.
  • Under Include (2) , select Do not include Gramps ID and leave the other options unselected.
  • Under Sections , select only Family .
  • Choose HTML as the output format and save as complete.html .

2. Tag Report

Open Reports → Text Reports → Tag Report... .

  • Select the person tag containing the same set of persons as the filter used for the other reports.
  • Select YYYY-MM-DD (ISO) as the date format.
  • Choose HTML as the output format and save as tag.html .

3. Records Report

Open Reports → Text Reports → Records Report... and select your own filter.

  • Select all options under Person 1 .
  • Select all options under Person 2 .
  • Select all options under Family 1 .
  • Choose HTML as the output format and save as records.html .

4. Birthday and Anniversary Report

  • Select your own filter.
  • Under Birthday Surname , select Wives use husband's surname (from last family listed) .
  • Set the year to the current year.
  • Select Include birthdays, anniversaries and deaths .
  • Choose HTML as the output format and save as birthdays.html .

Create statistics.json

When the four reports are ready, close the family tree and Gramps. Open the working folder in a terminal and run:

python statistics.py

The script reads the four report files and creates statistics.json .

View the statistics locally

Because the normal index.html loads statistics.json with JavaScript, open the folder through a local web server:

python -m http.server 8000

Then open http://localhost:8000/index.html in a browser. Press Ctrl+C in the terminal when you want to stop the local server.

Update the statistics

When the family tree changes, create the four Gramps reports again using the same filenames and run python statistics.py again. The existing statistics.json is replaced with updated data.