Skip to content

About

The Algerian Medical Passport is a revolutionary blockchain-based healthcare ecosystem that provides secure, transparent, and patient-controlled medical data management. Built on cutting-edge Web3 technologies, it serves as the first comprehensive medical passport system in Algeria and the MENA region.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

πŸ›οΈ Algerian Medical Passport Blockchain System

Algerian Medical Passport Logo

Revolutionizing Healthcare Through Blockchain Technology

A comprehensive, secure, and patient-controlled medical data management system for Algeria

License: MIT Node.js Version Solidity React TypeScript


🌟 Overview

The Algerian Medical Passport is a revolutionary blockchain-based healthcare ecosystem that provides secure, transparent, and patient-controlled medical data management. Built on cutting-edge Web3 technologies, it serves as the first comprehensive medical passport system in Algeria and the MENA region.

✨ Key Highlights

  • πŸ” Patient-Controlled Data: Complete data sovereignty for patients
  • πŸ›οΈ Government Verified: Official medical ID issuance and regulation
  • 🏒 Multi-Stakeholder: Serves all healthcare ecosystem participants
  • πŸ“± Mobile-First: Responsive design for all devices
  • 🌐 Multi-Network: Supports Polygon, Ethereum, and local networks
  • πŸ”’ Enterprise Security: Military-grade encryption and security
  • ⚑ Real-Time: Instant verification and updates
  • 🌍 Interoperable: Cross-platform medical record sharing

πŸ—οΈ System Architecture

The system serves six main stakeholders in a comprehensive healthcare ecosystem:

Stakeholder Role Key Capabilities
πŸ›οΈ Government Identity verification & regulation Medical ID issuance, system oversight, policy enforcement
πŸ‘¨β€βš•οΈ Doctors Medical diagnosis & prescription Patient record access, medical record creation, prescriptions
🏒 Hospitals Institutional care coordination Patient admissions, department coordination, treatment tracking
🏬 Clinics Outpatient & specialized care Consultation records, specialized treatments, care coordination
πŸ’Š Pharmacies Prescription verification & dispensing Real-time verification, fraud prevention, dispensing history
πŸ§‘β€πŸ€β€πŸ§‘ Patients Data ownership & access control Permission management, medical history access, emergency protocols

πŸ”§ Technology Stack

Blockchain & Smart Contracts

  • Blockchain Networks: Polygon, Ethereum, Hardhat Local
  • Smart Contracts: Solidity 0.8.19
  • Development Framework: Hardhat
  • Web3 Library: Ethers.js v5
  • Wallet Integration: MetaMask

Frontend

  • Framework: React 18+ with TypeScript
  • UI Library: Material-UI (MUI)
  • State Management: React Hooks + Context
  • Form Handling: Formik with Yup validation
  • Styling: Responsive CSS with Mobile-First approach

Backend

  • Runtime: Node.js 16+
  • Framework: Express.js
  • Database: MongoDB (optional), IPFS for documents
  • Authentication: JWT tokens
  • Security: Helmet, CORS, Rate limiting
  • Logging: Winston

Development & Deployment

  • Package Manager: npm
  • Testing: Hardhat tests, Jest
  • Linting: ESLint, Prettier
  • Version Control: Git
  • CI/CD Ready: GitHub Actions compatible

πŸ“ Project Structure

algerian-medical-passport-blockchain/
β”œβ”€β”€ πŸ“„ contracts/                    # Smart contracts (Solidity)
β”‚   β”œβ”€β”€ IdentityManagement.sol      # Medical ID issuance & verification
β”‚   β”œβ”€β”€ MedicalRecords.sol          # Medical record storage & access
β”‚   β”œβ”€β”€ PrescriptionManagement.sol  # Prescription lifecycle
β”‚   └── AccessControl.sol           # Permission management
β”‚
β”œβ”€β”€ πŸ“± frontend/                     # React + TypeScript application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/             # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/                  # Route components
β”‚   β”‚   β”œβ”€β”€ hooks/                  # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ config/                 # Configuration files
β”‚   β”‚   └── types/                  # TypeScript definitions
β”‚   └── public/
β”‚       └── healty1.png             # Custom logo
β”‚
β”œβ”€β”€ βš™οΈ backend/                      # Node.js API server
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/            # Request handlers
β”‚   β”‚   β”œβ”€β”€ middleware/             # Authentication & validation
β”‚   β”‚   β”œβ”€β”€ routes/                 # API routes
β”‚   β”‚   └── services/               # Business logic
β”‚   └── tests/                      # Backend tests
β”‚
β”œβ”€β”€ πŸ“‹ scripts/                     # Deployment & utility scripts
β”‚   β”œβ”€β”€ deploy.js                   # Contract deployment
β”‚   └── setupDemo.js                # Demo data setup
β”‚
β”œβ”€β”€ πŸ§ͺ test/                        # Smart contract tests
β”œβ”€β”€ πŸ“† demo/                        # Demo & presentation files
β”‚   β”œβ”€β”€ EXECUTIVE_PRESENTATION.html # Executive presentation
β”‚   └── DEMO_WALKTHROUGH.html       # Interactive demo guide
β”‚
β”œβ”€β”€ πŸ“ docs/                        # Documentation
β”‚   └── SYSTEM_ARCHITECTURE.md      # Comprehensive system docs
β”‚
β”œβ”€β”€ 🏠 .env.example                 # Environment variables template
β”œβ”€β”€ βš™οΈ hardhat.config.js             # Hardhat configuration
β”œβ”€β”€ πŸ“¦ package.json                 # Main package configuration
└── πŸ“‹ README.md                   # You are here!

πŸš€ Quick Start

πŸ“¦ Prerequisites

Before you begin, ensure you have the following installed:

1. πŸ“‹ Clone Repository

# Clone the repository
git clone https://github.com/nasrosoft/algerian-medical-passport-blockchain.git

# Navigate to project directory
cd algerian-medical-passport-blockchain

# Install dependencies for all packages
npm install

2. βš™οΈ Environment Configuration

# Copy environment template
cp .env.example .env

# Edit .env file with your configuration (optional for local development)
# nano .env

3. πŸ”— Deploy Smart Contracts (Local Development)

# Terminal 1: Start local Hardhat blockchain
npm run node

# Terminal 2: Deploy contracts to local network
npm run deploy:local

# Set up demo data with sample users and records
npx hardhat run scripts/setupDemo.js --network localhost

4. πŸš€ Start Development Servers

# Option 1: Start all services simultaneously
npm run dev

# Option 2: Start services individually
# Frontend (Terminal 1)
cd frontend && npm start

# Backend (Terminal 2)
cd backend && npm run dev

5. 🌐 Access the Application

Service URL Description
πŸ“± Frontend http://localhost:3000 Main application interface
βš™οΈ Backend API http://localhost:8000 RESTful API server
❀️ Health Check http://localhost:8000/health API health status
πŸ“† Demo Guide demo/DEMO_WALKTHROUGH.html Interactive walkthrough
πŸ“Š Presentation demo/EXECUTIVE_PRESENTATION.html Executive presentation

🌐 Network Configuration

Supported Blockchain Networks

Network Chain ID Status Purpose RPC URL
🏠 Localhost 1 βœ… Active Local Development http://localhost:8545
🏠 Localhost 1337 βœ… Active Hardhat Local http://localhost:8545
πŸ”¨ Localhost Hardhat 31337 βœ… Active Hardhat Network http://localhost:8545
🟣 Polygon Mumbai 80001 βœ… Ready Testnet https://rpc-mumbai.maticvigil.com/
🟣 Polygon Mainnet 137 🚧 Planned Production https://polygon-rpc.com/

MetaMask Network Setup

The application automatically detects your network and provides guidance for setup. For manual configuration:

Localhost Network:

  • Network Name: Localhost 8545
  • New RPC URL: http://localhost:8545
  • Chain ID: 1 (or 1337)
  • Currency Symbol: ETH

πŸ§ͺ Testing

Smart Contract Tests

# Run all smart contract tests
npm test

# Run tests with coverage report
npm run coverage

# Run specific test file
npx hardhat test test/IdentityManagement.test.js

# Run tests with gas reporting
npm test -- --gas

Frontend & Backend Tests

# Frontend tests
cd frontend && npm test

# Backend tests
cd backend && npm test

# E2E tests (if available)
npm run test:e2e

🌐 Testnet Deployment

Deploy to Polygon Mumbai

# Set up environment variables for testnet
export PRIVATE_KEY="your_private_key"
export POLYGON_MUMBAI_URL="your_rpc_url"

# Deploy to testnet
npm run deploy:testnet

# Verify contracts
npm run verify

Get Testnet MATIC

  1. Visit Polygon Faucet
  2. Enter your wallet address
  3. Request testnet MATIC tokens

🎭 Demo Users & Testing Scenarios

After running the demo setup script, you'll have the following test accounts:

πŸ’Ό Wallet Addresses (Local Development)

Role Account Address Private Key Available
πŸ›οΈ Government #0 Deployer account βœ… In Hardhat
πŸ‘¨β€βš•οΈ Doctor 1 #1 Cardiology specialist βœ… In Hardhat
πŸ‘¨β€βš•οΈ Doctor 2 #2 General practitioner βœ… In Hardhat
🏒 Hospital #7 City General Hospital βœ… In Hardhat
🏬 Clinic #8 Specialized clinic βœ… In Hardhat
πŸ’Š Pharmacy #3 Neighborhood pharmacy βœ… In Hardhat
πŸ§‘β€πŸ€β€πŸ§‘ Patient 1 #4 Adult patient βœ… In Hardhat
πŸ§‘β€πŸ€β€πŸ§‘ Patient 2 #5 Elderly patient βœ… In Hardhat
πŸ§‘β€πŸ€β€πŸ§‘ Patient 3 #6 Young adult patient βœ… In Hardhat

Demo Scenarios

  1. Patient Registration

    • Connect as Patient and register through the system
    • Government approves and issues medical ID
  2. Doctor-Patient Consultation

    • Patient grants access to doctor
    • Doctor creates medical records
    • Patient can view their records
  3. Prescription Workflow

    • Doctor issues prescription during consultation
    • Patient receives prescription notification
    • Pharmacy verifies and dispenses medication
  4. Access Control Management

    • Patient grants/revokes doctor access
    • Time-limited permissions
    • Emergency access controls
  5. Government Analytics

    • View system-wide statistics
    • Monitor healthcare provider activity
    • Generate anonymized reports

πŸŽ† Key Features

πŸ” Patient Data Sovereignty

  • Complete Control: Patients own and control their medical data
  • Granular Permissions: Grant/revoke access to specific providers
  • Time-Limited Access: Temporary permissions with automatic expiration
  • Emergency Protocols: Special access controls for critical situations
  • Audit Trail: Complete history of data access and permissions

πŸ›οΈ Government Oversight

  • Medical ID Issuance: Secure, blockchain-based identity verification
  • Provider Verification: Healthcare provider license validation
  • System Analytics: Privacy-preserving healthcare insights
  • Regulatory Compliance: Built-in compliance with healthcare regulations
  • Policy Enforcement: Automated enforcement of healthcare policies

🏒 Healthcare Provider Tools

  • Instant Access: Real-time access to patient medical history (with permission)
  • Immutable Records: Tamper-proof medical record creation
  • Smart Prescriptions: Cryptographically secured prescription management
  • Multi-Stakeholder: Seamless coordination between hospitals, clinics, and doctors
  • Treatment Tracking: Complete treatment outcome monitoring

πŸ’Š Pharmacy Integration

  • Real-Time Verification: Instant prescription authenticity validation
  • Fraud Prevention: Blockchain-based anti-counterfeiting
  • Dispensing History: Complete medication dispensing records
  • Inventory Management: Track medication stock and expiration
  • Drug Interaction Alerts: Safety warnings for medication conflicts

πŸ”’ Enterprise Security

  • End-to-End Encryption: AES-256 encryption for sensitive data
  • Multi-Signature Controls: Multi-party authorization for critical operations
  • Role-Based Access: Granular permission system by user type
  • Zero-Knowledge Ready: Privacy-preserving analytics capabilities
  • GDPR Compliance: Built-in data protection regulation adherence

πŸ“± User Experience

  • Mobile-First Design: Responsive interface for all devices
  • Multi-Language Support: Arabic, French, English interfaces
  • Real-Time Notifications: Instant updates on medical activities
  • Intuitive Dashboards: Role-specific user interfaces
  • Offline Capabilities: Essential functions work without internet

πŸš€ Production Deployment

Deploy to Polygon Mumbai (Testnet)

# Set up environment variables
export PRIVATE_KEY="your_private_key_here"
export POLYGON_MUMBAI_URL="your_polygon_rpc_url"
export POLYGONSCAN_API_KEY="your_polygonscan_api_key"

# Deploy to Mumbai testnet
npm run deploy:testnet

# Verify contracts on Polygonscan
npm run verify:testnet

Deploy to Polygon Mainnet (Production)

# Set up mainnet environment variables
export PRIVATE_KEY="your_production_private_key"
export POLYGON_MAINNET_URL="your_polygon_mainnet_rpc"
export POLYGONSCAN_API_KEY="your_polygonscan_api_key"

# Deploy to mainnet (use with caution)
npm run deploy:mainnet

# Verify contracts
npm run verify:mainnet

Get Testnet Tokens

  1. Polygon Mumbai Faucet: https://faucet.polygon.technology/
  2. Alchemy Polygon Faucet: https://www.alchemy.com/faucets/polygon-mumbai

🀝 Contributing

We welcome contributions to the Algerian Medical Passport project! Here's how you can help:

πŸ“¨ Reporting Issues

  1. Check existing issues to avoid duplicates
  2. Use the issue templates when available
  3. Provide detailed reproduction steps
  4. Include environment details (OS, Node.js version, etc.)

πŸ› οΈ Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“œ Code Standards

  • Follow TypeScript/JavaScript best practices
  • Write comprehensive tests for new features
  • Update documentation for API changes
  • Use conventional commit messages
  • Ensure all tests pass before submitting PR

πŸ“ Documentation

Help improve our documentation:

  • Fix typos and improve clarity
  • Add examples and use cases
  • Translate to Arabic or French
  • Create video tutorials

πŸ‘€ Team & Contact

πŸ’« Core Team

πŸ“¬ Contact Information

πŸ“ˆ Roadmap

🏁 Phase 1: Foundation (Completed)

  • βœ… Core smart contracts development
  • βœ… 6-stakeholder system implementation
  • βœ… Multi-network support
  • βœ… Comprehensive form validation
  • βœ… Responsive UI/UX design

πŸš€ Phase 2: Enhancement (Q1 2026)

  • πŸ”„ Mobile application (iOS/Android)
  • πŸ”„ Advanced analytics dashboard
  • πŸ”„ Multi-language support (Arabic/French)
  • πŸ”„ IPFS integration for document storage
  • πŸ”„ API marketplace for third-party integrations

🌍 Phase 3: Expansion (Q2-Q3 2026)

  • ⏳ Regional expansion (MENA countries)
  • ⏳ Insurance company integrations
  • ⏳ Cross-border medical record sharing
  • ⏳ Government API integration
  • ⏳ Healthcare research platform

πŸ€– Phase 4: Advanced Features (Q4 2026)

  • ⏳ AI-powered diagnostic assistance
  • ⏳ Telemedicine platform integration
  • ⏳ IoT medical device connectivity
  • ⏳ Advanced privacy (homomorphic encryption)
  • ⏳ Decentralized governance (DAO)

⭐ Show Your Support

If you find this project useful, please consider:

  • ⭐ Starring this repository
  • πŸ‘€ Following for updates
  • πŸ‘¨β€πŸ’» Contributing to the codebase
  • πŸ“’ Sharing with your network
  • πŸ“ Writing about your experience

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“œ License Summary

  • βœ… Commercial use allowed
  • βœ… Modification allowed
  • βœ… Distribution allowed
  • βœ… Private use allowed
  • ⚠️ License and copyright notice required
  • ❌ No warranty provided

Algerian Medical Passport

Built with INNO in Algeria for the future of healthcare

πŸš€ Revolutionizing Healthcare Through Blockchain Technology πŸš€

About

The Algerian Medical Passport is a revolutionary blockchain-based healthcare ecosystem that provides secure, transparent, and patient-controlled medical data management. Built on cutting-edge Web3 technologies, it serves as the first comprehensive medical passport system in Algeria and the MENA region.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages