@genobank/biofs 2.5.0 → 2.5.2

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE +37 -0
  3. package/README.md +2 -1
  4. package/bin/biofs.js +2 -1
  5. package/contracts/ClaraJobNFT.sol +2 -0
  6. package/dist/commands/link-clara.d.ts.map +1 -1
  7. package/dist/commands/link-clara.js +9 -3
  8. package/dist/commands/link-clara.js.map +1 -1
  9. package/dist/commands/tokenize-biosample.d.ts.map +1 -1
  10. package/dist/commands/tokenize-biosample.js +9 -3
  11. package/dist/commands/tokenize-biosample.js.map +1 -1
  12. package/dist/index.js +1 -1
  13. package/docs/AI_AGENT_MCP_MANUAL.md +2 -0
  14. package/docs/USER_MANUAL.md +2 -0
  15. package/docs/technical-details.html +555 -0
  16. package/lib/bionfs-client.js +2 -0
  17. package/lib/consent-manager.js +2 -0
  18. package/lib/consent-prompt.js +2 -0
  19. package/package.json +3 -3
  20. package/presentation/biofs-x402-kite-presentation.html +2 -0
  21. package/scripts/build_annotator_dictionary.py +1 -0
  22. package/scripts/deploy-clara-nft.js +2 -0
  23. package/ADMIN_REGISTER_LAB.md +0 -252
  24. package/ANNOTATOR_RECOMMENDATIONS_API.md +0 -490
  25. package/BIOFS_QUICK_START.md +0 -200
  26. package/BIOFS_TOKENIZE_COMPLETE.md +0 -541
  27. package/BIOFS_V1.2.7_PUBLISHED.md +0 -317
  28. package/BIOFS_V1.2.9_FIXES.md +0 -306
  29. package/BIOFS_V1.3.0_DIRECT_GRANT.md +0 -381
  30. package/BIOFS_V1.3.1_GRANTED_FILES.md +0 -328
  31. package/BIONFS_DEPLOYMENT_GUIDE.md +0 -408
  32. package/BIONFS_MOUNT_INTEGRATION_PLAN.md +0 -415
  33. package/BIONFS_PROTOCOL_SPECIFICATION.md +0 -688
  34. package/BIONFS_SEQUENTIAS_INTEGRATION.md +0 -457
  35. package/BIONFT_NFS_PROTOCOL_ARCHITECTURE.md +0 -583
  36. package/BIOOS_CLI_IMPLEMENTATION_COMPLETE.md +0 -422
  37. package/BIOOS_JOB_MANAGEMENT.md +0 -681
  38. package/BUGFIX_V2.1.3.md +0 -72
  39. package/CHANGELOG_V2.1.0.md +0 -386
  40. package/CHANGELOG_V2.2.0.md +0 -284
  41. package/ENHANCEMENT_DOCUMENTATION.md +0 -218
  42. package/GDPR_BIONFS_CONSENT_ARCHITECTURE.md +0 -798
  43. package/GDPR_BIONFS_IMPLEMENTATION_STATUS.md +0 -462
  44. package/INSTALL_V1.2.7_ON_MAC.md +0 -306
  45. package/LABNFT_BIOFS_INTEGRATION.md +0 -396
  46. package/OPENCRAVAT_ANNOTATORS_REFERENCE.md +0 -340
  47. package/OPENCRAVAT_ANNOTATOR_INTELLIGENCE_COMPLETE.md +0 -479
  48. package/QUICK_START_V2.1.0.md +0 -116
  49. package/RELEASE_SUMMARY_V1.2.7.md +0 -479
  50. package/RELEASE_SUMMARY_V1.3.0.md +0 -324
  51. package/SEQUENTIAS_PROTOCOL_ARCHITECTURE.md +0 -880
  52. package/SEQUENTIA_MIGRATION_GUIDE.md +0 -337
  53. package/SESSION_SUMMARY_DIRECT_GRANT.md +0 -321
  54. package/ULTRATHINK_BIONFS_COMPLETE.md +0 -458
  55. package/WEB3FUSE_LICENSE_TOKEN_ANALYSIS.md +0 -494
  56. package/WHERE_PERMISSIONS_LIVE.md +0 -165
  57. package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.dbg.json +0 -4
  58. package/artifacts/@openzeppelin/contracts/access/Ownable.sol/Ownable.json +0 -63
  59. package/artifacts/@openzeppelin/contracts/interfaces/IERC4906.sol/IERC4906.dbg.json +0 -4
  60. package/artifacts/@openzeppelin/contracts/interfaces/IERC4906.sol/IERC4906.json +0 -328
  61. package/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.dbg.json +0 -4
  62. package/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.json +0 -357
  63. package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.dbg.json +0 -4
  64. package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.json +0 -296
  65. package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol/IERC721Receiver.dbg.json +0 -4
  66. package/artifacts/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol/IERC721Receiver.json +0 -45
  67. package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol/ERC721URIStorage.dbg.json +0 -4
  68. package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol/ERC721URIStorage.json +0 -373
  69. package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol/IERC721Metadata.dbg.json +0 -4
  70. package/artifacts/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol/IERC721Metadata.json +0 -341
  71. package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +0 -4
  72. package/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.json +0 -10
  73. package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +0 -4
  74. package/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json +0 -10
  75. package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json +0 -4
  76. package/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.json +0 -10
  77. package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json +0 -4
  78. package/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.json +0 -30
  79. package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json +0 -4
  80. package/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.json +0 -30
  81. package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.dbg.json +0 -4
  82. package/artifacts/@openzeppelin/contracts/utils/math/Math.sol/Math.json +0 -10
  83. package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.dbg.json +0 -4
  84. package/artifacts/@openzeppelin/contracts/utils/math/SignedMath.sol/SignedMath.json +0 -10
  85. package/artifacts/build-info/1adfbc50ae3e1821260f858a9c689a37.json +0 -1
  86. package/artifacts/contracts/ClaraJobNFT.sol/ClaraJobNFT.dbg.json +0 -4
  87. package/artifacts/contracts/ClaraJobNFT.sol/ClaraJobNFT.json +0 -667
  88. package/cache/solidity-files-cache.json +0 -628
  89. package/check_clara2.js +0 -70
  90. package/check_clara3.js +0 -65
  91. package/config.json +0 -21
  92. package/hardhat.config.js +0 -25
  93. package/jest.config.js +0 -27
  94. package/mint_and_link_all.js +0 -128
  95. package/opencravat_annotators_dictionary.json +0 -2356
  96. package/package.json.working.v1.9.2.20251105_023952 +0 -48
  97. package/test-complete-flow.sh +0 -60
  98. package/test.vcf +0 -12
  99. package/test_23andme.txt +0 -12
  100. package/test_v2_mint.js +0 -101
@@ -1,306 +0,0 @@
1
- # Install BioFS v1.2.7 on Mac - BioOS Job Management + Annotator Intelligence
2
-
3
- ## Quick Install (Recommended)
4
-
5
- ### Option 1: Direct from npm (Easiest!)
6
-
7
- ```bash
8
- # Install globally from npm registry
9
- npm install -g @genobank/biofs@1.2.7
10
-
11
- # Verify version
12
- biofs --version # Should show 1.2.7
13
- ```
14
-
15
- ### Option 2: Direct Download from Server (Alternative)
16
-
17
- ```bash
18
- # On your Mac, download the package
19
- scp ubuntu@44.220.145.233:/home/ubuntu/genobank-cli/genobank-biofs-1.2.7.tgz ~/Downloads/
20
-
21
- # Install globally
22
- npm install -g ~/Downloads/genobank-biofs-1.2.7.tgz
23
-
24
- # Verify version
25
- biofs --version # Should show 1.2.7
26
- ```
27
-
28
- ## Test the New Features
29
-
30
- ### 1. Check Authentication (Already Done ✅)
31
-
32
- ```bash
33
- biofs whoami
34
- # Should show: 0xb3c3a584491b8ca4df45116a1e250098a0d6192d
35
- ```
36
-
37
- ### 2. Test Annotator Intelligence (NEW in v1.2.7!)
38
-
39
- ```bash
40
- # Get recommendations for cancer analysis
41
- curl "https://genobank.app/api_bioos/annotator_recommendations?phenotype=cancer"
42
-
43
- # Get recommendations for rare disease
44
- curl "https://genobank.app/api_bioos/annotator_recommendations?phenotype=rare_disease"
45
-
46
- # Get recommendations for splicing analysis
47
- curl "https://genobank.app/api_bioos/annotator_recommendations?analysis_type=splicing"
48
-
49
- # Browse all 146 available annotators
50
- curl "https://genobank.app/api_bioos/annotator_dictionary"
51
-
52
- # Look up specific annotator
53
- curl "https://genobank.app/api_bioos/annotator_dictionary?name=alphamissense"
54
- ```
55
-
56
- ### 3. List Available Pipeline Templates
57
-
58
- ```bash
59
- biofs job pipelines
60
- ```
61
-
62
- **Expected Output**:
63
- ```
64
- 🔧 Available Pipeline Templates:
65
-
66
- ┌────────────────────┬──────────────────────────────┬──────────────────────────────────────────────────┬────────┐
67
- │ Template ID │ Name │ Description │ Steps │
68
- ├────────────────────┼──────────────────────────────┼──────────────────────────────────────────────────┼────────┤
69
- │ fastq_to_report │ FASTQ to Clinical Report │ Process FASTQ → VCF → Annotation → Clinical Rep… │ 2 │
70
- ├────────────────────┼──────────────────────────────┼──────────────────────────────────────────────────┼────────┤
71
- │ vcf_annotation │ VCF Annotation │ Annotate VCF with rare coding variants │ 1 │
72
- ├────────────────────┼──────────────────────────────┼──────────────────────────────────────────────────┼────────┤
73
- │ vcf_alphagenome │ VCF with AlphaMissense Scor… │ Annotate VCF and score with AlphaMissense │ 2 │
74
- └────────────────────┴──────────────────────────────┴──────────────────────────────────────────────────┴────────┘
75
- ```
76
-
77
- ### 3. List Your BioFiles (Should Work with Existing Auth)
78
-
79
- ```bash
80
- biofs files
81
- ```
82
-
83
- This should show all Dra. Claudia's files from S3, IPFS, and Story Protocol.
84
-
85
- ### 4. Test Job Creation (Example - Won't Run Without File)
86
-
87
- ```bash
88
- # This is the syntax - you'll need an actual VCF file
89
- biofs job create "Annotate VCF with rare coding variants" your_file.vcf \
90
- --pipeline vcf_annotation
91
- ```
92
-
93
- ### 5. List Jobs (Will Show Empty Initially)
94
-
95
- ```bash
96
- biofs job list
97
- ```
98
-
99
- **Expected Output**:
100
- ```
101
- No research jobs found.
102
- Create a job: biofs job create "<prompt>" <file>
103
- ```
104
-
105
- ### 6. Test Help Command
106
-
107
- ```bash
108
- biofs help job
109
- ```
110
-
111
- **Expected Output**:
112
- ```
113
- Usage: biofs job [options] [command]
114
-
115
- Manage research jobs (BioOS)
116
-
117
- Commands:
118
- create [options] <prompt> <file> Create a research job from natural language prompt
119
- status [options] <job_id> Check job execution status
120
- results [options] <job_id> Get job results with download URLs
121
- list [options] List all your research jobs
122
- pipelines|templates [options] List available pipeline templates
123
- ```
124
-
125
- ## New Commands Available
126
-
127
- ### Job Management
128
- - `biofs job create "<prompt>" <file>` - Create research job
129
- - `biofs job status <job_id> [--watch]` - Check status
130
- - `biofs job results <job_id>` - Get results
131
- - `biofs job list [--status <status>]` - List jobs
132
- - `biofs job pipelines` - List templates
133
-
134
- ### All Commands Now Available
135
- ```bash
136
- # Authentication
137
- biofs login
138
- biofs logout
139
- biofs whoami
140
-
141
- # File Management
142
- biofs files [--filter <type>] [--source <source>]
143
- biofs download <file> [destination]
144
- biofs upload <file> [--tokenize]
145
-
146
- # BioIP Tokenization
147
- biofs tokenize <file> [--title "..."] [--license commercial]
148
-
149
- # Access Control
150
- biofs access request <biocid>
151
- biofs access grant <biocid> <wallet>
152
- biofs access revoke <biocid> <wallet>
153
- biofs access list [biocid]
154
- biofs access check <biocid>
155
-
156
- # BioOS Job Management (NEW!)
157
- biofs job create "<prompt>" <file>
158
- biofs job status <job_id>
159
- biofs job results <job_id>
160
- biofs job list
161
- biofs job pipelines
162
- ```
163
-
164
- ## Full Test Workflow (With Your Credentials)
165
-
166
- ### Step 1: Verify Installation
167
- ```bash
168
- biofs --version # Should be 1.2.6
169
- biofs whoami # Should show Dra. Claudia's wallet
170
- ```
171
-
172
- ### Step 2: Explore Pipelines
173
- ```bash
174
- biofs job pipelines
175
- ```
176
-
177
- ### Step 3: Check Your Files
178
- ```bash
179
- biofs files
180
- ```
181
-
182
- ### Step 4: Create a Test Job (If You Have a VCF)
183
- ```bash
184
- # If you have a VCF file
185
- biofs job create "Annotate with rare coding variants" your_file.vcf \
186
- --pipeline vcf_annotation
187
-
188
- # The CLI will:
189
- # 1. Upload your file if needed
190
- # 2. Create the job on GenoBank
191
- # 3. Return a job_id
192
- ```
193
-
194
- ### Step 5: Monitor Job
195
- ```bash
196
- # Check status once
197
- biofs job status <job_id>
198
-
199
- # Or watch in real-time (refreshes every 5 seconds)
200
- biofs job status <job_id> --watch
201
- ```
202
-
203
- ### Step 6: Download Results
204
- ```bash
205
- biofs job results <job_id>
206
- ```
207
-
208
- ## Troubleshooting
209
-
210
- ### If Version Still Shows 1.2.4 or 1.2.6
211
-
212
- ```bash
213
- # Uninstall old version first
214
- npm uninstall -g @genobank/biofs
215
-
216
- # Then install new version from npm
217
- npm install -g @genobank/biofs@1.2.7
218
-
219
- # Verify
220
- biofs --version # Should show 1.2.7
221
- ```
222
-
223
- ### If You Get Permission Errors
224
-
225
- ```bash
226
- # Use sudo on Mac
227
- sudo npm install -g @genobank/biofs@1.2.7
228
- ```
229
-
230
- ### If Commands Don't Work
231
-
232
- ```bash
233
- # Clear npm cache
234
- npm cache clean --force
235
-
236
- # Reinstall from npm
237
- npm install -g @genobank/biofs@1.2.7
238
- ```
239
-
240
- ## What's New in v1.2.7
241
-
242
- ✨ **OpenCRAVAT Annotator Intelligence (NEW!)**
243
- - Complete dictionary of 146 OpenCRAVAT annotators
244
- - Smart recommendations based on clinical phenotype (cancer, autism, rare disease, cardiovascular, etc.)
245
- - Analysis-type recommendations (rare coding, splicing, regulatory, de novo)
246
- - REST API endpoints for Claude AI integration
247
- - Natural language → annotator mapping
248
-
249
- ✨ **BioOS Job Management**
250
- - Natural language job creation
251
- - Real-time job monitoring with watch mode
252
- - Pipeline templates for common workflows
253
- - Story Protocol IP lineage tracking
254
- - Presigned S3 download URLs for results
255
- - SHA256 file verification
256
-
257
- ✨ **Enhanced User Experience**
258
- - Progress bars for job execution
259
- - Color-coded status indicators
260
- - Formatted tables for data display
261
- - JSON output for all commands
262
-
263
- ## Quick Reference
264
-
265
- ```bash
266
- # Job workflow
267
- biofs job pipelines # Browse templates
268
- biofs job create "prompt" file.vcf # Create job
269
- biofs job status <id> --watch # Monitor (live)
270
- biofs job results <id> # Download
271
- biofs job list # See all jobs
272
-
273
- # With pipeline template
274
- biofs job create "Annotate VCF" file.vcf --pipeline vcf_annotation
275
-
276
- # Natural language (Claude picks annotators)
277
- biofs job create "Find pathogenic cancer variants" tumor.vcf
278
-
279
- # Access control
280
- biofs access list # Your permissions
281
- biofs access request <biocid> # Request access
282
- biofs access grant <biocid> <wallet> # Grant access
283
- ```
284
-
285
- ## Documentation
286
-
287
- Full documentation available in the CLI package:
288
- - `BIOOS_JOB_MANAGEMENT.md` - Complete job management guide
289
- - `ANNOTATOR_RECOMMENDATIONS_API.md` - API documentation
290
- - `OPENCRAVAT_ANNOTATORS_REFERENCE.md` - All 146 annotators
291
-
292
- Or view online at: https://genobank.io/docs
293
-
294
- ---
295
-
296
- **Version**: 1.2.7
297
- **Release Date**: October 7, 2025
298
- **Published to npm**: ✅ Available at https://www.npmjs.com/package/@genobank/biofs
299
- **Your Wallet**: 0xb3c3a584491b8ca4df45116a1e250098a0d6192d
300
- **Authentication**: Valid for 28 more days
301
-
302
- ## Installation Command
303
-
304
- ```bash
305
- npm install -g @genobank/biofs@1.2.7
306
- ```
@@ -1,396 +0,0 @@
1
- # LabNFT + BioFS Integration Complete
2
-
3
- ## Overview
4
-
5
- GenoBank's lab registration system is now fully integrated with BioFS-CLI and all related services. Labs are registered via unified API, minted as LabNFTs on Sequentia blockchain, and recognized across the entire GenoBank ecosystem.
6
-
7
- ## Architecture
8
-
9
- ### Components Integrated
10
-
11
- 1. **LabNFT Smart Contract** (Sequentia L1)
12
- - Contract: `0x24f42752F491540e305384A5C947911649C910CF`
13
- - Chain ID: `15132025`
14
- - Network: Sequentia Mainnet (`http://52.90.163.112:8545`)
15
-
16
- 2. **GenoBank API** (`/register_lab` endpoint)
17
- - URL: `https://genobank.app/register_lab`
18
- - Generates custodial wallets or accepts user wallets
19
- - Mints LabNFTs automatically
20
- - Stores in MongoDB `labs` collection
21
-
22
- 3. **BioFS-CLI v2.2.0**
23
- - New module: `/src/lib/sequentia/LabNFT.ts`
24
- - Commands: `biofs admin register-lab`, `biofs admin verify-lab`
25
- - Integrated with Sequentia Protocol SDK
26
-
27
- 4. **Lab Management Service**
28
- - Service: `libs/service/lab_management_service.py`
29
- - Method: `register_lab_with_nft()`
30
- - DAO: `libs/dao/labnft_dao.py`
31
-
32
- ## New Features
33
-
34
- ### 1. Unified Lab Registration
35
-
36
- **Via BioFS-CLI:**
37
- ```bash
38
- # Register with custodial wallet generation
39
- biofs admin register-lab https://novogene.com --yes
40
-
41
- # Register with custom details
42
- biofs admin register-lab https://example.edu \
43
- --name "Example Genomics Lab" \
44
- --email contact@example.edu \
45
- --specialization "cancer genomics" \
46
- --location "Boston, MA" \
47
- --lab-type RESEARCHER
48
- ```
49
-
50
- **Via API:**
51
- ```bash
52
- curl -X POST https://genobank.app/register_lab \
53
- -H "Content-Type: application/json" \
54
- -d '{
55
- "name": "Test Lab",
56
- "lab_type": "LAB",
57
- "specialization": "WGS",
58
- "location": "Boston, MA",
59
- "website": "https://test-lab.com",
60
- "email": "contact@test-lab.com",
61
- "mint_nft": true
62
- }'
63
- ```
64
-
65
- ### 2. Lab Verification
66
-
67
- **Check LabNFT ownership and status:**
68
- ```bash
69
- biofs admin verify-lab 0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07
70
- ```
71
-
72
- **Output:**
73
- ```
74
- ✅ Lab Verified!
75
-
76
- LabNFT Details:
77
- Serial: #43
78
- Contract: 0x24f42752F491540e305384A5C947911649C910CF
79
- Owner: 0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07
80
-
81
- Lab Information:
82
- Name: Novogene
83
- Type: Lab
84
- Specialization: Genomic sequencing and bioinformatics
85
- Location: United States
86
- Website: https://novogene.com
87
- Email: contact@novogene.com
88
-
89
- Access Control:
90
- Access Level: Research Only
91
- GA4GH Level: None
92
- Verified: ✅ Yes
93
- Active: ✅ Yes
94
-
95
- GDPR Consent:
96
- Biodata Consent: 0xbe8ee34d...
97
- Commercial Consent: 0x2d3543df...
98
- ```
99
-
100
- ### 3. File Sharing with LabNFT Verification
101
-
102
- **BioFS will automatically verify LabNFT ownership when sharing files:**
103
-
104
- ```bash
105
- # Share file with lab (LabNFT verified automatically)
106
- biofs share patient001.vcf \
107
- --lab 0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07 \
108
- --license non-commercial
109
- ```
110
-
111
- **Backend verification flow:**
112
- 1. Check if recipient wallet has LabNFT
113
- 2. Verify LabNFT is active and verified
114
- 3. Check GDPR consent hashes
115
- 4. Grant access if all checks pass
116
-
117
- ## MongoDB Collections
118
-
119
- ### Unified `labs` Collection
120
-
121
- Replaces fragmented `lab_wallets`, `permittees`, and `researchers` collections:
122
-
123
- ```javascript
124
- {
125
- "_id": ObjectId("..."),
126
- "name": "Novogene",
127
- "owner_wallet": "0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07",
128
- "wallet_type": "custodial_generated", // or "user_provided"
129
- "wallet_private_key": "...", // Only for custodial wallets
130
- "wallet_mnemonic": "...", // Only for custodial wallets
131
- "wallet_claimed": false,
132
- "lab_type": "LAB", // LAB, RESEARCHER, or INSTITUTION
133
- "specialization": "Genomic sequencing",
134
- "location": "United States",
135
- "website": "https://www.novogene.com",
136
- "email": "contact@novogene.com",
137
- "verified": true,
138
- "sequentia": {
139
- "registered": true,
140
- "labnft_token_id": 43,
141
- "tx_hash": "0xabc123...",
142
- "block_number": 12345,
143
- "contract": "0x24f42752F491540e305384A5C947911649C910CF"
144
- },
145
- "gdpr_consent": {
146
- "biodata_consent_hash": "0xbe8ee34d...",
147
- "commercial_consent_hash": "0x2d3543df...",
148
- "consent_date": ISODate("2025-11-11T...")
149
- },
150
- "created_at": ISODate("2025-11-11T..."),
151
- "updated_at": ISODate("2025-11-11T...")
152
- }
153
- ```
154
-
155
- ## BioFS-CLI Integration
156
-
157
- ### New LabNFT Module
158
-
159
- **File:** `/home/ubuntu/biofs-cli/src/lib/sequentia/LabNFT.ts`
160
-
161
- **Key Features:**
162
- - Full LabNFT contract integration
163
- - EIP-55 checksummed addresses
164
- - GDPR consent hash generation
165
- - Lab type and access level enums
166
- - GA4GH compliance levels
167
-
168
- **Usage:**
169
- ```typescript
170
- import { LabNFT, LabType, AccessLevel } from '@genobank/biofs';
171
-
172
- // Initialize client
173
- const labNFT = new LabNFT(executorPrivateKey);
174
-
175
- // Check registration
176
- const isRegistered = await labNFT.isLabRegistered(wallet);
177
-
178
- // Get lab info
179
- const labInfo = await labNFT.getLabByWallet(wallet);
180
-
181
- // Mint new LabNFT
182
- const result = await labNFT.mintLab({
183
- owner: wallet,
184
- labType: LabType.LAB,
185
- name: "Test Lab",
186
- specialization: "Genomics",
187
- location: "Boston, MA",
188
- website: "https://test.com",
189
- email: "contact@test.com",
190
- accessLevel: AccessLevel.RESEARCH_ONLY
191
- });
192
- ```
193
-
194
- ## API Integration
195
-
196
- ### Unified `/register_lab` Endpoint
197
-
198
- **Location:** `/home/ubuntu/Genobank_APIs/production_api/run/runweb.py`
199
-
200
- **Request:**
201
- ```json
202
- {
203
- "name": "Lab Name",
204
- "lab_type": "LAB|RESEARCHER|INSTITUTION",
205
- "specialization": "genomics",
206
- "location": "New York, NY",
207
- "website": "https://example.com",
208
- "email": "contact@example.com",
209
- "wallet_address": "0x..." // optional
210
- "mint_nft": true
211
- }
212
- ```
213
-
214
- **Response:**
215
- ```json
216
- {
217
- "status": "Success",
218
- "status_details": {
219
- "message": "Lab registered successfully",
220
- "data": {
221
- "lab_id": "673cf34f79d8b5f2c9f20c91",
222
- "wallet_address": "0x44232e3c104BBd6c6de6C34567e1dB4af2104807",
223
- "wallet_type": "custodial_generated",
224
- "private_key": "...",
225
- "mnemonic": "word1 word2 ...",
226
- "labnft": {
227
- "serial": 34,
228
- "tx_hash": "0x1ebfa931...",
229
- "block_number": 12345,
230
- "contract": "0x24f42752F491540e305384A5C947911649C910CF"
231
- }
232
- }
233
- }
234
- }
235
- ```
236
-
237
- ## Migration Summary
238
-
239
- ### Before (Fragmented System)
240
-
241
- - **Collections:** `lab_wallets`, `permittees`, `researchers`
242
- - **Registration:** Manual via multiple endpoints
243
- - **No blockchain verification**
244
- - **No unified access control**
245
-
246
- ### After (Unified System)
247
-
248
- - **Collection:** Single `labs` collection
249
- - **Registration:** Unified `/register_lab` API
250
- - **LabNFT minting:** Automatic on registration
251
- - **Access control:** LabNFT-based verification
252
- - **CLI support:** `biofs admin register-lab`, `biofs admin verify-lab`
253
-
254
- ### Migration Stats
255
-
256
- - **Total labs:** 63
257
- - **Labs with LabNFTs:** 63 (100%)
258
- - **Custodial wallets:** 28
259
- - **User-provided wallets:** 35
260
- - **LabNFT serials:** #1 - #61 (plus test labs #60-61)
261
-
262
- ## Security Features
263
-
264
- ### 1. GDPR Compliance
265
-
266
- - **Biodata consent hash:** Stored on-chain
267
- - **Commercial consent hash:** Separate tracking
268
- - **Consent revocation:** Supported via ConsentManager module
269
-
270
- ### 2. Access Control
271
-
272
- - **Four access levels:**
273
- - Research Only (0)
274
- - Clinical Non-Critical (1)
275
- - Clinical Critical (2)
276
- - Commercial (3)
277
-
278
- - **GA4GH compliance levels:**
279
- - None (0)
280
- - Basic (1)
281
- - Lite (2)
282
- - Full (3)
283
-
284
- ### 3. Wallet Security
285
-
286
- - **Custodial wallets:** Private keys encrypted in MongoDB
287
- - **EIP-55 checksumming:** Address validation
288
- - **Claim workflow:** Labs can claim custodial wallets via email
289
-
290
- ## File Sharing Integration
291
-
292
- ### Current Implementation
293
-
294
- File sharing currently uses wallet-based verification:
295
-
296
- ```python
297
- # runweb.py:4668
298
- def share_file(self, signature, data):
299
- user = self.user_service.get_user_from_token(signature)
300
- saved = self.shared_service.share_file(user, data)
301
- return saved
302
- ```
303
-
304
- ### Future Enhancement (Planned)
305
-
306
- Add LabNFT verification layer:
307
-
308
- ```python
309
- def share_file(self, signature, data):
310
- user = self.user_service.get_user_from_token(signature)
311
-
312
- # Verify recipient has LabNFT
313
- recipient_wallet = data['permittee']
314
- if not self.labnft_dao.is_wallet_registered(recipient_wallet):
315
- raise ValueError("Recipient does not have LabNFT")
316
-
317
- # Verify LabNFT is active and verified
318
- lab_info = self.labnft_dao.get_lab_by_wallet(recipient_wallet)
319
- if not lab_info or not lab_info['verified'] or not lab_info['active']:
320
- raise ValueError("Recipient lab not verified")
321
-
322
- saved = self.shared_service.share_file(user, data)
323
- return saved
324
- ```
325
-
326
- ## Testing
327
-
328
- ### Test Lab Registration
329
-
330
- ```bash
331
- # Via CLI
332
- biofs admin register-lab https://novogene.com --yes
333
-
334
- # Via API
335
- curl -X POST https://genobank.app/register_lab \
336
- -H "Content-Type: application/json" \
337
- -d '{"name": "Test Lab", "lab_type": "LAB", "mint_nft": true}'
338
- ```
339
-
340
- ### Verify Registration
341
-
342
- ```bash
343
- # Check on-chain
344
- biofs admin verify-lab 0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07
345
-
346
- # Check in MongoDB
347
- mongosh "mongodb+srv://..." --eval "db.labs.findOne({owner_wallet: '0x9346be6aD3384EB36c172F8B2bB4b7C9d8afFc07'})"
348
- ```
349
-
350
- ## Version History
351
-
352
- - **v2.2.0** (2025-11-12): LabNFT integration complete
353
- - Added `LabNFT.ts` module
354
- - Updated `register-lab` to use unified API
355
- - Added `verify-lab` command
356
- - Integrated with Sequentia Protocol SDK
357
-
358
- - **v2.1.11** (Previous): Pre-LabNFT integration
359
- - Manual lab registration
360
- - BioPIL DAO placeholder
361
-
362
- ## Next Steps
363
-
364
- 1. **Implement LabNFT verification in file sharing endpoints**
365
- - Add LabNFT checks to `share_file()`
366
- - Add LabNFT checks to `approve_biosample_request()`
367
- - Add LabNFT checks to `deliver_raw_data_from_root()`
368
-
369
- 2. **Add lab claiming workflow**
370
- - Email verification for custodial wallets
371
- - Wallet claiming via GenoBank dashboard
372
- - Private key transfer mechanism
373
-
374
- 3. **Enhance BioFS-CLI**
375
- - `biofs lab list` - List all registered labs
376
- - `biofs lab update` - Update lab information
377
- - `biofs lab claim` - Claim custodial wallet
378
-
379
- 4. **Admin Dashboard Integration**
380
- - View all LabNFTs at `https://admin.genobank.io`
381
- - Approve/verify labs
382
- - Monitor LabNFT activity
383
-
384
- ## Support
385
-
386
- - **Documentation:** This file
387
- - **API Reference:** `/production_api/API-ENDPOINTS-FUNCTION-MANUAL.md`
388
- - **BioFS-CLI Help:** `biofs admin register-lab --help`
389
- - **Issues:** https://github.com/Genobank/biofs-cli/issues
390
- - **Email:** support@genobank.io
391
-
392
- ---
393
-
394
- **Implementation Date:** November 12, 2025
395
- **Author:** GenoBank.io Development Team
396
- **Version:** BioFS-CLI v2.2.0 + Production API v2025.11