How alfonsomedina/fastapitest works
Project type and purpose
• This is primarily a FastAPI-based backend service (monolithic HTTP API) whose job is to process and manage PDF documents, integrate with external SOAP/Web‐service endpoints (e.g. IPAS, SFE, WIPO), send emails, and expose endpoints for frontend or third-party callers. There is a minimal static front-end (HTML/CSS under a static folder), but the heart of the system is the FastAPI application in main.py.
File structure
• Top-level entry points:
• main.py – defines FastAPI app and HTTP routes
• Create-serv_fastApi.py, Create-serv_flask.py, CreateService.py – helper or legacy service‐bootstrappers
• compile/ – scripts to compile .py to .pyc
• Business logic modules:
• dinapi/ – SFE‐related logic (sfe.py)
• publicaciones/ – “publicaciones” feature set
• wipo/ – WIPO integration
• Models:
• models/InsertUserDocModel.py, insertRegModel.py, insertRenModel.py – Pydantic or data‐transfer schemas
• PDF and document processing:
• pdf/ – sample PDF documents
• auto_process.py, getFileDoc.py, tools/doc_pdf.py – PDF generation/extraction
• temp_pdf/ – temporary output
• Email sending:
• email_pdf_AG.py, email_reg_sfe.py, email_ren_sfe.py, tools/send_mail.py
• Tools and helpers:
• tools/ – various utilities (SOAP wrappers, database connectors in connect.py, data formatters, test scripts)
• Static assets:
• static/css/style.css, registroMOPC.html
README for additional insights
• Confirms it’s a FastAPI service launched via uvicorn main:app --host 0.0.0.0 --port 3600
• No explicit database folder, so persistence likely happens via SOAP calls or direct DB drivers in tools/connect.py
• Integration points to Nuxeo REST API, SOAP endpoints for process and action queries
a. Main components
• Client / Static UI (HTML/CSS)
• FastAPI HTTP Server (main.py)
• Pydantic Models (models/)
• Business Logic Modules (dinapi/, publicaciones/, wipo/)
• PDF Processor (auto_process, tools/doc_pdf)
• Email Sender (email_*.py, tools/send_mail)
• Utility Layer (tools/)
• External Services:
• IPAS Web Service
• SFE/SFE_REGISTRO SOAP Service
• WIPO Service
• Nuxeo REST API
• Data Store/DB (if any, or represented by SOAP backends)
b. Relationships and interactions
• HTTP requests flow from Client → FastAPI Controller
• Controllers validate payloads against Pydantic Models → invoke Business Logic
• Business Logic orchestrates:
• PDF creation / extraction via PDF Processor
• Data storage or retrieval via SOAP or DB connector
• Email dispatch via Email Sender
• Business Logic may call Utility Layer for shared routines
• External calls from Business Logic → External Services (SOAP or REST)
• Responses propagate back through the same layers to the client
c. Architectural patterns and design principles
• Layered architecture (Presentation → API Layer → Domain/Business Logic → Infrastructure/Utilities → External Systems)
• Separation of concerns:
• Pydantic models purely for validation/serialization
• Business modules grouped by feature (dinapi, publicaciones, wipo)
• Utility scripts factored under tools/
• Single monolith – no separate microservices
d. Key technologies, frameworks, libraries
• FastAPI + Uvicorn (ASGI server)
• Pydantic for models
• Python stdlib + third-party packages (as per requirements.txt)
• HTTP clients or zeep/suds for SOAP
• External REST integration with Nuxeo
• Virtualenv for environment isolation