datavault-cli 1.0.0__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,278 @@
1
+ Metadata-Version: 2.4
2
+ Name: datavault-cli
3
+ Version: 1.1.0
4
+ Summary: Cryptographic provenance and version control for AI training datasets
5
+ Home-page: https://github.com/thiminhkhuedao/DataVault
6
+ Author: Ry Nguyen
7
+ Author-email: thiminhkhuedao@gmail.com
8
+ Keywords: data provenance versioning AI machine-learning CSV sha256
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
12
+ Classifier: Topic :: Software Development :: Version Control
13
+ Requires-Python: >=3.6
14
+ Description-Content-Type: text/markdown
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: keywords
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # DataVault
26
+
27
+ **Cryptographic proof of data integrity for regulated AI.**
28
+
29
+ When an AI system makes a decision that affects someone's life — medical, legal, financial — regulators will ask three questions:
30
+
31
+ - Where did the training data come from?
32
+ - Who approved it?
33
+ - Has it been modified since?
34
+
35
+ DataVault answers all three with cryptographic proof. Zero dependencies. Pure Python stdlib.
36
+
37
+ ---
38
+
39
+ ## The problem
40
+
41
+ The EU AI Act (2024) requires organizations deploying high-risk AI systems to maintain verifiable records of their training data. Existing tools don't solve this:
42
+
43
+ - **Git** — not designed for large data files, no tamper detection, no approval workflow
44
+ - **DVC** — excellent for versioning, but cannot cryptographically prove data integrity to external auditors
45
+ - **Nothing** — provides audit-ready proof that your training data hasn't been modified since approval
46
+
47
+ DataVault fills this gap.
48
+
49
+ ---
50
+
51
+ ## EU AI Act compliance reference
52
+
53
+ | Requirement | Article | How DataVault addresses it |
54
+ |---|---|---|
55
+ | Data governance | Art. 10 | Every version logged with author, timestamp, commit message |
56
+ | Tamper detection | Art. 10 | SHA-256 fingerprint — any modification detected instantly |
57
+ | Immutable history | Art. 12 | Cryptographic hash chain — history cannot be rewritten |
58
+ | Approval workflow | Art. 13 | Multi-user signing with reviewer, approver, owner roles |
59
+ | Audit documentation | Art. 13 | Export full provenance report as HTML/PDF |
60
+
61
+ *DataVault is not a legal compliance tool. It provides the technical infrastructure that compliance requires.*
62
+
63
+ ---
64
+
65
+ ## Quickstart
66
+
67
+ ```bash
68
+ git clone https://github.com/thiminhkhuedao/DataVault.git
69
+ cd DataVault
70
+ python test_datavault.py
71
+ ```
72
+
73
+ Or install via pip:
74
+
75
+ ```bash
76
+ pip install datavault-cli
77
+ ```
78
+
79
+ No config. No database. Python 3.6+ only.
80
+
81
+ ---
82
+
83
+ ## Usage
84
+
85
+ ```bash
86
+ # Initialize a project
87
+ python datavault.py init my-project
88
+
89
+ # Track a dataset
90
+ python datavault.py add training_data.csv "raw data from source"
91
+
92
+ # Commit a change
93
+ python datavault.py commit training_data.csv "removed 42 duplicate rows"
94
+
95
+ # Prove the file hasn't been tampered with
96
+ python datavault.py verify training_data.csv
97
+
98
+ # Generate a full EU AI Act audit report
99
+ python datavault.py audit training_data.csv
100
+
101
+ # See which rows changed between versions (CSV only)
102
+ python datavault.py rowdiff training_data.csv v1 v3
103
+
104
+ # Semantic diff — analyze the meaning of changes
105
+ python datavault.py diff training_data.csv v1 v3 --semantic
106
+
107
+ # Statistical comparison between versions
108
+ python datavault.py compare training_data.csv v1 v3 --statistical
109
+
110
+ # Detect data quality issues
111
+ python datavault.py anomaly training_data.csv
112
+
113
+ # Freeze a version (no further commits without unfreezing)
114
+ python datavault.py freeze training_data.csv v3 "approved for production"
115
+
116
+ # Sign a version
117
+ python datavault.py sign training_data.csv v3 alice reviewer
118
+ python datavault.py sign training_data.csv v3 bob approver
119
+ python datavault.py approve training_data.csv v3
120
+
121
+ # Declare lineage (where did this data come from?)
122
+ python datavault.py link training_data.csv raw_data.csv labels.csv
123
+
124
+ # Declare remote lineage (from another GitHub repo)
125
+ python datavault.py link-remote training_data.csv \
126
+ --repo https://github.com/user/medical-data \
127
+ --file raw_scans.csv
128
+
129
+ # Watch files for unauthorized modifications in real time
130
+ python datavault.py watch training_data.csv
131
+
132
+ # Encrypt a version
133
+ python datavault.py keygen alice
134
+ python datavault.py encrypt training_data.csv v3 alice
135
+
136
+ # Verify the full cryptographic chain
137
+ python datavault.py chain training_data.csv
138
+
139
+ # Open the web dashboard
140
+ python datavault.py dashboard
141
+
142
+ # Export a provenance report (HTML/PDF)
143
+ python datavault.py export
144
+ ```
145
+
146
+ ---
147
+
148
+ ## All commands
149
+
150
+ ### Core versioning
151
+ | Command | Description |
152
+ |---|---|
153
+ | `init <name>` | Initialize a new project |
154
+ | `add <file> "msg"` | Start tracking a file |
155
+ | `commit <file> "msg"` | Save a new version |
156
+ | `log <file>` | Show version history |
157
+ | `status` | Show all tracked files |
158
+ | `verify <file>` | SHA-256 tamper detection |
159
+ | `diff <file> v1 v2` | Text diff between versions |
160
+ | `diff <file> v1 v2 --semantic` | Semantic diff — analyze meaning of changes |
161
+ | `checkout <file> v1` | Restore a version |
162
+
163
+ ### Data analysis (CSV)
164
+ | Command | Description |
165
+ |---|---|
166
+ | `rowlog <file>` | Row change statistics per version |
167
+ | `rowdiff <file> v1 v2` | Which rows were added, deleted, moved |
168
+ | `rowhistory <file> col val` | Full history of one specific row |
169
+ | `compare <file> v1 v2 --statistical` | Deep statistical comparison between versions |
170
+ | `anomaly <file> [version]` | Detect data quality issues |
171
+
172
+ ### Cryptographic chain
173
+ | Command | Description |
174
+ |---|---|
175
+ | `chain <file>` | Verify the full hash chain |
176
+ | `chainshow <file>` | Display chain visually |
177
+ | `chainbuild <file>` | Build/rebuild the chain |
178
+
179
+ ### Approval workflow
180
+ | Command | Description |
181
+ |---|---|
182
+ | `sign <file> v <name> [role]` | Sign a version |
183
+ | `signatures <file>` | List or verify signatures |
184
+ | `approve <file> v` | Check approval status |
185
+ | `freeze <file> v ["reason"] [--method password\|signature]` | Lock a version |
186
+ | `unfreeze <file> v [--by <name>]` | Unlock a version |
187
+ | `frozen` | List all frozen versions |
188
+
189
+ ### Lineage & provenance
190
+ | Command | Description |
191
+ |---|---|
192
+ | `link <output> <source1> [source2...]` | Declare local data dependencies |
193
+ | `lineage <file>` | Show full lineage tree |
194
+ | `lineages` | List all declared lineage |
195
+ | `link-remote <file> --repo <url> --file <f> [--hash <h>]` | Link to remote GitHub source |
196
+ | `verify-remote <file>` | Check if remote sources have changed |
197
+ | `remote-lineage <file>` | Show remote sources |
198
+
199
+ ### Security
200
+ | Command | Description |
201
+ |---|---|
202
+ | `watch <file> [--interval N]` | Real-time tamper detection |
203
+ | `keygen <key>` | Create an encryption key |
204
+ | `encrypt <file> v <key>` | Encrypt a version |
205
+ | `decrypt <file> v <key> [output]` | Decrypt a version |
206
+ | `encrypted` | List encrypted versions |
207
+
208
+ ### Reporting
209
+ | Command | Description |
210
+ |---|---|
211
+ | `audit <file>` | Generate EU AI Act audit report |
212
+ | `export` | Export HTML/PDF provenance report |
213
+ | `dashboard` | Open local web dashboard (port 5000) |
214
+ | `tag <file> v "label"` | Label a version |
215
+ | `migrate` | Backfill snapshots for existing versions |
216
+
217
+ ---
218
+
219
+ ## How it works
220
+
221
+ **SHA-256 tamper detection** — every version gets a 64-character fingerprint. Change one character anywhere and `verify` catches it.
222
+
223
+ **Hash chain** — each version's hash includes the previous version's hash. Delete or reorder any version and the chain breaks. Same principle as Bitcoin.
224
+
225
+ **Row-level tracking** — `rowdiff v1 v3` shows exactly which rows were added, deleted, or moved. Not just "the file changed".
226
+
227
+ **Semantic diff** — analyzes the *meaning* of changes. Mean drift, class imbalance shifts, distribution changes — not just raw line diffs.
228
+
229
+ **Multi-user signing** — signatures are cryptographically tied to the file hash. Modify the file after signing and the signature is invalidated automatically.
230
+
231
+ **Freeze** — lock a version with a passphrase or owner signature. Nobody can commit new versions without unfreezing.
232
+
233
+ **Lineage** — declare where your data came from, locally and across GitHub repos. Verify that sources haven't changed since you linked them.
234
+
235
+ **Watch mode** — continuous real-time monitoring. Alerts immediately on any unauthorized modification.
236
+
237
+ **Encryption** — encrypt specific versions with PBKDF2-derived keys. Pure Python, no dependencies.
238
+
239
+ ---
240
+
241
+ ## Files
242
+
243
+ | File | Purpose |
244
+ |---|---|
245
+ | `datavault.py` | CLI entrypoint |
246
+ | `vault_core.py` | Core engine — hashing, versioning, storage |
247
+ | `row_tracker.py` | Row-level CSV tracking |
248
+ | `chain.py` | Cryptographic hash chain |
249
+ | `signing.py` | Multi-user signing and approval |
250
+ | `freeze.py` | Version locking with passphrase or signature |
251
+ | `audit.py` | EU AI Act audit report generator |
252
+ | `semantic_diff.py` | Semantic analysis of dataset changes |
253
+ | `statistical_compare.py` | Statistical comparison between versions |
254
+ | `anomaly.py` | Data quality anomaly detection |
255
+ | `lineage.py` | Local data lineage tracking |
256
+ | `remote_lineage.py` | Cross-repo lineage via GitHub |
257
+ | `watch.py` | Real-time file monitoring |
258
+ | `encrypt.py` | Version encryption |
259
+ | `dashboard.py` | Local web dashboard (port 5000) |
260
+ | `pi_bridge.py` | Auto-commit sensor data from Raspberry Pi |
261
+ | `migrate.py` | Backfill snapshots for existing versions |
262
+ | `test_datavault.py` | Full demo — run this first |
263
+
264
+ ---
265
+
266
+ ## Requirements
267
+
268
+ - Python 3.6+
269
+ - Zero external dependencies — pure standard library
270
+
271
+ ---
272
+
273
+ ## Copyright
274
+
275
+ Copyright © 2026 Thi Minh Khuê Dao. All rights reserved.
276
+
277
+ This project and its source code are public for portfolio and evaluation purposes only.
278
+ No permission is granted to copy, distribute, modify, or use this code for any other purpose without explicit written permission.
@@ -0,0 +1,254 @@
1
+ # DataVault
2
+
3
+ **Cryptographic proof of data integrity for regulated AI.**
4
+
5
+ When an AI system makes a decision that affects someone's life — medical, legal, financial — regulators will ask three questions:
6
+
7
+ - Where did the training data come from?
8
+ - Who approved it?
9
+ - Has it been modified since?
10
+
11
+ DataVault answers all three with cryptographic proof. Zero dependencies. Pure Python stdlib.
12
+
13
+ ---
14
+
15
+ ## The problem
16
+
17
+ The EU AI Act (2024) requires organizations deploying high-risk AI systems to maintain verifiable records of their training data. Existing tools don't solve this:
18
+
19
+ - **Git** — not designed for large data files, no tamper detection, no approval workflow
20
+ - **DVC** — excellent for versioning, but cannot cryptographically prove data integrity to external auditors
21
+ - **Nothing** — provides audit-ready proof that your training data hasn't been modified since approval
22
+
23
+ DataVault fills this gap.
24
+
25
+ ---
26
+
27
+ ## EU AI Act compliance reference
28
+
29
+ | Requirement | Article | How DataVault addresses it |
30
+ |---|---|---|
31
+ | Data governance | Art. 10 | Every version logged with author, timestamp, commit message |
32
+ | Tamper detection | Art. 10 | SHA-256 fingerprint — any modification detected instantly |
33
+ | Immutable history | Art. 12 | Cryptographic hash chain — history cannot be rewritten |
34
+ | Approval workflow | Art. 13 | Multi-user signing with reviewer, approver, owner roles |
35
+ | Audit documentation | Art. 13 | Export full provenance report as HTML/PDF |
36
+
37
+ *DataVault is not a legal compliance tool. It provides the technical infrastructure that compliance requires.*
38
+
39
+ ---
40
+
41
+ ## Quickstart
42
+
43
+ ```bash
44
+ git clone https://github.com/thiminhkhuedao/DataVault.git
45
+ cd DataVault
46
+ python test_datavault.py
47
+ ```
48
+
49
+ Or install via pip:
50
+
51
+ ```bash
52
+ pip install datavault-cli
53
+ ```
54
+
55
+ No config. No database. Python 3.6+ only.
56
+
57
+ ---
58
+
59
+ ## Usage
60
+
61
+ ```bash
62
+ # Initialize a project
63
+ python datavault.py init my-project
64
+
65
+ # Track a dataset
66
+ python datavault.py add training_data.csv "raw data from source"
67
+
68
+ # Commit a change
69
+ python datavault.py commit training_data.csv "removed 42 duplicate rows"
70
+
71
+ # Prove the file hasn't been tampered with
72
+ python datavault.py verify training_data.csv
73
+
74
+ # Generate a full EU AI Act audit report
75
+ python datavault.py audit training_data.csv
76
+
77
+ # See which rows changed between versions (CSV only)
78
+ python datavault.py rowdiff training_data.csv v1 v3
79
+
80
+ # Semantic diff — analyze the meaning of changes
81
+ python datavault.py diff training_data.csv v1 v3 --semantic
82
+
83
+ # Statistical comparison between versions
84
+ python datavault.py compare training_data.csv v1 v3 --statistical
85
+
86
+ # Detect data quality issues
87
+ python datavault.py anomaly training_data.csv
88
+
89
+ # Freeze a version (no further commits without unfreezing)
90
+ python datavault.py freeze training_data.csv v3 "approved for production"
91
+
92
+ # Sign a version
93
+ python datavault.py sign training_data.csv v3 alice reviewer
94
+ python datavault.py sign training_data.csv v3 bob approver
95
+ python datavault.py approve training_data.csv v3
96
+
97
+ # Declare lineage (where did this data come from?)
98
+ python datavault.py link training_data.csv raw_data.csv labels.csv
99
+
100
+ # Declare remote lineage (from another GitHub repo)
101
+ python datavault.py link-remote training_data.csv \
102
+ --repo https://github.com/user/medical-data \
103
+ --file raw_scans.csv
104
+
105
+ # Watch files for unauthorized modifications in real time
106
+ python datavault.py watch training_data.csv
107
+
108
+ # Encrypt a version
109
+ python datavault.py keygen alice
110
+ python datavault.py encrypt training_data.csv v3 alice
111
+
112
+ # Verify the full cryptographic chain
113
+ python datavault.py chain training_data.csv
114
+
115
+ # Open the web dashboard
116
+ python datavault.py dashboard
117
+
118
+ # Export a provenance report (HTML/PDF)
119
+ python datavault.py export
120
+ ```
121
+
122
+ ---
123
+
124
+ ## All commands
125
+
126
+ ### Core versioning
127
+ | Command | Description |
128
+ |---|---|
129
+ | `init <name>` | Initialize a new project |
130
+ | `add <file> "msg"` | Start tracking a file |
131
+ | `commit <file> "msg"` | Save a new version |
132
+ | `log <file>` | Show version history |
133
+ | `status` | Show all tracked files |
134
+ | `verify <file>` | SHA-256 tamper detection |
135
+ | `diff <file> v1 v2` | Text diff between versions |
136
+ | `diff <file> v1 v2 --semantic` | Semantic diff — analyze meaning of changes |
137
+ | `checkout <file> v1` | Restore a version |
138
+
139
+ ### Data analysis (CSV)
140
+ | Command | Description |
141
+ |---|---|
142
+ | `rowlog <file>` | Row change statistics per version |
143
+ | `rowdiff <file> v1 v2` | Which rows were added, deleted, moved |
144
+ | `rowhistory <file> col val` | Full history of one specific row |
145
+ | `compare <file> v1 v2 --statistical` | Deep statistical comparison between versions |
146
+ | `anomaly <file> [version]` | Detect data quality issues |
147
+
148
+ ### Cryptographic chain
149
+ | Command | Description |
150
+ |---|---|
151
+ | `chain <file>` | Verify the full hash chain |
152
+ | `chainshow <file>` | Display chain visually |
153
+ | `chainbuild <file>` | Build/rebuild the chain |
154
+
155
+ ### Approval workflow
156
+ | Command | Description |
157
+ |---|---|
158
+ | `sign <file> v <name> [role]` | Sign a version |
159
+ | `signatures <file>` | List or verify signatures |
160
+ | `approve <file> v` | Check approval status |
161
+ | `freeze <file> v ["reason"] [--method password\|signature]` | Lock a version |
162
+ | `unfreeze <file> v [--by <name>]` | Unlock a version |
163
+ | `frozen` | List all frozen versions |
164
+
165
+ ### Lineage & provenance
166
+ | Command | Description |
167
+ |---|---|
168
+ | `link <output> <source1> [source2...]` | Declare local data dependencies |
169
+ | `lineage <file>` | Show full lineage tree |
170
+ | `lineages` | List all declared lineage |
171
+ | `link-remote <file> --repo <url> --file <f> [--hash <h>]` | Link to remote GitHub source |
172
+ | `verify-remote <file>` | Check if remote sources have changed |
173
+ | `remote-lineage <file>` | Show remote sources |
174
+
175
+ ### Security
176
+ | Command | Description |
177
+ |---|---|
178
+ | `watch <file> [--interval N]` | Real-time tamper detection |
179
+ | `keygen <key>` | Create an encryption key |
180
+ | `encrypt <file> v <key>` | Encrypt a version |
181
+ | `decrypt <file> v <key> [output]` | Decrypt a version |
182
+ | `encrypted` | List encrypted versions |
183
+
184
+ ### Reporting
185
+ | Command | Description |
186
+ |---|---|
187
+ | `audit <file>` | Generate EU AI Act audit report |
188
+ | `export` | Export HTML/PDF provenance report |
189
+ | `dashboard` | Open local web dashboard (port 5000) |
190
+ | `tag <file> v "label"` | Label a version |
191
+ | `migrate` | Backfill snapshots for existing versions |
192
+
193
+ ---
194
+
195
+ ## How it works
196
+
197
+ **SHA-256 tamper detection** — every version gets a 64-character fingerprint. Change one character anywhere and `verify` catches it.
198
+
199
+ **Hash chain** — each version's hash includes the previous version's hash. Delete or reorder any version and the chain breaks. Same principle as Bitcoin.
200
+
201
+ **Row-level tracking** — `rowdiff v1 v3` shows exactly which rows were added, deleted, or moved. Not just "the file changed".
202
+
203
+ **Semantic diff** — analyzes the *meaning* of changes. Mean drift, class imbalance shifts, distribution changes — not just raw line diffs.
204
+
205
+ **Multi-user signing** — signatures are cryptographically tied to the file hash. Modify the file after signing and the signature is invalidated automatically.
206
+
207
+ **Freeze** — lock a version with a passphrase or owner signature. Nobody can commit new versions without unfreezing.
208
+
209
+ **Lineage** — declare where your data came from, locally and across GitHub repos. Verify that sources haven't changed since you linked them.
210
+
211
+ **Watch mode** — continuous real-time monitoring. Alerts immediately on any unauthorized modification.
212
+
213
+ **Encryption** — encrypt specific versions with PBKDF2-derived keys. Pure Python, no dependencies.
214
+
215
+ ---
216
+
217
+ ## Files
218
+
219
+ | File | Purpose |
220
+ |---|---|
221
+ | `datavault.py` | CLI entrypoint |
222
+ | `vault_core.py` | Core engine — hashing, versioning, storage |
223
+ | `row_tracker.py` | Row-level CSV tracking |
224
+ | `chain.py` | Cryptographic hash chain |
225
+ | `signing.py` | Multi-user signing and approval |
226
+ | `freeze.py` | Version locking with passphrase or signature |
227
+ | `audit.py` | EU AI Act audit report generator |
228
+ | `semantic_diff.py` | Semantic analysis of dataset changes |
229
+ | `statistical_compare.py` | Statistical comparison between versions |
230
+ | `anomaly.py` | Data quality anomaly detection |
231
+ | `lineage.py` | Local data lineage tracking |
232
+ | `remote_lineage.py` | Cross-repo lineage via GitHub |
233
+ | `watch.py` | Real-time file monitoring |
234
+ | `encrypt.py` | Version encryption |
235
+ | `dashboard.py` | Local web dashboard (port 5000) |
236
+ | `pi_bridge.py` | Auto-commit sensor data from Raspberry Pi |
237
+ | `migrate.py` | Backfill snapshots for existing versions |
238
+ | `test_datavault.py` | Full demo — run this first |
239
+
240
+ ---
241
+
242
+ ## Requirements
243
+
244
+ - Python 3.6+
245
+ - Zero external dependencies — pure standard library
246
+
247
+ ---
248
+
249
+ ## Copyright
250
+
251
+ Copyright © 2026 Thi Minh Khuê Dao. All rights reserved.
252
+
253
+ This project and its source code are public for portfolio and evaluation purposes only.
254
+ No permission is granted to copy, distribute, modify, or use this code for any other purpose without explicit written permission.