Skip to content

Commit fbc5c20

Browse files
committed
Remove unused devDependencies from package.json and package-lock.json; update README.md to streamline document processing instructions.
1 parent 4c29353 commit fbc5c20

File tree

6 files changed

+19
-93
lines changed

6 files changed

+19
-93
lines changed

backend/README.md

+1-75
Original file line numberDiff line numberDiff line change
@@ -87,78 +87,4 @@ This script sets a resource policy that:
8787
1. Allows only authenticated Cognito users to access your API
8888
2. Denies any non-HTTPS requests to your API
8989

90-
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
90+
If you need more complex permissions, you can modify the policy object in the script.

backend/src/app.module.spec.ts

+15-8
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { JwtModule } from '@nestjs/jwt';
55
import { ReportsService } from './reports/reports.service';
66
import { vi, describe, it, expect } from 'vitest';
77
import configuration from './config/configuration';
8-
import { AwsBedrockService } from './document-processor/services/aws-bedrock.service';
98
import { PerplexityService } from './services/perplexity.service';
109
import { AwsSecretsService } from './services/aws-secrets.service';
1110
import { AwsTextractService } from './document-processor/services/aws-textract.service';
11+
import { AwsBedrockService } from './document-processor/services/aws-bedrock.service';
1212

1313
describe('AppModule', () => {
1414
it('should compile the module', async () => {
@@ -32,13 +32,6 @@ describe('AppModule', () => {
3232
findOne: vi.fn().mockResolvedValue({}),
3333
updateStatus: vi.fn().mockResolvedValue({}),
3434
})
35-
.overrideProvider(AwsBedrockService)
36-
.useValue({
37-
listAvailableModels: vi.fn().mockResolvedValue({
38-
models: [],
39-
currentModelId: 'test-model-id',
40-
}),
41-
})
4235
.overrideProvider(PerplexityService)
4336
.useValue({
4437
askQuestion: vi.fn().mockResolvedValue({}),
@@ -52,6 +45,20 @@ describe('AppModule', () => {
5245
extractText: vi.fn().mockResolvedValue({}),
5346
processBatch: vi.fn().mockResolvedValue([]),
5447
})
48+
.overrideProvider(AwsBedrockService)
49+
.useValue({
50+
generateResponse: vi.fn().mockResolvedValue('test response'),
51+
analyzeMedicalDocument: vi.fn().mockResolvedValue({
52+
keyMedicalTerms: [],
53+
labValues: [],
54+
diagnoses: [],
55+
metadata: {
56+
isMedicalReport: true,
57+
confidence: 0.9,
58+
missingInformation: [],
59+
},
60+
}),
61+
})
5562
.compile();
5663

5764
expect(module).toBeDefined();

backend/src/app.module.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Module, NestModule, MiddlewareConsumer, RequestMethod } from '@nestjs/common';
1+
import { Module, NestModule, MiddlewareConsumer } from '@nestjs/common';
22
import { ConfigModule } from '@nestjs/config';
33
import configuration from './config/configuration';
44
import { AppController } from './app.controller';
@@ -26,9 +26,6 @@ import { DocumentProcessorModule } from './document-processor/document-processor
2626
})
2727
export class AppModule implements NestModule {
2828
configure(consumer: MiddlewareConsumer) {
29-
consumer
30-
.apply(AuthMiddleware)
31-
.exclude({ path: 'health', method: RequestMethod.GET })
32-
.forRoutes('*');
29+
consumer.apply(AuthMiddleware).forRoutes('*'); // Apply to all routes
3330
}
3431
}

backend/src/services/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ async processReport(fileBuffer: Buffer, fileType: string, userId: string) {
169169
## Rate Limiting
170170

171171
Both services implement rate limiting based on user ID:
172-
- AWS Textract: 10 document requests per minute by default (configurable)
172+
- AWS Textract: 20 document requests per minute by default (configurable)
173173
- AWS Bedrock: 20 model invocations per minute by default (configurable)
174174

175175
## Batch Processing

package-lock.json

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
"build:frontend": "cd frontend && npm run build"
1111
},
1212
"devDependencies": {
13-
"@nestjs/testing": "^11.0.13",
14-
"@types/jest": "^29.5.14",
1513
"husky": "^9.1.7"
1614
}
1715
}

0 commit comments

Comments
 (0)