Skip to content

Commit 5d0b8e2

Browse files
committed
Add DocumentProcessorController and update README for medical document processing
- Introduced DocumentProcessorController in backend/src/controllers/document-processor.controller.ts to handle document upload and processing. - Implemented endpoints for uploading documents and retrieving a test form, enhancing the document processing functionality. - Updated backend/README.md to include detailed information about the new endpoints and usage instructions for the medical document processor.
1 parent 8871f07 commit 5d0b8e2

File tree

3 files changed

+535
-1
lines changed

3 files changed

+535
-1
lines changed

backend/README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,77 @@ This script sets a resource policy that:
8888
2. Denies any non-HTTPS requests to your API
8989

9090
If you need more complex permissions, you can modify the policy object in the script.
91+
92+
# Medical Document Processor Test Controller
93+
94+
This module provides a test controller for uploading and processing medical documents using the DocumentProcessorService.
95+
96+
## Available Endpoints
97+
98+
### Test Form
99+
```
100+
GET /api/document-processor/test-form
101+
```
102+
Provides a simple HTML form for testing the document processor functionality:
103+
- Upload PDF or image files (JPEG, PNG, TIFF)
104+
- See extracted text and medical analysis results
105+
106+
### Upload Document
107+
```
108+
POST /api/document-processor/upload
109+
```
110+
API endpoint for uploading and processing medical documents:
111+
- Accepts PDF or image files (JPEG, PNG, TIFF)
112+
- Returns extracted text and medical analysis
113+
114+
**Request parameters:**
115+
- `file` - The file to process (multipart/form-data)
116+
- `userId` - Optional user ID for tracking/analytics (defaults to "test-user-id")
117+
118+
**Response:**
119+
```json
120+
{
121+
"extractedText": {
122+
"rawText": "...",
123+
"lines": [...],
124+
"tables": [...],
125+
"keyValuePairs": [...]
126+
},
127+
"analysis": {
128+
"keyMedicalTerms": [...],
129+
"labValues": [...],
130+
"diagnoses": [...],
131+
"metadata": {
132+
"isMedicalReport": true,
133+
"confidence": 0.95,
134+
"missingInformation": []
135+
}
136+
},
137+
"processingMetadata": {
138+
"processingTimeMs": 2500,
139+
"fileType": "application/pdf",
140+
"fileSize": 245000
141+
}
142+
}
143+
```
144+
145+
### Test Status
146+
```
147+
GET /api/document-processor/test
148+
```
149+
Simple endpoint to verify the controller is working properly.
150+
151+
## Testing
152+
153+
To test the document processing functionality:
154+
155+
1. Ensure your backend server is running
156+
2. Navigate to `http://localhost:3000/api/document-processor/test-form` in your browser
157+
3. Upload a medical document (PDF, JPEG, PNG, or TIFF)
158+
4. View the results of text extraction and medical analysis
159+
160+
## Notes
161+
162+
- Maximum file size: 10 MB
163+
- Supported file types: PDF, JPEG, PNG, TIFF
164+
- For testing purposes, authentication is bypassed for these endpoints

0 commit comments

Comments
 (0)