How appacta/acta-import-api works
ACTA Import API accepts PDCA attachments, validates and records them, then processes uploads asynchronously and exposes their status. The main flow is documented in the README and visible in the route, service, and worker excerpts. Authentication has separate user-token and AI-token paths. The graph also includes the distinct text-validation and upload-job stages. Some implementation details are unsampled; documented relationships are cited to the README where needed.
Main entry points: services/anexos.py Attachment service · routes/anexos.py Attachment routes · jobs.py Upload processor · autenticacao.py Authentication
Components 16
API and identity
- Attachment routes
app/routes/anexos.py - Authentication
app/services/autenticacao.py
Attachment intake
- Attachment types
app/models/enums.py - Request and job models
app/schemas.py - Attachment service
app/services/anexos.py - File validation
app/utils/validacao.py - Text validation
app/utils/sem_magic_bytes.py
Async processing
- Upload queue
app/services/fila.py - Redis
app/database/redis.py - Queue worker
worker.py - Upload processor
app/services/jobs.py
Persistence and files
- PostgreSQL
app/database/postgres.py - Cloudinary client
app/services/cloudinary.py
Other components
- ACTA client
- acta-pg-api
- Cloudinary
Connections 20
- ACTA client → Attachment routes: submits or queries
README.md - Attachment routes → Authentication: resolves identity
app/routes/anexos.py - Authentication → acta-pg-api: queries user
app/services/autenticacao.py - Authentication → PostgreSQL: checks AI user
app/services/autenticacao.py - Attachment routes → Attachment service: dispatches upload
app/routes/anexos.py - Attachment routes → Attachment service: requests status
app/routes/anexos.py - Attachment service → File validation: validates file
app/services/anexos.py - File validation → Text validation: validates text
app/utils/validacao.py - Attachment service → PostgreSQL: checks and records
app/services/anexos.py - Attachment service → Upload queue: enqueues job
app/services/anexos.py - Upload queue → Redis: uses connection
app/services/fila.py - Queue worker → Upload queue: consumes jobs
worker.py - Queue worker → Upload processor: runs job
README.md - Upload processor → PostgreSQL: reads and updates
app/services/jobs.py - Upload processor → Cloudinary client: uploads file
app/services/jobs.py - Cloudinary client → Cloudinary: stores file
README.md - Attachment service → Request and job models: builds job
app/services/anexos.py - Attachment service → Attachment types: sets status
app/services/anexos.py - Upload processor → Attachment types: updates status
app/services/jobs.py - Attachment service → ACTA client: returns receipt or status
README.md