Skip to main content

SynthPopCan

CI Extended correctness Documentation Status PyPI DOI License: MIT

SynthPopCan logo

SynthPopCan helps researchers create, inspect, and validate modelled Canadian households and people from Census-derived data. It supports reproducible work without requiring researchers to expose private source data or become software developers first.

SynthPopCan is an independent research-software project. It is not affiliated with, endorsed by, or sponsored by Statistics Canada or the Government of Canada.

Core workflows:

  1. Provide a Python library and CLI that can create synthetic populations through IPF from Statistics Canada margin/control tables.
  2. Maintain explicit 2016 and 2021 Census microdata workflows for household- and person-level synthetic populations using tree-based generation plus calibration, while keeping source adapters and metadata appropriately census-vintage-specific.
  3. Maintain a local web app for configuring runs, inspecting controls, generating from prepared models, validating outputs, and downloading results.

Version 1.1.1 preserves the stable, explicitly bounded interface established by 1.0.0. Its packaged 1.x compatibility contract freezes the documented CLI, curated Python API, callable signatures, and supported persisted schemas while permitting additive extension. This maintenance release includes validation, internal-boundary, and dependency fixes. It retains 24 reviewed 2016/2021 small-area control packs: eight stable core packs, eight expanded-housing packs, and eight broad packs that can apply nine household and five person margins together with explicit runtime invariants. That bounded evidence is not a universal representativeness, privacy, or fitness claim.

It also includes a complete 2016/2021 field-eligibility inventory, a bilingual Quebec 2021 case study, dated preservation and software-management records, and an accepted open-by-default prepared-model policy. All 32 public Census-derived model concepts now point to verified, non-overwriting versions with embedded scoped licensing and preserved source provenance. The release boundary and post-1.0 research tracks are recorded in PLANS.md.

Detailed documentation is published at https://synthpopcan.readthedocs.io/. The source files live under docs/; start with docs/index.rst for task-based navigation to the web app, IPF from StatCan margin tables, generated-from-model workflows, the beginner Python API, and advanced microdata/model-training material.

The development branch and the latest documentation may describe the next release before it reaches PyPI. The PyPI badge above identifies what pip install synthpopcan currently installs; use the stable documentation for that published version. Maintained Can-FED and ODEF adapters are included in 0.7.2 and later.

Project records have distinct jobs:

Record Use it for
PLANS.md Current maintenance priorities, conditional research tracks, deferred scope, and open decisions
plans/ Detailed active scopes and archived implementation evidence
CHANGELOG.md Observable changes grouped by public release
adr/ Durable architecture decisions, alternatives, and consequences
CORRECTNESS.md Current tested correctness claims, evidence, limitations, and reproduction commands
NOTES.md Index of dated historical research and design syntheses, not current project status
docs/stewardship.md Supported environments, maintenance expectations, licensing, preservation identifiers, and dated records

Quick Start

These commands use a Unix-style shell. Windows readers should first complete the WSL setup in the Installation guide, then run the same commands inside the Ubuntu terminal.

Install the published package from PyPI:

Network required for installation.

python3 -m pip install synthpopcan

The base installation is enough to generate from portable frequency or CART models. Starting with 0.7.0, only researchers training new CART models need python3 -m pip install "synthpopcan[model-build]".

For a guided first look, start the local browser workbench:

synthpopcan serve

It opens forms, previews, run history, and downloads on this computer only. The local web app guide includes fictional teaching data and explains what stays on disk. Use the command line below when the work needs to be scripted or repeated exactly.

Then inspect the command line:

synthpopcan --help

Run a small offline smoke test with the bundled fictional model:

Runnable teaching example. Enter both commands in order.

synthpopcan models generate demo-linked-household-person \
  --households 10 \
  --condition "geo=Demo North" \
  --out synthpopcan-quickstart \
  --random-seed 42
synthpopcan validate linked synthpopcan-quickstart

This verifies linked household/person generation, but it does not create a representative Canadian population. The documentation explains how to choose research sources, controls, and model packages.

For a one-off command without installing the tool into the current environment, use uvx:

Network and uv required. See the Installation guide before using this route if uvx --version is not already available.

uvx synthpopcan --help
uvx synthpopcan guide ipf
uvx synthpopcan guide model
uvx synthpopcan guide small-area

From a source checkout for development:

Source checkout, network, Git, and uv required.

git clone https://github.com/dlq/synthpopcan.git
cd synthpopcan
uv sync
uv run synthpopcan --help

For installation details, see docs/installation.md.

Where To Start

Most readers should start in the Sphinx documentation rather than in this README:

Task Documentation
Choose a first workflow docs/getting-started.md
Start a reproducible command-line workflow docs/command-line.md
Use the local browser app docs/web-app.md
Generate with IPF from margin/control tables docs/ipf.md, docs/controls.md, docs/statcan.md
Assign linked households and people to small areas docs/small-area.md
Fetch verified display-only map boundaries docs/geodata.md
Attach governed external context as a sidecar layer docs/enrichment.md
Hand a validated linked population to another tool docs/exchange.md
Use the beginner Python API docs/library-getting-started.md
Work with local data layout and data doctor docs/data.md
Inspect source files safely docs/data.md, docs/statcan.md, docs/microdata.md
Work with census microdata adapters docs/microdata.md
Train, audit, package, or use tree models docs/tree.md
Validate generated outputs docs/validate.md
Understand correctness evidence and limitations CORRECTNESS.md
Check current priorities and conditional research PLANS.md, plans/README.md
Review completed release history CHANGELOG.md

Build the documentation locally with:

Source checkout required. Contributor setup is documented in CONTRIBUTING.md.

uv run sphinx-build -W -b html docs docs/_build/html

Data Policy

Large, raw, private, or access-controlled data are not tracked in git. Local source caches, derived artifacts, and scratch work have separate roles and must retain their provenance and access classification. See the maintained Data and Local Workspace chapter for the directory contract, licensing boundary, and safe handling rules.

Model Packages

Only the tiny fictional demo model is bundled. Larger reviewed models are downloaded on demand. List the current catalogue and generate from a selected package with:

synthpopcan models fetch quebec-2021-all-fields
synthpopcan models generate quebec-2021-all-fields \
  --households 1000 --out quebec-2021-population/

Prepared packages are derived research artifacts, not raw Census microdata or claims of official approval, privacy certification, or universal fitness. See Generate From a Model Package for ordinary use and Tree Models for training, audit, packaging, licensing, and release guidance.

How To Cite

Releases and prepared model packages are archived on Zenodo, so cite whichever matches what your work actually depended on.

You used Cite DOI
SynthPopCan generally The concept DOI, which always resolves to the newest release 10.5281/zenodo.21461463
SynthPopCan 1.1.0 The archived 1.1.0 version DOI 10.5281/zenodo.22017599
SynthPopCan 1.0.0 The archived 1.0.0 version DOI 10.5281/zenodo.21961301
SynthPopCan 0.9.0 The archived 0.9.0 version DOI 10.5281/zenodo.21876960
SynthPopCan 0.7.0 The archived 0.7.0 version DOI 10.5281/zenodo.21743129
A prepared model package That package's own DOI, listed on its Zenodo record one per package

For reproducibility, prefer the version DOI for the release and the model package DOI for each package you generated from: together they pin the exact code and the exact artifact, and every model record publishes the checksums needed to verify the file you downloaded.

Citation metadata lives in CITATION.cff, which GitHub renders as a ready-made citation from the sidebar.

The source history through v1.1.0 is also independently preserved in Software Heritage. Use its SWHIDs to identify source objects; continue to use the release DOI and artifact checksums to identify the software and model bytes used in research. The earlier captures through v1.0.0 and v0.9.0 remain available in the 2026-08-16 and 2026-08-15 preservation records.

Prepared model packages are derived from Statistics Canada public use microdata files under the Statistics Canada Open Licence. The catalogue, archive records, and current registered package bytes carry the required attribution and machine-readable rights contract. Historical package versions remain available under their original identifiers and checksums for reproducibility; the registry now selects the verified non-overwriting v1.0.0-rights.1 versions. See docs/data.md for the full attribution and licensing terms. The accepted open-by-default policy in ADR-0014 offers CC BY 4.0 only for original prepared-model rights the package author owns or controls. That scoped grant is cumulative with the continuing Statistics Canada conditions; it does not cover source Information, facts, or unprotectable results, and it does not relax privacy or provenance safeguards. The fail-closed existing-record correction implementation passed independent review, and all 32 metadata corrections, 32 non-overwriting versions, remote byte checks, and 32 registry updates completed on 2026-08-16. The durable correction record preserves sanitized evidence. External review remains welcome but is not a 1.0.0 gate.

Development Acknowledgement

Development of SynthPopCan has been supplemented by the use of large language models for tasks including code generation, review, testing, documentation, and research assistance. All resulting contributions remain subject to human review and the project's automated correctness and quality checks. Responsibility for the project and its releases rests with its maintainer.

Metadata

Release files for synthpopcan 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synthpopcan 1.1.1
File Size Uploaded
synthpopcan-1.1.1.tar.gz 7.8 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for synthpopcan 1.1.1
File Interpreter ABI Platform
synthpopcan-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 MB

Release files / synthpopcan-1.1.1.tar.gz

Download URL synthpopcan-1.1.1.tar.gz
Size 7.8 MB
Tags Source
SHA-256 checksum
How to use checksums
363b49321580a3de477501558639fce5c66866957998debe410776d929117779
BLAKE2b-256 checksum
How to use checksums
2ccb378d22bc188f4404c42417fe3ca2400025793c7493ad34a0b0eec3ac93f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release files / synthpopcan-1.1.1-py3-none-any.whl

Download URL synthpopcan-1.1.1-py3-none-any.whl
Size 535.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a30b550612af9b05bdd667f26f12c6841a2814338a13c3e89293f51923136d3d
BLAKE2b-256 checksum
How to use checksums
9a1facc2866365c6bd637ee5c971535c7a5717e3a840313d475762e7073beb03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page