Skip to content

Conversation

@TheoAtTechStack
Copy link
Contributor

PR Summary – OCR Integration & Encounter Form

Overview

This PR adds full support for capturing images from the webcam, uploading PDFs or multiple PNG/JPG images, sending them to the OCR service, and populating the Encounter form with normalized FHIR R4 data, including attaching the uploaded files to the encounter.

Key Features

  • Capture / Upload

    • Live camera capture (up to 30 images).
    • “Capture Next Image” button for sequential captures.
    • Upload multi-page PDFs or multiple PNG/JPG files.
    • Preview images before sending to OCR.
  • Send to OCR

    • Converts captured images/files to actual File objects and sends all at once to the OCR service.
    • Backend proxies files to OCR and returns recognized JSON.
  • Encounter Form Population

    • Automatically fills form fields (practitioners, organizations, medications, etc.).
    • Uploaded images/PDFs are attached as files to the encounter (attachments array).
  • Preview & Edit

    • Navigate captured pages/images.
    • Edit OCR results before final submission.

Data Normalization

Ensures all resources conform to FHIR R4 structure:

  • Flattened text fields.
  • ISO 8601 date strings.
  • Arrays for addresses.
  • Names properly split for practitioners.

Benefits

  • Simplifies digitization of medical records.
  • Reduces manual entry and errors.
  • Supports multiple images, PDFs, and live camera capture.
  • Uploaded files are preserved as attachments in the encounter.
  • Fully compatible with backend and FHIR R4 expectations.
PR.PDF.scan.DEMO.1.mov

@TheoAtTechStack
Copy link
Contributor Author

Hey @AnalogJ ! I opened the PR with the OCR scan flow. It's in draft until further feedback. Let me know if you have any notes or takes on this one, thanks!

@socket-security
Copy link

socket-security bot commented Oct 14, 2025

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
npm/elliptic@6.5.0 has a Critical CVE.

CVE: GHSA-vjh7-7g9h-fjfh Elliptic's private key extraction in ECDSA upon signing a malformed input (e.g. a string) (CRITICAL)

Affected versions: < 6.6.1

Patched version: 6.6.1

From: frontend/yarn.locknpm/elliptic@6.5.0

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/elliptic@6.5.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Critical
npm/webpack@5.74.0 has a Critical CVE.

CVE: GHSA-hc6q-2mpp-qw7j Cross-realm object access in Webpack 5 (CRITICAL)

Affected versions: >= 5.0.0 < 5.76.0

Patched version: 5.76.0

From: frontend/yarn.locknpm/webpack@5.74.0

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/webpack@5.74.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
npm/pdf-lib@1.17.1 has Obfuscated code.

Confidence: 0.90

Location: Package overview

From: frontend/package.jsonnpm/pdf-lib@1.17.1

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/pdf-lib@1.17.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
npm/safer-buffer@2.1.2 has Obfuscated code.

Confidence: 0.94

Location: Package overview

From: frontend/yarn.locknpm/safer-buffer@2.1.2

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/safer-buffer@2.1.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
npm/webcrypto-liner@1.4.0 has an HTTP dependency.

Dependency: elliptic@https://github.com/mahrud/elliptic

Location: Package overview

From: frontend/package.jsonnpm/webcrypto-liner@1.4.0

ℹ Read more on: This package | This alert | What are http dependencies?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Publish the HTTP URL dependency to npm or a private package repository and consume it from there.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/webcrypto-liner@1.4.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@socket-security
Copy link

socket-security bot commented Oct 15, 2025

@TheoAtTechStack TheoAtTechStack marked this pull request as ready for review October 28, 2025 12:49
@TheoAtTechStack TheoAtTechStack changed the title [DRAFT] Feature/OCR Scan Feature/OCR Scan Oct 28, 2025
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