A blockchain-based solution for tracking and tracing pharmaceutical products throughout the healthcare supply chain, ensuring authenticity and preventing counterfeiting.
- Smart Contract Integration: Ethereum-based smart contract for immutable drug tracking
- User Roles:
- Admin: Manages users and oversees the system
- Manufacturer: Adds new drugs to the blockchain
- Distributor: Updates drug location and status
- Retailer: Final point of sale tracking
- Consumer: Verifies drug authenticity
- Drug Tracing: Complete history of each drug from manufacturing to consumption
- Authentication: Secure login system for all stakeholders
- Real-time Updates: Instant blockchain updates for drug status changes
- Backend: Django (Python)
- Frontend: HTML, CSS, JavaScript
- Blockchain: Ethereum Smart Contracts (Solidity)
- Database: SQLite (Development), PostgreSQL (Production)
- Web3 Integration: Web3.py
- Python 3.8+
- Node.js and npm (for web3 dependencies)
- MetaMask or similar Web3 wallet
- Ethereum network access (Testnet/Mainnet)
-
Clone the repository:
git clone https://github.com/varshitha127/drug_traceability.git cd drug_traceability -
Create and activate virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.envfile in the root directory with:SECRET_KEY=your_django_secret_key DEBUG=True WEB3_PROVIDER_URI=your_ethereum_node_url -
Run migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
- Deploy the smart contract (
Drug.sol) to your chosen Ethereum network - Update the contract address in
DrugTraceApp/services/blockchain.py - Ensure your Web3 provider is properly configured
- Access the application at
http://localhost:8000 - Connect your Web3 wallet (MetaMask)
- Login with appropriate credentials
- Follow the role-specific workflows for drug tracing
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Varshitha - @varshitha127
Project Link: https://github.com/varshitha127/drug_traceability
drug_traceability/
│
├── DrugTraceApp/ # Main Django application
│ ├── services/ # Blockchain and business logic services
│ ├── templates/ # HTML templates
│ │ ├── admin/ # Admin interface templates
│ │ ├── auth/ # Authentication templates
│ │ ├── manufacturer/ # Manufacturer role templates
│ │ ├── distributor/ # Distributor role templates
│ │ ├── retailer/ # Retailer role templates
│ │ └── consumer/ # Consumer role templates
│ │
│ ├── static/ # Static files (CSS, JS, Images)
│ │ ├── css/ # Stylesheets
│ │ ├── js/ # JavaScript files
│ │ └── images/ # Image assets
│ │
│ ├── migrations/ # Database migrations
│ ├── __init__.py
│ ├── admin.py # Admin site configuration
│ ├── apps.py # App configuration
│ ├── forms.py # Form definitions
│ ├── models.py # Database models
│ ├── settings.py # Development settings
│ ├── settings_prod.py # Production settings
│ ├── urls.py # URL routing
│ ├── views.py # View functions
│ ├── wsgi.py # WSGI configuration
│ └── asgi.py # ASGI configuration
│
├── media/ # User-uploaded media files
├── staticfiles/ # Collected static files
├── venv/ # Virtual environment
│
├── Drug.sol # Smart contract source code
├── Drug.json # Compiled smart contract
├── manage.py # Django management script
├── requirements.txt # Python dependencies
├── Procfile # Deployment configuration
├── .gitignore # Git ignore rules
└── README.md # Project documentation
- Smart Contracts:
Drug.solcontains the Ethereum smart contract for drug tracking - Django App:
DrugTraceApp/contains the main web application - Templates: Role-specific templates for different stakeholders
- Static Files: CSS, JavaScript, and images for the web interface
- Services: Blockchain integration and business logic
- Media: Storage for user-uploaded files
- Configuration: Settings for both development and production environments