You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
curl -X POST http://localhost:8000/kyc/upload-id \
154
-
-H "Authorization: Bearer <access_token>" \
155
-
-F "user_id=user123" \
156
-
-F "file=@id_photo.jpg"
227
+
-H "Authorization: Bearer $TOKEN" \
228
+
-F "file=@/path/to/id_photo.jpg"
229
+
230
+
# Check task status
231
+
curl -X GET http://localhost:8000/tasks/abc123def456 \
232
+
-H "Authorization: Bearer $TOKEN"
233
+
234
+
# View all your past KYC tasks
235
+
curl -X GET http://localhost:8000/kyc/users/myuser/tasks \
236
+
-H "Authorization: Bearer $TOKEN"
237
+
238
+
# Get presigned URL for an uploaded file
239
+
curl -X GET http://localhost:8000/uploads/filename.jpg
157
240
```
158
241
242
+
## Security Considerations
243
+
244
+
-**Password Hashing**: All passwords are hashed using bcrypt before storage
245
+
-**JWT Secrets**: Use a strong, randomly generated secret for `SECRET_KEY` in production
246
+
-**S3 Presigned URLs**: Generated URLs expire after 1 hour by default
247
+
-**HTTPS**: Use HTTPS in production (configure in reverse proxy/load balancer)
248
+
-**Rate Limiting**: Consider adding rate limiting middleware for production deployments
249
+
-**CORS**: Configure CORS settings in FastAPI for frontend integration
250
+
159
251
## Extracted Data Format
160
252
161
253
AWS Textract returns ID fields with the following structure:
@@ -187,43 +279,87 @@ AWS Textract returns ID fields with the following structure:
187
279
- JPEG/JPG
188
280
- PNG
189
281
- WebP
282
+
- Maximum file size: 5MB
283
+
284
+
### Task Status Values
285
+
-`PENDING`: File uploaded, processing in queue
286
+
-`SUCCESS`: Processing completed successfully, extracted data is available
287
+
-`FAILURE`: Processing failed, check extracted_fields for error message
190
288
191
289
### AWS Textract Confidence Threshold
192
-
Adjust confidence scoring in `services/ocr_service.py` to filter low-confidence extractions.
290
+
Adjust confidence scoring in `services/ocr_service.py` to filter low-confidence extractions. By default, all extractions are returned with confidence scores for manual filtering.
291
+
292
+
## Troubleshooting
293
+
294
+
### Common Issues
295
+
296
+
**"Could not validate credentials" error**
297
+
- Ensure your JWT token is valid and not expired (expires after 30 minutes)
298
+
- Include the token in the Authorization header: `Authorization: Bearer <token>`
299
+
300
+
**"File too large" error**
301
+
- Maximum file size is 5MB
302
+
- Compress or resize your image and try again
303
+
304
+
**"Invalid file type" error**
305
+
- Only JPEG, PNG, and WebP formats are supported
306
+
- Convert your image to one of these formats
307
+
308
+
**S3 Connection Errors**
309
+
- Verify AWS credentials are set in `.env`
310
+
- Ensure the IAM user has S3 permissions
311
+
- Check S3 bucket name is correct and exists
312
+
313
+
**Database Connection Errors**
314
+
- Ensure PostgreSQL is running on the configured host/port
315
+
- Check DATABASE_URL in `.env` is correct
316
+
- Verify database credentials are correct
317
+
318
+
**Celery Worker Not Processing Tasks**
319
+
- Ensure Redis is running on the configured REDIS_URL
320
+
- Check worker logs: `celery -A worker worker --loglevel=debug`
321
+
- Verify AWS Textract credentials are configured
193
322
194
323
## Development
195
324
196
325
### Running Tests
197
326
```bash
198
-
pytest tests/
199
-
```
200
-
201
-
### Docker Deployment
202
-
A `docker-compose.yml` is available for containerized deployment with PostgreSQL and Redis.
203
-
204
-
## Logging
327
+
# Install test dependencies (if not already installed)
328
+
pip install pytest httpx
205
329
206
-
Logs are output to stdout with timestamps and log levels. Configure logging level in `utils/logger.py`.
330
+
# Run all tests
331
+
PYTHONPATH=. pytest tests/ -v
207
332
208
-
## Security Notes
333
+
# Run specific test file
334
+
PYTHONPATH=. pytest tests/test_main.py -v
209
335
210
-
-**Authentication**: Uses securely hashed (bcrypt) database-backed user authentication.
211
-
-**Environment Variables**: Store sensitive credentials in `.env` files (never commit to version control).
212
-
-**S3 Permissions**: Restrict S3 bucket access using IAM policies.
213
-
-**JWT Secret**: Use a strong, random secret key for JWT signing.
0 commit comments