Skip to content

[WIP] Add endpoint for ID card image upload and field extraction#43

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/add-id-card-upload-endpoint
Draft

[WIP] Add endpoint for ID card image upload and field extraction#43
Copilot wants to merge 1 commit intomainfrom
copilot/add-id-card-upload-endpoint

Conversation

Copy link
Contributor

Copilot AI commented Nov 29, 2025

  • Install Tesseract.js dependency for OCR functionality
  • Create controllers/credentials.js with endpoint logic for image upload and OCR extraction
  • Create routes/credentials.js with POST endpoint for uploading ID card images
  • Update server.js to register the new credentials route
  • Create media/credenciales/ directory for storing uploaded images
  • Add regex/string search to extract afiliacion, folio, and pensionado fields from OCR output
  • Add tests for the new endpoint
  • Update .gitignore to exclude uploaded credential images
  • Verify the implementation manually
Original prompt

Create an endpoint that receives an uploaded image of an ID card, saves it on the server, and extracts three fields using OCR with Tesseract: afiliacion, folio, pensionado (or pension depending on detected text).
Save file to:
media/credenciales/<generated_filename>.jpg
"Afiliación" → return as afiliacion

"Folio" → return as folio

"Pensionado" or "Pensión" → return as pensionado

Use regex or string search to extract values from the OCR output.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants