Recover approximate tabular data from scientific and professional figures.
Project description
figrecover
figrecover is a public-alpha Python package for recovering approximate source
tables from published figures when the original data were not released. It is
designed for technical PDF workflows such as FEMIC timber-supply-review
ingestion, FHOPS reference-document digitisation, and other modelling pipelines
that need auditable figure-derived data.
The package uses a hybrid model:
- Deterministic PDF and manifest tools prepare auditable figure crops.
- Optional local VLM tools propose chart type, labels, legends, tick labels, calibration hints, and likely series colours.
- Deterministic calibration maps figure pixels back into data coordinates.
- Extractors emit auditable CSV/JSON tables with diagnostics.
- QA/review tools generate overlays, metrics, review manifests, and accepted-table exports.
- Integration adapters export reviewed recovered data for FEMIC, FHOPS, and generic modelling workflows.
figrecover is pre-release research software. It does not provide a fully
automatic PDF-to-table pipeline or precision guarantees for arbitrary charts.
Recovered values are approximate and should be reviewed before they become
scientific or operational model inputs.
Current Alpha Scope
Supported in 0.1.0a1:
- manual calibrated extraction from prepared image crops;
- linear and log axis transforms;
- colour-based line, scatter, and bar extraction;
- simple filled-area top-edge or bottom-edge recovery;
- deterministic PDF page rendering and figure-candidate manifests;
- QA overlays, quality metrics, JSONL review manifests, and accepted-table export;
- corpus artifact layout and deterministic batch preparation;
- local VLM metadata proposal records and OpenAI-compatible backend boundary;
- generic, FEMIC, and FHOPS-oriented modelling exports;
- Sphinx docs, public-safe examples, CI, and release checks.
Not supported as reliable alpha functionality:
- fully automatic arbitrary PDF-to-table recovery;
- authoritative VLM-only numeric extraction;
- low-quality scanned document OCR workflows;
- 3D charts, maps, diagrams, heatmaps, boxplots, stacked/grouped bars, contour plots, ternary plots, and other complex chart classes.
Repository Conventions
This package is intended to live as a public UBC-FRESH repository under
UBC-FRESH/figrecover with an MIT license.
Development follows the same phase/task/subtask discipline used in
modelwright:
ROADMAP.mdmaps phases and tasks to GitHub issues.CHANGE_LOG.mdrecords the dated project narrative.planning/stores focused design notes and evidence records.- one feature branch and one parent issue should govern each active phase.
- private PDFs, rendered pages, crops, VLM outputs, and recovered private data
stay under ignored local paths such as
tmp/.
Install For Development
python -m venv .venv
. .venv/bin/activate
python -m pip install -e .[dev]
pytest
Optional extras:
python -m pip install -e .[cv,pdf,parsers,vlm,docs,dev]
Run the default checks:
python -m pytest
python -m ruff check .
sphinx-build -b html docs _build/html -W
python -m build
twine check dist/*
Examples
The examples/ directory contains publication-safe scripts that generate their
own synthetic inputs and write outputs under tmp/examples/:
python examples/synthetic_chart_extraction.py
python examples/synthetic_pdf_corpus.py
python examples/mocked_vlm_metadata.py
CLI Example
For a cropped plot image where the plot frame spans pixels (80, 40) to
(520, 360), and a blue line is #1f77b4:
figrecover digitize-image crop.png \
--mode line \
--series-name harvest \
--series-color '#1f77b4' \
--plot-left 80 --plot-right 520 --plot-top 40 --plot-bottom 360 \
--x-min 0 --x-max 100 --y-min 0 --y-max 250 \
--out harvest.csv
JSON output preserves metadata and diagnostics:
figrecover digitize-image crop.png \
--mode scatter \
--series-name observations \
--series-color '#d62728' \
--plot-left 80 --plot-right 520 --plot-top 40 --plot-bottom 360 \
--x-min 0 --x-max 100 --y-min 0 --y-max 250 \
--out observations.json
Python Example
from pathlib import Path
from figrecover import Calibration, DigitizeSpec, SeriesSpec, digitize_image
spec = DigitizeSpec(
calibration=Calibration.from_plot_bounds(
plot_left=80,
plot_right=520,
plot_top=40,
plot_bottom=360,
x_min=0,
x_max=100,
y_min=0,
y_max=250,
),
series=[
SeriesSpec(name="harvest", color="#1f77b4", mode="line", tolerance=45),
],
)
result = digitize_image(Path("crop.png"), spec)
print(result.to_dataframe())
Roadmap
Near-term phases are tracked in ROADMAP.md:
- Phase 0: governance and public repo bootstrap.
- Phase 1: architecture and dependency research.
- Phase 2: core records, calibration, and extraction API.
- Phase 3: document ingestion and figure cropping.
- Phase 4: local VLM assistance layer.
- Phase 5: QA, review, and human-in-the-loop workflows.
- Phase 6: batch corpus pipeline.
- Phase 7: FEMIC/FHOPS integration adapters.
- Phase 8: documentation, examples, and public alpha.
- Phase 9: scholarly publication and peer review.
Private-Data Hygiene
Do not commit private PDFs, rendered pages, crops, overlays, review manifests,
prompt logs, VLM responses, generated corpus outputs, or recovered private
tables. Keep them under ignored local paths such as tmp/ unless explicitly
sanitized and approved for public release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file figrecover-0.1.0a1.tar.gz.
File metadata
- Download URL: figrecover-0.1.0a1.tar.gz
- Upload date:
- Size: 50.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21fdd716c4ed8f4519548b7917b767467efac8fb643fd295c6ec8c7c77c989b0
|
|
| MD5 |
48c0387f2c991e400bb7f951e2c803c8
|
|
| BLAKE2b-256 |
68f563c086738fde2071f364227e699185389d5a92f4e5820e6ff536c3fb148f
|
Provenance
The following attestation bundles were made for figrecover-0.1.0a1.tar.gz:
Publisher:
release.yml on UBC-FRESH/figrecover
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
figrecover-0.1.0a1.tar.gz -
Subject digest:
21fdd716c4ed8f4519548b7917b767467efac8fb643fd295c6ec8c7c77c989b0 - Sigstore transparency entry: 1987754482
- Sigstore integration time:
-
Permalink:
UBC-FRESH/figrecover@83e978a1128412726293c0c855366085b1374b35 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/UBC-FRESH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83e978a1128412726293c0c855366085b1374b35 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file figrecover-0.1.0a1-py3-none-any.whl.
File metadata
- Download URL: figrecover-0.1.0a1-py3-none-any.whl
- Upload date:
- Size: 45.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e112c88ae464317ef2edd1a5d0a6e0923a597263ef185e55c0018be4a829e15
|
|
| MD5 |
554fecd2b3b26cb38ac8a298105e4c25
|
|
| BLAKE2b-256 |
ec2f09830770cfcf2031959d6d147a30c87477a2d55de5b5ecb1724833443319
|
Provenance
The following attestation bundles were made for figrecover-0.1.0a1-py3-none-any.whl:
Publisher:
release.yml on UBC-FRESH/figrecover
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
figrecover-0.1.0a1-py3-none-any.whl -
Subject digest:
7e112c88ae464317ef2edd1a5d0a6e0923a597263ef185e55c0018be4a829e15 - Sigstore transparency entry: 1987754587
- Sigstore integration time:
-
Permalink:
UBC-FRESH/figrecover@83e978a1128412726293c0c855366085b1374b35 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/UBC-FRESH
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83e978a1128412726293c0c855366085b1374b35 -
Trigger Event:
workflow_dispatch
-
Statement type: