# acc-tax-reighteen/ar-orderan-machinelearning architecture

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

- Interactive diagram: https://gitdiagram.com/acc-tax-reighteen/ar-orderan-machinelearning
- Repository: https://github.com/acc-tax-reighteen/ar-orderan-machinelearning

## Overview

This repository synchronizes AR invoice data into product-specific Google Sheets, using a locally trained customer-name resolver to match order entries with AR records. The workflow has two branches: historical order data is prepared and used to train the hybrid matcher offline; the runtime pipeline extracts AR data, formats dates, then repeatedly resolves customers and writes values and invoice summaries to Sheets. The README documents several runtime capabilities not visible in the partial injector excerpt; their internals are kept within that component. The automation script’s checks mention files absent from the supplied tree, so those are not mapped.

Main entry points: [`Dapur/1_CopyData.py`](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Dapur/1_CopyData.py) (AR extraction), [`Dapur/3_InjectDataToSS.py`](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Dapur/3_InjectDataToSS.py) (Sync and resolve), [`Jalankan Automasi.py`](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Jalankan%20Automasi.py) (Automation runner), [`ML/LookupData.py`](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/ML/LookupData.py) (Historical data lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Offline training"]
  node_lookup["Historical data lookup<br/>[LookupData.py]"]
  node_training_data["Training workbook"]
  node_trainer["Hybrid model training<br/>[TrainingModel.py]"]
end

subgraph group_preparation["AR preparation"]
  node_preparer["AR extraction<br/>[1_CopyData.py]"]
  node_ar_clean["Clean AR data"]
  node_feedback["Customer feedback data"]
  node_date_format["Date formatting<br/>[2_AdjDateFormat.py]"]
end

subgraph group_sync["Order synchronization"]
  node_runner["Automation runner"]
  node_injector["Sync and resolve"]
end

subgraph group_external["External data and services"]
  node_history["Historical orders"]
  node_model["Trained model data"]
  node_ar_workbook["ARVIEWER workbook"]
  node_sheets[("Product order sheets")]
end

node_operator(("Operator"))

node_operator -->|"starts"| node_runner
node_runner -->|"runs"| node_preparer
node_runner -->|"runs"| node_date_format
node_runner -->|"runs"| node_injector
node_history -->|"provides files"| node_lookup
node_lookup -->|"fills columns"| node_training_data
node_training_data -->|"trains from"| node_trainer
node_trainer -->|"produces"| node_model
node_ar_workbook -->|"provides sheets"| node_preparer
node_preparer -->|"extracts"| node_ar_clean
node_preparer -->|"extracts"| node_feedback
node_model -->|"copied by config"| node_preparer
node_ar_clean -->|"reads and rewrites"| node_date_format
node_ar_clean -->|"loads for matching"| node_injector
node_feedback -->|"preloads"| node_injector
node_model -->|"preloads resolver"| node_injector
node_injector -->|"updates values and notes"| node_sheets

click node_runner "https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Jalankan%20Automasi.py"
click node_lookup "https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/ML/LookupData.py"
click node_trainer "https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/ML/TrainingModel.py"
click node_preparer "https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Dapur/1_CopyData.py"
click node_date_format "https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Dapur/2_AdjDateFormat.py"
click node_injector "https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Dapur/3_InjectDataToSS.py"

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_lookup,node_training_data,node_trainer toneBlue
class node_preparer,node_ar_clean,node_feedback,node_date_format toneAmber
class node_runner,node_injector toneMint
class node_history,node_model,node_ar_workbook,node_sheets toneRose
class node_operator toneIndigo
```

## Components

### Offline training

- [Historical data lookup](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/ML/LookupData.py): `ML/LookupData.py`
- **Training workbook**
- [Hybrid model training](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/ML/TrainingModel.py): `ML/TrainingModel.py`

### AR preparation

- [AR extraction](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Dapur/1_CopyData.py): `Dapur/1_CopyData.py`
- **Clean AR data**
- **Customer feedback data**
- [Date formatting](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Dapur/2_AdjDateFormat.py): `Dapur/2_AdjDateFormat.py`

### Order synchronization

- [Automation runner](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Jalankan%20Automasi.py): `Jalankan Automasi.py`
- [Sync and resolve](https://github.com/acc-tax-reighteen/ar-orderan-machinelearning/blob/main/Dapur/3_InjectDataToSS.py): `Dapur/3_InjectDataToSS.py`

### External data and services

- **Historical orders**
- **Trained model data**
- **ARVIEWER workbook**
- **Product order sheets**

### Other components

- **Operator**

## Connections

- Operator → Automation runner: starts (evidence: `Jalankan Automasi.py`)
- Automation runner → AR extraction: runs (evidence: `Jalankan Automasi.py`)
- Automation runner → Date formatting: runs (evidence: `Jalankan Automasi.py`)
- Automation runner → Sync and resolve: runs (evidence: `Jalankan Automasi.py`)
- Historical orders → Historical data lookup: provides files (evidence: `README.md`)
- Historical data lookup → Training workbook: fills columns (evidence: `README.md`)
- Training workbook → Hybrid model training: trains from (evidence: `README.md`)
- Hybrid model training → Trained model data: produces (evidence: `README.md`)
- ARVIEWER workbook → AR extraction: provides sheets (evidence: `Dapur/1_CopyData.py`)
- AR extraction → Clean AR data: extracts (evidence: `Dapur/1_CopyData.py`)
- AR extraction → Customer feedback data: extracts (evidence: `Dapur/1_CopyData.py`)
- Trained model data → AR extraction: copied by config (evidence: `README.md`)
- Clean AR data → Date formatting: reads and rewrites (evidence: `Dapur/2_AdjDateFormat.py`)
- Clean AR data → Sync and resolve: loads for matching (evidence: `README.md`)
- Customer feedback data → Sync and resolve: preloads (evidence: `README.md`)
- Trained model data → Sync and resolve: preloads resolver (evidence: `README.md`)
- Sync and resolve → Product order sheets: updates values and notes (evidence: `README.md`)
