How process-intelligence1/ar-remittance-ptp works
This is an end-to-end AR remittance and promise-to-pay control tower. Customer email enters through Gmail, is stored and parsed, classified, extracted into invoice lines, matched against SAP open items, and surfaced to AR users for review and action with audit history. The graph also preserves dashboard, knowledge-base, PTP, demo, and snapshot capabilities. Some subsystem links rely on the SOURCE INDEX or README because their implementation excerpts were not provided; uncertain links are omitted.
Main entry points: App.tsx Workbench shell · pipeline.py Pipeline orchestrator · poller.py Gmail poller · index.ts Data source adapter
Components 34
Email intake
- Gmail poller
backend/app/gmail/poller.py - Gmail client
backend/app/gmail/client.py - Email file storage
backend/app/storage.py
Document processing
- Pipeline orchestrator
backend/app/pipeline.py - Document reading
backend/app/documents/service.py - OCR and format parsers
backend/app/documents - Email classification
backend/app/classification/service.py - Invoice extraction
backend/app/extraction/service.py - Extraction logic
backend/app/extraction/extractor.py
AR matching
- Work item matching
backend/app/matching/service.py - Candidate scoring
backend/app/matching/matcher.py - SAP reference data
backend/app/models/sap.py - PTP commitments
backend/app/ptp.py
API and state
- Scheduled worker
backend/app/worker.py - FastAPI routes
backend/app/main.py - Work item API
backend/app/api/workitems.py - Authentication API
backend/app/api/auth.py - AR application data
backend/app/models/ar.py - Outbound email
backend/app/outbound.py - Knowledge base rules
backend/app/rules_defaults.py
AR workbench
- Workbench shell
frontend/src/App.tsx - Session context
frontend/src/auth/AuthContext.tsx - Data source adapter
frontend/src/data/index.ts - Live API adapter
frontend/src/data/live.ts - Action queue
frontend/src/pages/Queue.tsx - Case detail
frontend/src/pages/RecordDetail.tsx - Dashboard
frontend/src/pages/Dashboard.tsx - Audit view
frontend/src/pages/Audit.tsx - Knowledge base view
frontend/src/pages/KnowledgeBase.tsx - PTP view
frontend/src/pages/RecordDetail.tsx - Display labels
frontend/src/data/labels.ts
Other components
- Customer email
- Gmail inbox
- AR operator
Connections 39
- Customer email → Gmail inbox: sends email
- Gmail inbox → Gmail poller: provides messages
backend/app/gmail/poller.py - Gmail poller → Gmail client: uses client
backend/app/gmail/poller.py - Gmail poller → Email file storage: stores files
backend/app/gmail/poller.py - Scheduled worker → Gmail poller: runs polling
backend/app/worker.py - Scheduled worker → Pipeline orchestrator: runs processing
backend/app/worker.py - Pipeline orchestrator → Document reading: runs reading
backend/app/pipeline.py - Pipeline orchestrator → Email classification: runs classification
backend/app/pipeline.py - Pipeline orchestrator → Invoice extraction: runs extraction
backend/app/pipeline.py - Pipeline orchestrator → Work item matching: runs matching
backend/app/pipeline.py - Document reading → OCR and format parsers: uses parsers
backend/app/documents/service.py - Invoice extraction → Extraction logic: calls extractor
backend/app/extraction/service.py - Work item matching → Candidate scoring: calls matcher
backend/app/matching/service.py - Work item matching → SAP reference data: loads reference data
backend/app/matching/service.py - Pipeline orchestrator → AR application data: records stage state
backend/app/pipeline.py - Work item matching → AR application data: saves work items
backend/app/matching/service.py - Gmail poller → AR application data: saves email records
backend/app/gmail/poller.py - Gmail poller → Outbound email: attaches replies
backend/app/gmail/poller.py - Scheduled worker → PTP commitments: runs PTP work
backend/app/worker.py - FastAPI routes → Work item API: registers route
backend/app/main.py - FastAPI routes → Authentication API: registers route
backend/app/main.py - Work item API → AR application data: reads and updates
backend/app/api/workitems.py - Work item API → Email file storage: serves file access
backend/app/api/workitems.py - AR operator → Workbench shell: uses workbench
frontend/src/App.tsx - Workbench shell → Session context: provides session
frontend/src/App.tsx - Workbench shell → Data source adapter: creates source
frontend/src/App.tsx - Session context → Data source adapter: sets token
frontend/src/auth/AuthContext.tsx - Data source adapter → Live API adapter: selects live source
frontend/src/data/index.ts - Live API adapter → FastAPI routes: calls API
- Workbench shell → Action queue: routes to queue
frontend/src/App.tsx - Workbench shell → Dashboard: routes to dashboard
frontend/src/App.tsx - Workbench shell → Audit view: routes to audit
frontend/src/App.tsx - Workbench shell → Knowledge base view: routes to rules
frontend/src/App.tsx - Action queue → Data source adapter: loads work items
- Case detail → Data source adapter: loads case data
frontend/src/pages/RecordDetail.tsx - Case detail → PTP view: shows commitments
frontend/src/pages/RecordDetail.tsx - Dashboard → Data source adapter: loads metrics
frontend/src/pages/Dashboard.tsx - Knowledge base view → Knowledge base rules: manages rules
- Workbench shell → Display labels: uses labels
frontend/src/App.tsx