A centralized B2B document exchange and data integration platform for the commodity trading sector that uses AI to map disparate product codes between trading partners.
QbilHub replaces email-based workflows with a structured "Hub Inbox" and leverages AI to automate the mapping of product codes, supplier names, and contract terms between different trading partners.
The system consists of two main components:
-
Core Application (Symfony/PHP) - "The Controller"
- System of record
- UI rendering
- Business logic
- User authentication
- Database: PostgreSQL with JSONB
-
Intelligence Microservice (Python/FastAPI) - "The Brain"
- Schema extraction using LLMs
- Entity resolution using dedupe library
- Active learning from user corrections
- PHP 8.2+
- Symfony 6.4
- API Platform
- Doctrine ORM
- PostgreSQL 15+
- Symfony Messenger (async processing)
- Symfony Mercure (real-time updates)
- Twig templates
- Vue.js 3
- Axios for API calls
- Webpack Encore
- Python 3.11+
- FastAPI
- dedupe (probabilistic record linkage)
- LangChain + OpenAI (schema extraction)
- Real-time notification badge for new documents
- Filterable view (My Inbox / All Accessible / Specific Colleague)
- Entity-aware document management
- Status tracking (New → Extracting → Resolving → Mapping → Processed)
- Global directory of tenants (subsidiaries)
- Opt-in activation model
- Relation mapping (internal IDs to external tenant codes)
- Intelligent routing (default to Hub instead of email)
- Many-to-many user delegations
- Shared mailbox functionality
- Audit trail of who actioned documents
- Left panel: PDF viewer or JSON tree of source document
- Right panel: Standard contract entry form
- AI pre-filled fields with confidence scores
- Color-coded confidence indicators (green >90%, yellow <90%)
- Active learning: corrections sent back to retrain models
- PHP 8.2+
- Composer
- Node.js 18+
- PostgreSQL 15+
- Python 3.11+
- RabbitMQ or Redis (for message queue)
cd QbilHub
composer installcp .env .env.local
# Edit .env.local with your database credentials and API keysphp bin/console doctrine:database:create
php bin/console doctrine:migrations:migratenpm install
npm run buildcd python-service
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your OpenAI API keySymfony Application:
symfony server:startPython Intelligence Service:
cd python-service
uvicorn app.main:app --reloadMessage Queue Worker:
php bin/console messenger:consume async -vvMercure Hub (for real-time updates):
# Download and run Mercure from https://mercure.rocks/
./mercure run- Tenant: Trading partners/subsidiaries
- User: System users with tenant association
- UserDelegation: Many-to-many delegation relationships
- TenantRelationMapping: Maps internal relations to external tenant codes
- ReceivedDocument: Incoming documents with JSONB raw data
- PurchaseContract: Standardized contract records
GET /hub/inbox- Hub inbox pageGET /hub/inbox/documents- Fetch inbox documentsGET /hub/inbox/unread-count- Get unread countPOST /hub/inbox/document/{id}/mark-read- Mark document as readGET /hub/mapping/document/{id}- Mapping interfaceGET /hub/mapping/document/{id}/data- Get document dataPOST /hub/mapping/document/{id}/save- Save mapped contractPOST /hub/mapping/document/{id}/feedback- Submit field correction
POST /api/extract-schema- Extract schema from raw dataPOST /api/resolve-entities- Resolve entities between tenantsPOST /api/feedback- Submit active learning feedback
- Document Received → Stored in
received_documentswith JSONB raw data - Schema Extraction → Python service uses LLM to map fields
- Entity Resolution → dedupe library matches product codes
- User Mapping → Split-view interface with pre-filled fields
- Correction Feedback → User corrections retrain the model
- Contract Created → Standardized purchase contract saved
The system improves over time through active learning:
- User corrects an AI-mapped field
- Correction sent to Python service via message queue
- Training data accumulated in JSONL files
- Model retrained after threshold (e.g., 10 corrections)
- Future predictions improve for that tenant pair
- Row-level security (tenants can't see each other's data)
- User authentication via Symfony Security
- API endpoints protected with IsGranted attributes
- JSONB storage allows flexible schema without exposing structure
- Message queue for async processing prevents timeout issues
- Use strict types (
declare(strict_types=1)) - Dependency Injection via constructor
- Attributes for routing and ORM mapping
- Repository pattern for database queries
- Use API Resources for standard CRUD
- Custom controllers for complex operations
- DTOs for request/response validation
- Modular, reusable components
- Props for configuration
- Axios for API communication
- Event-driven architecture
- Never fail silently
- Queue jobs if service is down
- User-friendly error messages
- Comprehensive logging
This is a commercial MVP project. For questions or support, contact the development team.
Proprietary - All rights reserved
- Enhanced product matching algorithms
- Multi-language support
- Mobile application
- Advanced analytics dashboard
- Integration with ERP systems
- Automated contract generation
- Blockchain-based audit trail