# bibijoulbi/prix-carburant architecture

> Architecture diagram of the GitHub repository bibijoulbi/prix-carburant, 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/bibijoulbi/prix-carburant
- Repository: https://github.com/bibijoulbi/prix-carburant

## Overview

Prix Carburants is a batch pipeline that downloads French public fuel-price data, extracts and parses its XML, cleans the records into a Pandas DataFrame, and stores station and price records in PostgreSQL. `main.py` coordinates the stages and commits or rolls back the database transaction. The download module also unpacks the ZIP; the parser and transformer are separate stages. Relationships are based on the README and the shown source excerpts; the SQL schema is present in the tree but was not sampled, so its details are not inferred.

Main entry points: [`main.py`](https://github.com/bibijoulbi/prix-carburant/blob/master/main.py) (Pipeline runner), [`src/download.py`](https://github.com/bibijoulbi/prix-carburant/blob/master/src/download.py) (Download and unpack), [`src/extraction.py`](https://github.com/bibijoulbi/prix-carburant/blob/master/src/extraction.py) (XML parser), [`src/transformation.py`](https://github.com/bibijoulbi/prix-carburant/blob/master/src/transformation.py) (Clean and transform)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Data ingestion"]
  node_downloader["Download and unpack<br/>[download.py]"]
end

subgraph group_processing["Data processing"]
  node_xml_parser["XML parser<br/>[extraction.py]"]
  node_transformer["Clean and transform<br/>[transformation.py]"]
end

subgraph group_persistence["Database storage"]
  node_db_connection["Database connection<br/>[database.py]"]
  node_station_writer["Station insertion<br/>[database.py]"]
  node_price_writer["Price insertion<br/>[database.py]"]
end

node_public_data(("Public fuel data"))
node_orchestrator["Pipeline runner<br/>[main.py]"]
node_postgres[("PostgreSQL")]

node_public_data -->|"provides data"| node_downloader
node_orchestrator -->|"downloads data"| node_downloader
node_downloader -->|"returns XML file"| node_orchestrator
node_orchestrator -->|"parses file"| node_xml_parser
node_xml_parser -->|"returns XML root"| node_orchestrator
node_orchestrator -->|"transforms root"| node_transformer
node_transformer -->|"returns DataFrame"| node_orchestrator
node_orchestrator -->|"opens connection"| node_db_connection
node_db_connection -->|"connects to"| node_postgres
node_orchestrator -->|"inserts stations"| node_station_writer
node_orchestrator -->|"inserts prices"| node_price_writer
node_station_writer -->|"writes stations"| node_postgres
node_price_writer -->|"writes prices"| node_postgres
node_orchestrator -->|"commits transaction"| node_postgres

click node_orchestrator "https://github.com/bibijoulbi/prix-carburant/blob/master/main.py"
click node_downloader "https://github.com/bibijoulbi/prix-carburant/blob/master/src/download.py"
click node_xml_parser "https://github.com/bibijoulbi/prix-carburant/blob/master/src/extraction.py"
click node_transformer "https://github.com/bibijoulbi/prix-carburant/blob/master/src/transformation.py"
click node_db_connection "https://github.com/bibijoulbi/prix-carburant/blob/master/src/database.py"
click node_station_writer "https://github.com/bibijoulbi/prix-carburant/blob/master/src/database.py"
click node_price_writer "https://github.com/bibijoulbi/prix-carburant/blob/master/src/database.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_downloader toneBlue
class node_xml_parser,node_transformer,node_postgres toneAmber
class node_db_connection,node_station_writer,node_price_writer toneMint
class node_public_data toneIndigo
class node_orchestrator toneTeal
```

## Components

### Data ingestion

- [Download and unpack](https://github.com/bibijoulbi/prix-carburant/blob/master/src/download.py): `src/download.py`

### Data processing

- [XML parser](https://github.com/bibijoulbi/prix-carburant/blob/master/src/extraction.py): `src/extraction.py`
- [Clean and transform](https://github.com/bibijoulbi/prix-carburant/blob/master/src/transformation.py): `src/transformation.py`

### Database storage

- [Database connection](https://github.com/bibijoulbi/prix-carburant/blob/master/src/database.py): `src/database.py`
- [Station insertion](https://github.com/bibijoulbi/prix-carburant/blob/master/src/database.py): `src/database.py`
- [Price insertion](https://github.com/bibijoulbi/prix-carburant/blob/master/src/database.py): `src/database.py`

### Other components

- **Public fuel data**
- [Pipeline runner](https://github.com/bibijoulbi/prix-carburant/blob/master/main.py): `main.py`
- **PostgreSQL**

## Connections

- Public fuel data → Download and unpack: provides data (evidence: `src/download.py`)
- Pipeline runner → Download and unpack: downloads data (evidence: `main.py`)
- Download and unpack → Pipeline runner: returns XML file (evidence: `src/download.py`)
- Pipeline runner → XML parser: parses file (evidence: `main.py`)
- XML parser → Pipeline runner: returns XML root (evidence: `src/extraction.py`)
- Pipeline runner → Clean and transform: transforms root (evidence: `main.py`)
- Clean and transform → Pipeline runner: returns DataFrame (evidence: `src/transformation.py`)
- Pipeline runner → Database connection: opens connection (evidence: `main.py`)
- Database connection → PostgreSQL: connects to (evidence: `src/database.py`)
- Pipeline runner → Station insertion: inserts stations (evidence: `main.py`)
- Pipeline runner → Price insertion: inserts prices (evidence: `main.py`)
- Station insertion → PostgreSQL: writes stations (evidence: `src/database.py`)
- Price insertion → PostgreSQL: writes prices (evidence: `src/database.py`)
- Pipeline runner → PostgreSQL: commits transaction (evidence: `main.py`)
