Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Data Director inventory

CI Coverage

dd-inventory describes a dataset's files where they live. It reads every file under a folder and writes a FileInventory, a JSON document of the core contract, that gives for each file:

  • its path relative to the folder;
  • its size and its SHA-256 digest;
  • its media type and every PRONOM identifier it matched, found with fido, and whether the match was by byte signature, container signature or extension only;
  • for a CSV or TSV table, its fields as a Frictionless Table Schema inferred from a sample of rows, reading empty cells and NA, N/A, NaN and null as missing values, and saying in its limitations which markers it met and which fields had no value to type;
  • where it found possible personal data, and never what (below).

The inventory holds facts about the files and never their content. Research data are not uploaded to Data Director: the researcher adds the inventory to their project instead (Projects). The digests let the files deposited later be shown to be the files described.

$ uv run dd-inventory path/to/dataset -o inventory.json

Given several folders, it makes one inventory with a part for each (Projects): each folder's files are listed under its name, and each part keeps its own tool, time and limitations. Two folders of the same name need names of their own, given with --as once for each folder, in order. make_inventory_of does the same from Python.

$ uv run dd-inventory raw processed -o inventory.json
$ uv run dd-inventory /lab/2024 /instrument/2024 --as lab --as instrument -o inventory.json

The package installs two names for the same command, dd-inventory and data-director-inventory, so that uvx data-director-inventory path/to/dataset works. It is published to PyPI and, for trying a release first, TestPyPI (RELEASING.md).

A researcher without a checkout runs it with uvx and attaches the file to a conversation in the app; the user guide's Making an inventory says how.

It looks for possible personal data in what it already reads: the values of each table's sampled rows, column by column; field, file and folder names; and .txt and .md files of at most 256 KB (Personal data and disclosure control). The detector is Presidio with its pattern recognisers only, with the UK ones on (National Insurance number, NHS number, postcode, passport, driving licence) and phone numbers read as UK numbers, plus a keyword table for names. It runs offline and loads no language model, so names and places are looked for in column headers and names, not in values. inventory_personal_data lists each finding: a kind, the file and column, the share of sampled values that matched and a confidence, both as bands, and the detector. A finding never holds a value, part of one, a row number or an example. An empty list means the detector found nothing, which does not mean the data hold no personal data; the limitations say what was not checked. --no-detect (or detector=None) skips the check, and the list is then absent, which says no detector ran. Presidio installs spaCy, which the command does not use; the pii-ner extra is for named-entity recognition later (#39).

$ uv run dd-inventory path/to/dataset --no-detect -o inventory.json

evals/compare_detectors.py compares detectors on the synthetic evaluation set in tests/data/disclosure/evaluation/: recall by kind, false positives on ordinary metadata, CPU time and what each adds. Its result, and why the default runs pattern recognisers only, is in Personal data and disclosure control.

Hidden files and folders (names beginning with .) are skipped, symbolic links are not followed, and both are counted in inventory_limitations. If fido cannot be loaded, formats are guessed from file extensions and the inventory says so.

The same package runs in a web browser under Pyodide, so that a researcher can describe a folder without installing anything (#367). The inventory it makes there is the command's, except that its inventory_tool_version carries a local version label naming the runtime, such as 0.1.0a3+pyodide.314.0.7; inventory_tool is dd-inventory in both. An inventory whose version has no + label was made by the command. make_inventory detects the runtime, and a caller may pass it in as runtime=. A caller may also pass on_file=, which is called once per file with a FileProgress (its relative path and size, and how many of the files are done), to show progress. The personal-data check runs there too, so the two find the same. browser/bundle/ builds the browser bundle (Pyodide, this package's wheel and its dependencies, with a stand-in for spaCy), and CI checks that it writes the same inventory as the command on tests/data/mixed (browser bundle).

To read an inventory in TypeScript, as the app does to show one to the researcher, use @data-director/inventory in browser/, which is not part of this Python package.

The package does not depend on the contract or any other part of Data Director (System and boundaries). Its tests check what it writes against the contract's FileInventory schema.

Module What it does
scan.py Walks the folder, digests each file and assembles the inventory.
identify.py The one module that calls fido, with the extension fallback.
tables.py Infers a table's fields with Frictionless, keeping the sampled values for the check.
personal.py Looks for possible personal data with Presidio and the keyword table (keywords.json, a copy of advisor.ethics's).
cli.py The dd-inventory command.

Metadata

Release files for data-director-inventory 0.1.0a5

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

Source distribution (sdist)

Source distribution for data-director-inventory 0.1.0a5
File Size Uploaded Provenance Actions
data_director_inventory-0.1.0a5.tar.gz 72.9 kB Without provenance Details for data_director_inventory-0.1.0a5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for data-director-inventory 0.1.0a5
File Interpreter ABI Platform Actions
data_director_inventory-0.1.0a5-py3-none-any.whl Python 3 none any Details for data_director_inventory-0.1.0a5-py3-none-any.whl

Total release size: 94.2 kB

Release files / data_director_inventory-0.1.0a5.tar.gz

Download URL data_director_inventory-0.1.0a5.tar.gz
Size 72.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b39c18da407279bb397fc626e3dd9a9f2f4063f0557e66432dcbec1cb992db6b
BLAKE2b-256 checksum
How to use checksums
ca0a781b781814996aa552d61cb3bd5cfb905f8476f2d3f6c5b64de4f9a2c15a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / data_director_inventory-0.1.0a5-py3-none-any.whl

Download URL data_director_inventory-0.1.0a5-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a111bd8cd3665058a58a7143870f8d1076ec99e17823a456a4e444f42f01639
BLAKE2b-256 checksum
How to use checksums
2010a2d6c71ee63c3c0a600eec4607dfa62076284ed1b196e0cc4ffbf7d4e856
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for data-director-inventory 0.1.0a5

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.

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