Week 1: Document Understanding Layer#2
Open
Abhishek-Kumar-Rai5 wants to merge 2 commits into
Open
Conversation
ff3279f to
ba43846
Compare
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.
Overview
This PR implements the Week 1 milestone of the BETYdb extraction pipeline: the complete Document Understanding Layer.
The pipeline converts Marker's raw document representation into the project's immutable Document Object while preserving structural provenance, deterministic identifiers, and document hierarchy.
This work establishes the foundation required for the retrieval and extraction stages in later milestones.
What this PR includes
Raw Marker Model
Document Object
Normalizer
Implemented the complete staged normalization pipeline:
Public API
The Document Understanding Layer exposes a single public entry point through the normalize() function. Given a validated MarkerDocument together with processing metadata, it executes the complete normalization pipeline and returns the project's immutable Document representation.
Repository Architecture
Design decisions
Current scope
This PR focuses on the document understanding layer only.
Validation
The complete normalization pipeline was exercised end-to-end using the smoke test (scripts/run_normalize_smoke_test.py) against three real Marker outputs:
For each document, the pipeline successfully:
Screenshots
Video recording of the normalizer smoke test :-
https://github.com/user-attachments/assets/84322b80-5ad3-4f67-aa9b-10220b7f23a6
Documentation
Added:
Architecture flow chart
Repository Navigation Guide
This repository is organized around the major stages of the extraction pipeline. The recommended order below provides enough context to understand how information flows from a PDF to a structured scientific representation.
1. Project Documentation (
docs/)Start here before reading the implementation.
document_schema_specification_v1.1.mdnormalizer.mdmarker_empirical_findings_paper1.md2. Marker Adapter (
src/betydb_extraction/marker_adapter/)The Marker Adapter is responsible for representing Marker output as validated Python objects.
Key entry points:
raw_model.pyPurpose:
3. Document Object (
src/betydb_extraction/document/)Defines the project's canonical immutable document representation.
Major components include:
These models are the shared representation used by every downstream stage.
4. Normalizer (
src/betydb_extraction/normalizer/)Responsible for transforming Marker documents into immutable Document Objects.
Important files:
api.pybuilders/internal/5. Tests (
tests/)Organized alongside the major project components.
marker_adapter/document/normalizer/These verify correctness, invariants, serialization, and deterministic behaviour.
6. Scripts (
scripts/)Contains helper scripts for running smoke tests and validating the complete normalization pipeline on real Marker outputs.
7. Data (
data/)Development resources used throughout the project.
raw_papers/marker_output/normalized_output/Recommended Reading Order
For new contributors:
docs/document_schema_specification_v1.1.mddocs/normalizer.mdmarker_adapter/document/normalizer/api.pynormalizer/internal/tests/