Repository navigation
Add pdf-report to hl7 - #12
Merged
Merged
Conversation
Folder sources now offer PDF reports, Help lists the HL7 files and PDF reports articles, and the fields notice names PDF report messages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings the lettre, url and cookie advisory updates (#13); CHANGELOG.md is regenerated from both branches' entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The help claims check refuses /\bprint/ in articles; "the label printed on the report" and "does not print" become "the label on the report" and "missing from the report". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PDF reports to HL7 files
Problem
Some laboratories publish results only as PDF reports, and some receivers collect HL7 messages as files rather than over MLLP. Until now, the engine could neither read a PDF report nor write HL7 messages as files.
What changes
Read PDF reports (pdf_report source), specified in pdf-reports.md and configuration.md §7.7:
A new crate, packie-pdf, reads the text layer of born-digital PDFs with positions (no OCR) and reads labelled fields through a template (right and below fields, the label area, agreement across pages). It does no I/O, works within limits on pages, decompressed bytes, words and time, and fails with a reason code.
The PDF is stored as one message before it is parsed. A report that fails becomes invalid with a reason_detail that never contains report text. Message store schema version 11.
Folder and SFTP endpoints gain filtered_directory and invalid_directory: a source file is moved according to the outcome of its message.
Mappings read field., report.pages and report.file_base64 (the report embedded, for example in an HL7 ED). New text step strip_suffix. Date formats accept the unpadded tokens M, d and H.
Test tool: the test_pdf_report IPC request, packie pdf test, Test with a PDF… in the connector editor and Test against the current template on an invalid report. It stores nothing and is audited as pdf_report_test.
Message views show the extracted text and the parsed fields. Export with bodies writes the extracted text.
Presets: a newborn screening report template and its mapping to ORU^R01, built from a synthetic report.
Write HL7 files (hl7_file destination), configuration §7.8: one message per file on a folder or SFTP endpoint, with file_name tokens, on_exists, the MSH header fields and max_message_bytes. HL7 sources can pass through without a mapping.
Fix: file receipt time. Messages read from files (delimited files and PDFs) are received when the engine takes the file, not at the file's modified time. Before, an old file dropped today was listed days back and could be removed by retention almost at once.
Review fixes in the PDF reader (on top of the feature):
a font without /Type /Font is read through its encoding;
rotated text in a font without a character map no longer rejects the report;
width lookup in two-byte fonts goes through a map, and the time limit is also checked per glyph;
more than 256 saved graphics states makes the file unreadable instead of being misread;
template labels are NFC-normalized like page text;
one ColumnType::as_str replaces two copies of the same helper;
the transform_path fuzz target checks PDF paths.
Requirements and specification
PRO-03, PRO-06, PRO-07, EPT-03, EPT-04. New docs/spec/pdf-reports.md. Updated: architecture, configuration, message-channels, operator-console, audit, diagnostics, acceptance, requirements, decisions, testing, the configuration reference, running and monitoring, the fuzz README, console help, and STATUS.md.
Tests
packie-pdf: conformance tests on synthetic reports (layouts, rotation, composite fonts, forms, refused inputs, limits), property tests on mutated files, and a pdf_read fuzz target with seeds.
Routing: message_pdf.rs and message_hl7_file.rs. Transform: pdf_to_hl7.rs. The config profile tests run the new presets. Engine and CLI end-to-end tests.
Console: unit tests for the test dialog, connector and endpoint settings, the channel form, presets and message views.
Checks run locally:
cargo test and cargo clippy --all-targets -D warnings for packie-pdf, packie-config and packie-engine: pass.
cargo test -p packie-ipc --test typescript: generated types are current.
npm run changelog:check, tsc and biome: pass.
Not run locally: the workspace-wide suite and the console vitest suite (CI).
Changelog
changelog.d/2026-11-19-pdf-reports.md (added), 2026-11-19-hl7-files.md (added) and 2026-11-20-file-receipt-time.md (fixed). CHANGELOG.md is regenerated.
New dependencies
lopdf 0.47 (MIT), with default features off (no clocks or threads): the PDF file structure.
icu_normalizer 2.4 (Unicode-3.0), already in the dependency tree: NFC for extracted text.
base64 0.23 (MIT/Apache-2.0), already in the dependency tree, now a workspace dependency: the embedded report and the test tool's upload.