Mobile Monitoring of Cognitive Change (M2C2) Platform
📘 M2C2 DataKit (m2c2-datakit): Universal Loading, Assurance, and Scoring
This is the documentation for the M2C2 DataKit Python package 🐍, which is part of the M2C2 Platform. The M2C2 Platform is a comprehensive system designed to facilitate the collection, processing, and analysis of mobile cognitive data (aka, ambulatory cognitive assessments, cognitive activities, and brain games).
🚀 A set of R, Python, and NPM packages for scoring M2C2kit Data! 🚀
Documentation
🔧 Installation
pip install m2c2-datakit
# or
pip3 install m2c2-datakit
🛠️ Setup for Developers of this Package
!make clean
!make dev-install
Developers:
- Dr. Nelson Roque | ORCID: https://orcid.org/0000-0003-1184-202X
- Dr. Scott Yabiku | ORCID: [Coming soon!]
Changelog
Source: https://github.com/m2c2-project/datakit
See CHANGELOG.md
🎯 Purpose
Enable researchers to plug in data from varied sources (e.g., MongoDB, UAS, MetricWire, CSV bundles) and apply a consistent pipeline for:
-
Input validation
-
Scoring via predefined rules
-
Inspection and summarization
-
Tidy export and codebook generation
🧠 L.A.S.S.I.E. Pipeline Summary
| Step | Method | Purpose |
|---|---|---|
| L | LASSIE.load() |
Load raw data from a supported source (e.g., MongoDB, UAS, MetricWire). |
| A | LASSIE.assure() |
Validate that required columns exist before processing. |
| S | LASSIE.score() |
Apply scoring logic based on predefined or custom rules. |
| S | LASSIE.summarize() |
Aggregate scored data by participant, session, or custom groups. |
| I | LASSIE.inspect() |
Visualize distributions or pairwise plots for quality checks. |
| E | LASSIE.export() |
Save scored and summarized data to tidy files and optionally metadata. |
🔌 Supported Sources
You may have used M2C2kit tasks via our various integrations, including the ones listed below. Each integration has its own loader class, which is responsible for reading the data and converting it into a format that can be processed by the m2c2_datakit package. Keep in mind that you are responsible for ensuring that the data is in the correct format for each loader class.
In the future we anticipate creating loaders for downloading data via API.
| Source Type | Loader Class | Key Arguments | Notes |
|---|---|---|---|
mongodb |
MongoDBImporter |
source_path (URL, to JSON) |
Expects flat or nested JSON documents. |
multicsv |
MultiCSVImporter |
source_map (dict of CSV paths) |
Each activity type is its own file. |
metricwire |
MetricWireImporter |
source_path (glob pattern or default) |
Processes JSON files from unzipped export. |
qualtrics |
QualtricsImporter |
source_path (URL to CSV) |
Each activity's trial saves data to a new column. |
uas |
UASImporter |
source_path (URL, to pseudo-JSON) |
Parses newline-delimited JSON. |
🧪 Example: Full Pipeline
For a full pipeline, go to our repo
MetricWire
mw = m2c2.core.pipeline.LASSIE().load(source_name="metricwire", source_path="data/metricwire/unzipped/*/*/*.json")
mw.assure(required_columns=m2c2.core.config.settings.STANDARD_GROUPING_FOR_AGGREGATION_METRICWIRE)
mw_scored = mw.score()
mw.inspect()
mw.export(file_basename="metricwire", directory="tidy/metricwire_scored")
mw.export_codebook(filename="codebook_metricwire.md", directory="tidy/metricwire_scored")
-----------------------------------------------------------------------------------------------------
MongoDB
mdb = m2c2.core.pipeline.LASSIE().load(source_name="mongodb", source_path="data/production-mongo-export/data_exported_120424_1010am.json")
mdb.assure(required_columns=m2c2.core.config.settings.STANDARD_GROUPING_FOR_AGGREGATION)
mdb.score()
mdb.inspect()
mdb.export(file_basename="mongodb_export", directory="tidy/mongodb_scored")
mdb.export_codebook(filename="codebook_mongo.md", directory="tidy/mongodb_scored")
-----------------------------------------------------------------------------------------------------
Understanding American Study (UAS) Datasets
uas = m2c2.core.pipeline.LASSIE().load(source_name="UAS", source_path= "https://uas.usc.edu/survey/uas/m2c2_ess/admin/export_m2c2.php?k=<INSERT KEY HERE>")
uas.assure(required_columns=m2c2.core.config.settings.STANDARD_GROUPING_FOR_AGGREGATION)
uas.score()
uas.inspect()
uas.export(file_basename="uas_export", directory="tidy/uas_scored")
uas.export_codebook(filename="codebook_uas.md", directory="tidy/uas_scored")
-----------------------------------------------------------------------------------------------------
MultiCSV
source_map = {
"Symbol Search": "data/reboot/m2c2kit_manualmerge_symbol_search_all_ts-20250402_151939.csv",
"Grid Memory": "data/reboot/m2c2kit_manualmerge_grid_memory_all_ts-20250402_151940.csv"
}
mcsv = m2c2.core.pipeline.LASSIE().load(source_name="multicsv", source_map=source_map)
mcsv.assure(required_columns=m2c2.core.config.settings.STANDARD_GROUPING_FOR_AGGREGATION)
mcsv.score()
uas.inspect()
mcsv.export(file_basename="uas_export", directory="tidy/uas_scored")
mcsv.export_codebook(filename="codebook_uas.md", directory="tidy/uas_scored")
💡 Contributions Welcome!
📌 Have ideas? Found a bug? Want to improve the package? Open an issue!.
📜 Code of Conduct - Please be respectful and follow community guidelines.
Acknowledgements
The development of m2c2-datakit was made possible with support from NIA (1U2CAG060408-01).
🌎 More Resources:
📌 M2C2kit Official Documentation Website
What is What? 🧠 Summary
| Thing | Type | Description |
|---|---|---|
m2c2_datakit |
Library/Package | Top-level Python package |
core/, loaders/, tasks/ |
Subpackages | Contain logically grouped modules |
log.py, export.py, etc. |
Modules | Individual Python files |
__init__.py |
Special Module | Marks the directory as a package |
🎬 Inspired by:
🚀 Let's go study some brains!
Metadata
Release files for m2c2-datakit 0.1.94
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| m2c2_datakit-0.1.94.tar.gz | 75.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| m2c2_datakit-0.1.94-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 150.2 kB
Release files / m2c2_datakit-0.1.94.tar.gz
| Download URL | m2c2_datakit-0.1.94.tar.gz |
|---|---|
| Size | 75.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2a897c132ef0f00f9fa7479469407df2b7f8af5bdb2aa1b005c57cf6ab8d851
|
|
BLAKE2b-256 checksum How to use checksums |
3e1f4b001c5008d56e3e96ca53d703d52e931148eb4824da363ac52fb51aca54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Release files / m2c2_datakit-0.1.94-py3-none-any.whl
| Download URL | m2c2_datakit-0.1.94-py3-none-any.whl |
|---|---|
| Size | 74.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ed10251a107b880e7902e938770b1c9d84d06afbfa16898a135ab1332ecbee81
|
|
BLAKE2b-256 checksum How to use checksums |
eb4ae6c4d6e3b198ef48d6a80ade1096896f6354deb1f727fc152711e548b8b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Security for m2c2-datakit 0.1.94
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.