Inspiration

Pharmacies handle medicines that have different batch numbers, expiry dates, suppliers, and dispensing histories. We identified a practical safety gap: when a batch approaches expiry or is recalled, it can be difficult to quickly determine the affected stock and identify customers who previously received that specific batch.

This inspired us to build PharmaFlow – Pharmacy Safety & Traceability, a system designed to connect inventory, batch tracking, dispensing audits, expiry monitoring, recall management, and patient safety workflows in one platform.

What We Built

PharmaFlow provides an end-to-end pharmacy management and traceability workflow:

Medicine Identification → Batch Registration → Inventory → Dispensing → Audit → Expiry/Recall Detection → Customer Traceability → Safety Action

Key features include:

  • Barcode/QR-based medicine identification
  • External medicine/product lookup when a barcode is not available in the pharmacy inventory
  • Pharmacist verification before adding externally identified medicines
  • Batch-level inventory and expiry tracking
  • Supplier invoice OCR and structured stock entry
  • Dispensing with batch-level traceability
  • Immutable dispensing audit records
  • Recall management and affected-customer identification
  • Expiry and low-stock monitoring
  • Patient safety communication workflows
  • Reports and pharmacy analytics
  • AI Pharmacy Assistant for operational pharmacy intelligence
  • What-If Expiry & Inventory Simulator for non-destructive decision support

The AI assistant is focused on pharmacy operations rather than diagnosis or treatment. It uses controlled pharmacy data to answer questions about inventory, batches, expiry, dispensing, recalls, suppliers, alerts, and operational trends.

How We Built It

The application was developed using:

  • React.js for the frontend
  • Node.js + Express.js for the backend
  • Firebase Admin SDK
  • Google Cloud Firestore for persistent pharmacy data
  • REST APIs for frontend-backend communication
  • Barcode/QR scanning for medicine identification
  • OCR for supplier invoice processing
  • Gemini-based AI for pharmacy intelligence
  • Transaction-based database operations for safe stock updates
  • Responsive UI for desktop, tablet, and mobile use

We designed the system so that important operations are handled by the backend and persisted in Firestore rather than relying on temporary frontend data.

For dispensing, the system maintains the relationship between the medicine, batch, quantity, customer, pharmacist, and dispensing time. This enables the system to trace which customers were associated with a particular batch when a recall or safety event occurs.

What-If Decision Support

One of the key features is the What-If Expiry & Inventory Simulator.

Instead of modifying live inventory, the simulator creates a separate projection using actual pharmacy data such as:

  • Current stock
  • Historical dispensing rate
  • Days remaining to expiry
  • Unit cost
  • Proposed additional stock
  • Demand changes
  • Supplier delays

It can calculate projected consumption, surplus, potential shortage, expiry risk, utilization, and capital at risk.

This allows pharmacists to explore scenarios without changing their actual inventory records.

What We Learned

During development, we learned that building a healthcare-related software system requires more than creating a functional interface. Data consistency, traceability, security, accurate status reporting, and reliable database operations are equally important.

We learned how to:

  • Design a full-stack application
  • Build REST APIs
  • Work with Firestore transactions
  • Implement batch-level data relationships
  • Integrate barcode scanning and OCR
  • Process real application data through controlled AI tools
  • Separate simulation data from live operational data
  • Handle authentication and pharmacy-level data isolation
  • Build responsive interfaces
  • Test interconnected modules
  • Design safety-focused workflows

Challenges

One of the major challenges was maintaining accurate relationships between batches, inventory, dispensing records, and customers. A recall cannot simply notify every customer; the system needs to identify customers who actually received the affected batch.

Another challenge was barcode identification. A barcode may identify a product but does not automatically provide pharmacy-specific information such as the physical batch, expiry date, quantity, or purchase price. PharmaFlow therefore separates external product identification from pharmacist verification and inventory registration.

We also faced challenges in ensuring that the AI assistant works with actual pharmacy data without becoming an unrestricted medical chatbot. We addressed this by using controlled backend operations and keeping the AI focused on operational pharmacy intelligence.

Outcome

PharmaFlow brings together pharmacy inventory management, batch-level traceability, dispensing audit, expiry intelligence, recall handling, customer exposure identification, safety communication, and AI-assisted operational decision support into one platform.

Our goal is to help pharmacies move from simply recording medicine transactions to maintaining a connected safety workflow where every batch can be tracked, every dispense can be audited, and potential risks can be identified earlier.

Share this project:

Updates

Submission history