# acc-tax-reighteen/ekstrak-pdf-gudang-shell architecture

> Architecture diagram of the GitHub repository acc-tax-reighteen/ekstrak-pdf-gudang-shell, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell
- Repository: https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell

## Overview

This repository automates monthly Shell warehouse-invoice reporting. The main user workflow downloads Gmail PDF attachments, extracts and date-filters invoice fields, matches tax invoice numbers against CTX exports, combines and deduplicates records, then updates a styled Excel report. It also offers a separate tax-number lookup mode. The README documents these capabilities; some intermediate script wiring is not visible in the sampled source, so uncertain relationships are left out or marked unverified.

Main entry points: [`Dapur/A_JustXlookupData.py`](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/A_JustXlookupData.py) (Standalone Tax Lookup), [`Proses Faktur SHELL.py`](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Proses%20Faktur%20SHELL.py) (Menu Orchestrator), [`Dapur/1_AmbilLampiranGmail.py`](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/1_AmbilLampiranGmail.py) (PDF Download), [`Dapur/2_EkstrakPdfShell.py`](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/2_EkstrakPdfShell.py) (Invoice Extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Workflow Control"]
  node_orchestrator["Menu Orchestrator"]
end

subgraph group_extract["Invoice Intake"]
  node_attachment_download["PDF Download"]
  node_pdf_extract["Invoice Extraction"]
  node_invoice_data["Extracted Invoice Data"]
end

subgraph group_matching["Tax Matching"]
  node_tax_match["Tax Number Matching<br/>[4_XlookupData.py]"]
  node_lookup_mode["Standalone Tax Lookup"]
end

subgraph group_reporting["Report Preparation"]
  node_merged_records["Combined Records"]
  node_final_cleanup["Final Deduplication"]
  node_report_converter["Report Conversion"]
  node_template_writer["Template Report Writer"]
  node_sum_merger["Totals and Merges"]
  node_final_report["Monthly Warehouse Report"]
end

subgraph group_inputs["Inputs and Configuration"]
  node_warehouse_config["Warehouse Mapping<br/>[gudang.conf]"]
  node_email_config["Email Search Rules<br/>[gmail.conf]"]
  node_ctx_export["CTX Tax Export<br/>[CTX.xlsx]"]
  node_existing_report["Existing Shell Report"]
  node_report_template["Report Template<br/>[TEMPLATE.xlsx]"]
  node_lookup_config["Lookup Tolerance<br/>[lookup.conf]"]
end

node_operator(("User"))
node_gmail["Gmail API"]

node_operator -->|"chooses mode"| node_orchestrator
node_orchestrator -->|"runs pipeline"| node_attachment_download
node_attachment_download -->|"searches and downloads"| node_gmail
node_attachment_download -->|"reads rules"| node_email_config
node_pdf_extract -->|"reads mapping"| node_warehouse_config
node_pdf_extract -->|"extracts fields"| node_invoice_data
node_orchestrator -.->|"runs pipeline"| node_pdf_extract
node_invoice_data -.->|"matches fields"| node_tax_match
node_ctx_export -->|"supplies tax numbers"| node_tax_match
node_tax_match -.->|"adds tax numbers"| node_merged_records
node_existing_report -->|"supplies report data"| node_report_converter
node_merged_records -.->|"deduplicates"| node_final_cleanup
node_final_cleanup -.->|"prepares report data"| node_template_writer
node_report_template -->|"provides layout"| node_template_writer
node_template_writer -.->|"creates workbook"| node_sum_merger
node_sum_merger -->|"updates totals"| node_final_report
node_operator -->|"chooses lookup"| node_lookup_mode
node_ctx_export -->|"supplies tax numbers"| node_lookup_mode
node_existing_report -->|"updates report"| node_lookup_mode
node_lookup_mode -->|"reads tolerance"| node_lookup_config
node_lookup_mode -->|"saves matched report"| node_final_report

click node_orchestrator "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Proses%20Faktur%20SHELL.py"
click node_attachment_download "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/1_AmbilLampiranGmail.py"
click node_pdf_extract "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/2_EkstrakPdfShell.py"
click node_warehouse_config "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/gudang.conf"
click node_email_config "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/gmail.conf"
click node_ctx_export "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/CTX.xlsx"
click node_tax_match "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/4_XlookupData.py"
click node_merged_records "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/6_CombineDeleteDuplicateAndSort.py"
click node_final_cleanup "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/7_HelperDeleteDuplicateFinalData.py"
click node_report_converter "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/5_KnifeToOperationFinalData.py"
click node_template_writer "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/9_CopyDataToTemplate.py"
click node_report_template "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/TEMPLATE.xlsx"
click node_sum_merger "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/11_HelperMergedSUM.py"
click node_lookup_mode "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/A_JustXlookupData.py"
click node_lookup_config "https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/lookup.conf"

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_orchestrator,node_operator toneBlue
class node_attachment_download,node_pdf_extract,node_invoice_data toneAmber
class node_tax_match,node_lookup_mode,node_gmail toneMint
class node_merged_records,node_final_cleanup,node_report_converter,node_template_writer,node_sum_merger,node_final_report toneRose
class node_warehouse_config,node_email_config,node_ctx_export,node_existing_report,node_report_template,node_lookup_config toneIndigo
```

## Components

### Workflow Control

- [Menu Orchestrator](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Proses%20Faktur%20SHELL.py): `Proses Faktur SHELL.py`

### Invoice Intake

- [PDF Download](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/1_AmbilLampiranGmail.py): `Dapur/1_AmbilLampiranGmail.py`
- [Invoice Extraction](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/2_EkstrakPdfShell.py): `Dapur/2_EkstrakPdfShell.py`
- **Extracted Invoice Data**

### Tax Matching

- [Tax Number Matching](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/4_XlookupData.py): `Dapur/4_XlookupData.py`
- [Standalone Tax Lookup](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/A_JustXlookupData.py): `Dapur/A_JustXlookupData.py`

### Report Preparation

- [Combined Records](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/6_CombineDeleteDuplicateAndSort.py): `Dapur/6_CombineDeleteDuplicateAndSort.py`
- [Final Deduplication](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/7_HelperDeleteDuplicateFinalData.py): `Dapur/7_HelperDeleteDuplicateFinalData.py`
- [Report Conversion](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/5_KnifeToOperationFinalData.py): `Dapur/5_KnifeToOperationFinalData.py`
- [Template Report Writer](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/9_CopyDataToTemplate.py): `Dapur/9_CopyDataToTemplate.py`
- [Totals and Merges](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/11_HelperMergedSUM.py): `Dapur/11_HelperMergedSUM.py`
- **Monthly Warehouse Report**

### Inputs and Configuration

- [Warehouse Mapping](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/gudang.conf): `Dapur/gudang.conf`
- [Email Search Rules](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/gmail.conf): `Dapur/gmail.conf`
- [CTX Tax Export](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/CTX.xlsx): `Dapur/CTX.xlsx`
- **Existing Shell Report**
- [Report Template](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/TEMPLATE.xlsx): `Dapur/TEMPLATE.xlsx`
- [Lookup Tolerance](https://github.com/acc-tax-reighteen/ekstrak-pdf-gudang-shell/blob/main/Dapur/lookup.conf): `Dapur/lookup.conf`

### Other components

- **User**
- **Gmail API**

## Connections

- User → Menu Orchestrator: chooses mode (evidence: `Proses Faktur SHELL.py`)
- Menu Orchestrator → PDF Download: runs pipeline (evidence: `Proses Faktur SHELL.py`)
- PDF Download → Gmail API: searches and downloads (evidence: `Dapur/1_AmbilLampiranGmail.py`)
- PDF Download → Email Search Rules: reads rules (evidence: `Dapur/1_AmbilLampiranGmail.py`)
- Invoice Extraction → Warehouse Mapping: reads mapping (evidence: `README.md`)
- Invoice Extraction → Extracted Invoice Data: extracts fields (evidence: `Dapur/2_EkstrakPdfShell.py`)
- Menu Orchestrator → Invoice Extraction: runs pipeline
- Extracted Invoice Data → Tax Number Matching: matches fields
- CTX Tax Export → Tax Number Matching: supplies tax numbers (evidence: `Dapur/4_XlookupData.py`)
- Tax Number Matching → Combined Records: adds tax numbers
- Existing Shell Report → Report Conversion: supplies report data (evidence: `Dapur/5_KnifeToOperationFinalData.py`)
- Combined Records → Final Deduplication: deduplicates
- Final Deduplication → Template Report Writer: prepares report data
- Report Template → Template Report Writer: provides layout (evidence: `Dapur/9_CopyDataToTemplate.py`)
- Template Report Writer → Totals and Merges: creates workbook
- Totals and Merges → Monthly Warehouse Report: updates totals (evidence: `Dapur/11_HelperMergedSUM.py`)
- User → Standalone Tax Lookup: chooses lookup
- CTX Tax Export → Standalone Tax Lookup: supplies tax numbers (evidence: `Dapur/A_JustXlookupData.py`)
- Existing Shell Report → Standalone Tax Lookup: updates report (evidence: `Dapur/A_JustXlookupData.py`)
- Standalone Tax Lookup → Lookup Tolerance: reads tolerance (evidence: `Dapur/A_JustXlookupData.py`)
- Standalone Tax Lookup → Monthly Warehouse Report: saves matched report (evidence: `Dapur/A_JustXlookupData.py`)
