Inspiration

ClinicOCR (Healthcare Project )was inspired by a common problem in small clinics: doctors still deal with handwritten prescriptions and paper-based medical records. Difficult handwriting, misplaced papers, and the time required to manually enter information make it difficult to maintain and review patient history.

We wanted to build a lightweight solution that could digitize handwritten prescriptions while keeping the doctor in control. This led to ClinicOCR, an AI-powered medical document intelligence platform that combines OCR and AI to turn handwritten prescriptions into structured digital records.

What it does

ClinicOCR allows a doctor to:

  • Add and manage patients
  • Upload handwritten prescriptions
  • Check image quality before processing
  • Preprocess prescription images
  • Extract raw text using Tesseract OCR
  • Use Google Gemini AI to correct OCR errors and structure the information
  • Extract medicine names, dosage, and frequency
  • Generate concise prescription summaries
  • Identify important findings and medical tags
  • Review and edit AI-generated information before saving
  • Maintain patient-wise prescription history
  • Search prescriptions by patient, medicine, date, tags, and important records
  • Add private doctor notes
  • Export prescription information as a PDF

ClinicOCR also includes historical pattern detection, where AI can analyze a patient's previous prescriptions and identify recurring symptoms or patterns that may deserve clinical follow-up.

The system is designed as an assistive tool, not a diagnostic system. The doctor always has the final authority.

How we built it

We built ClinicOCR using Next.js 15, TypeScript, Tailwind CSS, and shadcn/ui for the frontend and application interface.

For the database layer, we used PostgreSQL with Neon and Drizzle ORM.

The core AI pipeline works like this:

Prescription Image
        ↓
Image Preprocessing
        ↓
Tesseract OCR
        ↓
Raw OCR Text
        ↓
Google Gemini AI
        ↓
Structured Medical Data
        ↓
Doctor Review
        ↓
PostgreSQL
        ↓
Patient History
        ↓
Historical Pattern Detection

For image processing, we use techniques such as grayscale conversion, contrast enhancement, noise reduction, and image quality analysis to improve OCR results.

Tesseract extracts the original text, while Gemini helps refine the OCR output and extract structured information such as medicines, dosage, frequency, summaries, findings, and tags.

We also used jsPDF and html2canvas for PDF report generation.

Challenges we ran into

Handwritten OCR

Handwritten prescriptions are difficult for OCR systems because handwriting styles, image quality, lighting, blur, and tilt can affect recognition accuracy.

We addressed this by adding image preprocessing and image quality checks before OCR.

OCR mistakes

Medicine names and medical terms can be incorrectly recognized by OCR. We therefore added Gemini as a refinement layer while preserving the original OCR output so that the doctor can compare and verify the information.

AI API rate limits

During development, we encountered Gemini API rate limits. This taught us the importance of handling AI failures gracefully and avoiding unnecessary repeated AI requests.

Database ID consistency

We also encountered issues where mock patient IDs such as pat-102 conflicted with PostgreSQL UUID requirements. This highlighted the importance of maintaining consistent identifiers across the frontend, database, URLs, and prescription relationships.

Performance

AI processing and database operations can take time. We had to pay attention to loading states, unnecessary API calls, and page rendering so that expensive operations do not make the entire application feel slow.

Accomplishments that we're proud of

We are proud that ClinicOCR evolved from a simple OCR concept into a complete medical document workflow.

Some of our key accomplishments include:

  • Building a complete patient management system
  • Implementing handwritten prescription OCR
  • Adding image preprocessing and quality detection
  • Integrating Gemini AI for medical information structuring
  • Creating doctor review and editing functionality
  • Building searchable patient prescription history
  • Adding medicine recognition and OCR confidence indicators
  • Implementing important prescription records and doctor notes
  • Adding PDF report generation
  • Extending the system with historical pattern detection
  • Successfully building and compiling the complete Next.js application

Most importantly, we designed the system so that AI assists the doctor instead of replacing the doctor's judgment.

What we learned

Building ClinicOCR taught us how to integrate multiple technologies into one complete AI-powered application.

We learned that building an AI product involves much more than simply calling an AI API. The quality of the input, OCR accuracy, structured outputs, database design, error handling, performance, and user experience all affect the final result.

We also learned:

  • How image preprocessing can improve OCR
  • How to combine Tesseract OCR with an AI refinement layer
  • How to structure AI responses into usable JSON
  • How to connect AI-generated information with a relational database
  • How to maintain patient-wise historical records
  • How to handle API rate limits and failures
  • How important human verification is when working with medical information
  • How historical data can be used to identify recurring patterns

What's next for ClinicOCR

The next step is to make ClinicOCR more robust and production-ready.

Future improvements include:

  • Secure authentication
  • Multi-doctor and clinic accounts
  • Multi-language OCR
  • More advanced patient history analysis
  • Better historical health trend visualization
  • EMR integration
  • Appointment management
  • Mobile support
  • More advanced analytics

We also want to explore how historical prescription data can help doctors identify recurring health patterns and potential early warning signals, while keeping the system strictly assistive and ensuring that clinical decisions remain with qualified medical professionals.

ClinicOCR's goal is simple: turn handwritten medical records into structured, searchable, and useful medical information — while keeping the doctor in control.

Built With

Share this project:

Updates

Submission history