debiaspy is a Python package for assessing, adjusting and validating
population representation bias in digital trace data. It is designed for
spatio-temporally aggregated data that provide population counts by location and
flows between locations.
The package workflow focuses on three linked tasks:
- measuring coverage and representativeness bias
- adjusting biased origin-destination flows
- validating adjusted flows against benchmark data
Mobile-phone-derived mobility data are the main motivating example, but the same logic can apply to other location-to-location flow data with comparable spatial and temporal aggregation and a validation target. Examples include trade of goods, Internet traffic, supply chains and other forms of interaction between places.
This repository currently contains the package skeleton only. The core adjustment, validation and measurement methods have not yet been implemented.
From the repository root:
python -m pip install -e ".[dev]"Install the empirical data companion when you need to reproduce tutorials or examples that use the packaged mobility, Census, covariate and coverage data:
python -m pip install git+https://github.com/de-bias/debiaspydata.gitFor local development with a sibling checkout:
python -m pip install -e ../debiaspydataRun the test suite:
python -m pytestRun linting:
python -m ruff check .Format code:
python -m ruff format .See CONTRIBUTING.md and docs/development/workflow.md for the contributor workflow.
The initial source files are organised around the main package tasks: measuring bias, adjusting flows, validating outputs, plotting diagnostics and loading example data. These files are placeholders until the Python implementation begins:
adjust_all_methods.pyadjust_coefficient.pyadjust_inverse_penetration.pyadjust_multilevel_bayes.pyadjust_raking_ratio.pyadjust_selection_rate.pyadjust_selection_rate2.pydata_simulated.pydistribution_metrics.pyexample_data.pyflow_comparisons.pyglobals.pymeasure_bias.pyplot_validation.pyvalidate_flow_methods.pyvalidate_flows.py
This flat layout keeps the package easy to inspect during the first stage of development. It can be reorganised later if the Python implementation needs a larger internal structure.
Tutorial placeholders are stored in docs/tutorials. The sequence is organised
around the package workflow:
t02-why-this-matters.qmdt03-getting-set-up.qmdt04-measuring-coverage-bias.qmdt05-identifying-and-explaining-bias.qmdt06-adjusting-biases.qmdt07-validation.qmdt08-visualising-flows.qmdt09-advanced-bayesian-adjustment.qmd
The tutorial placeholders are configured as a Quarto website. To preview the site locally:
quarto previewTo render the static site:
quarto renderThe rendered site is written to _site/, which is ignored by git.
We use the All Contributors Bot to recognise everyone’s work—code, docs, ideas, design and more.
After your PR is merged, comment on an issue or PR:
@all-contributors please add @your-username for code, doc, etc.
Replace @your-username and the contribution types as appropriate. See the
emoji key for available
contribution types.
Thank you for helping us build open, collaborative and impactful projects with DEBIAS.
Carmen Cabrera 📖 💻 🐛 🖋 🎨 💡 🤔 🚇 🚧 📦 📆 🔬 👀 🔧 |
Francisco Rowe 📖 💻 🐛 🖋 🎨 💡 🤔 🚇 🚧 📦 📆 🔬 👀 🔧 |
This project follows the all-contributors specification. Contributions of any kind are welcome.