π Summit Machathon 6.0 Project
π₯ Team Members: Habiba Yousri, Haneen Akram, Renad Hossam, Mohammed Mostafa, Shrouk Mohamed
Pen to Pill (P2P) is an AI-powered system that digitizes handwritten medical prescriptions, focusing on complex multilingual documents (Arabic & English).
It aims to enhance patient safety and boost healthcare efficiency by converting unstructured handwriting into structured, usable medical data.
| Technology | Purpose |
|---|---|
| Roboflow | Annotation tool for labeling Arabic & English text |
| YOLOv8 | Detects handwritten regions in prescriptions |
| TrOCR | Multilingual OCR for handwritten text |
| BART (mBART) | Structures and cleans the recognized text |
| Python, PyTorch | Core implementation frameworks |
| Google Colab / Kaggle | Model training & experimentation |
| React.js | Frontend UI |
| FastAPI | Backend API development |
A step-by-step AI pipeline:
-
Handwritten Word Detection
- Annotate data using Roboflow
- Train YOLOv8 on multilingual bounding boxes
-
Duplicate Removal
- Use Non-Maximum Suppression (IoU = 0.8)
-
Box Sorting
- Top-to-bottom, left-to-right for logical reading order
-
Text Recognition (TrOCR)
- Process word crops and predict text with fine-tuned TrOCR
-
Text Reconstruction
- Combine detected words into one coherent string
-
Text Correction & Structuring (mBART)
- Normalize output to this format:
medicine dosage, medicine dosage, ...
- Normalize output to this format:
-
Post-Processing
- Extract structured
(medicine, dosage)pairs
- Extract structured
- Add more real-world handwritten prescriptions to the dataset
- Enhance mBART accuracy for edge cases
- Integrate with EHR systems and mobile apps
- Support more languages beyond Arabic-English
- Node.js & npm
- Python 3.10.0
- Git
cd FrontEnd
npm i
npm run serverβ‘οΈ In a new terminal:
npm startcd ..
cd BackEndMake sure the Python version is 3.10.0
-
Windows:
python --version
-
Linux/macOS:
python3 --version
-
Windows:
python -m venv venv
-
Linux/macOS:
python3 -m venv venv
-
Windows:
venv\Scripts\activate
-
Linux/macOS:
source venv/bin/activate
pip install -r requirements.txt-
Windows:
python app.py
-
Linux/macOS:
python3 app.py
π The frontend runs at http://localhost:8000 and communicates with the backend via FastAPI.