How sahilbehl2003/healthcare_e_vault works
Project Type and Purpose
• This is a full-stack DApp (decentralized application) with:
• A React-based web client
• A Python-based AI/QA chatbot backend
• A Solidity smart contract running on a local Ethereum network (Hardhat)
• Purpose:
• Allow users to upload, remove, and share file references on-chain
• Provide an AI assistant for searching/qa’ing medical documents
Main Components
A. Frontend (client/)
• React SPA (App.js, components/…)
• Ethers.js + MetaMask integration for on-chain calls
• HTTP calls to Python AI backend (e.g., for vector searches)
B. Backend & AI (chatbot/)
• ingest.py: PDF ingestion & embedding creation
• model.py: Query interface for FAISS vectorstore
• FAISS DB (vectorstore/db_faiss/index.faiss & index.pkl)
C. Smart Contract (contracts/, scripts/, test/)
• Solidity contract “Upload.sol” (in contracts/)
• Hardhat config & scripts (hardhat.config.js, scripts/deploy.js)
• Local Ethereum node via npx hardhat node
• Tests (test/UploadTest.js)
Relationships & Data Flows
1. User interacts with React UI
– FileUpload component → optional off-chain storage (e.g., IPFS)
– Calls uploadInstance.add(...) via Ethers.js → Smart Contract on Hardhat network
2. Smart Contract stores IPFS URIs in user-scoped lists, manages access control
– add(), removeFile(), allow(), disallow(), display()
– Data remains on-chain; URIs point to off-chain content
3. React UI queries contract for file list → renders in Display component
4. AI Query Flow
– User enters question in AI component → HTTP POST to Python service
– Python service loads FAISS index & embeddings → returns best matches
– React UI displays AI/QA results
5. Deployment Flow
– scripts/deploy.js → deploys Upload.sol → returns contract address → injected into React env
Architectural Patterns & Design Principles
• Separation of Concerns
– UI Layer (React)
– Business Logic (Python AI + Solidity contract)
– Data Persistence
• On-chain (Smart Contract)
• Off-chain (FAISS vectorstore, IPFS)
• Modular components
– React components folder
– Python modules for ingest & model
– Hardhat scripts/tests separated
• API abstraction
– Ethers.js abstracts contract calls
– Potential REST API for Python AI
Essential Elements
• Clear labels for each component & folder
• Notes on data formats (e.g., IPFS URI, JSON, embeddings)