Skip to content

magicsunday/webtrees-statistics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

103 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest version License CI

Statistics

A tab-based statistics dashboard for the webtrees genealogy application.

Renders tree-wide statistics across six tabs (Overview, Names, Tree health, Life span, Family, Places) using donut charts, progress lists, world maps, and tag clouds. Built on the shared widget library @magicsunday/webtrees-chart-lib.

Requirements

  • webtrees 2.2 or newer
  • PHP 8.3 or newer

Installation

Using Composer

To install using Composer, run the following command from the root directory of your webtrees installation:

composer require magicsunday/webtrees-statistics:* --update-no-dev

The module installs into the modules_v4 directory of your webtrees installation automatically.

To remove it:

composer remove magicsunday/webtrees-statistics --update-no-dev

Using Git

If you prefer to track the current main branch directly, clone it into your modules_v4 directory:

git clone https://github.com/magicsunday/webtrees-statistics.git modules_v4/webtrees-statistics

What renders today

Phase 1 ships four populated tabs and two placeholder tabs:

Tab Status Content
Overview Populated Sex / Living-deceased / Marital-status donuts
Names Populated Common-surname + male / female given-name tag clouds (stream graph tracked in #13)
Tree health Placeholder Data-quality metrics tracked in #11
Life span Populated Births by month / zodiac sign / century, deaths by month / century (age / lifespan widgets in #3)
Family Placeholder Marriage / divorce / children / kinship widgets tracked in #4, #5, #6, #2
Places Populated Country-of-birth and country-of-death world maps with companion top-10 progress lists (migration sankey in #12)

The marital-status donut counts each living individual exactly once. Precedence follows the same per-family decision order webtrees core uses in \Fisharebest\Webtrees\Census\AbstractCensusColumnCondition: an active divorce tag classes the survivor as divorced, a deceased partner as widowed, an active marriage with a living partner as current. Anything else falls into single. The four buckets sum exactly to StatisticsData::countIndividualsLiving() without clamping.

Architecture

The aggregator service MagicSunday\Webtrees\Statistic\Statistic is resolved through the webtrees DI container and pulls data from four sources:

  • Fisharebest\Webtrees\StatisticsData — core data accessor for individual, family, and event counts.
  • Repository/FamilyRepository — Census-aligned marital classification not exposed by core.
  • Repository/EventRepository — zodiac-sign grouping not exposed by core.
  • Repository/NameRepository — primary-name distinct counts (n_num = 0) so totals stay in sync with the Top-N name lists.

Each tab renders a template under resources/views/modules/statistics-chart/Templates/ that composes Partials (DonutChart, ProgressList, GeoMap, TagCloud) and passes them aggregator output.

Theming

The module ships a single stylesheet (resources/css/statistics.css) that is loaded once per page through View::push('styles'). All colours are defined as --wmstats-* custom properties on the .wt-statistics-chart root, with a [data-bs-theme="dark"] override block that lifts the donut and progress-bar palette into a dark-friendly range. Webtrees themes that toggle data-bs-theme on <html> switch the module's visuals automatically.

Development

Build the assets

Install Node dependencies and build the JS bundle:

npm install
npm run prepare

Run tests

The full pre-commit gate (PHPStan, PHP-CS-Fixer, Rector, PHPUnit, Biome, Jest, jscpd):

composer ci:test

Single PHPUnit class:

composer ci:test:php:unit -- --filter FamilyRepositoryClassifierTest

Auto-fix PHP style and Rector findings:

composer ci:cgl
composer ci:rector

About

SVG based statistics module for webtrees genealogy application.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

 
 
 

Contributors