How ahmedelzaria/medsender-challenge works
Main Components
a) External Services Layer:
• OpenAI API (GPT-4o-mini)
• Llama Parse API
b) Application Core:
• FastAPI Web Server
• File Processing Pipeline
• Validation System
• Document Processing System
• Model Integration Layer
c) Storage/Temporary Components:
• Temporary File Storage for PDF processing
Key Architectural Patterns to Highlight
a) The Composite Validator Pattern:
• How multiple validators (size, extension, MIME) can be combined
• Inheritance hierarchy from BaseValidator
b) The Processor Pattern:
• BaseProcessor and its PDF implementation
• Leave room for future processor types
c) The Model Handler Pattern:
• OpenAI model integration
• Extension points for future models
1. Input Layer:
• [PDF Document] → [FastAPI Endpoint]
2. Validation Layer (use a composite pattern visualization):
• SizeValidator
• ExtensionValidator
• MimeValidator
• Connected through CompositeValidator
3. Processing Pipeline:
• [PDF Processor] → [Llama Parse] → [Text Extraction] → [OpenAI Processing]
4. Output Layer:
• [Structured JSON Response]
Important Relationships
• The validation chain showing how multiple validators work together
• The processing pipeline's sequential flow
• Error handling paths returning to the client
• External API integration points
Specific Implementation Details
• The app/processors directory structure showing extensibility
• The app/validators hierarchy
• The app/models integration point
• The prompts system integration