# giriharan007/spotcheck--xylem architecture

> Architecture diagram of the GitHub repository giriharan007/spotcheck--xylem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/giriharan007/spotcheck--xylem
- Repository: https://github.com/giriharan007/spotcheck--xylem

## Overview

#### Purpose and Entry Point
This is a file-oriented Python quality-inspection pipeline for comparing an English source PDF against localized PDF versions. The likely orchestration entry point is `main.py`; specialized standalone stages are exposed through `FirstPage.py`, `Toc.py`, `LastPage.py`, `Barcode_QR_Check.py`, `crop_pdf_images.py`, and `Compare_cropped_images.py`.

#### Input Contract
The system consumes paired PDF manuals from a source-language baseline and translation set:
- `Input/English/894387_5.0_en-US_2026-04_IOM.Start350.pdf`
- `Input/Translated/882539_5.0_da-DK_2026-04_IOM.Start350.pdf`
- `Input/Translated/882543_5.0_de-DE_2026-04_IOM.Start350.pdf`

A second, self-contained comparison fixture exists under `Input/set1/`, with English and Swedish PDFs plus result artifacts. File names encode document identity, version, locale, and date; this naming appears to be the principal pairing boundary.

#### Document-Structure Inspection Stages
Separate scripts imply checks for high-value manual regions:
- First-page inspection: `FirstPage.py`
- Table-of-contents inspection: `Toc.py`
- Last-page inspection: `LastPage.py`
- Barcode/QR validation: `Barcode_QR_Check.py`

These checks likely evaluate localized documents independently or relative to the English source. Their separation makes them natural pipeline nodes with PDF input and report-row/output evidence as boundaries.

#### Visual Comparison Pipeline
`crop_pdf_images.py` converts or extracts page-level regions from source PDFs, producing English crops under `Output/Cropped_Images/894387_5.0_en-US_2026-04_IOM.Start350/` and per-language comparison evidence under `Output/Cropped_Comparison/`.

`Compare_cropped_images.py` consumes aligned source/translation crops and writes page-specific visual comparison outputs. Existing directories for Danish, German, Greek, Spanish, Finnish, French, Italian, Dutch, Norwegian, Portuguese, and Swedish show that the pipeline fans out once per translated PDF, then aggregates findings.

#### Table Extraction and Comparison
Tables are a distinct processing path:
- Extraction: `Tables/Table_extraction.py`
- Comparison: `Tables/Compare_Tables.py`
- Structured outputs: `Input/set1/output/Result/table_comparison.json`, `Input/set1/output/Result/table_comparison.xlsx`

The boundary is extracted table representation rather than rendered pages. Debug/result material is also organized by language pair in `Output/Table images/Table comparison debug. English and DK/` and `Output/Table images/Table comparison debug. English and GE/`, supporting both machine-readable comparison results and reviewer-facing visual evidence.

#### Reporting and Persistence
The pipeline is local and filesystem-backed: PDFs are inputs, generated crops/debug assets are intermediate evidence, and spreadsheets/JSON/CSV are final or reviewable outputs. The consolidated deliverable is `Output/PDF_Quality_Inspection_Report.xlsx`; table comparisons additionally emit CSV/JSON/XLSX.

No deployed service, database, queue, web runtime, or external API integration is represented in the repository tree. Execution therefore depends on a Python runtime plus locally available PDF/image/table-processing dependencies, with `Input/` and `Output/` serving as the operational interface.

Main entry points: [`Input/Translated/882539_5.0_da-DK_2026-04_IOM.Start350.pdf`](https://github.com/giriharan007/spotcheck--xylem/blob/main/Input/Translated/882539_5.0_da-DK_2026-04_IOM.Start350.pdf) (Localized PDFs), [`main.py`](https://github.com/giriharan007/spotcheck--xylem/blob/main/main.py) (Pipeline orchestrator), [`Output/PDF_Quality_Inspection_Report.xlsx`](https://github.com/giriharan007/spotcheck--xylem/blob/main/Output/PDF_Quality_Inspection_Report.xlsx) (Quality inspection report), [`Tables/Table_extraction.py`](https://github.com/giriharan007/spotcheck--xylem/blob/main/Tables/Table_extraction.py) (Table extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Input PDFs"]
  node_english_pdfs["English baseline PDFs<br/>PDF input"]
  node_translated_pdfs["Localized PDFs<br/>PDF input"]
  node_fixture_set["English–Swedish fixture<br/>comparison fixture"]
end

subgraph group_inspection["Structure checks"]
  node_first_page["First-page check<br/>inspection stage<br/>[FirstPage.py]"]
  node_toc["TOC check<br/>inspection stage<br/>[Toc.py]"]
  node_last_page["Last-page check<br/>inspection stage<br/>[LastPage.py]"]
  node_barcode_qr["Barcode / QR check<br/>inspection stage"]
end

subgraph group_visual["Visual comparison"]
  node_crop_pages["PDF crop extraction<br/>image extraction stage<br/>[crop_pdf_images.py]"]
  node_english_crops["English image crops<br/>intermediate evidence"]
  node_compare_crops["Crop image comparison<br/>visual comparison stage"]
  node_comparison_evidence["Localized crop evidence<br/>visual evidence"]
end

subgraph group_tables["Table comparison"]
  node_extract_tables["Table extraction<br/>table processing stage"]
  node_compare_tables["Table comparison<br/>table processing stage<br/>[Compare_Tables.py]"]
end

subgraph group_outputs["Review outputs"]
  node_table_results["Table comparison JSON<br/>structured result"]
  node_table_workbook["Table comparison workbook<br/>review workbook"]
  node_table_debug["Table visual debug<br/>review evidence"]
  node_quality_report["Quality inspection report<br/>consolidated workbook"]
end

node_main{{"Pipeline orchestrator<br/>Python entry point<br/>[main.py]"}}

node_main -->|"runs"| node_first_page
node_main -->|"runs"| node_toc
node_main -->|"runs"| node_last_page
node_main -->|"runs"| node_barcode_qr
node_main -->|"runs"| node_crop_pages
node_main -->|"runs"| node_extract_tables
node_english_pdfs -->|"baseline"| node_first_page
node_translated_pdfs -->|"localized manual"| node_first_page
node_english_pdfs -->|"baseline"| node_toc
node_translated_pdfs -->|"localized manual"| node_toc
node_translated_pdfs -->|"inspects"| node_last_page
node_translated_pdfs -->|"validates"| node_barcode_qr
node_english_pdfs -->|"extracts regions"| node_crop_pages
node_translated_pdfs -->|"extracts regions"| node_crop_pages
node_crop_pages -->|"writes baseline crops"| node_english_crops
node_english_crops -->|"baseline regions"| node_compare_crops
node_translated_pdfs -->|"localized regions"| node_compare_crops
node_compare_crops -->|"writes differences"| node_comparison_evidence
node_english_pdfs -->|"extracts tables"| node_extract_tables
node_translated_pdfs -->|"extracts tables"| node_extract_tables
node_fixture_set -->|"fixture PDFs"| node_extract_tables
node_extract_tables -->|"structured tables"| node_compare_tables
node_compare_tables -->|"writes JSON"| node_table_results
node_compare_tables -->|"writes XLSX"| node_table_workbook
node_compare_tables -->|"writes debug images"| node_table_debug
node_first_page -->|"findings"| node_quality_report
node_toc -->|"findings"| node_quality_report
node_last_page -->|"findings"| node_quality_report
node_barcode_qr -->|"findings"| node_quality_report
node_comparison_evidence -->|"visual findings"| node_quality_report
node_table_workbook -.->|"table findings"| node_quality_report

click node_main "https://github.com/giriharan007/spotcheck--xylem/blob/main/main.py"
click node_english_pdfs "https://github.com/giriharan007/spotcheck--xylem/blob/main/Input/English/894387_5.0_en-US_2026-04_IOM.Start350.pdf"
click node_translated_pdfs "https://github.com/giriharan007/spotcheck--xylem/blob/main/Input/Translated/882539_5.0_da-DK_2026-04_IOM.Start350.pdf"
click node_first_page "https://github.com/giriharan007/spotcheck--xylem/blob/main/FirstPage.py"
click node_toc "https://github.com/giriharan007/spotcheck--xylem/blob/main/Toc.py"
click node_last_page "https://github.com/giriharan007/spotcheck--xylem/blob/main/LastPage.py"
click node_barcode_qr "https://github.com/giriharan007/spotcheck--xylem/blob/main/Barcode_QR_Check.py"
click node_crop_pages "https://github.com/giriharan007/spotcheck--xylem/blob/main/crop_pdf_images.py"
click node_compare_crops "https://github.com/giriharan007/spotcheck--xylem/blob/main/Compare_cropped_images.py"
click node_extract_tables "https://github.com/giriharan007/spotcheck--xylem/blob/main/Tables/Table_extraction.py"
click node_compare_tables "https://github.com/giriharan007/spotcheck--xylem/blob/main/Tables/Compare_Tables.py"
click node_table_results "https://github.com/giriharan007/spotcheck--xylem/blob/main/Input/set1/output/Result/table_comparison.json"
click node_table_workbook "https://github.com/giriharan007/spotcheck--xylem/blob/main/Input/set1/output/Result/table_comparison.xlsx"
click node_quality_report "https://github.com/giriharan007/spotcheck--xylem/blob/main/Output/PDF_Quality_Inspection_Report.xlsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_english_pdfs,node_translated_pdfs,node_fixture_set toneBlue
class node_first_page,node_toc,node_last_page,node_barcode_qr toneAmber
class node_crop_pages,node_english_crops,node_compare_crops,node_comparison_evidence toneMint
class node_extract_tables,node_compare_tables toneRose
class node_table_results,node_table_workbook,node_table_debug,node_quality_report toneIndigo
class node_main toneNeutral
```

## Components

### Input PDFs

- [English baseline PDFs](https://github.com/giriharan007/spotcheck--xylem/blob/main/Input/English/894387_5.0_en-US_2026-04_IOM.Start350.pdf): PDF input · Source manuals provide the comparison baseline. · `Input/English/894387_5.0_en-US_2026-04_IOM.Start350.pdf`
- [Localized PDFs](https://github.com/giriharan007/spotcheck--xylem/blob/main/Input/Translated/882539_5.0_da-DK_2026-04_IOM.Start350.pdf): PDF input · Filename locale and version define pairing with the baseline. · `Input/Translated/882539_5.0_da-DK_2026-04_IOM.Start350.pdf`
- **English–Swedish fixture**: comparison fixture

### Structure checks

- [First-page check](https://github.com/giriharan007/spotcheck--xylem/blob/main/FirstPage.py): inspection stage · `FirstPage.py`
- [TOC check](https://github.com/giriharan007/spotcheck--xylem/blob/main/Toc.py): inspection stage · `Toc.py`
- [Last-page check](https://github.com/giriharan007/spotcheck--xylem/blob/main/LastPage.py): inspection stage · `LastPage.py`
- [Barcode / QR check](https://github.com/giriharan007/spotcheck--xylem/blob/main/Barcode_QR_Check.py): inspection stage · `Barcode_QR_Check.py`

### Visual comparison

- [PDF crop extraction](https://github.com/giriharan007/spotcheck--xylem/blob/main/crop_pdf_images.py): image extraction stage · Creates page-level regions for aligned comparison. · `crop_pdf_images.py`
- **English image crops**: intermediate evidence
- [Crop image comparison](https://github.com/giriharan007/spotcheck--xylem/blob/main/Compare_cropped_images.py): visual comparison stage · Fans out for each localized manual. · `Compare_cropped_images.py`
- **Localized crop evidence**: visual evidence

### Table comparison

- [Table extraction](https://github.com/giriharan007/spotcheck--xylem/blob/main/Tables/Table_extraction.py): table processing stage · Builds structured table representations from PDFs. · `Tables/Table_extraction.py`
- [Table comparison](https://github.com/giriharan007/spotcheck--xylem/blob/main/Tables/Compare_Tables.py): table processing stage · `Tables/Compare_Tables.py`

### Review outputs

- [Table comparison JSON](https://github.com/giriharan007/spotcheck--xylem/blob/main/Input/set1/output/Result/table_comparison.json): structured result · `Input/set1/output/Result/table_comparison.json`
- [Table comparison workbook](https://github.com/giriharan007/spotcheck--xylem/blob/main/Input/set1/output/Result/table_comparison.xlsx): review workbook · `Input/set1/output/Result/table_comparison.xlsx`
- **Table visual debug**: review evidence
- [Quality inspection report](https://github.com/giriharan007/spotcheck--xylem/blob/main/Output/PDF_Quality_Inspection_Report.xlsx): consolidated workbook · Final filesystem-backed inspection deliverable. · `Output/PDF_Quality_Inspection_Report.xlsx`

### Other components

- [Pipeline orchestrator](https://github.com/giriharan007/spotcheck--xylem/blob/main/main.py): Python entry point · Coordinates local PDF inspection stages. · `main.py`

## Connections

- Pipeline orchestrator → First-page check: runs
- Pipeline orchestrator → TOC check: runs
- Pipeline orchestrator → Last-page check: runs
- Pipeline orchestrator → Barcode / QR check: runs
- Pipeline orchestrator → PDF crop extraction: runs
- Pipeline orchestrator → Table extraction: runs
- English baseline PDFs → First-page check: baseline
- Localized PDFs → First-page check: localized manual
- English baseline PDFs → TOC check: baseline
- Localized PDFs → TOC check: localized manual
- Localized PDFs → Last-page check: inspects
- Localized PDFs → Barcode / QR check: validates
- English baseline PDFs → PDF crop extraction: extracts regions
- Localized PDFs → PDF crop extraction: extracts regions
- PDF crop extraction → English image crops: writes baseline crops
- English image crops → Crop image comparison: baseline regions
- Localized PDFs → Crop image comparison: localized regions
- Crop image comparison → Localized crop evidence: writes differences
- English baseline PDFs → Table extraction: extracts tables
- Localized PDFs → Table extraction: extracts tables
- English–Swedish fixture → Table extraction: fixture PDFs
- Table extraction → Table comparison: structured tables
- Table comparison → Table comparison JSON: writes JSON
- Table comparison → Table comparison workbook: writes XLSX
- Table comparison → Table visual debug: writes debug images
- First-page check → Quality inspection report: findings
- TOC check → Quality inspection report: findings
- Last-page check → Quality inspection report: findings
- Barcode / QR check → Quality inspection report: findings
- Localized crop evidence → Quality inspection report: visual findings
- Table comparison workbook → Quality inspection report: table findings
