A healthtech invoice service has two distinct inputs: order data that should determine the invoice, and uploaded scans that may help reconcile it. Template ownership decides where those inputs meet. If a recognition result can silently change a billing template, an OCR confidence problem becomes a rendering problem. The separation needs to be explicit.
Short answer: Accept and validate the upload, retain the original scan, queue OCR, and store extracted text against the document ID. Validate candidate billing values before admitting them into order data. Generate the invoice PDF through an explicitly owned template. Keep operational telemetry small enough to explain this sequence without copying the medical document into the logs.
This design applies to a Node.js service with Express handling admission and a separate worker handling recognition. The important boundary is the durable handoff.…