Document Extract
Category: AI & ML
Node id: document-extract
Standards: PHI, IEC-62304-Class-C
Extract structured patient/procedure/billing data from a PDF medical document (bill, procedure report, referral, or lab report) using Gemini on Vertex AI. Handles scanned and digital PDFs; classifies then extracts.
What it does
- Native PDF ingestion (scanned + digital) via Gemini on Vertex AI
- Classify-then-extract in a single model call
- Verbatim code/amount extraction (no code invention)
- Low-confidence review gating for human-in-the-loop
Use cases
- Extract patients and procedures from medical bills/invoices
- Structure operative/procedure reports, referrals, and lab reports
- Feed a downstream FHIR mapper (Claim/Procedure/Patient/ServiceRequest/Observation)
Runtime
- Performance tier:
variable
Input ports
| Name | Type | Required | Description |
|---|---|---|---|
document | binary | No | PDF bytes ([]byte) or base64-encoded PDF string |
document_base64 | text | No | Base64-encoded PDF (alternative to 'document') |
pdf_path | text | No | Local filesystem path to a PDF (alternative input, e.g. for testing) |
Output ports
| Name | Type | Required | Description |
|---|---|---|---|
document_type | text | No | Classified type: bill|procedure_report|referral|lab_report|other |
extracted | json | No | Structured ExtractionResult (patient, procedures, billing, etc.) |
raw_response | text | No | Canonical JSON string of the extraction result |
confidence | number | No | Overall model confidence 0.0-1.0 |
needs_review | boolean | No | True when confidence is below threshold or any field was flagged |
metadata | json | No | model, filename, token usage |
success | boolean | No | Whether extraction succeeded |
Settings
Basic
| Setting | Name | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|---|
| Model | model | string | No | gemini-2.5-pro | Gemini model ID (falls back to GEMINI_MODEL env) |
Auth
| Setting | Name | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|---|
| GCP Project | gcp_project | string | No | Vertex AI project ID (falls back to GEMINI_PROJECT / GOOGLE_CLOUD_PROJECT env) | ||
| GCP Location | gcp_location | string | No | global | Vertex AI location, e.g. 'global' or 'europe-west1' (falls back to GEMINI_LOCATION env) |
Advanced
| Setting | Name | Type | Required | Default | Allowed values | Description |
|---|---|---|---|---|---|---|
| Temperature | temperature | number | No | 0 | min 0; max 2 | Sampling temperature; 0 for deterministic extraction |
| Max Tokens | max_tokens | number | No | 8192 | min 1 | Maximum output tokens |
| Min Confidence | min_confidence | number | No | 0.6 | min 0; max 1 | Below this overall confidence the result is flagged needs_review |
Errors
| Code | Description |
|---|---|
PDF_INPUT_MISSING | No PDF provided via document/document_base64/pdf_path |
PROJECT_REQUIRED | No Vertex project in config or environment |
GEMINI_CALL_FAILED | Vertex/Gemini request failed |
PARSE_FAILED | Model output was not valid JSON |
Runtime notes
- Auth via GCP Application Default Credentials / workload identity — no API key.
- Provide the PDF via 'document' ([]byte or base64), 'document_base64', or 'pdf_path'.
- needs_review is computed by the node (min_confidence or any review_flags), not trusted from the model.
See Build any workflow for how to put nodes together and Ports, types and data flow for how port types connect.
Something unclear? Send documentation feedback by email.