How jrdandp/backendtest works
This is a FastAPI backend for automating Scordsoft cobros and service-order reports. Its main workflow accepts a request, validates date inputs, authenticates and downloads a report, then normalizes it; the order workflow can additionally synchronize orders and assignments to PostgreSQL. Separate capabilities include normalizing an existing cobros file and checking service/database health. The README documents the layered architecture; source-index references and excerpts support the shown calls. Unsampled endpoint and utility details are represented only where documented or indexed.
Main entry points: automation_service.py Automation service · scrapper_client.py Scrapper adapter · registroCobros.py Cobros download · ordenes.py Orders download
Components 25
HTTP API
- FastAPI app
app/main.py - API v1 routes
app/api/v1/api.py - Automation endpoints
app/api/v1/endpoints/automation.py - Health endpoint
app/api/v1/endpoints/health.py - Dependency injection
app/api/deps.py - Automation DTOs
app/schemas/automation.py - Response DTOs
app/schemas/common.py
Automation Use Cases
- Automation service
app/services/automation_service.py - Date validation
Utils/utilsDate.py - Cobros normalizer
dataNormalizer.py - Normalization helpers
Utils/utilsNormalizer.py - Orders normalizer
ordenesNormalizer.py
Scordsoft Automation
- Scrapper adapter
app/infrastructure/scrapper_client.py - Portal login
Scrapper/login.py - Cobros download
Scrapper/registroCobros.py - Orders download
Scrapper/ordenes.py - Scraper helpers
Utils/utilsScrapper.py - File utilities
Utils/utilsFiles.py
Order Data
- Order repository
app/repositories/orden_repository.py - Base repository
app/repositories/base.py - Order entities
app/models/orden.py - PostgreSQL
app/core/database.py
Other components
- API caller
- Scordsoft portal
- Report files
Connections 36
- API caller → FastAPI app: sends request
README.md - FastAPI app → API v1 routes: mounts routes
app/main.py - API v1 routes → Automation endpoints: registers
app/api/v1/api.py - API v1 routes → Health endpoint: registers
app/api/v1/api.py - Automation endpoints → Automation service: invokes
app/api/v1/endpoints/automation.py - Automation endpoints → Dependency injection: gets dependencies
app/api/v1/endpoints/automation.py - Automation endpoints → Automation DTOs: validates and returns
app/api/v1/endpoints/automation.py - Health endpoint → PostgreSQL: checks connection
app/api/v1/endpoints/health.py - Health endpoint → Response DTOs: returns response
app/api/v1/endpoints/health.py - Dependency injection → PostgreSQL: provides session
app/api/deps.py - Dependency injection → Automation service: provides service
app/api/deps.py - Automation service → Date validation: validates dates
app/services/automation_service.py - Automation service → Scrapper adapter: orchestrates reports
app/services/automation_service.py - Automation service → Orders normalizer: normalizes orders
app/services/automation_service.py - Automation service → Order repository: syncs orders
app/services/automation_service.py - Scrapper adapter → Portal login: authenticates
app/infrastructure/scrapper_client.py - Scrapper adapter → Cobros download: downloads cobros
app/infrastructure/scrapper_client.py - Scrapper adapter → Orders download: downloads orders
app/infrastructure/scrapper_client.py - Scrapper adapter → Cobros normalizer: normalizes cobros
app/infrastructure/scrapper_client.py - Portal login → Scordsoft portal: authenticates with
Scrapper/login.py - Cobros download → Scordsoft portal: requests report
Scrapper/registroCobros.py - Orders download → Scordsoft portal: requests report
Scrapper/ordenes.py - Portal login → Scraper helpers: extracts form tokens
Scrapper/login.py - Cobros download → Scraper helpers: extracts form values
Scrapper/registroCobros.py - Orders download → Scraper helpers: extracts form values
Scrapper/ordenes.py - Cobros download → File utilities: creates output directory
Scrapper/registroCobros.py - Orders download → File utilities: creates output directories
Scrapper/ordenes.py - Cobros normalizer → Normalization helpers: uses
dataNormalizer.py - Order repository → Base repository: extends
app/repositories/orden_repository.py - Order repository → Order entities: upserts entities
app/repositories/orden_repository.py - Order repository → PostgreSQL: commits changes
app/repositories/orden_repository.py - Portal login → Report files: returns session
- Cobros download → Report files: writes report
Scrapper/registroCobros.py - Orders download → Report files: writes report
Scrapper/ordenes.py - Cobros normalizer → Report files: writes normalized file
- Orders normalizer → Report files: writes normalized file