Skip to main content
Junction’s Lab Report Parsing API converts lab report files into structured JSON. You can upload PDF, JPEG, and PNG reports from external laboratories, patient-uploaded records, or historical chart archives, then retrieve extracted metadata, results, reference ranges, interpretations, and LOINC matches. Lab Report Parsing is separate from Junction’s ordered lab test workflow. It does not place an order, collect a sample, or request a result from a lab. It reads an existing report document and returns the data Junction can extract from that document.
This feature is in closed beta.Interested in this feature? Get in touch with your Customer Success Manager.

When to Use It

Use Lab Report Parsing when you already have a completed lab report file and need to make it usable in your application. Common use cases include:
  • Patient uploads of lab reports from outside providers
  • Historical data imports from PDFs or scanned records
  • Multi-lab result aggregation using LOINC as a normalization layer
  • Backfilling structured results before a user starts ordering through Junction
If the result came from a Junction lab order, use the order result format documentation and results endpoints instead.

Workflow

The parsing workflow is asynchronous:
  1. Upload one or more report files to create a parsing job.
  2. Junction validates and stages the uploaded file, then queues the parsing job.
  3. Junction extracts report metadata and lab results, then attempts to match extracted results to LOINC codes.
  4. Your application receives a webhook or polls the job endpoint.
  5. When the job is completed, the data object contains parsed metadata and results.

Uploading Reports

Create a parsing job with the Create Lab Report Parser Job endpoint. The request is multipart/form-data and requires: Supported file formats and upload limits: When you upload multiple image files, Junction treats each image as one page and merges the files into a single PDF in the order supplied. Multi-file uploads cannot include PDFs. Each individual file must also be no larger than 30 MiB, although the 30 MiB combined limit is normally the effective limit for a multi-file request. Junction validates the declared Content-Type and file signature for every file. It also verifies that PDFs can be read and decodes images in multi-file uploads while merging them. A file that passes synchronous upload validation can still fail later during asynchronous parsing.
cURL
The create response returns the job immediately. At this point, data is null because parsing has not completed.
Response

Job Statuses

The status field describes the state of the parsing job. If a parsing job fails, failure_reason can include:
Parser status and failure reason enums are non-exhaustive. Store unknown values safely and avoid hard-failing if Junction adds a new value or returns failure_reason: null.

Upload Validation Errors

Some invalid uploads are rejected synchronously by the create endpoint instead of becoming failed parser jobs. These errors return an HTTP error response before a parsing job is created.

Human Review

Set needs_human_review to true to request manual review where enabled for your team. Do not use this field as a substitute for your application’s own clinical review or validation requirements. Human review is not enabled for every team by default. Contact your account manager before depending on it in production. If your team is not enabled for human review, creating a job with needs_human_review=true returns a 400 response:
Error
The response includes two review fields:

Parsed Output

When status is completed, data contains: Example completed response:
Response

Metadata

metadata is extracted from the document header and surrounding report content when present. Not every report contains every metadata field. Treat patient names, date of birth, lab name, report dates, and specimen number as nullable. Treat unknown or unsupported gender values as other. Date fields are strings and are not guaranteed to use one date format. Parse them only after validating the returned value.

Result Fields

Each data.results[] item contains the extracted value and associated context.

Value and Type

data.results[].value is always returned as a string. Do not assume it can always be parsed as a number. For type: "numeric", value should be a number encoded as a string, such as "5" or "5.0". For other result types, value can contain comparators, text, boolean-like values, durations, percentages, or ratios. Use type before deciding how to parse or display the value.
The parser output is optimized to preserve what was reported. Store the raw value string and derive typed values in your application only after checking type, units, and reference range fields.
The parser-specific type values are related to, but not identical to, the order result ResultType values documented in Result Formats. Parser results currently include numeric, range, comment, boolean, duration, percentage, and ratio. When type is not supplied by extraction, Junction infers it from value. For example, "<50", "≥2000", and "10-20" are inferred as range; "20%" is inferred as percentage; "97/100" is inferred as ratio; and unrecognized text is inferred as comment.

Reference Ranges and Interpretation

The parser may extract min_reference_range and max_reference_range as numeric bounds when the report includes a parseable reference range. It may also return:
  • interpretation: possible values are normal, abnormal, critical, or unknown.
  • is_above_max_range: whether the result is above the extracted maximum
  • is_below_min_range: whether the result is below the extracted minimum
These fields depend on the quality and structure of the source report. Some reports include clear numeric bounds; others include textual ranges, age-specific ranges, sex-specific ranges, comments, or formatting that cannot be normalized into numeric bounds. For numeric values, Junction can infer whether the result is above or below the extracted numeric reference bounds. For comparator range values, Junction only sets range flags when the comparator is conclusive. For example, ">2000" with a max reference range of 1100 is above range, but ">500" with the same max is inconclusive. If a value is conclusively outside the extracted bounds, interpretation is abnormal. Numeric values without an out-of-range flag are interpreted as normal. Non-numeric and inconclusive range values are interpreted as unknown unless the parser extracted a more specific interpretation. If you need custom boundary logic, read the result value, type, units, and reference range fields together. For general order-result reference range guidance, see Reference Range.

LOINC Matching

Junction attempts to match extracted results to LOINC codes so you can compare markers across different labs and report formats. Each loinc_matches[] item includes: confidence_score is a matching score for the candidate LOINC code. It is not an accuracy score for the extracted lab result, patient metadata, units, reference ranges, or interpretation. A high score means Junction’s LOINC matcher found a stronger candidate for that result row than lower-scored candidates; it does not prove that the source document was parsed correctly. In most integrations, use loinc_match_status for workflow decisions instead of building your own thresholds on confidence_score. Store the score for debugging, audit, or support workflows, but avoid using it as a clinical-confidence or result-accuracy signal. Use loinc_match_status to decide how much review your workflow needs:
LOINC matches are not guaranteed for every extracted result. Your integration should handle loinc_matches: null, an empty match list, low confidence scores, needs_review, no_match, and future match statuses.

Webhooks

Subscribe to parser events to avoid polling. The POST response is produced from the initial job record and returns upload_pending. After Junction stages the file, the lab_report.parsing_job.created webhook contains the same job in started status. A later lab_report.parsing_job.updated webhook contains the terminal completed or failed state. Webhook delivery is asynchronous, so your application should not depend on receiving events in the same order as API responses. Webhook payloads include the user, team, and parsing job:
Webhook payload
For webhook delivery behavior, retries, and event structure, see Webhooks.

Sandbox Limits

Sandbox lab report parsing has a limit of 300 non-failed jobs per team. Jobs in upload_pending, started, or completed count toward the limit. Jobs with status: "failed" or a non-null failure_reason do not count. When the sandbox limit is reached, the response is:
Error
This is a team-wide sandbox usage limit, not a per-user or file-level validation error. Retrying the same request, creating more users, or changing the report file does not reset it. Production access is enabled per team and does not use the sandbox job-count check. Contact Junction support if you need higher-volume testing or production access.

Integration Guidance

Build your parser integration defensively:
  • Keep the original report file or a pointer to it in your system for audit and reprocessing workflows.
  • Store data.results[].value as a string, even when type is numeric.
  • Treat parser enums as non-exhaustive and log unknown status, type, failure_reason, sample_type, measurement_kind, and loinc_match_status values.
  • Do not require LOINC matches to be present before displaying the extracted result to users.
  • Review low-confidence or needs_review LOINC matches before using them for clinical decisioning, cohort logic, or automated recommendations.
  • Expect null metadata and null reference range fields when the source report does not include parseable values.
  • Use webhooks for normal processing and keep polling as a fallback for missed events or manual support flows.

API Reference