# π©Έ Blood Report AI Analyzer
A Java Spring Boot + n8n + MySQL web app that:
- Takes a PDF blood report from the user
- Extracts text (OCR if scanned)
- Analyzes it using an AI model (OpenAI / Gemini)
- Returns a structured + human-readable report
Inspired by tools like SmallPDF, but built for **learning** and **automation-ready workflows**.
---
## π Features
- PDF upload (supports scanned and digital)
- Text extraction with Apache PDFBox / Tesseract OCR
- AI analysis of blood parameters (status, causes, recommendations)
- Structured table + narrative report
- Optional PDF export of results
- MySQL storage for history
- n8n integration for AI calls or PDF generation
---
## π 5-Day Build Roadmap
### **Day 1 β Project Setup & File Upload**
**Goals:**
- Create Spring Boot web app (Maven)
- Enable PDF upload (Multipart)
- Store uploaded file temporarily
**Steps:**
- Setup dependencies:spring-boot-starter-web spring-boot-starter-thymeleaf (or JSP) spring-boot-starter-data-jpa mysql-connector-j commons-fileupload pdfbox
- Folder structure:
/controller /service /model /repository /resources/templates (or JSP)
- File upload form (Thymeleaf/JSP)
- Controller to handle `MultipartFile` uploads
**AI Shortcut:**
Ask GitHub Copilot:
*"Generate Spring Boot controller to handle PDF file upload and save to local folder."*
---
### **Day 2 β PDF Text Extraction**
**Goals:**
- Extract text from PDF (digital or scanned)
**Steps:**
- For digital PDFs β **Apache PDFBox**
- For scanned PDFs β Convert to images + OCR with **Tesseract (tess4j)**
- Optional: Store extracted text in MySQL
**AI Shortcut:**
Use n8n **PDF Extract Node** or **Google Cloud Vision API**.
---
### **Day 3 β AI Analysis Pipeline**
**Goals:**
- Send extracted text to AI model
- Receive structured & narrative analysis
**Options:**
- **In Spring Boot:** Call OpenAI/Gemini API with Java HTTP requests
- **In n8n:** Send extracted text to a webhook β AI Node β Return JSON
**Prompt Example:**
Analyze the following blood report data and give:
- All parameter values
- Status: Low / Normal / High
- Possible causes
- Suggestions Report text: {{EXTRACTED_TEXT}}
---
### **Day 4 β Display Results**
**Goals:**
- Show table + summary in UI
- Enable PDF download
**Steps:**
- HTML table for: Parameter | Value | Normal Range | Status
- Summary section for recommendations
- Export as PDF with **iText/OpenPDF** or n8n HTMLβPDF node
---
### **Day 5 β Polish & Deploy**
**Goals:**
- Clean UI
- Store history in MySQL
- Deploy to cloud
**Steps:**
- MySQL Table:
```sql
CREATE TABLE reports (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
filename VARCHAR(255),
extracted_text TEXT,
analysis TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
- History page listing all reports
- Deploy to Render / Railway / other hosting
| Task | Learn Mode (Manual) | AI Shortcut (Automation) |
|---|---|---|
| File upload | Write controller code | Copilot scaffold |
| PDF extraction | Apache PDFBox + Tesseract | n8n PDF Extract Node |
| AI call | Java HTTP request to API | n8n OpenAI/Gemini Node |
| Formatting | Java parsing + HTML table | AI returns JSON β render directly |
| PDF export | iText/OpenPDF | n8n HTMLβPDF Node |
(For mastering Spring Boot + AI integration)
Day 1: Java OOP basics & BloodReport class
Day 2: Spring Boot setup & /hello endpoint
Day 3: REST APIs with @RestController
Day 4: MySQL + JPA setup
Day 5: AI analysis service (Hemoglobin)
Day 6: Add WBC analysis
Day 7: n8n webhook integration
Day 8: Validation with @Valid
Day 9: CRUD endpoints for reports
Day 10: JUnit testing + Postman tests
Day 11: Deploy to Render / Railway
Day 12: Final bugfix & demo
-
Clone repo:
git clone https://github.com/yourusername/blood-report-ai.git cd blood-report-ai -
Add API keys in
.envorapplication.properties -
Run:
mvn spring-boot:run
-
Open browser at
http://localhost:8080
For faster progress, build core upload + AI integration first. Enhance with OCR, MySQL history, and PDF export after you get a working MVP.
---
Do you want me to also make a **workflow diagram** for this so your README has visuals?
That would make it look more like a real SaaS project page.