Skip to content

"Welcome to the Sri Lankan Immunization Real-Time Tracker, A powerful web-based platform designed to deliver clear, interactive dashboards and insights on vaccine distribution and reported side effects across the country. Built for speed and simplicity, this tool empowers fast, informed decision-making through an intuitive user experience."

Notifications You must be signed in to change notification settings

Kavi511/SL-Immunization-Safety-System

Repository files navigation

πŸ’‰ Sri Lankan Vaccine Safety Network (SLVSN)

Laravel PHP License Build Status

πŸ“‹ Table of Contents

🎯 About

The Sri Lankan Vaccine Safety Network (SLVSN) is a comprehensive vaccine monitoring and safety tracking system designed to assess vaccine safety and effectiveness across large and diverse populations in Sri Lanka. This Laravel-based web application leverages Big Data Analytics and Visualization to enhance vaccination process monitoring at large scales of public health.

Mission Statement

"The project explores the concept of Big Data and Big Data visualization in relation to the vaccination process in Sri Lanka, ensuring vaccine safety and effectiveness through collaborative, investigator-led research efforts."

✨ Features

πŸ” Authentication & User Management

  • Secure Registration/Login: Medical professionals can register with medical license numbers
  • Profile Management: Users can update their profiles and credentials
  • Password Reset: Secure password recovery system
  • Session Management: Secure session handling with Laravel Breeze

πŸ’‰ Vaccine Management

  • Vaccine Registry: Track vaccines with manufacturer details, batch numbers, and expiration dates
  • Patient Records: Comprehensive patient information management
  • Vaccination Records: Link patients with administered vaccines and healthcare providers
  • Adverse Effects Tracking: Monitor and report vaccine adverse effects with severity levels

πŸ“Š Data Analytics & Visualization

  • Power BI Integration: Interactive dashboards for vaccination data analysis
  • Real-time Monitoring: Live tracking of vaccination progress and adverse effects
  • Big Data Processing: Handle large-scale vaccination data efficiently
  • Audit Trails: Complete change logging system with database triggers

πŸ“° Information Hub

  • News Integration: Real-time vaccine-related news from external APIs
  • Research Access: Platform for accessing vaccination studies and data
  • Community Engagement: Discussion forums and information sharing

πŸ›‘οΈ Data Security & Compliance

  • Database Triggers: Automatic change logging for all critical tables
  • Data Integrity: Foreign key constraints and validation rules
  • Audit Logging: Comprehensive tracking of all system changes
  • Secure API Integration: Protected external service connections

πŸ—οΈ System Architecture

Database Schema

Core Tables

  • users: Healthcare professionals with medical license numbers
  • patients: Patient demographic and contact information
  • vaccines: Vaccine inventory with batch tracking
  • vaccination_records: Links patients, vaccines, and administrators
  • adverse_effects: Adverse effect reports with severity classification
  • adverse_effect_logs: Audit trail for adverse effect changes
  • change_log: System-wide change tracking

Key Relationships

users (1) -----> (N) vaccination_records
patients (1) ---> (N) vaccination_records  
vaccines (1) ---> (N) vaccination_records
vaccination_records (1) -> (N) adverse_effects

Technology Stack

  • Backend: Laravel 11.31 (PHP 8.2+)
  • Frontend: Blade Templates, Alpine.js, Tailwind CSS
  • Database: MySQL with automated triggers
  • Testing: Pest PHP testing framework
  • Build Tools: Vite, PostCSS
  • Analytics: Power BI integration

πŸ“ Project Structure

.
β”œβ”€ backend/                          # Laravel application (server-side)
β”‚  β”œβ”€ app/                           # Application code (Models, Http Controllers, Requests, etc.)
β”‚  β”œβ”€ bootstrap/                     # Framework bootstrap
β”‚  β”œβ”€ config/                        # Laravel configuration files
β”‚  β”œβ”€ database/                      # Migrations, factories, seeders
β”‚  β”œβ”€ public/                        # Public web root (Vite builds output to build/ here)
β”‚  β”‚  └─ build/                      # Compiled assets from frontend (manifest.json, assets/...)
β”‚  β”œβ”€ resources/
β”‚  β”‚  └─ views/                      # Blade templates (server-rendered UI)
β”‚  β”œβ”€ routes/                        # Web, console, auth routes
β”‚  β”œβ”€ storage/                       # Framework/cache/logs (should be writable)
β”‚  β”œβ”€ tests/                         # Pest tests
β”‚  β”œβ”€ vendor/                        # Composer dependencies
β”‚  β”œβ”€ artisan                        # Artisan CLI
β”‚  β”œβ”€ composer.json                  # Backend Composer config and scripts
β”‚  └─ phpunit.xml                    # PHPUnit/Pest configuration
β”‚
β”œβ”€ frontend/                         # Client-side assets and build tooling
β”‚  β”œβ”€ resources/
β”‚  β”‚  β”œβ”€ css/                        # Tailwind entry (app.css)
β”‚  β”‚  └─ js/                         # JS entry (app.js, bootstrap.js)
β”‚  β”œβ”€ package.json                   # Frontend scripts and deps
β”‚  β”œβ”€ package-lock.json              # Lockfile
β”‚  β”œβ”€ postcss.config.js              # PostCSS configuration
β”‚  β”œβ”€ tailwind.config.js             # Tailwind scan paths (points to backend views)
β”‚  └─ vite.config.js                 # Builds to ../backend/public/build and dev server
β”‚
β”œβ”€ CHANGELOG.md
β”œβ”€ README.md
└─ (optional) .env files             # Backend env at backend/.env; Vite env at frontend/.env

Run targets (quick ref)

  • Backend dev: cd backend && composer install && composer dev
  • Frontend dev only: cd frontend && npm install && npm run dev
  • Production build: cd backend && composer build

🧰 Local Setup with XAMPP

Apache Alias (serve at http://localhost/slvsn)

  1. Open C:\xampp\apache\conf\httpd.conf and ensure these are enabled (no leading #):
LoadModule rewrite_module modules/mod_rewrite.so
Include conf/extra/httpd-xampp.conf
  1. Open C:\xampp\apache\conf\extra\httpd-xampp.conf (or httpd.conf if preferred) and add:
# Serve SLVSN at http://localhost/slvsn
Alias /slvsn "S:/Vaccine_Monitoring_Sys/backend/public"
<Directory "S:/Vaccine_Monitoring_Sys/backend/public">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
    DirectoryIndex index.php
</Directory>
  1. Restart Apache in XAMPP.

Environment

Edit backend/.env:

APP_URL=http://localhost/slvsn
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=vaccine_monitoring
DB_USERNAME=root
DB_PASSWORD=
QUEUE_CONNECTION=sync

One-time backend prep

cd S:\Vaccine_Monitoring_Sys\backend
php artisan key:generate
php artisan storage:link

Build frontend assets (outputs to backend/public/build)

cd S:\Vaccine_Monitoring_Sys\frontend
npm install
npm run build

Notes:

  • Vite 6 writes the manifest to public/build/.vite/manifest.json. The build script also copies to public/build/manifest.json for compatibility.

Clear Laravel caches if routes/assets change

cd S:\Vaccine_Monitoring_Sys\backend
php artisan config:clear
php artisan cache:clear
php artisan route:clear
php artisan view:clear

Open the site

  • http://localhost/slvsn
  • If you see a 404 on pretty URLs, verify mod_rewrite is enabled and AllowOverride All is set in the Alias <Directory> block.

πŸ“‹ Requirements

System Requirements

  • PHP: 8.2 or higher
  • Composer: Latest version
  • Node.js: 18+ and npm
  • Database: MySQL 8.0+ or MariaDB 10.3+
  • Web Server: Apache/Nginx

PHP Extensions

  • OpenSSL
  • PDO
  • Mbstring
  • Tokenizer
  • XML
  • Ctype
  • JSON
  • BCMath

πŸš€ Installation

1. Clone the Repository

git clone https://github.com/your-username/vaccine-monitoring-system.git
cd vaccine-monitoring-system

2. Install Dependencies

# Install PHP dependencies
composer install

# Install Node.js dependencies
npm install

3. Environment Setup

# Copy environment file
cp .env.example .env

# Generate application key
php artisan key:generate

4. Configure Environment Variables

Edit .env file with your settings:

APP_NAME="Vaccine Monitoring System"
APP_ENV=local
APP_KEY=base64:your-generated-key
APP_DEBUG=true
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=vaccine_monitoring
DB_USERNAME=your_username
DB_PASSWORD=your_password

# News API Configuration
NEWS_API_KEY=your_news_api_key

5. Database Setup

# Create database
mysql -u root -p -e "CREATE DATABASE vaccine_monitoring;"

# Run migrations
php artisan migrate

# Seed database (optional)
php artisan db:seed

6. Build Assets

# Development
npm run dev

# Production
npm run build

7. Start Development Server

# Option 1: Laravel development server
php artisan serve

# Option 2: Using the dev script (includes queue worker and Vite)
composer run dev

Visit http://localhost:8000 to access the application.

πŸ—„οΈ Database Setup

Migration Files

The system includes comprehensive database migrations:

  1. Core Laravel Tables:

    • 0001_01_01_000000_create_users_table.php
    • 0001_01_01_000001_create_cache_table.php
    • 0001_01_01_000002_create_jobs_table.php
  2. Vaccine System Tables:

    • 2024_12_28_070514_create_vaccines_table.php
    • 2024_12_28_070602_create_patients_table.php
    • 2024_12_28_070631_create_vaccination_records_table.php
    • 2024_12_28_071225_create_adverse_effects_table.php
  3. Audit & Logging:

    • 2024_12_28_072019_create_change_log_table.php
    • 2025_01_13_114103_create_adverse_effect_logs_table.php
  4. Database Triggers:

    • 2024_12_28_110152_create_triggers_for_vaccines.php
    • 2024_12_28_110647_create_update_trigger_for_patients.php
    • 2024_12_28_110658_create_update_trigger_for_vaccination_records.php
    • 2024_12_28_110709_create_update_trigger_for_adverse_effects.php
  5. User Enhancements:

    • 2025_01_13_083120_add_medical_no_to_users_table.php

Running Migrations

# Run all migrations
php artisan migrate

# Rollback migrations (if needed)
php artisan migrate:rollback

# Fresh migration with seeding
php artisan migrate:fresh --seed

βš™οΈ Configuration

News API Setup

  1. Register at NewsAPI.org
  2. Get your API key
  3. Add to .env: NEWS_API_KEY=your_api_key_here

πŸ“Š Power BI Integration

The dashboard integrates with Power BI for advanced analytics. Update the iframe source in resources/views/dashboard.blade.php with your Power BI report URL.

Mail Configuration

Configure mail settings in .env for password reset functionality:

MAIL_MAILER=smtp
MAIL_HOST=your-smtp-host
MAIL_PORT=587
MAIL_USERNAME=your-email
MAIL_PASSWORD=your-password
MAIL_ENCRYPTION=tls

πŸ“– Usage

User Registration

  1. Navigate to /register
  2. Fill in required information including medical license number
  3. Verify email (if email verification is enabled)
  4. Access the dashboard

Managing Adverse Effects

  1. Login to the system
  2. Navigate to "Adverse Effects" section
  3. Create, view, edit, or delete adverse effect reports
  4. View audit logs for all changes

Accessing Analytics

  1. Login and go to Dashboard
  2. View Power BI integrated reports
  3. Analyze vaccination trends and adverse effects
  4. Export data for further analysis

News & Information

  • Visit /news for latest vaccine-related news
  • News is automatically fetched from external APIs
  • Articles are filtered for vaccine and health-related content

πŸ”Œ API Documentation

Adverse Effects API

// List all adverse effects
GET /adverse_effects

// Create new adverse effect
POST /adverse_effects

// Edit adverse effect
GET /adverse_effects/{id}/edit

// Update adverse effect
PUT /adverse_effects/{id}

// Delete adverse effect
DELETE /adverse_effects/{id}

// View audit logs
GET /adverse_effects/logs

Authentication Routes

// Registration
GET|POST /register

// Login
GET|POST /login

// Logout
POST /logout

// Password Reset
GET|POST /forgot-password
GET|POST /reset-password/{token}

πŸ§ͺ Testing

Running Tests

# Run all tests
php artisan test

# Run specific test suite
php artisan test --testsuite=Feature

# Run with coverage
php artisan test --coverage

# Run specific test file
php artisan test tests/Feature/AdverseEffectTest.php

Test Suites

  • Feature Tests: End-to-end application testing
  • Unit Tests: Individual component testing
  • Authentication Tests: User registration, login, logout
  • Adverse Effects Tests: CRUD operations and validation

Available Test Files

  • tests/Feature/AdverseEffectTest.php
  • tests/Feature/UserAuthenticationTest.php
  • tests/Feature/ProfileTest.php
  • tests/Feature/Auth/AuthenticationTest.php
  • tests/Feature/Auth/RegistrationTest.php

πŸ› οΈ Development

Code Style

The project uses Laravel Pint for code formatting:

# Format code
./vendor/bin/pint

# Check formatting
./vendor/bin/pint --test

Development Commands

# Start development environment
composer run dev

# Clear application cache
php artisan cache:clear
php artisan config:clear
php artisan view:clear

# Generate IDE helper files
php artisan ide-helper:generate

Database Management

# Create new migration
php artisan make:migration create_table_name

# Create new model with migration
php artisan make:model ModelName -m

# Create new controller
php artisan make:controller ControllerName --resource

🀝 Contributing

We welcome contributions to improve the Vaccine Monitoring System!

How to Contribute

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

Development Guidelines

  • Follow PSR-12 coding standards
  • Write tests for new features
  • Update documentation as needed
  • Ensure all tests pass before submitting PR

Reporting Issues

  • Use GitHub Issues for bug reports
  • Provide detailed reproduction steps
  • Include system information and error logs

πŸ“„ License

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

πŸ™ Acknowledgments

  • Laravel Framework: For providing an excellent foundation
  • Sri Lankan Health Ministry: For supporting vaccine safety initiatives
  • Healthcare Professionals: For their valuable feedback and requirements
  • Open Source Community: For the amazing tools and libraries

πŸ“ž Support

For support and questions:


Crafted with care for Sri Lanka's Healthcare System

Ensuring vaccine safety through technology and data-driven insights.#

About

"Welcome to the Sri Lankan Immunization Real-Time Tracker, A powerful web-based platform designed to deliver clear, interactive dashboards and insights on vaccine distribution and reported side effects across the country. Built for speed and simplicity, this tool empowers fast, informed decision-making through an intuitive user experience."

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published