Overview
The Expediente API generates comprehensive employee evaluation files that compile all captured data from the evaluation process. Reports are generated using Puppeteer for HTML-to-PDF conversion.Expediente reports include personal data, family information, academic history, work trajectory, economic data, references, and more. Two report types are supported: Nuevo Ingreso (New Entry) and Permanente (Permanent).
Render Expediente HTML
Endpoint
Authentication
No authentication required (public endpoint for internal PDF generation).Path Parameters
The evaluation ID to generate the expediente for.
Response
Returns an HTML view without layout (layout: false) optimized for PDF generation. The template used depends on evaluation type:
- tipoEvalID = 1:
expedienteViews/RenderExpedientePerma(Permanent employees) - tipoEvalID ≠ 1:
expedienteViews/RenderExpedienteNI(New entry employees)
Data Sections Included
Personal information of the employee.
Evaluation metadata.
Family members information.
Academic history and education records.
Social media accounts and online presence.
Work trajectory for new entry employees.
Work trajectory for permanent employees.
Economic and financial information.
Bank accounts (active records only).
Credit lines and loans (active records only).
Real estate properties (active records only).
Personal property and vehicles (active records only).
Personal and professional references.
Training and certifications (active records only).
Recent employment history for new entry evaluations.
Family members involved in legal processes.
Family members in law enforcement or government.
Additional income sources.
Work assignments and postings (Permanente only).
Database Queries
The endpoint executes multiple parallel queries to gather comprehensive data:Error Response
- Evaluation ID not found
- Database connection errors
- Missing required data
Generate Expediente PDF
Endpoint
Authentication
No authentication required.Path Parameters
The evaluation ID to generate the PDF for.
Response
application/pdfPDF file binary data.
PDF Generation Settings
The PDF is generated using Puppeteer with the following configuration:PDF Specifications
Paper size: A4 (210mm × 297mm)
Includes background colors and images in PDF.
Left margin.
Top margin.
Right margin.
Bottom margin (larger for footers).
Generation Process
- HTML Rendering: Calls
/Expediente/RenderExpediente/:evalIDinternally - Page Load: Puppeteer navigates to HTML view at
http://localhost:4001 - Media Emulation: Sets media type to “screen” for proper styling
- PDF Conversion: Renders HTML to PDF with specified settings
- Response: Returns PDF binary with
application/pdfcontent type - Cleanup: Closes Puppeteer browser instance
Performance Considerations
Error Response
- Evaluation ID not found
- Puppeteer fails to launch
- HTML rendering errors
- PDF generation timeout
Implementation Details
Source Code References
- Routes: ExpedienteRoutes.js:6-7
- Controller: ExpedienteController.js:23-191
- Models: ExpedienteModel.js (15+ SQL queries)
- Puppeteer Config: ExpedienteController.js:6-21
Template Views
expedienteViews/RenderExpedientePerma.hbs- Permanent employee templateexpedienteViews/RenderExpedienteNI.hbs- New entry employee template
Data Filtering
All data queries filter for active records only (e.g.,
familiarActivo = 1, academicoActivo = 1) to exclude soft-deleted entries.Use Cases
- Official Records: Generate complete employee evaluation file for HR records
- Background Checks: Compile all background investigation data
- Audit Compliance: Produce standardized reports for regulatory review
- Management Review: Provide comprehensive evaluation summaries
- Archive Documentation: Create permanent record of evaluation process