Family Statistics is a small genealogy statistics project for Gramps.
The purpose is to show some of the same types of statistical information that are available in Gramps, but on a private family history website.
The project uses four HTML reports exported from Gramps. A Python script reads these reports and creates statistics.json, which is then displayed by index.html using JavaScript.
Gramps must be running in English, and the date format must be YYYY-MM-DD (ISO) when the reports are created.
The Python script depends on specific English report headings and English month names when reading the exported HTML files. Reports generated in another language may therefore not be parsed correctly.
The statistics page is divided into four sections:
Shows events occurring on today's date:
The newest events are shown first.
Shows:
It also shows record lists for:
Shows lifespan statistics:
It also shows record lists for:
Shows the ten most frequent:
Each entry shows the percentage first and the number of persons afterwards.
The examples use a Gramps person tag named ProfileTag.
You may use your own filter and tag, but the tag must contain the same set of persons as the filter used for the reports.
A guide for creating a person tag from a filter is available here:
Create a tag from a filter – step 3
The selected tag name is read from the Gramps Tag Report and is shown dynamically on the statistics page, for example:
Selected filter: ProfileTag
beautifulsoup4Install BeautifulSoup if needed:
python -m pip install beautifulsoup4
Tested with:
macOS has not been tested.
The package contains:
index.html
LICENSE
README.md
RELEASE_NOTES.md
statistics.py
statistics.css
statistics.js
example/
index.html
The example folder contains a standalone demonstration page that can be opened directly in a web browser before creating your own reports.
The example index.html is created specifically for preview purposes. It contains its own embedded CSS, JavaScript and fictional example data, so it does not use statistics.json and does not require localhost or a web server.
The normal index.html in the main folder still uses statistics.json and must be opened through localhost or a web server.
Four Gramps reports are first exported as HTML:
All four files must be saved in the same folder as statistics.py.
The required filenames are:
complete.html
tag.html
records.html
birthdays.html
After the reports have been created, statistics.py reads them and creates:
statistics.json
The statistics page then reads statistics.json.
Open Gramps and open the family tree you want to use.
Go to:
Reports / Text Reports / Complete Individual Report...
Use these settings:
complete.html in the same folder as statistics.py.Go to:
Reports / Text Reports / Tag Report...
Use these settings:
tag.html in the same folder as statistics.py.Go to:
Reports / Text Reports / Records report...
Use these settings:
records.html in the same folder as statistics.py.Open the Birthday and Anniversary Report.
Use these settings:
birthdays.html in the same folder as statistics.py.When all four reports have been created, close the family tree and Gramps.
Open the working folder in a terminal and run:
python statistics.py
The script reads:
birthdays.html
complete.html
records.html
tag.html
and creates:
statistics.json
Because index.html loads statistics.json using JavaScript, the page should be opened through a local web server rather than directly as a file.
Open the working folder in a terminal and run:
python -m http.server 8000
Then open a web browser and go to:
http://localhost:8000/index.html
Stop the local server when you are finished by returning to the terminal and pressing:
Ctrl+C
When the family tree changes, create the four Gramps reports again using the same filenames and run:
python statistics.py
This replaces statistics.json with updated data.
The generated date is displayed on the page, for example:
Data updated August 23, 2026