feat(pdf): archive check tool pnpm report:compare (attachment vs its v3 reading, unresolved items flagged, --diff/--summary/--identity); readAttachedDocument split out of extractReportJson; stale scaffold:species script removed; docs
This commit is contained in:
1 parent
1e0491f3bc
commit
dc78a00835
13 files changed
+753
-37
No files matched your search
@@ -3,6 +3,7 @@
|
||||
Placeholder — to be written when implementing src/pdf/.
|
||||
|
||||
Will cover:
|
||||
|
||||
- A4 portrait dimensions (595.28 × 841.89 pt)
|
||||
- Page layout: header / body / footer zones
|
||||
- Observation page structure
|
||||
@@ -27,3 +28,26 @@ Import (`importReportFromPdf(bytes, migrationMap)`) accepts:
|
||||
or finding the map cannot place is kept with its snapshots and flagged
|
||||
`unresolved: true`; the outcome reports `migrated` and the unresolved counts;
|
||||
- any other version: `ImportError('incompatible_version', foundVersion)`.
|
||||
|
||||
## Checking an archive against its migration
|
||||
|
||||
`pnpm report:compare <file.pdf | folder>...` reads the attachment of one or
|
||||
more PDFs and prints it next to its v3 reading on the bundled reference
|
||||
sheet, without writing anything:
|
||||
|
||||
- a v2 archive PDF: every legacy zone (`data-anno-id`, side, vertebrae) and
|
||||
every legacy finding path is shown with its canonical target and the
|
||||
current label of that target (`same` when the path did not change);
|
||||
- a v3 PDF: every zone and finding is checked against the sheet, and the
|
||||
header says whether the report was written on the bundled sheet document;
|
||||
- anything the sheet cannot place is printed as `!! UNRESOLVED` with the
|
||||
reason: unknown legacy zone id, finding removed from the sheet by the
|
||||
curation, finding that never belonged to the legacy catalog, or a v3
|
||||
finding flagged `unresolved` in the report itself.
|
||||
|
||||
Options: `--summary` (one line per file, counts and unresolved counts),
|
||||
`--identity` (print the practitioner, animal and owner names, off by
|
||||
default), `--locale fr|en` (labels), `--diff a.pdf b.pdf` (compare the v3
|
||||
content of two PDFs: an archive and the PDF exported after importing it
|
||||
should print `identical v3 content`). The tool exits 2 when a file could not
|
||||
be read (no attachment, unknown version, oversized) and prints the reason.
|
||||
Reference in new issue
Block a user