OCR in Open EMR

Hi i would like to ask if it’s possible the have a OCR inside Open EMR? the flow will be provider will update a image file (prescription) and extract the text in the prescription and add the data in the prescription of the patient where the image was uploaded.

Thanks
Casper

:mag: What is OCR in OpenEMR?

OCR (Optical Character Recognition) in OpenEMR is used to:

  • Convert scanned images or PDFs (e.g., lab results, insurance cards, referral letters) into editable, searchable text.
  • Extract useful data (like patient names, dates, insurance numbers) from uploaded documents and store them in the EHR system.

:white_check_mark: Step-by-Step: How to Integrate OCR in OpenEMR

:wrench: Prerequisites

  1. OpenEMR installed (preferably v7+)
  2. PHP enabled with required extensions (imagick, gd, shell_exec, etc.)
  3. Tesseract OCR installed on the server

:package: Step 1: Install Tesseract OCR

On Ubuntu/Debian:

undefined

On macOS (using Homebrew):

undefined (1)

:white_check_mark: Test it:

2. Create OCR Upload Module in OpenEMR:

:file_folder: Location:

interface/forms/ocr_upload/

Required Files:

:page_facing_up: 3. File: interface/forms/ocr_upload/new.php:

:page_facing_up: 4. File: interface/forms/ocr_upload/process_upload.php

:white_check_mark: Output: Shows the extracted OCR text from uploaded image/PDF.

:safety_pin: 5. (Optional) Link OCR to Menu

File:

interface/main/left_nav.php (or use Admin > Menu Editor in GUI)

Add:

undefined (6)

:lock: 6. Permissions

Make sure Tesseract and OpenEMR can access and write to the /documents/ folder:

:white_check_mark: Test Steps:

  1. Go to https://your-openemr.com/interface/forms/ocr_upload/new.php
  2. Upload an image with text (e.g., insurance card).
  3. Tesseract will extract and display the text.

:pushpin: Optional Enhancements:

  • Use html2text() to clean up OCR output.
  • Save OCR results in the database (documents or form_encounter).
  • Auto-link OCR to a patient using PID. If you face any difficulties to find, Don’t worry, we are providing free support

wow thank you so much @Qiaben we will try this one :slight_smile:

1 Like

Where is this?
Thanks.
Regards.
Luis