docling-project / docling-project/docling
Metadata in `ConversionResult`
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
## New feature
Allow document backends to populate a generic metadata fields in the `ConversionResult` object.
For example: PDF metadata, USPTO patents metadata, etc
## Specs
- `ConversionResult`:
- Add `metadata: Dict[str, Any] = {}`
- https://github.com/docling-project/docling/blob/ff351fd40c4b635133401e77dea89bec8cd0ca33/docling/datamodel/document.py#L198-L210
- Backends
- Add `extract_metadata()` to the `AbstractDocumentBackend`. It can just be a default implementation returning the empty dict.
- https://github.com/docling-project/docling/blob/ff351fd40c4b635133401e77dea89bec8cd0ca33/docling/backend/abstract_backend.py#L13-L39
- Pipeline
- Start with the SimplePipeline, add something like `conv_res.document = conv_res.input._backend.extract_metadata()`
- https://github.com/docling-project/docling/blob/ff351fd40c4b635133401e77dea89bec8cd0ca33/docling/pipeline/simple_pipeline.py#L39-L40
Contributor guide
Assessment
This issue has not been assessed yet.