Skip to content

Kritika200520/code-cleanup-kritika

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

247 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🩺 PuduCan

PUDUcherry Cancer Patient Management Dashboard

A modern healthcare platform built for ASHA workers, nurses, and doctors to manage cancer patient data efficiently β€” part of a national study led by JIPMER and sponsored by ICMR.

πŸ”— View Live Demo β†’

License: Apache 2.0 PRs Welcome Framework: Next.js DB: Firebase Styling: Tailwind CSS Testing: Vitest


πŸ“‹ Table of Contents

πŸ§‘β€πŸ’Ό Admin β€” Patients View (Light theme)

Admin Patients View Light

πŸ“Š Patient Disease Report

Patient Report

βž• Add Doctor / Nurse / ASHA

The same form is used for all staff types β€” field labels change based on role.

Add Doctor

πŸ₯ Add Hospital

Add Hospital

♻️ Admin β€” Recover Deleted Patient

Recover Patient

πŸ‘¨β€βš•οΈ Doctor β€” Patients View

Doctor View

πŸ‘©β€βš•οΈ Nurse β€” Patients View

Nurse View

πŸ“‹ Add Patient Form

Add Patient Form

πŸ“± ASHA Worker β€” Patients View (Mobile)

ASHA Mobile View

πŸ—‘οΈ Delete Patient View

Delete Patient


🎯 About PuduCan

PuduCan is a healthcare management system designed to streamline cancer patient tracking and care coordination across hospitals in Puducherry. It enables ASHA workers, nurses, and doctors to:

  • βœ… Manage patient records securely
  • βœ… Track disease progression and treatment
  • βœ… Generate detailed patient reports
  • βœ… Collaborate across roles with role-based access
  • βœ… Import/export patient data efficiently

This platform is part of a national research initiative to improve cancer care delivery and patient outcomes.


✨ Core Features

1. Role-Based Access Control (RBAC)

Different user roles have tailored dashboards and permissions:

  • Admin: Full system access, manage users and hospitals
  • Doctor: View and update patient treatment plans
  • Nurse: Track patient vitals and progress
  • ASHA Worker: Community-level patient monitoring

2. Patient Management

  • Add, view, update, and delete patient records
  • Detailed patient forms with data validation
  • Real-time updates across all users via Firebase
  • Soft delete with recovery option

3. Advanced Data Table

  • πŸ” Search & Filter: Find patients by name, ID, status, etc.
  • πŸ“„ Pagination: Navigate large datasets efficiently
  • πŸ“Š Data Export: Export to CSV or Excel for reports
  • πŸ“€ Data Import: Bulk upload patient data with validation

4. Real-Time Collaboration

  • Instant updates when patient data changes
  • Live notification of user actions
  • Multi-user safe operations

5. Hospital & User Management (Admin Only)

  • Add and manage hospitals
  • Create accounts for doctors, nurses, and ASHA workers
  • Assign roles and permissions

πŸ“Έ Screenshots

Home Page

Home Page

Admin Dashboard - Patients View

Dark Theme Light Theme
Admin Dark Admin Light

Clinical Features

Disease Report Add Doctor/Nurse/ASHA
Report Add Staff
Add Hospital Recover Patient
Hospital Recover

Role-Specific Views

Doctor View Nurse View ASHA Mobile View
Doctor Nurse ASHA

Forms & Operations

Add Patient Delete Patient
Add Patient Delete

πŸ› οΈ Tech Stack

Frontend

Data & APIs

Forms & Validation

  • Form Management: React Hook Form - Performance-focused
  • Schema Validation: Zod - Type-safe validation

Quality & Testing


πŸš€ Getting Started

Prerequisites

Ensure you have the following installed:

  • Node.js (v18 or higher)
  • npm or yarn
  • Git account for version control

Installation

  1. Clone the repository

    git clone https://github.com/lourduradjou/puducan-jipmer.git
    cd puducan-jipmer
  2. Install dependencies

    npm install
  3. Set up environment variables Create a .env.local file in the root directory:

    NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
    NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_auth_domain
    NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
    NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_storage_bucket
    NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
    NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
  4. Run the development server

    npm run dev

    Open http://localhost:3000 in your browser

  5. Build for production

    npm run build
    npm start

Sample Data

The assets/ folder contains a sample Excel file showing the correct format for importing patient data.


πŸ“ Project Structure

puducan-jipmer/
β”œβ”€β”€ app/                    # Next.js app directory
β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”œβ”€β”€ (auth)/            # Authentication pages
β”‚   β”œβ”€β”€ (dashboard)/       # Dashboard pages
β”‚   └── layout.tsx         # Root layout
β”œβ”€β”€ components/            # Reusable React components
β”‚   β”œβ”€β”€ table/             # Table components
β”‚   β”œβ”€β”€ forms/             # Form components
β”‚   β”œβ”€β”€ dialogs/           # Modal dialogs
β”‚   └── shared/            # Common components
β”œβ”€β”€ lib/                   # Utility functions & configs
β”‚   β”œβ”€β”€ firebase.ts        # Firebase initialization
β”‚   β”œβ”€β”€ hooks/             # Custom React hooks
β”‚   └── utils/             # Helper functions
β”œβ”€β”€ styles/                # Global CSS & Tailwind
β”œβ”€β”€ public/                # Static assets
β”œβ”€β”€ assets/                # Sample data files
└── tests/                 # Test files

βš™οΈ How It Works

User Authentication Flow

  1. User signs up/logs in via Firebase Authentication
  2. Role assigned by admin determines dashboard access
  3. User navigated to role-specific dashboard

Patient Data Flow

  1. ASHA Worker β†’ Identifies patients in community
  2. Nurse β†’ Records vitals and clinical observations
  3. Doctor β†’ Reviews and prescribes treatment
  4. Admin β†’ Oversees all activities and generates reports

Real-Time Updates

  • All data changes instantly sync via Firebase Firestore
  • TanStack Query caches results and invalidates when needed
  • Components automatically re-render with latest data

πŸ”§ Development

Code Quality and Refactoring

The codebase is designed to be modular, maintainable, and scalable following modern software engineering principles.

Component-Based Architecture

  • Reusable Components: UI broken into small, single-responsibility components, making code easier to understand, test, and maintain.
  • Generic Components: Created reusable components like GenericTable and GenericDialog, reducing code duplication across the application.

Custom Hooks

  • Encapsulated Logic: Custom hooks encapsulate and reuse logic for common tasks:
    • useAuth: Manages user authentication state and provides user information to components
    • useTableData: Fetches and manages data table operations including pagination, searching, and filtering
    • More hooks available for specific domain logic

Code Style and Linting

  • ESLint and Prettier: Enforce consistent code style and catch potential errors early, ensuring clean and readable code.
  • Husky Pre-commit Hooks: Automatically run linting and tests before each commit, preventing errors from entering the codebase.

Running Tests

# Run all tests
npm run test

# Watch mode
npm run test:watch

# Coverage report
npm run test:coverage

πŸš„ Performance Optimizations and Caching

The application is built with performance as a top priority, utilizing modern web technologies and best practices for a fast, responsive user experience.

Next.js Optimizations

  • Automatic Code Splitting: JavaScript bundles are split into smaller chunks β€” users only download code needed for their page, reducing initial load time.
  • Image Optimization: The next/image component automatically optimizes images, serving modern formats like WebP and resizing for different devices.
  • Static Site Generation (SSG): Pages without real-time data (About, Contact) are pre-rendered at build time for instant loading.
  • Incremental Static Regeneration (ISR): Hybrid approach allowing static pages to update without full rebuilds.

Data Fetching and Caching with TanStack Query

  • Server-Side State Management: TanStack Query (React Query) manages asynchronous data from Firestore with robust caching that reduces redundant API calls.
  • staleTime & cacheTime: Queries serve cached data while re-fetching in the background, keeping UI responsive. cacheTime keeps data cached even when unused.
  • Query Invalidation: When data updates (e.g., patient record edited), relevant queries are invalidated to trigger re-fetch and update UI with latest information.

Client-Side Caching and State Management

  • Zustand for Global State: Lightweight global state management without the complexity of larger libraries, sharing state across components seamlessly.
  • localStorage for Form Data: Form state is cached to prevent data loss during entry β€” reload the page and restore progress.

Summary: Key Caching Mechanisms

Level Technology Purpose
Bundle Next.js Code Splitting Reduce initial JS download
Assets Image Optimization Serve optimal image formats
API Calls TanStack Query Cache Firestore responses
State Zustand Share state across components
Local Data localStorage Persist form progress

🀝 Contributing

We welcome contributions from developers of all experience levels! Your work directly impacts cancer patient care across India.

Getting Started with Contributing

For First-Time Contributors

Look for issues labeled good first issue β€” these are:

  • βœ… Well-scoped and clearly documented
  • βœ… Beginner-friendly
  • βœ… Don't require deep codebase knowledge

View Good First Issues β†’

For v1.1 Development

Check out v1.1 related issues here: View v1.1 Issues β†’

Contribution Workflow

  1. Fork the repository and create your feature branch

    git checkout -b feature/your-feature-name
  2. Make your changes with descriptive commits

    git commit -m "feat: add new patient filter"
  3. Push to your fork and create a Pull Request

    git push origin feature/your-feature-name
  4. Describe your changes clearly in the PR description

For detailed guidelines, see CONTRIBUTING.md and ARCHITECTURE.md.


πŸ“ License

This project is licensed under the Apache License 2.0 β€” see the LICENSE file for details.

You are free to use, modify, and distribute this project, provided you include the original license and copyright notice.


πŸ“ž Support & Questions


Made with ❀️ for cancer patients and healthcare workers across India

⭐ If this project helped you, please consider giving it a star!

About

🩺 Cancer patient management platform for ASHA workers, nurses & doctors β€” built for JIPMER's national study, sponsored by ICMR

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 96.3%
  • JavaScript 2.8%
  • CSS 0.9%